通过 TokenHub 统一 API 访问 ByteDance Seedance 2.0 视频生成 model。支持文生视频、图生视频、视频编辑、音频驱动生成等能力。本指南将带你完成完整的集成流程。
th-xxxxxxxxxxxx...)https://tokenhub.store/api/v1所有请求都需要在请求头中携带 API Key:
Authorization: Bearer th-your-api-keyPOST/videos/generations创建视频生成任务,返回任务 ID
GET/videos/generations/{task_id}查询任务状态,成功时返回视频 URL
| 模型 ID | 输入 | 价格 | 描述 |
|---|---|---|---|
| doubao-seedance-2.0 | 无视频输入 | $6.970/1M (1080p $7.727) | 旗舰 model,最高质量。支持 1080p。 |
| 含视频输入 | $4.242/1M (1080p $4.697) | 支持视频输入的旗舰版,性价比高。 | |
| doubao-seedance-2.0-fast | 无视频输入 | $5.606/1M | 快速 model,生成更快。 |
| 含视频输入 | $3.333/1M | 支持视频输入的快速 model,最实惠。 |
计费说明:
示例:doubao-seedance-2.0 无视频输入(≤720p),生成一个 5 秒视频,约 1M tokens → 费用约为 $6.970
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| model | string | 必填 | 模型 ID,例如 "doubao-seedance-2.0" |
| prompt | string | 必填 | 视频描述文本。英文提示词通常效果更好 |
| duration | number | 可选 | 视频时长(秒),范围 4–15,默认 5 |
| resolution | string | 可选 | “480p”、“720p”或“1080p”(默认 720p;仅 doubao-seedance-2.0 支持 1080p) |
| aspect_ratio | string | 可选 | 宽高比:"adaptive"(默认)、"16:9"、"9:16"、"1:1" 等 |
| image_url | string | 可选 | 参考图片 URL(image-to-video) |
| image_urls | string[] | 可选 | 多个参考图片 URL 的数组 |
| video_url | string | 可选 | 参考视频 URL(视频编辑 / video-to-video) |
| video_urls | string[] | 可选 | 多个参考视频 URL 的数组(最多 3 个) |
| video_durations | number[] | 可选 | 每个视频的时长数组,单位秒,例如 [3, 5] |
| input_video_duration | number | 可选 | 输入视频总时长,单位秒(video_durations 的替代项) |
| audio_url | string | 可选 | 参考音频 URL(背景音乐 / SFX) |
| audio_urls | string[] | 可选 | 多个参考音频 URL 的数组(最多 3 个) |
| generate_audio | boolean | 可选 | 是否生成音频,默认 true |
| watermark | boolean | 可选 | 是否添加水印,默认 false |
| content | array | 可选 | 媒体资源数组。每项:{ type: "image_url", image_url: { url }, role }。支持的 role:first_frame(最多 1 个)、last_frame(最多 1 个)、reference_image、reference_video、reference_audio |
你可以自由组合文本、图片、视频和音频作为输入。请注意以下限制:
最基础的用法——用文本描述一个场景来生成视频。
curl -X POST https://tokenhub.store/api/v1/videos/generations \
-H "Authorization: Bearer th-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedance-2.0",
"prompt": "A golden retriever running on a sunny beach, waves crashing in the background, cinematic slow motion, 4K quality",
"duration": 5,
"resolution": "720p",
"aspect_ratio": "16:9",
"watermark": false
}'响应:
{
"id": "xxxxxx-task-id",
"object": "video.generation.task",
"model": "doubao-seedance-2.0",
"status": "queued",
"created": 1719900000
}视频生成是异步的——请轮询状态直到完成。
# Poll task status using the task_id from creation response
curl https://tokenhub.store/api/v1/videos/generations/YOUR_TASK_ID \
-H "Authorization: Bearer th-your-api-key"任务进行中:
{
"id": "YOUR_TASK_ID",
"object": "video.generation.task",
"model": "doubao-seedance-2.0",
"status": "running",
"created": 1719900000
}任务已完成(已收到视频 URL):
{
"id": "YOUR_TASK_ID",
"object": "video.generation.task",
"model": "doubao-seedance-2.0",
"status": "succeeded",
"created": 1719900000,
"data": [
{
"video_url": "https://tokenhub-data.tos-cn-hongkong.volces.com/user_sd_file/YOUR_TASK_ID.mp4",
"cover_image_url": "https://tokenhub-data.tos-cn-hongkong.volces.com/user_sd_file/YOUR_TASK_ID_cover.jpg"
}
],
"usage": {
"video_duration": 5
}
}import requests
import time
API_BASE = "https://tokenhub.store/api/v1"
API_KEY = "th-your-api-key"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
# Step 1: Create video generation task
payload = {
"model": "doubao-seedance-2.0",
"prompt": "A majestic eagle soaring over snow-capped mountains, golden hour lighting, cinematic aerial shot",
"duration": 5,
"resolution": "720p",
"aspect_ratio": "16:9",
"watermark": False
}
resp = requests.post(f"{API_BASE}/videos/generations", json=payload, headers=headers)
task = resp.json()
task_id = task["id"]
print(f"Task created: {task_id}, status: {task['status']}")
# Step 2: Poll for result
while True:
resp = requests.get(f"{API_BASE}/videos/generations/{task_id}", headers=headers)
result = resp.json()
status = result["status"]
print(f"Status: {status}")
if status == "succeeded":
video_url = result["data"][0]["video_url"]
duration = result["usage"]["video_duration"]
print(f"Video ready! Duration: {duration}s")
print(f"URL: {video_url}")
break
elif status == "failed":
print(f"Failed: {result.get('error', {}).get('message', 'Unknown error')}")
break
time.sleep(5)const API_BASE = "https://tokenhub.store/api/v1";
const API_KEY = "th-your-api-key";
const headers = {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
};
// Step 1: Create task
const createResp = await fetch(`${API_BASE}/videos/generations`, {
method: "POST",
headers,
body: JSON.stringify({
model: "doubao-seedance-2.0",
prompt: "A majestic eagle soaring over snow-capped mountains, cinematic aerial shot",
duration: 5,
resolution: "720p",
aspect_ratio: "16:9",
watermark: false,
}),
});
const task = await createResp.json();
console.log("Task created:", task.id);
// Step 2: Poll for result
const poll = async () => {
while (true) {
const resp = await fetch(`${API_BASE}/videos/generations/${task.id}`, { headers });
const result = await resp.json();
console.log("Status:", result.status);
if (result.status === "succeeded") {
console.log("Video URL:", result.data[0].video_url);
console.log("Duration:", result.usage.video_duration, "seconds");
return result;
}
if (result.status === "failed") {
console.error("Failed:", result.error?.message);
return result;
}
await new Promise(r => setTimeout(r, 5000));
}
};
await poll();import requests, time
API_BASE = "https://tokenhub.store/api/v1"
headers = {
"Authorization": "Bearer th-your-api-key",
"Content-Type": "application/json"
}
# Image-to-Video with a single reference image
payload = {
"model": "doubao-seedance-2.0",
"prompt": "The woman in the photo turns to face the camera and smiles warmly, her hair gently blowing in the wind",
"duration": 5,
"resolution": "720p",
"image_url": "https://your-bucket.com/portrait.jpg",
"watermark": False
}
resp = requests.post(f"{API_BASE}/videos/generations", json=payload, headers=headers)
task_id = resp.json()["id"]
print(f"Task: {task_id}")
# Poll for result
while True:
r = requests.get(f"{API_BASE}/videos/generations/{task_id}", headers=headers).json()
if r["status"] == "succeeded":
print(f"Done: {r['data'][0]['video_url']}")
break
elif r["status"] == "failed":
print(f"Error: {r.get('error', {}).get('message')}")
break
time.sleep(5)当你的输入图片包含真人时,TokenHub 会自动将请求路由到支持真人生成的上游。无需修改客户端。
当上游内容过滤器检测到输入图片中包含真人时,会自动触发。
请求格式与普通 image-to-video 完全一致——仍然是相同的 POST /v1/videos/generations body。
GET 轮询方式完全一致——使用 POST 返回的任意 id 调用 /v1/videos/generations/{id},直到 status 变为 succeeded 或 failed。id 重写由服务端处理;在请求生命周期内你始终看到相同的 id。
当你的账号未配置支持真人的 provider 时,会返回 status 400。请联系你的管理员启用受支持的 provider。
当上游资源准备超过 5 分钟时,会通过 GET 返回 status: failed。可以安全重试请求。
pat-id 对客户端是透明的——持续轮询直到 status 变化。
# POST
curl -X POST https://tokenhub.store/api/v1/videos/generations \
-H "Authorization: Bearer $TH_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedance-2.0",
"prompt": "let her dance and spin",
"duration": 8,
"resolution": "480p",
"content": [
{ "type": "image_url", "image_url": { "url": "https://example.com/portrait.png" }, "role": "first_frame" }
]
}'
# → {"id":"pat-abc123","status":"queued"}
# GET (asset still uploading)
curl https://tokenhub.store/api/v1/videos/generations/pat-abc123 -H "Authorization: Bearer $TH_KEY"
# → {"id":"pat-abc123","status":"queued"}
# GET (upstream task running)
# → {"id":"pat-abc123","status":"running"}
# GET (complete — id stays pat-, video_url in data)
# → {"id":"pat-abc123","status":"succeeded","data":[{"video_url":"..."}]}推荐格式:[主体] + [动作] + [环境/背景] + [镜头/风格]
"A young woman walking through a cherry blossom garden, petals falling in slow motion, soft natural lighting, cinematic 35mm film look""Close-up of hands pouring latte art into a ceramic cup, steam rising, warm cafe ambiance, shallow depth of field""Aerial drone shot of a winding river through autumn forest, golden and red leaves, morning mist, 4K cinematic"© 2026 TokenHub · Powered by ByteDance Seedance 2.0 · support@tokenhub.store