CokeAPI
视频生成系列

Seedance 2 Fast

Seedance 2 快速版视频生成,支持文生视频、首尾帧和多模态参考,480p-720p,快速出片。

CokeAPI 接入 Seedance 2 Fast 快速版视频模型。默认是异步任务: POST 创建后拿到 task_id,再通过 GET /v1/generations/{task_id} 轮询直到 succeeded

图生视频提示:生成接口不再接收内联 base64 图片数据。请先使用 文件上传接口 上传参考图片获取 URL,再传入 image_urlsimage_with_roles

模型 ID: seedance-2-fast

调用示例

curl https://cokeapi.com/v1/video/generations \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "seedance-2-fast",
    "prompt": "微距镜头拍摄一只玻璃蛙停在叶片上,纪录片风格",
    "duration": 11,
    "aspect_ratio": "16:9",
    "resolution": "720p",
    "generate_audio": true
  }'
curl https://cokeapi.com/v1/video/generations \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "seedance-2-fast",
    "prompt": "镜头从窗边花束慢慢推到餐桌中央,画面色调温暖柔和",
    "duration": 5,
    "aspect_ratio": "16:9",
    "image_with_roles": [
      {"url": "https://cdn.cokeapi.com/uploads/2026/05/17/first.png", "role": "first_frame"},
      {"url": "https://cdn.cokeapi.com/uploads/2026/05/17/last.png", "role": "last_frame"}
    ],
    "resolution": "720p",
    "generate_audio": false
  }'
TASK_ID="01HX..."
curl https://cokeapi.com/v1/generations/$TASK_ID \
  -H "Authorization: Bearer sk-xxxxxxxx"
import httpx, time

BASE = "https://cokeapi.com/v1"
HEADERS = {"Authorization": "Bearer sk-xxxxxxxx"}

r = httpx.post(
    f"{BASE}/video/generations",
    headers=HEADERS,
    json={
        "model": "seedance-2-fast",
        "prompt": "微距镜头拍摄一只玻璃蛙停在叶片上,纪录片风格",
        "duration": 11,
        "aspect_ratio": "16:9",
        "resolution": "720p",
        "generate_audio": True,
    },
    timeout=60,
)
task_id = r.json()["id"]

while True:
    r = httpx.get(f"{BASE}/generations/{task_id}", headers=HEADERS, timeout=30)
    data = r.json()
    if data["status"] in ("succeeded", "failed", "refunded"):
        print(data)
        break
    time.sleep(5)
const BASE = "https://cokeapi.com/v1";
const KEY = process.env.COKEAPI_KEY;

const create = await fetch(`${BASE}/video/generations`, {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "seedance-2-fast",
    prompt: "微距镜头拍摄一只玻璃蛙停在叶片上,纪录片风格",
    duration: 11,
    aspect_ratio: "16:9",
    resolution: "720p",
    generate_audio: true,
  }),
});
const { id: taskId } = await create.json();

while (true) {
  const poll = await fetch(`${BASE}/generations/${taskId}`, {
    headers: { "Authorization": `Bearer ${KEY}` },
  });
  const data = await poll.json();
  if (["succeeded", "failed", "refunded"].includes(data.status)) {
    console.log(data);
    break;
  }
  await new Promise((r) => setTimeout(r, 5000));
}

请求参数

参数类型必填默认值说明
modelstringseedance-2-fast
promptstring视频内容描述,中文≤500字,英文≤1000词
client_business_idstring客户侧业务 ID,可用于查询状态
durationint0时长(秒): 4-15,传 0 为自动时长
aspect_ratiostring宽高比: 21:9 / 16:9 / 4:3 / 1:1 / 3:4 / 9:16
image_urlsstring[]兼容模式图片 URL 数组,1张按首帧处理
image_with_rolesobject[]带角色的图片数组,每项含 urlrole
video_with_rolesobject[]带角色的视频数组,每项含 urlrole
audio_with_rolesobject[]带角色的音频数组,每项含 urlrole
resolutionstring720p分辨率: 480p/720p
generate_audiobooltrue是否生成同步音频
seedint随机种子
callback_urlstring回调地址,需配合 trace_id 使用
trace_idstring调用方透传 ID,需配合 callback_url 使用

image_with_roles 格式

[
  {"url": "https://example.com/first.png", "role": "first_frame"},
  {"url": "https://example.com/last.png", "role": "last_frame"}
]

支持的 role 值:

  • first_frame — 首帧图(最多 1 张)
  • last_frame — 尾帧图(最多 1 张)
  • reference_image — 参考图(最多 9 张)

video_with_roles 格式

[{"url": "https://example.com/ref.mp4", "role": "reference_video"}]

role 固定为 reference_video

audio_with_roles 格式

[{"url": "https://example.com/ref.mp3", "role": "reference_audio"}]

role 固定为 reference_audio。需配合图片或视频参考输入。

响应

创建任务 (POST)

{
  "id": "video_abc123def456",
  "task_id": "video_abc123def456",
  "object": "video.generation.task",
  "status": "queued",
  "progress": 0,
  "model": "seedance-2-fast",
  "kind": "video",
  "mode": "text_to_video",
  "created": 1768380224
}

查询任务 (GET /v1/generations/{task_id})

完成后:

{
  "id": "video_abc123def456",
  "task_id": "video_abc123def456",
  "object": "video.generation.task",
  "status": "succeeded",
  "progress": 100,
  "model": "seedance-2-fast",
  "kind": "video",
  "mode": "text_to_video",
  "result": {
    "id": "video_abc123def456",
    "object": "video.generation",
    "created": 1768380224,
    "model": "seedance-2-fast",
    "data": [
      {
        "url": "https://cdn.cokeapi.com/v/video_abc123def456.mp4",
        "duration_ms": 8000,
        "width": 1280,
        "height": 720
      }
    ]
  },
  "created": 1768380224
}

任务状态说明

状态说明
queued任务已排队等待处理
running任务正在处理中
succeeded任务已完成
failed任务失败
refunded任务失败已退款

计费

按 6 秒基准档计费,超过 6 秒按 10 秒档计费(费用 = 基准价 × 10/6)。

分辨率6 秒基准价10 秒价
480p$0.082$0.137
720p$0.165$0.275

图生视频(带参考图)按 i2v 价目计费:

分辨率6 秒基准价(i2v)10 秒价(i2v)
480p$0.084$0.14
720p$0.22$0.367

失败任务不计费,自动退款。价格为 2026-07 快照,以 模型列表页 实时价目为准。

注意事项

  • 首帧/首尾帧模式与多模态参考模式互斥。
  • image_urls 不应与 image_with_roles 同时使用。
  • 最高分辨率仅支持 720p。
  • 失败的任务不计费,会自动返还预扣点数。

本页目录