Create video tasks
Seedance API(v3)
Use https://api.tokenlio.ai with your platform Bearer Key and an exact model ID from the current catalog. Official references provide more field details; use the addresses, authentication and examples on this page for your calls.
Submit model/content to create a video task. HTTP200/id means admission; query the task or receive a callback for the final result.
Request parameters
| Field | Type | Default | Description |
|---|---|---|---|
model | string | Required | Exact public model ID from the current catalog; see models and inputs. |
content | object[] | Required | Nonempty text/media input array. |
resolution | string | 720p | Output resolution supported by the selected model. |
ratio | string | adaptive | 16:9, 9:16, 3:4, 1:1, 4:3, 21:9, adaptive; Mini adaptive support depends on availability. |
duration | integer | Model default | 2.0 family: 4–15 seconds; 2.5: 4–30 seconds. -1 selects automatic duration; 2.5 defaults to -1, Mini support depends on availability. |
generate_audio | boolean | true | Generate audio. Fast/Mini examples explicitly use false; audio support depends on availability. |
return_last_frame | boolean | false | Return a last-frame URL when supported. |
watermark | boolean | false | Add a generated-content watermark. |
seed | integer | — | Random seed; identical output is not guaranteed. |
output_format | string | mp4 | 2.5 also supports mov. |
priority | integer | 0 | 0–9. |
execution_expires_after | integer | 172800 | Expiry in seconds, 3600–259200. |
tools | object[] | — | Text-only input; at most one {"type":"web_search"}. |
omni_reference_task_type | string | auto | 2.5: auto / reference; edit / extend where available. |
draft | boolean | false | 2.5 draft mode where available. |
callback_url | string | — | Public HTTPS callback receiving the platform task object; deduplicate with X-Tokenlio-Event-Id. |
JSON fields are case-sensitive. Use actual booleans and integers, omit unused fields, and keep the request within 64 MiB. Create, individual GET and DELETE do not use query parameters; see task management for list parameters.
content elements
| type | Value | role |
|---|---|---|
text | text | — |
image_url | image_url.url | reference_image, first_frame, last_frame |
video_url | video_url.url | reference_video |
audio_url | audio_url.url | reference_audio |
draft_task | draft_task.id | — |
Put role beside the media object, not inside it. Media may use public HTTPS URLs or asset://ASSET_ID; images also accept Base64 Data URLs directly in image_url.url, as described under image inputs. Never put your API Key in a media URL. First/last-frame input cannot be mixed with reference media. The 2.0 family needs image/video input alongside reference audio; 2.5 supports audio-only references. First/last-frame mode on 2.5 requires ratio:"adaptive".
Image inputs: URL, Base64 and asset ID
content[].image_url.url accepts three input forms for first frames, last frames and reference images:
| Input | image_url.url value | Usage |
|---|---|---|
| Public image URL | https://example.com/valley.png | A directly accessible image URL that remains valid during processing. |
| Local image as Base64 | data:image/png;base64,<COMPLETE_BASE64> | Embed the encoded file in JSON; no image hosting or CreateAsset call is required first. |
| Asset ID | asset://ASSET_ID | Reference an existing asset; see material management. |
Use the complete format data:image/<image-format>;base64,<Base64-data>. The image format must be lowercase and match the actual file: image/png for PNG, image/jpeg for JPEG, or image/webp for WebP. Bare Base64, local paths and file:// URLs do not replace a Data URL. Use standard Base64 as one continuous string without line breaks, and replace every placeholder in an example.
Image requirements follow the official creation API:
- Formats:
jpeg,png,webp,bmp,tiff,gif; Seedance 2.0 and later also supportheicandheif. - Each image must be smaller than 30 MB, with width and height each 300–6000 px and a width/height ratio of 0.4–2.5.
- The platform generation request limit is 64 MiB, including JSON, all encoded images and other fields. Base64 is approximately 4/3 of the original file size; add up all images and prefer public URLs or asset IDs for large files.
- Encoding does not change media counts, roles or model restrictions; see models and inputs.
first_framesets the opening frame;reference_imageprovides a reference and cannot be mixed with first/last-frame mode.
See local image to video with Base64 for a complete example. Inline images belong in the generation request, not a material Action upload; the 32 KiB material Action limit does not apply to this generation request.
Create and query
curl -sS --fail-with-body "https://api.tokenlio.ai/api/v3/contents/generations/tasks" \
-H "Authorization: Bearer $TOKENLIO_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"model": "seedance-2.0",
"content": [
{
"type": "text",
"text": "A ceramic teapot in soft window light, slow camera orbit"
}
],
"resolution": "1080p",
"duration": 5,
"generate_audio": false
}'
curl -sS --fail-with-body "https://api.tokenlio.ai/api/v3/contents/generations/tasks/TASK_ID" \
-H "Authorization: Bearer $TOKENLIO_API_KEY"Creation response:
{
"id": "dfc68868-d388-4d83-a173-d44e47a8bec7"
}Input and mode examples
The following JSON bodies use the same creation endpoint. Replace all media URLs and task IDs with your own accessible inputs. Mode-specific availability and media limits are listed in models.
First frame
{
"model": "seedance-2.0",
"content": [
{
"type": "text",
"text": "The camera slowly approaches the subject"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/first.png"
},
"role": "first_frame"
}
],
"duration": 5,
"generate_audio": false
}First and last frames
{
"model": "seedance-2.5",
"content": [
{
"type": "text",
"text": "A smooth transition from sunrise to evening"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/first.png"
},
"role": "first_frame"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/last.png"
},
"role": "last_frame"
}
],
"ratio": "adaptive",
"duration": 8,
"generate_audio": false
}Reference image
{
"model": "seedance-2.0",
"content": [
{
"type": "text",
"text": "Use the character from image 1 walking through a garden"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/character.png"
},
"role": "reference_image"
}
],
"duration": 5,
"generate_audio": false
}Local image to video with Base64
Use the Python 3 standard library to read a local PNG and create request.json. This step only processes local files and does not start generation. Replace ./valley.png with your image. For JPEG, also change the Data URL prefix to data:image/jpeg;base64,; changing the extension alone is insufficient.
import base64
import json
from pathlib import Path
image = Path("./valley.png").read_bytes()
if not image or len(image) >= 30_000_000:
raise ValueError("Image must be nonempty and smaller than 30 MB")
payload = {
"model": "seedance-2.0",
"content": [
{
"type": "text",
"text": "Use the reference valley, lake and clouds. Cloud shadows move slowly, subtle ripples cross the water, and the camera steadily advances. Natural, realistic footage.",
},
{
"type": "image_url",
"image_url": {
"url": "data:image/png;base64," + base64.b64encode(image).decode("ascii")
},
"role": "reference_image",
},
],
"duration": 5,
"resolution": "720p",
"ratio": "16:9",
"generate_audio": False,
}
body = json.dumps(payload, ensure_ascii=False).encode("utf-8")
if len(body) > 64 * 1024 * 1024:
raise ValueError("Encoded request exceeds 64 MiB; use a URL or asset ID")
Path("request.json").write_bytes(body)After confirming the parameters, run the following command to submit a real generation request, billed by actual usage. --data-binary @request.json reads the complete body without putting a large Base64 string in command-line arguments:
curl -sS --fail-with-body "https://api.tokenlio.ai/api/v3/contents/generations/tasks" \
-H "Authorization: Bearer $TOKENLIO_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $SEEDANCE_REQUEST_ID" \
--data-binary @request.jsonSet the platform Key and a unique SEEDANCE_REQUEST_ID for this intent beforehand. Keep the original idempotency key and request.json for recovery; use a new key for a new intent and do not automatically resend creation. Acceptance returns {"id":"platform UUID"}. Save it and query the task for status and content.video_url; acceptance is not completed generation.
To start the video with the original image, change reference_image to first_frame; Seedance 2.5 first-frame mode also requires ratio:"adaptive". request.json contains the complete image data: protect it as you would the original material, and keep it out of logs and source control.
Reference video
{
"model": "seedance-2.0",
"content": [
{
"type": "text",
"text": "Follow the camera movement in video 1 in a snowy street"
},
{
"type": "video_url",
"video_url": {
"url": "https://example.com/movement.mp4"
},
"role": "reference_video"
}
],
"duration": 5,
"generate_audio": false
}Image, video and audio references
{
"model": "seedance-2.0",
"content": [
{
"type": "text",
"text": "Use the character from image 1, the motion from video 1 and the rhythm of audio 1"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/character.png"
},
"role": "reference_image"
},
{
"type": "video_url",
"video_url": {
"url": "https://example.com/movement.mp4"
},
"role": "reference_video"
},
{
"type": "audio_url",
"audio_url": {
"url": "https://example.com/rhythm.mp3"
},
"role": "reference_audio"
}
],
"duration": 8,
"generate_audio": false
}Audio-only reference on 2.5
{
"model": "seedance-2.5",
"content": [
{
"type": "text",
"text": "An abstract landscape whose movement follows the rhythm of audio 1"
},
{
"type": "audio_url",
"audio_url": {
"url": "https://example.com/rhythm.mp3"
},
"role": "reference_audio"
}
],
"duration": 10,
"generate_audio": false
}Asset reference
{
"model": "seedance-2.0-mini",
"content": [
{
"type": "text",
"text": "The referenced character waves at the camera"
},
{
"type": "image_url",
"image_url": {
"url": "asset://ASSET_ID"
},
"role": "reference_image"
}
],
"resolution": "720p",
"duration": 5,
"generate_audio": false
}See material and person-verification Actions for asset creation.
Web search
{
"model": "seedance-2.5",
"content": [
{
"type": "text",
"text": "A documentary-style introduction to the city described in the prompt"
}
],
"tools": [
{
"type": "web_search"
}
],
"duration": 10,
"generate_audio": false
}Last-frame output
{
"model": "seedance-2.0",
"content": [
{
"type": "text",
"text": "A boat arrives at a quiet dock"
}
],
"duration": 5,
"return_last_frame": true,
"generate_audio": false
}Read content.last_frame_url in the successful response.
MOV output
{
"model": "seedance-2.5",
"content": [
{
"type": "text",
"text": "A slow overhead shot of a forest canopy"
}
],
"duration": 8,
"output_format": "mov",
"generate_audio": false
}Longer scene
{
"model": "seedance-2.5",
"content": [
{
"type": "text",
"text": "A continuous 20-second shot: a traveler leaves the station, crosses a courtyard and approaches a waiting train"
}
],
"resolution": "1080p",
"duration": 20,
"generate_audio": false
}2.5 editing and extension
Both modes require reference video and ratio:"adaptive". Editing uses duration:-1; its input video is 4–30 seconds. Extension should describe what happens next. These modes are available where supported.
{
"model": "seedance-2.5",
"content": [
{
"type": "text",
"text": "Change the setting in video 1 from daytime to sunset"
},
{
"type": "video_url",
"video_url": {
"url": "https://example.com/source.mp4"
},
"role": "reference_video"
}
],
"omni_reference_task_type": "edit",
"ratio": "adaptive",
"duration": -1,
"generate_audio": false
}{
"model": "seedance-2.5",
"content": [
{
"type": "text",
"text": "Continue video 1 as the subject turns and walks toward the sea"
},
{
"type": "video_url",
"video_url": {
"url": "https://example.com/source.mp4"
},
"role": "reference_video"
}
],
"omni_reference_task_type": "extend",
"ratio": "adaptive",
"duration": 8,
"generate_audio": false
}Draft to formal video
Create a draft at 480p. After it succeeds, use its task ID as the only content element and request 1080p. Omit inherited controls: draft, duration, ratio, seed, generate_audio, omni_reference_task_type, tools and bitrate_mode. Do not request a last frame on the draft.
{
"model": "seedance-2.5",
"content": [
{
"type": "text",
"text": "A cinematic tracking shot through a bamboo forest"
}
],
"draft": true,
"resolution": "480p",
"duration": 5,
"generate_audio": false
}{
"model": "seedance-2.5",
"content": [
{
"type": "draft_task",
"draft_task": {
"id": "dfc68868-d388-4d83-a173-d44e47a8bec7"
}
}
],
"resolution": "1080p"
}