Skip to main content

Prerequisites

  1. Create an API key in the Developer Console.
  2. Store the key in an environment variable or secret manager.
  3. Choose either an SDK integration or direct HTTP integration.

Integration Options

IntegrationGuidance
AILabTools Multi-language SDKsUse an official SDK for supported runtimes.
AILabTools PHP SDKUse the Composer package for PHP applications.
Direct HTTPCall 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.
Unversioned commands install the latest published release. Versioned snippets are pinning examples; check the linked registry before copying a fixed version into production.
Requires Node.js 18 or later.The package is published on npm. npm, pnpm, Yarn, and Bun install the same ailabtools package.

npm: ailabtools

npm install ailabtools

pnpm: ailabtools

pnpm add ailabtools

Yarn: ailabtools

yarn add ailabtools

Bun: ailabtools

bun add ailabtools
bun add only covers dependency installation. Validate your application before using Bun as the production runtime for the Node.js SDK.

Authentication

All SDKs authenticate with an AILabTools API key. SDK examples use AILAB_API_KEY as the environment variable name:
export AILAB_API_KEY="your_api_key_here"
Pass this value to the SDK client in your application code.
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.
For public browser, desktop, or mobile applications, do not ship your AILabTools API key with the client. Call AILabTools from your backend, or issue requests through a trusted service that keeps the API key private.

Implementation Notes

TopicGuidance
Request fieldsSDKs 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 uploadsUse SDK-supported file helpers such as file paths, bytes, buffers, streams, or language-specific file wrappers.
Async tasksIf a response contains task_id, use the SDK polling helper where available or call Querying Async Task Results.
Result URLsResult image URLs may be temporary. Download and store files promptly if your application needs long-term access.
ErrorsLog request_id and log_id when handling API errors. These IDs help the support team locate failed requests.