API 协议
Seedance 2.0 / 2.5:参数、场景与调用指南
预览指南
粘贴给 AI,帮助理解文档并完成接入。 仅包含文档与示例,不包含真实密钥。
直接答案统一入口 POST /v1/videos;content 为单数,不是 Kling 的 contents。文本为 type=text,媒体为 image_url/video_url/audio_url。
更新 · 审核信息
模型定位与适用场景
适合文字生成、首尾帧、多素材创作与人物参考。2.5 另有草稿与草稿转正式视频流程;各版本不要只替换名称后复用全部高级参数。
本指南核对本站请求契约,不代表所有场景均已完成收费出片验收。使用模型广场显示的精确模型、分组和有效端点;示例中的 example.com 素材与占位任务 ID 必须替换。先以最小请求确认可用,再逐项添加参考素材和高级参数。价格以模型广场及实际账单为准。
型号与入口
doubao-seedance-2-0-260128, doubao-seedance-2-0-fast-260128, doubao-seedance-2-0-mini-260615, doubao-seedance-2-5-260628
POST /v1/videos
参考素材格式
| 素材 | 字段 | 传输格式 | 文件准备与限制 |
|---|---|---|---|
| 图片 / 首尾帧 | content[].image_url.url + role | HTTP(S) 图片 URL、完整 data:image/<格式>;base64,...,或本站审核成功且适用于该型号的 asset://ID。 | 推荐 JPEG/PNG/WebP;role 为 first_frame、last_frame 或 reference_image。优先显式 MIME 的 data URI,不依赖裸 Base64 的格式推断。 |
| 参考 / 编辑视频 | content[].video_url.url + role=reference_video | HTTP(S) 视频直链,或已完成本站素材审核的 asset://ID;不传视频 Base64/data URI。 | 推荐 MP4(H.264、音轨 AAC);编辑按对应版本要求提供视频时长与角色。真人素材遵循本站审核流程。 |
| 参考音频 | content[].audio_url.url + role=reference_audio | HTTP(S) 音频 URL、data:audio/wav;base64,... / data:audio/mpeg;base64,...,或审核可用的 asset://ID;不传裸音频 Base64。 | WAV/MP3;2.0 系列须同时提供参考图或参考视频;2.5 的组合与时长要求独立核对。 |
| 任务 / 素材 ID | content[].draft_task.id / asset://ID | 草稿转正式引用成功的本站 task_ ID;素材使用审核后返回的 asset://ID,二者不可互换。 | draft_task 仅 2.5;当前正式生成有已记录的 500,尚未验收。素材审核任务 ID 不是素材 ID。 |
参数与组合限制
- 统一入口 POST /v1/videos;content 为单数,不是 Kling 的 contents。文本为 type=text,媒体为 image_url/video_url/audio_url。
- role 区分 first_frame/last_frame 与 reference_image/reference_video/reference_audio。真人素材需先上传、审核到 active,再用返回的 asset:// 引用。
- 最低时长示例使用 4 秒;先确认对应分辨率和渠道可用,再添加声音、末帧或参考素材。2.x 固定镜头通过提示词描述,不发送旧版 camera_fixed/seed。
- 2.5 草稿使用 draft=true 和 480p;正式生成使用一个 draft_task 引用和 1080p,继承草稿的时长、画幅与声音设置,不重复提交。
- 草稿转正式需使用本人可访问的成功本站任务 ID。素材审核、视频生成、草稿生成是不同任务,不要互换 ID。
- 2026-11-15 业务站实测:2.0 Fast 图片加参考音频生成了含非静音音轨的视频;2.5 的 4 秒 480p 草稿成功。草稿转 1080p 请求触发本站 500,尚未完成出片验收。草稿 /content 下载返回 502,但 completed 的 video_url 可下载解码;遇下载异常先检查结果地址,不要重新创建收费任务。
| 字段 | 类型 | 用法与限制 |
|---|---|---|
Authorization | header string | 必填。使用 Bearer <本站 API Key>;JSON 请求使用 Content-Type: application/json。官方鉴权及区域域名由本站渠道处理。 |
model | string | 必填,使用本页列出的精确版本;2.0、fast、mini、2.5 的参数边界不同。 |
content | object[] | 必填,文本和媒体列表;草稿转正式时仅用 draft_task 内容项。 |
content[].type | string | 每项必填:text/image_url/video_url/audio_url;draft_task 仅 2.5。 |
content[].text | string | type=text 必填。官方建议中文 ≤500 字、英文 ≤1000 词;固定镜头需求写入提示词。 |
content[].image_url.url | string | 图片项必填。公网 URL、图片 data URI 或本站素材流程返回的 asset:// ID;官方单张 <30 MB,宽高 300–6000 px、比例 0.4–2.5;2.0 参考图 ≤9,2.5 ≤30。本站素材权限与渠道限制仍需满足。 |
content[].video_url.url | string | 视频项必填:公网 URL 或已绑定的 asset:// ID,不是原始 Base64。官方 2.0 ≤3 段、每段 2–15 秒且合计 ≤15 秒;2.5 ≤10 段、每段 2–30 秒且合计 ≤30 秒,编辑源至少 4 秒。单段 ≤200 MB。 |
content[].audio_url.url | string | 音频项必填:公网 URL、音频 data URI 或已绑定素材 ID;WAV/MP3,单段 ≤15 MB。2.0 ≤3 段、2–15 秒且合计 ≤15 秒,须配图或视频;2.5 ≤10 段、2–30 秒且合计 ≤30 秒,官方允许纯音频参考。 |
content[].role | string | 图片首帧 first_frame(单图可省略)、尾帧 last_frame、参考图 reference_image;视频必填 reference_video,音频必填 reference_audio。首尾帧与全模态参考互斥。 |
duration | integer | 2.0 系列 4–15 秒或 -1;2.5 为 4–30 秒或 -1,官方 2.5 默认 -1。2.5 编辑必须 -1。本站可能有更窄的渠道限制;最低成本示例显式用 4 秒。 |
resolution | string | 官方默认 720p。2.0/2.5 标准版 480p/720p/1080p/4k;fast/mini 仅 480p/720p。本站 4k 路由未逐一验收,不能据官方枚举认定可调用。 |
ratio | string | 16:9/4:3/1:1/3:4/9:16/21:9/adaptive;官方 2.x 默认 adaptive。2.5 首帧、首尾帧、编辑、延长必须 adaptive。 |
generate_audio | boolean | 可选,默认 true;false 为无声;2.0/2.5 支持,显式 false 保留。 |
watermark | boolean | 可选,官方默认 false。 |
return_last_frame | boolean | 可选,默认 false;true 请求返回 JPEG 尾帧,读取成功任务实际返回字段,不能把任务 ID 当图片地址。 |
draft | boolean | 仅 2.5,默认 false;true 只能搭配 480p。2026-10-28 10:00(UTC+8)以后创建的官方草稿有效 14 天;之前 7 天。本站草稿转正式失败情况见条件示例。 |
content[].draft_task.id | string | 2.5 正式生成时引用本人成功草稿的本站 task_ ID;不重新传文本、媒体、时长、画幅、音频等继承字段。 |
callback_url | string | 可选任务状态回调;需可访问的 HTTP(S) 地址。回调不替代本站主动查询,也不保证回调中使用本站任务 ID。 |
execution_expires_after | integer | 可选,3600–259200 秒,默认 172800;从创建时间计,过期终止为 expired。 |
seed | integer | 官方当前仅列 Seedance 1.0 pro/pro fast 支持(-1–2147483647,默认 -1)。不是本页 2.x 可用能力;已从 2.x 示例移除。 |
camera_fixed | boolean | 官方当前仅列 1.0 pro/pro fast 支持,默认 false;2.x 用提示词描述固定机位,不发送此字段。 |
frames | integer | 官方仅 1.0 pro/pro fast:29–289 且为 25+4n;本页 2.x 不适用,不与 duration 混用。 |
service_tier | string | 官方仅 1.0 提供 default/flex 分级;2.0/2.5 暂不支持 flex,不能据旧文档申请离线折扣。 |
omni_reference_task_type | string | 仅 2.5:auto(默认)/reference/edit/extend,本站已校验并转发。edit/extend 必须有 reference_video 且 ratio=adaptive;edit 还要求 duration=-1、参考视频实际时长 4–30 秒。素材时长及任务与提示词是否一致由上游校验;本地转发通过不等于编辑出片验收。 |
output_format | string | 仅 2.5:mp4(默认)或 mov,本站已校验并转发。mov 的专业编码可能需要兼容播放器;文件后缀不能替代此设置。 |
priority | integer | 官方 2.x:整数 0–9,默认 0,同接入点内数值越大越优先,不中断运行任务。本站已转发,显式 0 保留。 |
safety_identifier | string | 可选,稳定匿名终端用户标识,最多 64 个可打印 ASCII 字符;建议对用户标识做哈希。本站已校验并转发。 |
tools[].type | string | 官方 2.x 支持 web_search;本站已转发,tools 可省略、为空数组,或包含一个 type=web_search 项。是否执行搜索由模型决定,转发不代表一定产生搜索次数。 |
场景与代码示例
文生视频
适用型号:doubao-seedance-2-0-260128, doubao-seedance-2-0-fast-260128, doubao-seedance-2-0-mini-260615, doubao-seedance-2-5-260628
POST /v1/videos
{
"model": "doubao-seedance-2-5-260628",
"content": [
{
"type": "text",
"text": "人物走过花园,镜头缓慢推进。"
}
],
"duration": 4,
"ratio": "16:9",
"resolution": "720p",
"generate_audio": true,
"watermark": false
}
curl
curl --fail-with-body --silent --show-error --connect-timeout 10 --max-time 120 --request POST 'https://api.tu-zi.com/v1/videos' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"model": "doubao-seedance-2-5-260628",
"content": [
{
"type": "text",
"text": "人物走过花园,镜头缓慢推进。"
}
],
"duration": 4,
"ratio": "16:9",
"resolution": "720p",
"generate_audio": true,
"watermark": false
}'
python
import json
import os
import requests
url = "https://api.tu-zi.com/v1/videos"
headers = json.loads("{\"Authorization\":\"Bearer YOUR_API_KEY\",\"Content-Type\":\"application/json\"}")
for name in ["API_KEY"]:
if not os.environ.get(name, "").strip():
raise RuntimeError("Set environment variable: " + name)
headers["Authorization"] = "Bearer " + os.environ["API_KEY"]
payload = json.loads("{\"model\":\"doubao-seedance-2-5-260628\",\"content\":[{\"type\":\"text\",\"text\":\"人物走过花园,镜头缓慢推进。\"}],\"duration\":4,\"ratio\":\"16:9\",\"resolution\":\"720p\",\"generate_audio\":true,\"watermark\":false}")
response = requests.request("POST", url, headers=headers, json=payload, timeout=120)
response.raise_for_status()
result = response.json()
if isinstance(result, dict) and (result.get("success") is False or result.get("code") is False or result.get("error")):
raise RuntimeError(json.dumps(result, ensure_ascii=False))
print(json.dumps(result, ensure_ascii=False, indent=2))
javascript
// Node.js 20+
const url = "https://api.tu-zi.com/v1/videos";
const headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
};
for (const name of ["API_KEY"]) {
if (!process.env[name]?.trim()) throw new Error("Set environment variable: " + name);
}
headers.Authorization = 'Bearer ' + process.env.API_KEY;
const response = await fetch(url, { method: "POST", headers, body: JSON.stringify({
"model": "doubao-seedance-2-5-260628",
"content": [
{
"type": "text",
"text": "人物走过花园,镜头缓慢推进。"
}
],
"duration": 4,
"ratio": "16:9",
"resolution": "720p",
"generate_audio": true,
"watermark": false
}), signal: AbortSignal.timeout(120000) });
if (!response.ok) throw new Error(await response.text());
const result = await response.json();
if (result?.success === false || result?.code === false || result?.error) throw new Error(JSON.stringify(result));
console.log(JSON.stringify(result, null, 2));
首尾帧
适用型号:doubao-seedance-2-0-260128, doubao-seedance-2-0-fast-260128, doubao-seedance-2-0-mini-260615, doubao-seedance-2-5-260628
POST /v1/videos
{
"model": "doubao-seedance-2-5-260628",
"content": [
{
"type": "text",
"text": "人物走过花园,镜头缓慢推进。"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/subject.png"
},
"role": "first_frame"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/end.png"
},
"role": "last_frame"
}
],
"duration": 4,
"resolution": "720p",
"generate_audio": false,
"ratio": "adaptive"
}
curl
curl --fail-with-body --silent --show-error --connect-timeout 10 --max-time 120 --request POST 'https://api.tu-zi.com/v1/videos' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"model": "doubao-seedance-2-5-260628",
"content": [
{
"type": "text",
"text": "人物走过花园,镜头缓慢推进。"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/subject.png"
},
"role": "first_frame"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/end.png"
},
"role": "last_frame"
}
],
"duration": 4,
"resolution": "720p",
"generate_audio": false,
"ratio": "adaptive"
}'
python
import json
import os
import requests
url = "https://api.tu-zi.com/v1/videos"
headers = json.loads("{\"Authorization\":\"Bearer YOUR_API_KEY\",\"Content-Type\":\"application/json\"}")
for name in ["API_KEY"]:
if not os.environ.get(name, "").strip():
raise RuntimeError("Set environment variable: " + name)
headers["Authorization"] = "Bearer " + os.environ["API_KEY"]
payload = json.loads("{\"model\":\"doubao-seedance-2-5-260628\",\"content\":[{\"type\":\"text\",\"text\":\"人物走过花园,镜头缓慢推进。\"},{\"type\":\"image_url\",\"image_url\":{\"url\":\"https://example.com/subject.png\"},\"role\":\"first_frame\"},{\"type\":\"image_url\",\"image_url\":{\"url\":\"https://example.com/end.png\"},\"role\":\"last_frame\"}],\"duration\":4,\"resolution\":\"720p\",\"generate_audio\":false,\"ratio\":\"adaptive\"}")
response = requests.request("POST", url, headers=headers, json=payload, timeout=120)
response.raise_for_status()
result = response.json()
if isinstance(result, dict) and (result.get("success") is False or result.get("code") is False or result.get("error")):
raise RuntimeError(json.dumps(result, ensure_ascii=False))
print(json.dumps(result, ensure_ascii=False, indent=2))
javascript
// Node.js 20+
const url = "https://api.tu-zi.com/v1/videos";
const headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
};
for (const name of ["API_KEY"]) {
if (!process.env[name]?.trim()) throw new Error("Set environment variable: " + name);
}
headers.Authorization = 'Bearer ' + process.env.API_KEY;
const response = await fetch(url, { method: "POST", headers, body: JSON.stringify({
"model": "doubao-seedance-2-5-260628",
"content": [
{
"type": "text",
"text": "人物走过花园,镜头缓慢推进。"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/subject.png"
},
"role": "first_frame"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/end.png"
},
"role": "last_frame"
}
],
"duration": 4,
"resolution": "720p",
"generate_audio": false,
"ratio": "adaptive"
}), signal: AbortSignal.timeout(120000) });
if (!response.ok) throw new Error(await response.text());
const result = await response.json();
if (result?.success === false || result?.code === false || result?.error) throw new Error(JSON.stringify(result));
console.log(JSON.stringify(result, null, 2));
图像、视频与音频参考
适用型号:doubao-seedance-2-0-260128, doubao-seedance-2-0-fast-260128, doubao-seedance-2-0-mini-260615, doubao-seedance-2-5-260628
POST /v1/videos
{
"model": "doubao-seedance-2-5-260628",
"content": [
{
"type": "text",
"text": "人物走过花园,镜头缓慢推进。"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/subject.png"
},
"role": "reference_image"
},
{
"type": "video_url",
"video_url": {
"url": "https://example.com/action.mp4"
},
"role": "reference_video"
},
{
"type": "audio_url",
"audio_url": {
"url": "https://example.com/voice.wav"
},
"role": "reference_audio"
}
],
"duration": 4,
"ratio": "16:9",
"generate_audio": true,
"watermark": false
}
curl
curl --fail-with-body --silent --show-error --connect-timeout 10 --max-time 120 --request POST 'https://api.tu-zi.com/v1/videos' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"model": "doubao-seedance-2-5-260628",
"content": [
{
"type": "text",
"text": "人物走过花园,镜头缓慢推进。"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/subject.png"
},
"role": "reference_image"
},
{
"type": "video_url",
"video_url": {
"url": "https://example.com/action.mp4"
},
"role": "reference_video"
},
{
"type": "audio_url",
"audio_url": {
"url": "https://example.com/voice.wav"
},
"role": "reference_audio"
}
],
"duration": 4,
"ratio": "16:9",
"generate_audio": true,
"watermark": false
}'
python
import json
import os
import requests
url = "https://api.tu-zi.com/v1/videos"
headers = json.loads("{\"Authorization\":\"Bearer YOUR_API_KEY\",\"Content-Type\":\"application/json\"}")
for name in ["API_KEY"]:
if not os.environ.get(name, "").strip():
raise RuntimeError("Set environment variable: " + name)
headers["Authorization"] = "Bearer " + os.environ["API_KEY"]
payload = json.loads("{\"model\":\"doubao-seedance-2-5-260628\",\"content\":[{\"type\":\"text\",\"text\":\"人物走过花园,镜头缓慢推进。\"},{\"type\":\"image_url\",\"image_url\":{\"url\":\"https://example.com/subject.png\"},\"role\":\"reference_image\"},{\"type\":\"video_url\",\"video_url\":{\"url\":\"https://example.com/action.mp4\"},\"role\":\"reference_video\"},{\"type\":\"audio_url\",\"audio_url\":{\"url\":\"https://example.com/voice.wav\"},\"role\":\"reference_audio\"}],\"duration\":4,\"ratio\":\"16:9\",\"generate_audio\":true,\"watermark\":false}")
response = requests.request("POST", url, headers=headers, json=payload, timeout=120)
response.raise_for_status()
result = response.json()
if isinstance(result, dict) and (result.get("success") is False or result.get("code") is False or result.get("error")):
raise RuntimeError(json.dumps(result, ensure_ascii=False))
print(json.dumps(result, ensure_ascii=False, indent=2))
javascript
// Node.js 20+
const url = "https://api.tu-zi.com/v1/videos";
const headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
};
for (const name of ["API_KEY"]) {
if (!process.env[name]?.trim()) throw new Error("Set environment variable: " + name);
}
headers.Authorization = 'Bearer ' + process.env.API_KEY;
const response = await fetch(url, { method: "POST", headers, body: JSON.stringify({
"model": "doubao-seedance-2-5-260628",
"content": [
{
"type": "text",
"text": "人物走过花园,镜头缓慢推进。"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/subject.png"
},
"role": "reference_image"
},
{
"type": "video_url",
"video_url": {
"url": "https://example.com/action.mp4"
},
"role": "reference_video"
},
{
"type": "audio_url",
"audio_url": {
"url": "https://example.com/voice.wav"
},
"role": "reference_audio"
}
],
"duration": 4,
"ratio": "16:9",
"generate_audio": true,
"watermark": false
}), signal: AbortSignal.timeout(120000) });
if (!response.ok) throw new Error(await response.text());
const result = await response.json();
if (result?.success === false || result?.code === false || result?.error) throw new Error(JSON.stringify(result));
console.log(JSON.stringify(result, null, 2));
提示词控制镜头与末帧输出
适用型号:doubao-seedance-2-0-260128, doubao-seedance-2-0-fast-260128, doubao-seedance-2-0-mini-260615, doubao-seedance-2-5-260628
POST /v1/videos
{
"model": "doubao-seedance-2-5-260628",
"content": [
{
"type": "text",
"text": "固定机位拍摄人物走过花园,保持镜头稳定。"
}
],
"duration": 4,
"ratio": "9:16",
"resolution": "720p",
"return_last_frame": true
}
curl
curl --fail-with-body --silent --show-error --connect-timeout 10 --max-time 120 --request POST 'https://api.tu-zi.com/v1/videos' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"model": "doubao-seedance-2-5-260628",
"content": [
{
"type": "text",
"text": "固定机位拍摄人物走过花园,保持镜头稳定。"
}
],
"duration": 4,
"ratio": "9:16",
"resolution": "720p",
"return_last_frame": true
}'
python
import json
import os
import requests
url = "https://api.tu-zi.com/v1/videos"
headers = json.loads("{\"Authorization\":\"Bearer YOUR_API_KEY\",\"Content-Type\":\"application/json\"}")
for name in ["API_KEY"]:
if not os.environ.get(name, "").strip():
raise RuntimeError("Set environment variable: " + name)
headers["Authorization"] = "Bearer " + os.environ["API_KEY"]
payload = json.loads("{\"model\":\"doubao-seedance-2-5-260628\",\"content\":[{\"type\":\"text\",\"text\":\"固定机位拍摄人物走过花园,保持镜头稳定。\"}],\"duration\":4,\"ratio\":\"9:16\",\"resolution\":\"720p\",\"return_last_frame\":true}")
response = requests.request("POST", url, headers=headers, json=payload, timeout=120)
response.raise_for_status()
result = response.json()
if isinstance(result, dict) and (result.get("success") is False or result.get("code") is False or result.get("error")):
raise RuntimeError(json.dumps(result, ensure_ascii=False))
print(json.dumps(result, ensure_ascii=False, indent=2))
javascript
// Node.js 20+
const url = "https://api.tu-zi.com/v1/videos";
const headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
};
for (const name of ["API_KEY"]) {
if (!process.env[name]?.trim()) throw new Error("Set environment variable: " + name);
}
headers.Authorization = 'Bearer ' + process.env.API_KEY;
const response = await fetch(url, { method: "POST", headers, body: JSON.stringify({
"model": "doubao-seedance-2-5-260628",
"content": [
{
"type": "text",
"text": "固定机位拍摄人物走过花园,保持镜头稳定。"
}
],
"duration": 4,
"ratio": "9:16",
"resolution": "720p",
"return_last_frame": true
}), signal: AbortSignal.timeout(120000) });
if (!response.ok) throw new Error(await response.text());
const result = await response.json();
if (result?.success === false || result?.code === false || result?.error) throw new Error(JSON.stringify(result));
console.log(JSON.stringify(result, null, 2));
2.5 草稿
适用型号:doubao-seedance-2-5-260628
POST /v1/videos
{
"model": "doubao-seedance-2-5-260628",
"content": [
{
"type": "text",
"text": "人物走过花园,镜头缓慢推进。"
}
],
"draft": true,
"resolution": "480p",
"duration": 4,
"ratio": "16:9",
"generate_audio": true,
"watermark": false
}
curl
curl --fail-with-body --silent --show-error --connect-timeout 10 --max-time 120 --request POST 'https://api.tu-zi.com/v1/videos' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"model": "doubao-seedance-2-5-260628",
"content": [
{
"type": "text",
"text": "人物走过花园,镜头缓慢推进。"
}
],
"draft": true,
"resolution": "480p",
"duration": 4,
"ratio": "16:9",
"generate_audio": true,
"watermark": false
}'
python
import json
import os
import requests
url = "https://api.tu-zi.com/v1/videos"
headers = json.loads("{\"Authorization\":\"Bearer YOUR_API_KEY\",\"Content-Type\":\"application/json\"}")
for name in ["API_KEY"]:
if not os.environ.get(name, "").strip():
raise RuntimeError("Set environment variable: " + name)
headers["Authorization"] = "Bearer " + os.environ["API_KEY"]
payload = json.loads("{\"model\":\"doubao-seedance-2-5-260628\",\"content\":[{\"type\":\"text\",\"text\":\"人物走过花园,镜头缓慢推进。\"}],\"draft\":true,\"resolution\":\"480p\",\"duration\":4,\"ratio\":\"16:9\",\"generate_audio\":true,\"watermark\":false}")
response = requests.request("POST", url, headers=headers, json=payload, timeout=120)
response.raise_for_status()
result = response.json()
if isinstance(result, dict) and (result.get("success") is False or result.get("code") is False or result.get("error")):
raise RuntimeError(json.dumps(result, ensure_ascii=False))
print(json.dumps(result, ensure_ascii=False, indent=2))
javascript
// Node.js 20+
const url = "https://api.tu-zi.com/v1/videos";
const headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
};
for (const name of ["API_KEY"]) {
if (!process.env[name]?.trim()) throw new Error("Set environment variable: " + name);
}
headers.Authorization = 'Bearer ' + process.env.API_KEY;
const response = await fetch(url, { method: "POST", headers, body: JSON.stringify({
"model": "doubao-seedance-2-5-260628",
"content": [
{
"type": "text",
"text": "人物走过花园,镜头缓慢推进。"
}
],
"draft": true,
"resolution": "480p",
"duration": 4,
"ratio": "16:9",
"generate_audio": true,
"watermark": false
}), signal: AbortSignal.timeout(120000) });
if (!response.ok) throw new Error(await response.text());
const result = await response.json();
if (result?.success === false || result?.code === false || result?.error) throw new Error(JSON.stringify(result));
console.log(JSON.stringify(result, null, 2));
2.5 草稿转正式视频
适用型号:doubao-seedance-2-5-260628
POST /v1/videos
2026-11-15 业务站实测触发本站 500,当前未通过草稿转正式验收。以下仅说明字段:引用本人成功草稿的本站 ID,指定 1080p,继承其余设置;不要自动重建任务。
{
"model": "doubao-seedance-2-5-260628",
"content": [
{
"type": "draft_task",
"draft_task": {
"id": "task_REPLACE_WITH_SUCCESSFUL_DRAFT"
}
}
],
"resolution": "1080p",
"watermark": false
}
任务结果与下载
保存提交返回的 id 或 task_id。统一视频查询使用 GET /v1/videos/{task_id},等待 queued / in_progress 到 completed 或 failed;完成后读取 video_url(部分响应同时在 metadata.url 提供)。本站相对路径需与调用域名拼接,/content 入口使用本站 Key;外部下载 URL 不携带本站 Key。结果可能过期,请及时下载。网络超时保留任务 ID 继续 GET,不自动重试创建 POST。
统一视频完整 Python / JavaScript 轮询下载示例
常见问题定位
| 现象 | 检查方式 |
|---|---|
| Error validating image / 图片 URI 错误 | 视频或任务 ID 是否误填到了图片字段;检查媒体 URL 是否返回真实素材 |
| unsupported content type / 字段不支持 | 检查系列、版本和 content/contents/input 的准确类型;不要把音频 URL 填入 voice_id |
| 400 参数冲突 | 检查 prompt 与 input、首尾帧与多参考、秒数与 response_format 的互斥项 |
| HTTP 成功但任务 failed | 记录本站任务 ID、时间、模型、域名和已脱敏参数;按任务错误定位,不能依据提交 200 宣称成功 |
| 404 或不可访问任务 | 确认域名、Key 权限、本站任务类型;不要使用其他站点或官方任务 ID |
| 本地文件无法访问 | 使用系列明确支持的上传方式,或提供可读取的 HTTPS 媒体 URL |
资料与适用范围
适用场景
- 选择视频模型和素材协议
- 排查参数与任务失败
API 协议
/v1/videos
常见问题
拿到 task_id 就代表生成成功吗?
不代表。保存本站任务 ID,查询到成功终态并确认结果可读取后才算完成;failed 要查看错误,不要自动重建任务。
本地图片、视频和 WAV 能直接填写路径吗?
不能。URL 字段需要服务可读取的媒体地址;localhost、电脑路径及需要浏览器登录的链接不可用。Kling 本地 PCM WAV 的 multipart 音色上传需本站先启用该接口(2026-11-15 两站实测均为 404);其他素材按该系列上传或素材流程处理。
能把不同模型的参数和任务 ID 互换吗?
不能假定兼容。核对精确型号、入口、大小写、媒体角色及互斥字段。编辑、草稿和音色都要求对应类型、本人可访问的成功任务;官方能力也不等于本站已验收。
兔子API