The unified async task API provides a standardized submit → poll → retrieve workflow, abstracting away provider-specific differences.
Overview
AI tasks such as video generation, image generation, and music generation can take anywhere from tens of seconds to several minutes. To ensure a good user experience and system stability, these tasks are handled through an async task API:- Submit a task — Send a generation request and immediately receive a task ID
- Poll for status — Use the task ID to check progress, or receive a callback notification
- Retrieve results — Once complete, get the generated resource URLs from the response
Submit a Task
POST /v1/task/submitRequest Parameters
Request Examples
Response Example
Query a Task
GET /v1/task/{task_id}Request Examples
Response Examples
Task in progress:Task Statuses
Callback Notifications
When you include acallback_url in your submit request, the system will send a POST request to that URL whenever the task status changes. The callback body uses the same format as the query response:
Complete Polling Example
Response Fields
Usage Information
After a task reaches a terminal state (completed / failed), some models include a usage field in the response that reports the actual resources consumed. The usage field is a tagged union: the type field distinguishes the metering unit.
type=tokens (token-based billing)
Used by Doubao / Vidu / Ali / Kling text-based / Gemini and other token-billed tasks:type=duration (duration-based billing)
Used by Sora / Xai-video and other video generation tasks billed by output duration:- Tasks billed strictly per-call (e.g., Flux / Replicate / Midjourney) do not return a
usagefield - The
usagefield is not returned while the task isqueuedorin_progress - Historical tasks and tasks where the upstream did not report usage data also omit this field
- Sub-fields with a zero value (e.g.,
text_tokens: 0) are omitted
Notes
Related Links
Video Models
Provider-specific video generation API documentation
Image Models
Image generation API documentation