API basics
Connect your application to chaozapi with API keys, asynchronous processing and examples in seven languages.
Upload an image or video, choose a processing tool, and retrieve the result from your own application. API tasks use the same assets, credits and processing queue as the workspace.
https://www.chaozapi.com/api/v1China edition · CNY pricingCreate an API key
Section titled “Create an API key”Open Account → API, name your key and choose an expiry. Copy the full gk_… secret when it is shown; it is displayed only once. Global and China accounts, keys, balances and storage are independent. Use a key issued by the site in the base URL.
New keys have read and write access. They can query assets, tasks, results and balance, upload files, and submit or cancel tasks. Previously issued read-only keys keep their original access.
Send Authorization: Bearer YOUR_API_KEY to /api/v1/*. Keep the key in a server environment variable or secret store. API keys cannot sign in, change account settings, pay for credits, or access administrator endpoints. Revoking a key prevents new requests; already submitted tasks continue.
Prepare your environment
Section titled “Prepare your environment”Set GLACIER_API_KEY to your own secret before running the examples. On macOS/Linux use export GLACIER_API_KEY='YOUR_API_KEY'; in PowerShell use $env:GLACIER_API_KEY='YOUR_API_KEY'. The cURL snippets use Bash syntax; on Windows run them in Git Bash or WSL.
Every interface below includes cURL, Node.js, Python, Go, Rust, Java and C# tabs. Your language selection stays in sync across examples and pages. Each snippet performs one request and prints the HTTP status and response, including useful error details.
| Tab | Runtime / dependencies |
|---|---|
| cURL | cURL 7.76+; Bash; jq for the signed upload example |
| Node.js | Node.js 22+; built-in fetch; save as .mjs |
| Python | Python 3.10+; standard library |
| Go | Go 1.22+; standard library |
| Rust | A Cargo project with reqwest 0.13 (blocking, default TLS); upload also uses serde_json |
| Java | Java 17+ HTTP client; upload ticket parsing also uses Jackson Databind |
| C# | .NET 8+ console project; built-in HttpClient |
Replace ASSET_ID, VERSION_ID, TASK_ID and QUOTE_ID with IDs returned by earlier requests. The upload example’s sizeBytes must be the exact size of your file. Use the tool catalog for supported parameters; the examples use 2× image upscaling.
From source to result
Section titled “From source to result”- Read the tool catalog and upload limits.
- Request an upload ticket; send file bytes directly to its signed URL with its returned headers. Do not send the API key to file URLs.
- Confirm the upload using its
assetId. If it ispreparing, poll upload status untilready. - A quote is recommended but optional. If you request one, continue only when
problemisnull. - Save the full body and
Idempotency-Keybefore submitting. Use the unchanged selection withquoteId, or submit directly with amaxCostCreditscap. - Poll the returned task path until
succeeded,failedorcanceled. - Retrieve the result. Download from
output.downloadUrl, or consume the structured report if there is no output file.
Request conventions
Section titled “Request conventions”Requests and responses use JSON with camelCase fields. Omit optional fields you do not need; do not send null unless the schema permits it. A 204 response has no body. IDs are opaque lowercase UUID strings. Times use ISO 8601; media durations and watermark positions in time use milliseconds. Credits are integers, not currency amounts.
The field panels on each interface are built from the same OpenAPI contract as the backend. Expand nested objects and variants for complete types, required fields and constraints. You can also import the downloadable public contract into your own client tools.
Use an SDK or an AI assistant
Section titled “Use an SDK or an AI assistant”The SDK guide includes Python, TypeScript and Go source downloads and resumable examples. The AI integration skill explains how to adapt an application, choose endpoints and verify the integration.
The seven language tabs are individual HTTP examples. SDKs are reusable clients that handle upload readiness, submission, polling and file downloads.