Video & Materials
Create Video
Start a video generation task
Overview
Video generation takes time. A successful create response returns a task ID and poll_url; use that URL to check progress and retrieve the result.
Check Task Status
Call the poll_url in the create response. id and task_id identify the same task; you can also use GET /v1/tasks/{id}.
Audio and Media Input
Audio behavior depends on the selected model and operation. A video may contain sound even when no audio selector is exposed. Omitting a selector is different from sending false.
veo3.1andveo3.1-fastalways generate audio under the Gemini API contract. Forwan-2.6andwan-2.7video generation, audio cannot be disabled. Omitoutput_audioor usetruewhere the model detail permits it.hailuo-h3and Grok video models generate native audio. Do not add an audio switch that the selected model detail does not list.- Seedance 1.5/2.x and
viduq3-pro/viduq3-turbodefault to audio on and support silent output. PixVerse C1/V5.6/V6 default to audio off. Useoutput_audioonly for operations that list it; Vidu also accepts its declared booleanaudiofield. audio_url/audio_urlsprovide input or reference audio. They are not audio-output switches. Video editing, motion transfer, and style transfer may retain the input soundtrack; preserving source audio does not mean muting it.
Check the model detail for allowed values and audio-dependent prices. Supported aliases outputAudio, generate_audio, and boolean audio must agree with output_audio when combined. Do not assume every version or operation in a model family shares the same audio controls.
Use publicly reachable https URLs for images, videos, and audio. Some models also accept inline data: URLs; URLs are more reliable for large files.
Request Body
veo3.1Video model ID. Use the Models API for current models and operation for text-to-video, image-to-video, and other generation modes.
PixVerse
- Model:
pixverse-c1,pixverse-v6,pixverse-v5.6 - Operations:
text-to-video,image-to-video,start-end-to-video,reference-to-video - Audio selector:
output_audio, defaultfalse
On TokenLab, the PixVerse models above do not accept operation=video-extension.
HappyHorse
- Model:
happyhorse-1.0 - Operations:
text-to-video,image-to-video,reference-to-video,video-to-video - Audio selector: Do not send
output_audio
Text description of the video to generate. Required for most public video models.
Generation mode. Supported values include text-to-video, image-to-video, reference-to-video, start-end-to-video, video-to-video, video-extension, audio-to-video, and motion-control. If omitted, TokenLab infers it from the inputs. Sending it explicitly catches mismatched fields earlier.
Publicly accessible URL of the starting image for image-to-video generation. For Seedance material assets, you may also pass asset://asset-YYYYMMDDHHMMSS-xxxxx to use an ACTIVE TokenLab material as the first frame. For best cross-model compatibility, prefer image_url with an https URL.
Inline image as a data URL (for example, data:image/jpeg;base64,...). Supported by compatible models, but image_url provides the broadest compatibility across public video models.
Reference image inputs for models that support dedicated reference conditioning. The supported count is model-dependent. For seedance-2.0 and seedance-2.0-fast, TokenLab currently supports up to 9 reference images plus up to 3 reference videos and 3 reference audios. Each Seedance reference may be an https URL or an asset://asset-YYYYMMDDHHMMSS-xxxxx URI for an ACTIVE TokenLab material. For model selection, 4K boundaries, and Mini notes, see the Seedance 2.0 video models guide. Public https URLs are recommended for non-material inputs; compatible models also accept inline data: URLs. For grok-imagine-video, reference-to-video accepts up to 7 image references and duration is capped at 10 seconds. grok-imagine-video-1.5-preview is image-to-video only and does not accept reference images.
TokenLab Seedance material asset ID returned by Create Material Asset. Use it after the asset is ACTIVE with Seedance models that can use the TokenLab material library. This field is a generic reference input; to assign first-frame, last-frame, or reference-image semantics explicitly, put asset://<material_asset_id> in start_image, end_image, or reference_images instead.
Multiple TokenLab Seedance material asset IDs. They share the same Seedance image-reference limit as reference_images; the selected model must be able to use the TokenLab material library.
Ordinary image URLs are passed as image inputs; they do not create reusable material assets. Create reusable assets through the material API, then use their TokenLab IDs or asset://asset-YYYYMMDDHHMMSS-xxxxx URIs. If explicit materials return 409 seedance_material_preparing, check the returned inactive_asset_ids and retry after those materials become ACTIVE.
Optional reference role for models that distinguish between asset and style references.
Use kling_elements only when the selected model’s current public detail lists this field. Provide image inputs and 1–3 elements, each with name, optional description, and 2–4 element_input_urls; reference them as @name in prompt. Do not combine element references with output_audio=true.
Publicly accessible URL of the source video. Required for video-url based video-to-video flows and for motion-control; some derivative flows use task_id instead.
Additional reference video inputs for models that support multimodal reference conditioning. The supported count is model-dependent. For seedance-2.0 and seedance-2.0-fast, TokenLab currently supports up to 3 reference videos.
Public audio URL for an audio-driven or reference-audio operation supported by the selected model.
Additional reference audio inputs for models that support multimodal reference conditioning. The supported count is model-dependent. For seedance-2.0 and seedance-2.0-fast, TokenLab currently supports up to 3 reference audios.
Task identifier used by some continuation, extension, or derivative flows.
Model-specific extension start offset used by some video-extension flows.
Model-specific extension multiplier or repeat count used by some video-extension flows.
Generated output video duration in seconds. For Seedance 1.5/2.0 models, omitting this field uses 5; sending -1 lets the model choose within its supported duration range, and billing is estimated conservatively until the task finishes.
Compatibility alias for duration. If both seconds and duration are sent, they must be identical. For Seedance, seconds=-1 has the same auto-duration meaning as duration=-1.
Aspect ratio, for example adaptive, 16:9, 9:16, 1:1, 4:3, 3:4, or 21:9. Seedance defaults to adaptive when omitted.
Model-dependent output resolution. Seedance defaults to 720p; seedance-2.0 supports 480p, 720p, 1080p, and 4k, while seedance-2.0-fast and seedance-2.0-mini are limited to 480p and 720p.
Audio-output selector for operations that declare it. Omission follows the model default; false requests silent output only when allowed. See the audio behavior above and the selected model detail.
Enable Seedance 1.5 Pro draft mode. Do not send it with draft_task_id.
Seedance 1.5 Pro draft promotion task ID. Send a previous draft task ID to create the final video; this is not a generic video field.
Compatibility alias for aspect_ratio. If both ratio and aspect_ratio are sent, they must be identical.
Compatibility alias for output_audio. If generate_audio, output_audio, and outputAudio appear together, all values must match.
Optional execution expiry in seconds for compatible video models. Seedance defaults to 172800 seconds when omitted.
Optional task priority from 0 to 9 for compatible video models. Do not combine priority with service_tier=flex.
Optional end-user safety identifier for compatible video models. If omitted for Seedance, TokenLab uses user when provided.
default is accepted as a compatibility no-op for Seedance 2.0 models. flex is only allowed when the selected model supports it.
Optional frame count for compatible video models. Seedance 2.0 models and Seedance 1.5 Pro do not support this field.
Optional fixed-camera selector for compatible video models. Seedance 2.0 models do not support this field.
Frames per second (1-120) for models that expose FPS control.
What to avoid in the generated video.
Random seed for reproducible generation. Seedance uses -1 for a random seed when omitted.
Prompt adherence strength (0-20) for models that expose CFG-style control.
Motion intensity (0-1) for models that expose it.
URL or compatible image input for the first frame in start-end-to-video.
URL or compatible image input for the last frame in start-end-to-video.
Model-specific size tier for compatible video models.
Optional watermark toggle for models that expose it. Seedance defaults to false when omitted.
Model-specific effect selector for specialized editing flows.
A unique identifier for the end-user. For Seedance, TokenLab also uses this value as safety_identifier when that field is omitted.
Compatible Field Names
- Primary fields use snake_case:
aspect_ratio,output_audio,reference_images, andreference_image_type. - For compatibility, TokenLab also accepts
ratio,generate_audio,outputAudio,seconds,referenceImages, andreferenceImageType. - If a primary field and its alias are both sent, their values must match.
- If
operationis omitted, TokenLab infers it from the inputs.
Media Input
- Prefer publicly reachable
httpsURLs over inline base64 forimage_url,reference_images,video_url, andaudio_url. - Avoid mixing inline base64 and remote URLs in the same request.
- Keep remote media URLs valid until task processing starts.
Seedance Parameters
For Seedance 1.5/2.0 models, the unified endpoint follows TokenLab field names while accepting the compatible aliases seconds, ratio, and generate_audio. Omitted Seedance selectors use these defaults: duration=5, resolution=720p, aspect_ratio=adaptive, output_audio=true, watermark=false, return_last_frame=false, execution_expires_after=172800, priority=0, and seed=-1.
duration=-1 or seconds=-1 lets Seedance choose the output duration within the model-supported range. TokenLab estimates cost conservatively before the task finishes, then settles from the completed task usage when available. service_tier=default is accepted for Seedance 2.0 as a compatibility no-op; service_tier=flex, frames, and camera_fixed are rejected where the selected model does not support them.
Seedance Example
curl -X POST "https://api.tokenlab.sh/v1/videos/generations" \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "seedance-2.5",
"prompt": "A sleek product reveal with cinematic camera movement",
"operation": "text-to-video",
"duration": -1,
"aspect_ratio": "adaptive",
"resolution": "720p",
"output_audio": true
}'Response
Fields describing results, errors, timestamps, and the model are returned when available for the task.
Canonical async task identifier. Treat this as the same identity as task_id when both are present.
Canonical async task identifier for polling. This is the same task identity used by async status endpoints.
Preferred polling URL for this task. Use this exact path when checking status.
TokenLab billing transaction ID when settlement already completed. This is the dashboard/accounting transaction identifier and is separate from the async id / task_id.
Task status: pending, processing, completed, failed.
Unix timestamp when the task was created.
Model used.
Direct video URL when the result is already available.
Single video result with url, duration, width, and height when available.
Multiple video results when the task returns more than one output.
Error message or structured error object when the task fails.
Request
curl -X POST "https://api.tokenlab.sh/v1/videos/generations" \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "veo3.1",
"prompt": "A cat walking through a garden, cinematic lighting",
"operation": "text-to-video",
"duration": 4,
"aspect_ratio": "16:9"
}'Response
{
"id": "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"task_id": "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"poll_url": "/v1/tasks/ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"status": "pending",
"model": "veo3.1",
"created": 1706000000
}Image to Video
response = requests.post(
"https://api.tokenlab.sh/v1/videos/generations",
headers={"Authorization": "Bearer sk-your-api-key"},
json={
"model": "hailuo-2.3-standard",
"prompt": "The scene begins from the provided image and adds gentle natural motion.",
"operation": "image-to-video",
"image_url": "https://example.com/image.jpg",
"duration": 6,
"resolution": "768p"
}
)Kling 3.0 Elements
Use kling_elements only when the selected model’s current public detail lists this field. Provide image inputs and 1–3 elements, each with name, optional description, and 2–4 element_input_urls; reference them as @name in prompt. Do not combine element references with output_audio=true.
Reference to Video
Use operation=reference-to-video when the model supports dedicated reference conditioning. In TokenLab requests, image references use reference_images, while multimodal reference videos and audios use video_urls and audio_urls. For seedance-2.0 and seedance-2.0-fast, TokenLab currently supports up to 9 reference images plus up to 3 reference videos and 3 reference audios. For model selection, 4K boundaries, and Mini notes, see the Seedance 2.0 video models guide. duration controls generated output length only; it does not set a separate limit for reference video input duration. For grok-imagine-video, reference-to-video accepts up to 7 image references (reference_images or image_urls) and duration is capped at 10 seconds. Do not combine reference images with image_url / image first-frame inputs. grok-imagine-video-1.5-preview is image-to-video only.
response = requests.post(
"https://api.tokenlab.sh/v1/videos/generations",
headers={"Authorization": "Bearer sk-your-api-key"},
json={
"model": "veo3.1",
"prompt": "Keep the same subject identity, palette, and framing while adding subtle natural motion.",
"operation": "reference-to-video",
"reference_images": [
"https://example.com/ref-a.jpg",
"https://example.com/ref-b.jpg"
],
"reference_image_type": "asset",
"duration": 8,
"resolution": "720p",
"aspect_ratio": "9:16"
}
)Keyframe Control
Use start_image and end_image to control the first and last frames:
response = requests.post(
"https://api.tokenlab.sh/v1/videos/generations",
headers={"Authorization": "Bearer sk-your-api-key"},
json={
"model": "viduq2-pro",
"operation": "start-end-to-video",
"start_image": "https://example.com/day.jpg",
"end_image": "https://example.com/night.jpg",
"duration": 5,
"resolution": "720p",
"aspect_ratio": "16:9"
}
)Video to Video
For grok-imagine-video video-to-video, send a public HTTPS .mp4 URL in video_url and the editing prompt. Omit resolution, duration, and aspect_ratio for this operation.
Use operation=video-to-video when the model accepts an existing video as the primary input.
response = requests.post(
"https://api.tokenlab.sh/v1/videos/generations",
headers={"Authorization": "Bearer sk-your-api-key"},
json={
"model": "grok-imagine-video",
"operation": "video-to-video",
"video_url": "https://example.com/source.mp4",
"prompt": "Enhance the clip while preserving the original motion."
}
)Motion Control
Use operation=motion-control when the model expects both a subject image and a motion reference video. TokenLab maps the public image_url + video_url request shape to the motion-control request format for that model.
response = requests.post(
"https://api.tokenlab.sh/v1/videos/generations",
headers={"Authorization": "Bearer sk-your-api-key"},
json={
"model": "kling-3.0-motion-control",
"operation": "motion-control",
"prompt": "Keep the subject identity stable while following the motion reference.",
"image_url": "https://example.com/subject.png",
"video_url": "https://example.com/motion.mp4",
"resolution": "720p"
}
)Model Discovery
Public video inventory and supported operations change over time. Use the Models API to check current support before wiring a model-specific flow:
curl "https://api.tokenlab.sh/v1/models?recommended_for=video"
curl "https://api.tokenlab.sh/v1/models/veo3.1"Read the model detail response before relying on model-specific operations or fields. Operations such as audio-to-video and video-extension are model-specific; confirm current availability there instead of relying on static examples in this page.
Authorization
BearerAuth API Key authentication. Create or manage API keys in Dashboard > API > API Keys.
In: header
Headers
Per-request Delivery policy. Overrides the API key and Workspace defaults. Auto tries TokenLab Verified first and may switch once to Official only before output, request acceptance, or persistent resource creation.
Value in
- "auto"
- "verified"
- "official"
Request Body
application/json
Response
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json