Media API
POST/omni/media/v1/contents/generations/tasks

Video generation

Video generation is asynchronous: create a task (202 + task id), poll until the status is terminal, then read the signed URL. Same base URL and atp- key as image. The gateway routes your unified model to a video provider with same-name failover. Available video models: seedance-2-0 (standard), seedance-2-0-mini (lighter / lower cost), seedance-2-0-fast (faster rendering), and the Kling family (preview): kling-v3-standard/-pro, kling-o3-standard/-pro with -i2v / -reference / -reference-7 / -v2v / -video-edit variants — all billed per second by resolution (Kling audio generation not yet available); confirm with GET /v1/models.

  • A succeeded task carries content.video_url — a signed edge URL with a 30-minute TTL. After expiry the task still reports succeeded but video_url is null and expired: true (re-create to regenerate).
  • Requests are refused with 402 insufficient_quota when the project balance is ≤ 0.
Check the model and project permission first

Call GET https://api.atptoken.ai/v1/models with the same key used to create the task. If a model is absent, that project cannot use it; installing a skill or knowing the model name does not bypass allowed models.

Create a task

curl https://api.atptoken.ai/omni/media/v1/contents/generations/tasks \
  -H "Authorization: Bearer atp-..." -H "Content-Type: application/json" \
  -H "Idempotency-Key: my-stable-key-123" \
  -d '{
    "model": "seedance-2-0",
    "content": [
      { "type": "text", "text": "a red fox running through snow, cinematic" },
      { "type": "image_url", "image_url": { "url": "https://example.com/first.jpg" }, "role": "first_frame" }
    ],
    "resolution": "720p",
    "ratio": "16:9",
    "duration": 5
  }'
# → 202 { "id": "task_..." }
FieldTypeDescription
modelstring · Requnified video model (`video` pool)
contentarray · Reqmultimodal input blocks (see below)
resolutionstring`480p` / `720p` / `1080p` / `4k`
ratiostring`16:9` `9:16` `4:3` `3:4` `1:1` `21:9` `adaptive` (alias `aspect_ratio`)
durationintegerseconds (mutually exclusive with `frames`)
framesintegerframe count (alt to `duration`)
generate_audiobooleanadd a soundtrack (alias `add_audio`)
seedinteger
watermarkboolean

content[] blocks — Each block is { "type": "text" | "image_url" | "video_url" | "audio_url", ... }. Text only → text-to-video; include an image → image-to-video. image_url/video_url take { "url": "<https | base64 | asset://pid.id>" }; role is first_frame / last_frame / reference_image / reference_video.

Poll until terminal

curl https://api.atptoken.ai/omni/media/v1/contents/generations/tasks/task_... \
  -H "Authorization: Bearer atp-..."
# → { "status": "succeeded", "content": { "video_url": "https://media-prod.atptoken.ai/v/...mp4?exp=...&sig=..." } }
MethodPathAction
POST/omni/media/v1/contents/generations/taskscreate
GET/omni/media/v1/contents/generations/tasks/{id}poll
GET/omni/media/v1/contents/generations/taskslist
DELETE/omni/media/v1/contents/generations/tasks/{id}cancel

Errors

400
invalid request body.
402
`insufficient_quota`: project balance ≤ 0 (create only; poll / list / cancel stay open).
403
`permission_denied`: the gated model is not enabled for this project.
422
the model has no video provider.
502
upstream generation failed.