Skip to content

Generate videos

Video models are asynchronous. Submit a task, poll its status, then download the clip. Balance is reserved on submit and refunded automatically if the task fails.

1 · Submit a task

curl https://api.tokport.io/v1/videos \
  -H "Authorization: Bearer $TOKPORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"seedance-2-0","prompt":"slow dolly-in on a coral reef at sunrise, sunbeams through the water","seconds":"5","ratio":"16:9"}'

# poll until status is "completed", then download
curl https://api.tokport.io/v1/videos/{id} -H "Authorization: Bearer $TOKPORT_API_KEY"
curl https://api.tokport.io/v1/videos/{id}/content -H "Authorization: Bearer $TOKPORT_API_KEY" -o clip.mp4
FieldTypeDescription
model*stringModel id. Always "seedance-2-0".
prompt*stringWhat should happen in the clip: subject, motion, camera move and mood.
secondsstring (enum)Clip length in seconds. Billed per clip, whatever the length.4568101215default: 5
ratiostring (enum)Frame aspect ratio.16:99:16default: 16:9
json — submit response
{
  "id": "task_gz9n3dcAaaJ942r9iXjyLzvW7CU9W9eG",
  "object": "video",
  "model": "seedance-2-0",
  "status": "queued",
  "progress": 0,
  "created_at": 1791535189
}

2 · Poll for the result

curl
curl https://api.tokport.io/v1/videos/task_gz9n3dcAaaJ942r9iXjyLzvW7CU9W9eG \
  -H "Authorization: Bearer $TOKPORT_API_KEY"
# -> { "id": "task_…", "object": "video", "status": "completed", "progress": 100,
#      "created_at": 1791535189, "completed_at": 1791535206 }

status is one of queued, in_progress, completed or failed (with an error object). Seedance 2.0 renders typically take 2–4 minutes. Poll every 5–10 seconds.

3 · Download the clip

curl
curl https://api.tokport.io/v1/videos/task_gz9n3dcAaaJ942r9iXjyLzvW7CU9W9eG/content \
  -H "Authorization: Bearer $TOKPORT_API_KEY" -o clip.mp4

The content route streams the MP4 bytes through the gateway. Save it: output storage upstream is not permanent.

Image to video

Same endpoint; add the first frame as image (URL or data: URL). The prompt becomes optional and describes the motion.

curl https://api.tokport.io/v1/videos \
  -H "Authorization: Bearer $TOKPORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"seedance-2-0","image":"https://example.com/frame.png","prompt":"slow dolly-in on a coral reef at sunrise, sunbeams through the water","seconds":"5","ratio":"16:9"}'

# poll until status is "completed", then download
curl https://api.tokport.io/v1/videos/{id} -H "Authorization: Bearer $TOKPORT_API_KEY"
curl https://api.tokport.io/v1/videos/{id}/content -H "Authorization: Bearer $TOKPORT_API_KEY" -o clip.mp4

Video models