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

OptionBest forStart here
Official SDKSupported runtimes that benefit from typed clients, file helpers, SDK method names, and async polling helpers.Install the package below, then open the SDK API index.
Direct HTTPUnsupported runtimes, custom HTTP clients, or integrations that need full request control.Open the API reference page for the endpoint, such as Universal Background Removal.
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.
SDK methods may use language-native field names. The API reference remains the source of truth for field meaning, valid values, billing, and response structure.

Available SDKs

Installable SDK packages and documentation links:
Only published SDKs are listed. For other languages or runtimes, use the direct HTTP API.
PlatformPackageNotesDocs
Node.js / TypeScriptnpm: ailabtoolsRequires Node.js 18 or later.Examples · SDK README
Python (async)PyPI: ailabtools-sdkRequires Python 3.8 or later. Import as ailabtools.Examples · SDK README
Gopkg.go.dev: github.com/ailabtools/ailabtools-sdk/packages/goUse package docs for Go type names.Examples · Package docs
Dart / Flutterpub.dev: ailabtoolsPure Dart package. Use dart pub or flutter pub.Examples · SDK README
PHPPackagist: ailabtools/ailabtoolsRequires PHP 8.1 or later and Composer.Examples · SDK README
RubyRubyGems: ailabtoolsRequires Ruby 2.6 or later.Examples · SDK README
Rustcrates.io: ailabtoolsRequires Rust 1.70 or later.Examples · SDK README
JavaMaven Central: com.ailabtools:ailabtools-sdkRequires Java 11 or later.Examples · SDK README
SwiftSwift Package Manager / CocoaPods: AILabToolsUse SwiftPM or CocoaPods.Examples · SDK README

Install

Choose the package manager used by your project.
Multiple commands in the same tab install the same SDK package. They are package-manager alternatives, not separate SDKs.
Unversioned commands install the latest release available at install time. Versioned snippets show a verified release; check the linked registry page before pinning or upgrading in production.
The SDK runtime requirement is Node.js 18 or later.
bun add is listed as a package installation command. Test separately before treating the Bun runtime itself as a supported production runtime.

npm

npm install ailabtools

pnpm

pnpm add ailabtools

Yarn

yarn add ailabtools

Bun

bun add ailabtools

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 support locate failed requests.