Video Generation API
OpenAI-compatible asynchronous video endpoint /v1/video/generations. Most video models are asynchronous: submit a task first, then poll for results.
1. Submit Video Generation Task
- Path:
/v1/video/generations - Request Method:
POST
Core Parameter Descriptions
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Video generation model name, e.g., doubao-seedance-2-5, kling-v3-omni, wan3.0-video (Alibaba Wan) |
prompt | string | Yes | Prompt text describing video motion and visuals |
negative_prompt | string | No | Negative prompt to exclude unwanted visual elements |
images / image_urls | array | No | Array of reference image objects/URLs (image_urls behaves identically to images). Supports HTTP URLs or Base64. 1 image is typically the first frame; 2 images specify start & end frames; 3 or more are used for multi-image reference (Kling/Volcengine, etc.) |
videos | array | No | Array of reference video URLs for video-to-video generation or motion control (e.g., Kling Omni video reference / Bytefor video reference) |
audios | array | No | Array of reference audio URLs for soundtrack or audio reference (e.g., Volcengine Ark / Bytefor, etc.) |
files | array | No | Reference file URLs (Wan, etc.; default role file) |
links | array | No | Reference webpage URLs (Wan, etc.; default role link) |
resolution | string | No | Target resolution (e.g., 1080p, 720p, 480p); the system automatically translates and adapts dimensions to provider-supported specs (e.g., Kling 1080p maps to pro mode, 720p maps to std mode) |
ratio | string | No | Aspect ratio (e.g., 16:9, 9:16, adaptive). Seedance 2.5 first-frame/edit/extend requires adaptive |
duration | integer | No | Duration (seconds). Seedance 2.5 supports 4–30 or -1; 2.0 supports 4–15 or -1 |
generate_audio | boolean | No | Whether to synchronously generate matching background sound effects / audio track (default false) |
watermark | boolean | No | Whether to add a watermark to the generated video (supported by selected channels such as Volcengine Ark and Alibaba Bailian) |
web_search | boolean | No | Whether to enable web search (default false; effective on Volcengine/Gemini, ignored on Wan) |
seed | integer | No | Random seed (used to control determinism of video generation) |
For Alibaba Wan Video (
wan3.0-video) andfiles/links, see "Wan Video Generation" (slug:wan-video).
Task Submission Example
curl -X POST https://www.tokenpad.ai/v1/video/generations \
-H "Authorization: Bearer sk-your_token" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedance-2-5-260628",
"prompt": "Pushing open classic European doors to reveal a fantastical castle above a sea of clouds, aerial view, 4K detail",
"resolution": "1080p",
"duration": 5
}'
Submission Response (Obtain Task ID)
{
"id": "video_task_abc123xyz789",
"task_id": "video_task_abc123xyz789",
"status": "pending",
"message": "Task submitted successfully"
}
2. Poll for Task Result
- Path:
/v1/video/generations/{task_id}or/v1/tasks/{task_id} - Method:
GET
Query Response Example (Generation Succeeded)
{
"id": "video_task_abc123xyz789",
"task_id": "video_task_abc123xyz789",
"status": "completed",
"data": [
{
"url": "https://example.com/output/generated_video.mp4"
}
]
}
3. Cancel Video Task
- Path:
/v1/video/generations/{task_id}or/v1/tasks/{task_id} - Method:
DELETE - Description: Cancel an unfinished task. For this site's ComfyUI: the frozen pre-deduction is refunded only after the node confirms execution has stopped and no video has been output yet; if generation already succeeded, cancellation fails and charges apply normally. For Volcengine Ark, use the native
DELETE /api/v3/contents/generations/tasks/{task_id}
curl -X DELETE https://www.tokenpad.ai/v1/video/generations/video_task_abc123xyz789 \
-H "Authorization: Bearer sk-your_token"
4. Multimodal Image Type Specification (images)
For "Image-to-Video" or "Multi-Image Reference Video", the gateway provides a flexible OpenAI-compatible multimodal interface. You can pass one or more images via images (or image_urls) and specify each image's role in video generation (such as first frame, last frame, or reference image) in either of two ways:
① Smart Count Inference Mode (Minimal Mode)
If you pass a list of plain image URL strings, the gateway automatically infers their types based on the number of images provided:
- Pass 1 image: Automatically recognized as the video First Frame / Start Frame.
- Pass exactly 2 images: The first image is recognized as the First Frame, and the second image is recognized as the Last Frame / End Frame.
- Pass 3 or more images: All images are automatically recognized as Multi-Image Reference Images.
Request Example:
{
"model": "doubao-seedance-2-5-260628",
"prompt": "Smoothly transition from the first image to the ancient Chinese style scene in the second image",
"images": [
"https://example.com/first_frame.png",
"https://example.com/last_frame.png"
]
}
② Explicit Role Declaration Mode (Advanced Mode)
If you want precise control over each image's role, or want to specify a single image as the last frame or a reference image, pass array elements as objects with a role (or type) field:
- First frame:
"role": "first_frame"or"role": "first" - Middle frame:
"role": "middle_frame"(multi-keyframe generation mode, e.g., Kling 4.0) - Last frame:
"role": "last_frame","role": "last", or"role": "tail"(prefer"last_frame") - Reference image:
"role": "refer_image"or"role": "reference_image"
Request Example:
{
"model": "doubao-seedance-2-5-260628",
"prompt": "A running husky",
"images": [
{
"url": "https://example.com/dog_reference.png",
"role": "reference_image"
}
]
}
Pass parameters according to the role conventions above.