Skip to main content
POST
Submit Task
Submit an image, video, or audio generation task and immediately receive a task_id.

Request Parameters

string
required
Model name, such as "veo3", "gpt-4o-image", "sora2"
string
default:"generate"
Action type: generate, edit, upscale, variation, blend
string
Generation prompt text
string
Webhook URL invoked when the task completes
object
Pass-through field for model-specific parameters; forwarded directly to the upstream model
For more parameters, see Image Generation Overview or Video Generation Overview.

Response

integer
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 a Prefer: 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 result and cost)
  • Window exceeded → the current state plus pre_consumed_cost is returned; continue polling GET /v1/tasks/{task_id}
Best suited for fast tasks such as image generation, prototyping, and testing. For long-running tasks (video), prefer polling or webhooks.

Idempotent Submission (Idempotency-Key)

Submit with an Idempotency-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