Prerequisites
- Create an API key in the Developer Console.
- Store the key in an environment variable or secret manager.
- Choose either an SDK integration or direct HTTP integration.
Integration Options
| Integration | Guidance |
|---|---|
| AILabTools Multi-language SDKs | Use an official SDK for supported runtimes. |
| AILabTools PHP SDK | Use the Composer package for PHP applications. |
| Direct HTTP | Call the API endpoints directly from your own HTTP client. |
SDKs wrap the same public HTTP APIs documented on this site. Direct HTTP and SDK integrations use the same API key and the same underlying endpoints.
Install
Select your runtime, then use the package manager already used by your project.- Node.js
- Python
- Go
- Dart / Flutter
- PHP
- Ruby
- Rust
- Java
- Swift
Requires Node.js 18 or later.The package is published on npm. npm, pnpm, Yarn, and Bun install the same npm:
pnpm:
Yarn:
Bun:
ailabtools package. npm: ailabtools
pnpm: ailabtools
Yarn: ailabtools
Bun: ailabtools
Authentication
All SDKs authenticate with an AILabTools API key. SDK examples useAILAB_API_KEY as the environment variable name:
AILAB_API_KEY is an SDK example convention, not an HTTP header name. Direct HTTP calls use the ailabapi-api-key request header shown in each API reference page.Implementation Notes
| Topic | Guidance |
|---|---|
| Request fields | SDKs may expose language-native names, such as returnForm for the HTTP field return_form. Use the SDK docs for code and the API reference for field meaning. |
| File uploads | Use SDK-supported file helpers such as file paths, bytes, buffers, streams, or language-specific file wrappers. |
| Async tasks | If a response contains task_id, use the SDK polling helper where available or call Querying Async Task Results. |
| Result URLs | Result image URLs may be temporary. Download and store files promptly if your application needs long-term access. |
| Errors | Log request_id and log_id when handling API errors. These IDs help the support team locate failed requests. |

