Skip to content

Video tasks API · Unified v1 ​

API version

This page describes the Unified Video API (v1). You can independently choose the Seedance Native API (v3) instead; use the request and result format documented for your chosen interface.

Model capabilities and optional controls

Only specifications and modes currently available for the requested API model ID can be used. Ranges on this page are interface limits, not a guarantee that every model ID supports every combination. Unsupported durations, resolutions, input counts or modes are rejected with VIDEO_REQUEST_INVALID; do not retry the same unsupported request.

Optional controls generate_audio, return_last_frame, seed, watermark and output_format may have no effect or use a default when unsupported. Defaults describe the request, not a guarantee of generated audio, a final frame, repeatable output or a particular container. Check the actual assets and downloaded file. Unknown fields, invalid types and null are still rejected.

Video and image tasks share GET /v1/tasks/{id} and GET /v1/tasks/{id}/content. Use create → query → download. Image results use roles image_0–image_3.

Create → query → download. Use your Workspace API Key to create a video task, query its ID, and download the result when complete.

Choose a model ​

ModelOutput durationResolutionReference inputsReference
Seedance 2.04–15 integer seconds480p / 720p / 1080p / 4kUp to 9 images, 3 videos, 3 audio clipsParameters and examples
Seedance 2.0 Fast4–15 integer seconds480p / 720pUp to 9 images, 3 videos, 3 audio clipsParameters and examples
Seedance 2.0 Mini4–15 integer seconds480p / 720pUp to 9 images, 3 videos, 3 audio clipsParameters and examples
Seedance 2.54–30 integer seconds480p / 720p / 1080pUp to 30 images, 10 videos, 10 audio clips; audio-only references allowedParameters and examples
MiniMax H34–15 integer seconds2k / 768pUp to 9 images, 3 videos, 3 audio clipsParameters and examples
MiniMax H3 Max5–15 integer seconds480p / 768p / 1080pUp to 9 images, 3 videos, 3 audio clipsParameters and examples
Grok Imagine Video1–15 integer seconds480p / 720p1–50 images; Base also edits one videoParameters and examples
Grok Imagine Video 1.51–15 integer seconds480p / 720p / 1080p1–50 reference images; no editingParameters and examples
Wan 3.02–30 / -1480p / 720p / 1080pReference images / video / audio / document / webpageParameters and examples
Wan 3.0 Prime2–30 / -1480p / 720p / 1080pReference images / video / audio / document / webpageParameters and examples
HappyHorse 1.03–15720p / 1080pText / images / editParameters and examples
HappyHorse 1.13–15720p / 1080pText / imagesParameters and examples

Grok models use optional operation: generate (default). Base additionally accepts operation: edit with exactly one video_urls and no generation controls, including duration. 1.5 does not edit. Absent and explicit operations have different idempotency fingerprints; keep the original request shape on retry.

Copy the API model ID from the model catalog. example/seedance-2.5 is a placeholder: replace it with your model ID, not its display name.

Endpoints and authentication ​

Base URL: https://api.tokenlio.ai. Use your Tokenlio Workspace model-routing Key.

MethodPath relative to the Base URLPurpose
POST/v1/videos/generationsCreate a video task; returns 202
GET/v1/tasks/{id}Get task status and results
GET/v1/tasks/{id}/contentObtain a 307 redirect to the private video
GET/v1/tasks/{id}/content?role=last_frameDownload the last frame when requested and available

Use Authorization: Bearer <TOKENLIO_API_KEY> on all requests and Content-Type: application/json on POST requests. Responses are JSON objects. Use the video endpoints below, not Chat/Responses.

1. Create ​

Supply the Key securely through your environment. Replace the placeholder model ID before running.

bash
BASE_URL='https://api.tokenlio.ai'
curl "$BASE_URL/v1/videos/generations" \
  -H "Authorization: Bearer $TOKENLIO_API_KEY" \
  -H 'Content-Type: application/json' \
  --data '{"model":"example/seedance-2.5","prompt":"A quiet landscape at sunrise","duration":6,"resolution":"720p"}'

Illustrative 202 response; IDs and the model are examples:

json
{
  "id": "dfc68868-d388-4d83-a173-d44e47a8bec7",
  "model": "example/seedance-2.5",
  "status": "queued",
  "assets": []
}

202 means your request was accepted. Save the returned id and query it for the final result.

Task response fields ​

FieldTypeDescription
idstringTask ID for querying and downloading
modelstringAPI model ID used in this request
statusstringTask status; see the table below
assetsobject[]Result assets; empty before completion
assets[].rolestringvideo is the generated video; last_frame is the final image, returned only if requested and available
assets[].urlstringExpiring download link; query the task again for a new link after expiry
assets[].source_urlstringOptional original asset link, only for Seedance-family API model IDs in successful, fully settled task queries when a URL was recorded.
messagestringOptional task guidance; if it says not to resubmit, keep querying the original task
error.codestringFailure reason, such as TASK_TIMEOUT
error.messagestringTask failure description

For Seedance-family API model IDs, a successful, fully settled GET /v1/tasks/{id} response may include assets[].source_url for each recorded original asset URL. Other models and unfinished or failed tasks omit this field. The original link may already be expired or access-limited; its expiry is not checked and the link is not refreshed when querying. Save files promptly; use assets[].url if the original link is unavailable. Platform download links and console previews are unchanged. Do not send your Tokenlio API Key to either asset URL.

Do not automatically retry creation

No extra client request identifier is required. Each POST without one is independent, even with identical parameters. Disable SDK/HTTP automatic retries for creation. If it times out before you receive an ID, check call records before submitting again: another submission may incur another charge.

Optional: avoid duplicate creation with Idempotency-Key

This header is optional. Supply it only once, using 1–128 printable non-whitespace ASCII characters. The same Key, header value and parameters return the original task. Changed parameters return VIDEO_IDEMPOTENCY_CONFLICT. Without it, every POST creates an independent task, even with identical parameters.

2. Query ​

bash
TASK_ID='dfc68868-d388-4d83-a173-d44e47a8bec7'
curl "$BASE_URL/v1/tasks/$TASK_ID" \
  -H "Authorization: Bearer $TOKENLIO_API_KEY"

Poll every 5–15 seconds and increase the interval on read failures. Check progress with GET for the original task; do not POST another creation.

statusMeaning
queuedWaiting for execution
processingVideo generation is in progress; keep querying
succeededGeneration succeeded; use the download links in assets
failedTask failed or timed out; inspect error.code

Follow any guidance in message. If it asks you not to recreate the task, keep querying the same id or contact support with that task ID.

Query and download use the API Key that created the task. Keep it valid and never expose it in browser code or logs.

Success and timeout responses ​

A successful task provides signed asset links; last_frame is included only when requested and available:

json
{
  "id": "dfc68868-d388-4d83-a173-d44e47a8bec7",
  "model": "example/seedance-2.5",
  "status": "succeeded",
  "assets": [
    { "role": "video", "url": "https://SIGNED_DOWNLOAD_URL/result.mp4", "source_url": "https://origin.example.com/result.mp4" },
    { "role": "last_frame", "url": "https://SIGNED_DOWNLOAD_URL/frame.png", "source_url": "https://origin.example.com/frame.png" }
  ]
}
json
{
  "id": "dfc68868-d388-4d83-a173-d44e47a8bec7",
  "model": "example/seedance-2.5",
  "status": "failed",
  "assets": [],
  "error": { "code": "TASK_TIMEOUT", "message": "Video task timed out." }
}

3. Download ​

When status=succeeded, download from assets[].url without attaching your API Key to that link. Query again when links expire. Alternatively, use these Key-authenticated download endpoints:

bash
curl --location "$BASE_URL/v1/tasks/$TASK_ID/content" \
  -H "Authorization: Bearer $TOKENLIO_API_KEY" -o result.mp4

# Only if return_last_frame=true and the asset is available:
curl --location "$BASE_URL/v1/tasks/$TASK_ID/content?role=last_frame" \
  -H "Authorization: Bearer $TOKENLIO_API_KEY" -o last-frame

The content endpoint returns 307; follow the redirect to download the file. It does not return URL JSON. Save MOV output as a .mov file.

Protect the Key and signed URL

Never use --location-trusted. curl removes Authorization on cross-host redirects; custom clients must also strip it before following the storage URL. Do not persist signed URLs or put them in logs. Anyone holding a link can use it until expiry; later permission revocation does not instantly invalidate an already signed link.

Billing and reference rates ​

Model pages show USD rates and charging rules, not a task total. Check final charges and currency in console usage records; create/query responses do not include accounting fields. Failed, timed-out or undelivered tasks are not charged. Polling and downloads do not create another generation request.

expected_pricing_revision is optional: send it only if you already hold a valid value. A mismatch returns VIDEO_PRICE_CHANGED; it does not lock a price. For models that support it, max_charge_amount is a non-negative USD decimal string with at most eight fractional digits; an accepted amount above this limit is rejected. Unsupported models reject the field.

Wan supports duration: -1 for automatic duration. HappyHorse 1.0 also supports operation: edit; 1.1 does not. See the model pages for mode-specific fields and input requirements.

Input URLs and request limits ​

  • Public HTTPS/443 URLs only. No credentials, fragments, localhost/private addresses or base64. There is no input upload/confirmation API.
  • image_urls and image_with_roles are mutually exclusive. Do not reuse an identical URL within or across input arrays. At most 50 total URL inputs, further limited by each model.
  • Input URLs must be directly accessible without redirects. Keep URLs valid and content stable, and prepare materials according to the model's input requirements.
  • JSON body ≤64 KiB. Unknown, duplicate and null fields are rejected. Generation requires an explicit integer duration; 5.0, "5" and omission are invalid. -1 is valid only for models that explicitly support automatic duration. Do not append arbitrary query parameters to POST or task-detail requests.
  • No draft, draft_task_id, tools, web_search, moderation, negative_prompt, aspect_ratio or audio aliases. Use the documented platform fields only.

Errors ​

Request errors return {"error":{"message":"…","type":"…"}}: type identifies the error and message describes it. A successful query for a failed generation still returns HTTP200; read the task's status=failed and error.code.

HTTP / codeAction
400 VIDEO_REQUEST_INVALID / VIDEO_ASSET_INVALIDCheck types, model rules, URLs and references
401 INVALID_API_KEYCheck the Tokenlio Key, state and IP restrictions
402 INSUFFICIENT_BALANCEYour Workspace has insufficient available funds; top up or check its balance
404 MEDIA_TASK_NOT_FOUNDCheck the platform task ID and current scope; unauthorized and missing tasks share this response
409 VIDEO_PRICE_CHANGEDReview current catalog terms, then decide whether to submit
409 MEDIA_CONTENT_NOT_READYQuery the task; do not regenerate
409 VIDEO_IDEMPOTENCY_CONFLICTFor optional-header integrations, restore the original parameters
429 VIDEO_AMOUNT_BUDGET_EXCEEDEDCheck Workspace/member/Key amount budgets
503 VIDEO_RUNTIME_NOT_READY / VIDEO_SERVICE_UNAVAILABLEService temporarily unavailable; try later or contact support. If you have a task ID, only query that task

Continue with Seedance 2.0, Seedance 2.0 Fast, Seedance 2.0 Mini, Seedance 2.5, MiniMax H3 or MiniMax H3 Max.

Access leading AI models through one unified API