豆包 Seedance

通过统一视频接口调用字节跳动火山方舟的 Seedance 视频模型,支持文生视频和图生视频。

项 值
提交 POST /v1/video/generations
查询 GET /v1/video/generations/{task_id}
鉴权 Authorization: Bearer YOUR_API_KEY
Content-Type application/json

异步流程、轮询与计费见 概述与通用流程。

支持的模型

可用模型以 模型列表 返回为准(或控制台模型价格页)。Seedance Pro 系列同时支持文生视频和图生视频;Lite 系列按用途分为文生视频(名称含 t2v)和图生视频(名称含 i2v)两种,以模型列表中的名称为准。

文生视频

BASH
curl https://www.nextai-code.com/v1/video/generations \
  -H "Authorization: Bearer $NEXTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "YOUR_MODEL",
    "prompt": "一只柴犬在樱花树下奔跑,镜头缓慢跟随"
  }'

提交响应只有 task_id:

JSON
{ "task_id": "cgt-20250101123456-abcde" }

任务 ID 按 概述 · 读取任务 ID 的方法读取(先 id 后 task_id),与其它厂商写法一致。

图生视频

BASH
curl https://www.nextai-code.com/v1/video/generations \
  -H "Authorization: Bearer $NEXTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "YOUR_MODEL",
    "prompt": "让画面中的人物转身微笑",
    "image": "https://example.com/first-frame.png"
  }'
  • image 传一张图片 URL;images 可传多张,按顺序发送。多张图(如首尾帧)是否支持取决于模型。
  • 图片要求(格式、尺寸、大小)以火山方舟文档为准。

查询

BASH
curl https://www.nextai-code.com/v1/video/generations/cgt-20250101123456-abcde \
  -H "Authorization: Bearer $NEXTAI_API_KEY"
JSON
{
  "code": "success",
  "message": "",
  "data": {
    "task_id": "cgt-20250101123456-abcde",
    "action": "generate",
    "status": "SUCCESS",
    "fail_reason": "https://ark-content-generation.example.com/xxx.mp4",
    "progress": "100%",
    "submit_time": 1734567890,
    "start_time": 1734567900,
    "finish_time": 1734568000,
    "data": {
      "id": "cgt-20250101123456-abcde",
      "model": "YOUR_MODEL",
      "status": "succeeded",
      "content": { "video_url": "https://ark-content-generation.example.com/xxx.mp4" },
      "usage": { "completion_tokens": 108900, "total_tokens": 108900 }
    }
  }
}
  • data.status 为 SUCCESS 时,成片地址在 data.fail_reason。这是火山方舟的临时链接,请尽快下载转存(直接 GET,不要附带 API Key)。
  • 失败时 data.fail_reason 为 task failed,具体原因看 data.data。
  • 豆包任务不支持 GET /v1/videos/{task_id}(返回 501 not_implemented)。

特有参数

平台发给火山方舟的只有 model、prompt 和图片,size、duration、metadata 不会生效。

需要控制分辨率、比例、时长时,按火山方舟的文本指令写在 prompt 末尾,例如:

JSON
{
  "model": "YOUR_MODEL",
  "prompt": "一只柴犬在樱花树下奔跑 --ratio 16:9 --resolution 720p --duration 5"
}

指令名称与取值以火山方舟文档为准,是否生效取决于模型。

限制

  • 按 Token 计费时,提交时先按预估预扣,任务成功后按实际 Token 用量多退少补;失败全额退回。
  • 火山方舟拒绝提交时返回 fail_to_fetch_task,HTTP 状态码沿用火山方舟,message 为其原始响应。
  • 其它错误见 概述 · 错误。

相关文档