Skip to main content

Async flow

1

Submit

Call POST /v1/images or POST /v1/videos and read data.task_id.
2

Poll

Call the matching GET .../{task_id} until status is terminal.
3

Fetch result

On success, use data.result.image_url or data.result.video_url. On failure, read data.error_message.
Poll every 2–5 seconds and set a sensible timeout.

Response shape

Successful calls return code: 20000 with payload in data. Create and query share the same data schema.

Common codes

Best practices

  1. Persist media promptly: result URLs are kept about 3 days.
  2. Check the catalog: confirm live model IDs via the model catalog.
  3. Reconcile with cost: data.cost is the charged amount (credits).
  4. Protect keys: never commit API keys to public repos.