API接口

基本信息

API 地址
API Key
请求头需携带:x-token:

模型列表(自由选择)

接口地址
请求方式GET
鉴权头Authorization: Bearer 你的API密钥

请求示例

curl '{{BASE}}/v1/models' \
-H 'Authorization: Bearer {{KEY}}'

返回字段

object: list。data[].id = 可调用的模型标识,任选一个填到视频生成接口的 model 参数;status 为 retiring 表示即将下线,建议换新模型。input_modalities 表示该模型能接收的素材(text / image / video / audio)。

视频生成(Seedance)

接口地址
请求方式POST
Content-Typeapplication/json

请求参数

model*模型 ID(必填),从模型列表任选,如 doubao-seedance-2-0-260128
message画面描述(字符串)。中文建议不超过 500 字。与下面的素材至少传一项
first_frame首帧图 URL(图生视频)。也可传 data:image/png;base64,…
last_frame尾帧图 URL,须同时传 first_frame(首尾帧生视频)
images参考图 URL 数组(参考图生视频)。2.0 系列 1–9 张,2.5 最多 30 张。格式:["https://example.com/img1.jpg"]
videos参考视频 URL 数组(2.0 / 2.5 支持)
audios参考音频 URL 数组(2.0 / 2.5 支持)
aspect_ratio画面比例:16:9 / 4:3 / 1:1 / 3:4 / 9:16 / 21:9 / adaptive(自动)
duration时长(整数秒)。2.5:4–30;2.0 系列:4–15;1.0 pro / pro fast:2–12。2.0 / 2.5 可传 -1 由模型自选
resolution分辨率:480p / 720p / 1080p / 4k。2.0:最高 4k;2.5、1.0 pro:最高 1080p;2.0 fast / mini:最高 720p
generate_audio是否生成声音(布尔,默认 true,仅支持有声视频的模型)
seed随机种子(整数,可选),相同种子更易复现
watermark是否加水印(布尔,可选)
其他方舟原生参数(如 frames、camera_fixed、return_last_frame、service_tier)原样转发
首帧/首尾帧(first_frame、last_frame)与参考素材(images、videos、audios)是两种用法,不能混用。

请求示例(文生视频)

curl -X POST '{{BASE}}/api.php/video_seedance/seedanceSubmit' \
-H 'x-token: {{KEY}}' \
-H 'Content-Type: application/json' \
-d '{
  "model": "doubao-seedance-2-0-260128",
  "message": "一只橘猫在窗台上伸懒腰,午后阳光,电影感",
  "aspect_ratio": "16:9",
  "duration": 5,
  "resolution": "720p"
}'

请求示例(图生视频)

curl -X POST '{{BASE}}/api.php/video_seedance/seedanceSubmit' \
-H 'x-token: {{KEY}}' \
-H 'Content-Type: application/json' \
-d '{
  "model": "doubao-seedance-2-0-260128",
  "message": "镜头缓慢推近,人物转身微笑",
  "first_frame": "https://example.com/first.jpg",
  "duration": 5
}'

请求示例(参考图生视频)

curl -X POST '{{BASE}}/api.php/video_seedance/seedanceSubmit' \
-H 'x-token: {{KEY}}' \
-H 'Content-Type: application/json' \
-d '{
  "model": "doubao-seedance-2-0-260128",
  "message": "图1的产品放在图2的桌面上,镜头环绕展示",
  "images": ["https://example.com/product.png", "https://example.com/desk.jpg"],
  "aspect_ratio": "9:16",
  "duration": 8
}'

返回示例

{"errno": 0, "message": "ok", "data": {"task_id": "cgt-20261102142031-5tlzp"}}

结果轮询

查询接口
请求方式GET 或 POST

请求参数

task_id*提交接口返回的任务号。可放在 URL 参数、表单或 JSON 体里

轮询示例

curl '{{BASE}}/api.php/video_seedance/getResult?task_id=cgt-20261102142031-5tlzp' \
-H 'x-token: {{KEY}}'

返回字段

statusqueued 排队中 / running 生成中 / succeeded 成功 / failed 失败 / cancelled 已取消 / expired 已过期
status_text状态的中文说明
video_url成功后的视频地址(mp4)。24 小时内有效,请及时下载转存
last_frame_url尾帧图地址(请求时传 return_last_frame: true 才有)
duration实际时长(秒,取整)
resolution / ratio实际分辨率 / 比例
seed本次使用的随机种子
error_code / error_message失败时的错误码与原因
created_at / updated_at创建 / 更新时间(Unix 秒)

返回示例

{
  "errno": 0,
  "message": "ok",
  "data": {
    "task_id": "cgt-20261102142031-5tlzp",
    "model": "doubao-seedance-2-0-260128",
    "status": "succeeded",
    "status_text": "成功",
    "video_url": "https://…/video.mp4",
    "last_frame_url": "",
    "duration": 5,
    "resolution": "720p",
    "ratio": "16:9",
    "seed": 98024,
    "created_at": 1793600434,
    "updated_at": 1793600684,
    "error_code": "",
    "error_message": ""
  }
}
生成一般需要 1–5 分钟,建议每 5–10 秒查询一次,直到 status 为 succeeded 或 failed。

错误码

返回统一为 {"errno", "message", "data"},HTTP 状态码为 200,以 errno 判断结果(模型列表接口除外,为 OpenAI 格式)。
0成功
400参数错误,见 message
401API Key 无效或未携带 x-token
404任务不存在或已过期
502生成服务报错,data.upstream_code / upstream_message 为原始错误
500服务内部错误,请稍后重试
已复制