Task Management
Submit Task
POST /v1/tasks — Submit an asynchronous generation task
POST
Submit Task
Submit an image, video, or audio generation task and immediately receive a
For more parameters, see Image Generation Overview or Video Generation Overview.
Best suited for fast tasks such as image generation, prototyping, and testing.
For long-running tasks (video), prefer polling or webhooks.
task_id.
Request Parameters
Model name, such as
"veo3", "gpt-4o-image", "sora2"Action type:
generate, edit, upscale, variation, blendGeneration prompt text
Webhook URL invoked when the task completes
Pass-through field for model-specific parameters; forwarded directly to the upstream model
Response
Quota pre-deducted at submission. The final charge is the
cost field returned
by the status endpoint once the task reaches a terminal state: success = actual
charge; failure/cancellation = automatic full refund (cost: 0).In-Request Waiting (Prefer: wait)
If you’d rather not poll, add aPrefer: wait=N header (N ≤ 60 seconds) to wait
for the result within a single call:
- Completed within the window → the full terminal result is returned directly (including
resultandcost) - Window exceeded → the current state plus
pre_consumed_costis returned; continue pollingGET /v1/tasks/{task_id}
Idempotent Submission (Idempotency-Key)
Submit with anIdempotency-Key: <unique-string> header and repeated requests
with the same key within 24 hours reuse the originally created task (same
task_id, no double billing). Useful for network-retry scenarios.
Examples
Submit Task