Official SDK for IQuly AI Tools Platform
Official TypeScript SDK for the IQuly AI Tools Platform.
``bashUsing npm
npm install @iquly/sdk
Quick Start
`typescript
import { IQuly } from "@iquly/sdk";// Initialize the client
const client = new IQuly({
apiKey: "your-api-key",
// Optional configurations
baseUrl: "https://iquly.com/api", // Default
timeout: 30000, // Default: 30 seconds
});
// Get a toolkit
const toolkit = await client.getToolkit("toolkit-id", "provider");
// Execute a function
const result = await client.executeFunction("function-id", {
// function parameters
});
// Listen to execution events
client.on("execution.complete", ({ functionId, result }) => {
console.log(
Function ${functionId} completed:, result);
});client.on("execution.error", ({ functionId, error }) => {
console.error(
Function ${functionId} failed:, error);
});
`Features
- 🔒 Type-safe API with TypeScript support
- 🚀 Promise-based async/await API
- 📦 Built-in TypeScript types
- 🎯 Event-driven architecture
- âš¡ Automatic request timeout handling
- 🔄 Vercel AI Tools compatibility
Configuration
The SDK accepts the following configuration options:
`typescript
interface IQulyConfig {
apiKey: string; // Required: Your IQuly API key
baseUrl?: string; // Optional: API base URL (default: https://iquly.com/api)
timeout?: number; // Optional: Request timeout in ms (default: 30000)
retryAttempts?: number; // Optional: Number of retry attempts
debug?: boolean; // Optional: Enable debug mode
}
`Error Handling
The SDK provides several custom error types for better error handling:
-
IQulyError: Base error class for all SDK errors
- AuthenticationError: Thrown when authentication fails
- RateLimitError: Thrown when rate limit is exceeded
- ToolExecutionError: Thrown when a tool execution fails
- ValidationError: Thrown when input validation fails`typescript
try {
await client.executeFunction("function-id", params);
} catch (error) {
if (error instanceof AuthenticationError) {
// Handle authentication error
} else if (error instanceof RateLimitError) {
// Handle rate limit error
} else {
// Handle other errors
}
}
`Events
The SDK emits the following events:
-
execution.complete: Emitted when a function execution completes successfully
- execution.error`: Emitted when a function execution fails