AI 模型接口视频(Videos)
Seedance 视频生成(Dreamina)
使用 EasyRouter 统一接口调用 Dreamina Seedance 2.0 系列视频生成模型,支持文生视频、图生视频、视频续写。
Dreamina Seedance 2.0 是新一代视频生成模型,支持文生视频、图生视频、以及视频输入续写 / 编辑。EasyRouter 通过 /v1/video/generations 异步任务接口对外提供服务。
Seedance 是异步任务型接口:提交后立即返回 task_id,需要轮询获取结果。
一、支持的模型
| 模型 | 说明 | 支持能力 |
|---|---|---|
dreamina-seedance-2-0 | 标准版 Seedance 2.0,画质优先 | 文生视频、图生视频、视频续写 |
dreamina-seedance-2-0-fast | 快速版 Seedance 2.0,延迟更低 | 文生视频、图生视频、视频续写 |
两个模型都支持视频作为输入(视频续写 / 视频编辑),在 metadata.content 中传入 video_url 即可。
二、通用接口
2.1 提交任务
POST /v1/video/generations请求头
| Header | 必填 | 说明 |
|---|---|---|
Authorization | ✓ | Bearer sk-你的APIKey |
Content-Type | ✓ | application/json |
请求体字段
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | ✓ | Seedance 模型名,见上表 |
prompt | string | ✓ | 视频描述提示词 |
image | string | — | 图生视频的参考图(URL 或 base64 data URI);与 images 二选一 |
images | string[] | — | 多图参考(URL 或 base64 data URI) |
duration | int | — | 视频时长(秒),常见 5 / 10 秒,默认 5 |
seconds | string | — | duration 的字符串形式(兼容 OpenAI Sora API)。必须是纯数字字符串(如 "5"、"10"),不能带单位。仅在顶层 duration 为 0 或未传时生效。 |
metadata | object | — | Seedance 特有参数容器(见第三节) |
响应
{
"id": "task_xxxxxxxxxxxxx",
"task_id": "task_xxxxxxxxxxxxx",
"object": "video",
"model": "dreamina-seedance-2-0",
"status": "queued",
"progress": 0,
"created_at": 1730000000
}id / task_id 是 EasyRouter 公开 ID(task_ 前缀),用于后续查询。不等于上游任务 id。
2.2 查询任务状态
GET /v1/video/generations/{task_id}响应结构为 {code, message, data} 包装。成功时 code 为 "success",data 是任务详情对象。
响应示例(成功)
{
"code": "success",
"message": "",
"data": {
"id": 6,
"task_id": "task_jEctEHDF1vefS2L3HND2JnzXPslnAYby",
"platform": "45",
"user_id": 1,
"group": "default",
"channel_id": 12,
"quota": 818125,
"action": "generate",
"status": "SUCCESS",
"fail_reason": "",
"result_url": "https://ark-acg-...volces.com/xxx.mp4?X-Tos-...",
"submit_time": 1778236598,
"start_time": 1778236601,
"finish_time": 1778236698,
"created_at": 1778236598,
"updated_at": 1778236698,
"progress": "100%",
"properties": {
"input": "",
"upstream_model_name": "dreamina-seedance-2-0-260128",
"origin_model_name": "dreamina-seedance-2-0"
},
"data": {
"id": "cgt-20260508183637-m6gj8",
"seed": 42,
"draft": false,
"model": "dreamina-seedance-2-0-260128",
"ratio": "16:9",
"usage": {
"total_tokens": 108900,
"completion_tokens": 108900
},
"status": "succeeded",
"content": {
"video_url": "https://ark-acg-...volces.com/xxx.mp4?X-Tos-..."
},
"duration": 5,
"resolution": "720p",
"service_tier": "default",
"generate_audio": true,
"framespersecond": 24,
"execution_expires_after": 172800,
"created_at": 1778236598,
"updated_at": 1778236696
}
}
}data 字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
id | int | 内部任务自增 ID |
task_id | string | EasyRouter 公开任务 ID(以 task_ 开头),用于后续查询 |
platform | string | 上游平台编号 |
user_id | int | 用户 ID |
group | string | 所属分组 |
channel_id | int | 实际调用的渠道 ID |
quota | int | 本次任务扣费的 quota 原始值 |
action | string | 任务动作,通常为 generate |
status | string | 任务状态:SUBMITTED / QUEUED / IN_PROGRESS / SUCCESS / FAILURE |
fail_reason | string | 失败原因(仅 status = FAILURE 时非空) |
result_url | string | 视频结果 URL(仅成功时返回,为上游临时链接) |
progress | string | 进度,形如 "100%" |
submit_time / start_time / finish_time | int64 | 提交 / 开始 / 完成的 Unix 时间戳(秒) |
created_at / updated_at | int64 | 记录创建 / 最近更新时间 |
properties.upstream_model_name | string | 实际发给上游的模型名 |
properties.origin_model_name | string | 客户端请求的模型名 |
data | object | 上游原始响应(含 usage、content.video_url、resolution、framespersecond 等) |
状态枚举
| 状态 | 说明 |
|---|---|
SUBMITTED | 已提交 |
QUEUED | 已进入上游队列 |
IN_PROGRESS | 生成中 |
SUCCESS | 已完成,result_url 为视频地址 |
FAILURE | 生成失败,fail_reason 为失败原因 |
2.3 下载视频内容
GET /v1/videos/{task_id}/content直接返回视频二进制流(Content-Type: video/mp4)。EasyRouter 自动代理上游 URL。
强烈推荐使用 /content 代理接口下载视频,而不是直接访问 result_url。后者是上游的临时链接,有效期有限。
三、Seedance 特有参数(metadata)
所有 Seedance 特有字段都通过请求体的 metadata 对象传递,系统会透传给上游。
3.1 分辨率 / 宽高比 / 时长
| 字段 | 类型 | 说明 | 取值示例 |
|---|---|---|---|
resolution | string | 分辨率档位 | 480p 720p 1080p |
ratio | string | 宽高比 | 16:9 9:16 1:1 4:3 3:4 21:9 adaptive(自适应) |
duration | int | 视频时长(秒)。**注意:**顶层 duration(或 seconds)的优先级高于 metadata.duration。 | 5 10 |
frames | int | 指定帧数(可选,与 duration 互斥) | 如 121 |
seed | int | 随机种子 | 0 ~ 2^31-1 |
3.2 镜头与内容控制
| 字段 | 类型 | 说明 |
|---|---|---|
camera_fixed | bool | 是否固定镜头(true = 镜头静止) |
watermark | bool | 是否添加官方水印 |
3.3 高级参数
| 字段 | 类型 | 说明 |
|---|---|---|
service_tier | string | 服务档位,影响速度与配额(如 auto / default / priority) |
execution_expires_after | int | 任务执行超时时间(秒) |
generate_audio | bool | 是否同步生成音频 |
draft | bool | 草稿模式(更快速、更便宜,质量略降) |
return_last_frame | bool | 是否在响应中返回视频最后一帧图片 |
callback_url | string | 任务完成后的回调通知 URL |
3.4 多模态输入(content 数组)
除了顶层 image / images 字段外,你也可以直接在 metadata.content 传递多模态输入数组,支持图片和视频混合输入:
{
"model": "dreamina-seedance-2-0",
"prompt": "把这段视频延长,让猫咪走到画面外",
"metadata": {
"content": [
{
"type": "video_url",
"video_url": {
"url": "https://example.com/cat.mp4"
}
}
],
"resolution": "720p"
}
}type | 用途 |
|---|---|
image_url + image_url.url | 图片参考(图生视频) |
video_url + video_url.url | 视频输入(视频续写 / 编辑) |
四、完整调用示例
# Step 1: 提交任务
curl -X POST https://easyrouter.io/v1/video/generations \
-H "Authorization: Bearer sk-你的APIKey" \
-H "Content-Type: application/json" \
-d '{
"model": "dreamina-seedance-2-0",
"prompt": "一只猫在月球表面漫步,背景是璀璨的星空",
"duration": 5,
"metadata": {
"resolution": "720p",
"ratio": "16:9",
"seed": 42
}
}'
# Step 2: 轮询任务
curl https://easyrouter.io/v1/video/generations/task_abc123 \
-H "Authorization: Bearer sk-你的APIKey"
# Step 3: 下载视频
curl https://easyrouter.io/v1/videos/task_abc123/content \
-H "Authorization: Bearer sk-你的APIKey" \
-o cat_on_moon.mp4curl -X POST https://easyrouter.io/v1/video/generations \
-H "Authorization: Bearer sk-你的APIKey" \
-H "Content-Type: application/json" \
-d '{
"model": "dreamina-seedance-2-0",
"prompt": "让这只猫跳起来",
"image": "https://example.com/cat.jpg",
"duration": 5,
"metadata": {
"resolution": "720p",
"ratio": "16:9"
}
}'# 视频续写 / 编辑
curl -X POST https://easyrouter.io/v1/video/generations \
-H "Authorization: Bearer sk-你的APIKey" \
-H "Content-Type: application/json" \
-d '{
"model": "dreamina-seedance-2-0",
"prompt": "延长这段视频,让猫咪走到画面外",
"metadata": {
"content": [
{
"type": "video_url",
"video_url": {
"url": "https://example.com/cat-original.mp4"
}
}
],
"resolution": "720p",
"duration": 5
}
}'# Fast 版:速度优先,延迟更低
curl -X POST https://easyrouter.io/v1/video/generations \
-H "Authorization: Bearer sk-你的APIKey" \
-H "Content-Type: application/json" \
-d '{
"model": "dreamina-seedance-2-0-fast",
"prompt": "赛博朋克城市街景,霓虹灯闪烁,雨夜",
"duration": 5,
"metadata": {
"resolution": "720p",
"ratio": "16:9",
"camera_fixed": false,
"generate_audio": true
}
}'五、错误处理
5.1 HTTP 400 参数错误
- 模型不存在或未授权:
model not allowed - prompt 为空:
prompt is required - 分辨率 / 时长参数非法:由上游返回具体错误
5.2 HTTP 401 / 403 鉴权错误
401 Unauthorized:API Key 无效或已过期403 Forbidden:API Key 无权访问此模型(检查 token 模型白名单)
5.3 HTTP 402 余额不足
返回 insufficient user quota 错误。
5.4 任务 failed 状态
常见原因:
| 原因 | 处理建议 |
|---|---|
| 内容审核失败 | 修改 prompt,避免敏感内容 |
| 图片 / 视频 URL 不可访问 | 确保 URL 公开可访问,或改用 base64 |
| 上游超时 | 稍后重试,或切换到 dreamina-seedance-2-0-fast |
任务 failed 时 EasyRouter 会自动退回已扣费用。