TokenRa
登录注册

VIDEO API

Mini · Fast · Pro

Seedance 2.0 视频生成接口文档(Mini、Fast、Pro)

通过 OpenAI 兼容接口调用:支持文生视频、图生视频,以及图片/视频/音频多模态参考。

01

POST / VIDEO GENERATIONS

提交视频生成任务

HTTP MethodPOST
请求路径https://tokenra.io/v1/video/generations
鉴权头部Authorization: Bearer sk-your_token

A. 经典文生视频

BASH
curl -X POST https://tokenra.io/v1/video/generations \
  -H "Authorization: Bearer sk-your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "seedance-2-0-fast",
    "prompt": "一只穿着红大衣的可爱小猫,在漫天大雪中好奇地伸爪抓雪花,写实电影画质,微距镜头",
    "resolution": "720p",
    "ratio": "16:9",
    "duration": 5,
    "generate_audio": true
  }'

B. 单图/首尾帧图生视频

传入 1 张图为首帧;传入 2 张图时,第一张为首帧、第二张为尾帧。

BASH
curl -X POST https://tokenra.io/v1/video/generations \
  -H "Authorization: Bearer sk-your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "seedance-2-0-fast",
    "prompt": "画面由第一张图片的森林日出平滑过渡到第二张图片的雷雨大作场景,大风吹拂树木",
    "images": [
      "https://example.com/forest_sunny.png",
      "https://example.com/forest_storm.png"
    ],
    "resolution": "720p",
    "ratio": "16:9",
    "duration": 5
  }'

C. 多图外观/主体参考生视频(不含视频参考)

多张外观参考时,使用带 role(或等价 type)的对象数组,取值为 "reference_image"

BASH
curl -X POST https://tokenra.io/v1/video/generations \
  -H "Authorization: Bearer sk-your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "seedance-2-0-fast",
    "prompt": "参考图一中角色的发型与服饰、图二中的脸部轮廓以及图三中的背景,生成一段主角在木屋前缓缓走动的视频",
    "images": [
      {
        "url": "https://example.com/clothes_ref.png",
        "role": "reference_image"
      },
      {
        "url": "https://example.com/face_ref.png",
        "role": "reference_image"
      },
      {
        "url": "https://example.com/room_ref.png",
        "role": "reference_image"
      }
    ],
    "resolution": "720p",
    "ratio": "16:9",
    "duration": 5
  }'

D. 图像参考 + 视频参考多模态混合生成

火山 Seedance 支持“图像参考(控制主体外观)+ 视频参考(控制镜头/运动轨迹)”混合生成。若请求中同时包含 videos,所有 images 均会被自动识别为外观参考。

BASH
curl -X POST https://tokenra.io/v1/video/generations \
  -H "Authorization: Bearer sk-your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "seedance-2-0-fast",
    "prompt": "让第一张图中的柴犬,完美复刻视频二中狗奔跑的轨迹与镜头摇移,动作写实连贯",
    "images": [
      {
        "url": "https://example.com/my_shiba_inu.png",
        "role": "reference_image"
      }
    ],
    "videos": [
      "https://example.com/running_action_reference.mp4"
    ],
    "resolution": "720p",
    "ratio": "16:9",
    "duration": 5
  }'
02

GET / TASK STATUS

轮询获取任务结果

请求路径/v1/video/generations/{task_id}
BASH
curl -X GET https://tokenra.io/v1/video/generations/video_task_abc123 \
  -H "Authorization: Bearer sk-your_token_here"
03

PARAMETERS

完整参数字典说明

OpenAI 兼容参数名 类型 必填 默认值 描述与限制
model string - 目标视频生成模型名,传入 doubao-seedance-2-0
prompt string - 视频生成画面与动作描述提示词,对中文理解极佳
images / image_urls array - 图片参考数组。智能模式下:1张为首帧,2张为首尾帧。支持使用对象形式指定 role 或其等价字段 type(如 "first_frame""last_frame""reference_image"
videos array - 视频参考链接数组,用于控制视频生成的运动、背景或场景
audios array - 音频参考链接数组,实现视频声画融合
resolution string "720p" 目标视频清晰度,可选 "720p""1080p"
ratio string "16:9" 目标画幅比例,可选 "16:9""9:16""4:3""3:4""1:1"
duration integer 5 视频时长(秒)
camera_fixed boolean false 是否锁定镜头(保持静态视角拍摄)
generate_audio boolean false 是否同步生成匹配的视频背景环境音效
web_search boolean false 是否启用联网搜索
seed integer - 随机种子值,用于多次生成时的效果控制
04

200 OK

返回结果示例

提交任务响应:

JSON
{
  "id": "video_task_abc123",
  "task_id": "video_task_abc123",
  "status": "pending",
  "message": "Task submitted successfully"
}

查询结果响应(已完成):

JSON
{
  "id": "video_task_abc123",
  "task_id": "video_task_abc123",
  "status": "completed",
  "data": [
    {
      "url": "https://example.com/output/generated_video.mp4"
    }
  ]
}
05

ERROR HANDLING

常见失败返回示例

本平台接口遵循标准的 HTTP 状态码与统一的 JSON 错误响应格式。

状态码 说明
400 Bad Request 参数错误 / 模型不存在
401 Unauthorized API Key 无效 / 未授权
429 Too Many Requests 余额不足 / 频控限制

400 响应示例:

JSON
{
  "error": {
    "message": "The model does not exist or you do not have access to it.",
    "type": "invalid_request_error",
    "param": "model",
    "code": "model_not_found"
  }
}

排查建议:

  • 检查请求体中的 model 字段值是否正确,参考“开放端点一览表”中的可用模型
  • 使用 JSON 校验工具检查请求体格式,确保逗号和括号闭合正确