CokeAPI
视频生成系列

Wan 2.6

阿里 Wan 2.6 标准版视频生成,支持文生视频、图生视频与参考视频重绘,5/10/15 秒,720p/1080p。

CokeAPI 接入阿里 Wan 2.6 标准版视频模型。默认是异步任务: POST 创建后拿到 task_id,再通过 GET /v1/generations/{task_id} 轮询直到 succeeded

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

模型 ID: wan2.6

调用示例

curl https://cokeapi.com/v1/video/generations \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan2.6",
    "prompt": "一只橘猫在雪地中奔跑,电影级画面,超高清",
    "aspect_ratio": "16:9",
    "resolution": "1080p",
    "duration": 10
  }'
curl https://cokeapi.com/v1/video/generations \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan2.6",
    "prompt": "镜头缓慢推进,主体转身面向镜头",
    "image_urls": ["https://cdn.cokeapi.com/uploads/2026/05/17/photo.png"],
    "aspect_ratio": "16:9",
    "resolution": "1080p",
    "duration": 5
  }'
curl https://cokeapi.com/v1/video/generations \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan2.6",
    "prompt": "将视频风格转换为水彩动画效果",
    "metadata": {
      "reference_urls": ["https://cdn.cokeapi.com/uploads/2026/05/17/ref-video.mp4"]
    },
    "aspect_ratio": "16:9",
    "resolution": "1080p",
    "duration": 5
  }'
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": "wan2.6",
        "prompt": "一只橘猫在雪地中奔跑,电影级画面",
        "aspect_ratio": "16:9",
        "resolution": "1080p",
        "duration": 10,
    },
    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: "wan2.6",
    prompt: "一只橘猫在雪地中奔跑,电影级画面",
    aspect_ratio: "16:9",
    resolution: "1080p",
    duration: 10,
  }),
});
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));
}

请求参数

参数类型必填默认值说明
modelstringwan2.6
promptstring视频描述文本
durationint5时长秒数: 5 / 10 / 15
aspect_ratiostring16:916:9 / 9:16 / 1:1 / 4:3 / 3:4
resolutionstring1080p720p / 1080p
image_urlsstring[]参考图片 URL 列表,用于图生视频
negative_promptstring反向提示词,描述不希望出现的内容
seedint随机种子,可复现结果
audioboolfalse是否同步生成音频
metadata.reference_urlsstring[]参考视频 URL 列表,用于视频重绘(r2v)
asyncbooltrue是否立即返回任务态
callback_urlstring任务完成时 POST 回调到此 URL

响应

创建任务 (POST)

{
  "id": "01HX...",
  "task_id": "01HX...",
  "object": "video.generation.task",
  "status": "queued",
  "progress": 0,
  "model": "wan2.6",
  "kind": "video",
  "mode": "text_to_video",
  "created": 1714200000
}

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

进行中:

{
  "id": "01HX...",
  "task_id": "01HX...",
  "object": "video.generation.task",
  "status": "running",
  "progress": 45,
  "model": "wan2.6",
  "kind": "video",
  "mode": "text_to_video",
  "created": 1714200000
}

完成后:

{
  "id": "01HX...",
  "task_id": "01HX...",
  "object": "video.generation.task",
  "status": "succeeded",
  "progress": 100,
  "model": "wan2.6",
  "kind": "video",
  "mode": "text_to_video",
  "result": {
    "id": "01HX...",
    "object": "video.generation",
    "created": 1714200000,
    "model": "wan2.6",
    "data": [
      {
        "url": "https://cdn.cokeapi.com/v/01HX....mp4",
        "duration_ms": 10000,
        "width": 1920,
        "height": 1080
      }
    ]
  },
  "created": 1714200000
}

Wan 2.6 任务平均耗时 60-180 秒。推荐每 5 秒轮询一次。也可以在创建时传 callback_url,任务完成后主动 POST 推送结果。超过 15 分钟仍未完成会自动标记为 failed 并退款。统一查询入口见 异步任务

计费

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

分辨率6 秒基准价10 秒价
720p$0.16$0.267
1080p$0.96$1.6

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

注意事项

  • 任务最长保留 24 小时,超过会被清理。需要长期存储请下载到自有 OSS。
  • 图生视频和参考视频重绘请先通过 文件上传接口 上传参考图片或视频获取 URL。
  • 支持 5 种宽高比:16:9 / 9:16 / 1:1 / 4:3 / 3:4
  • 失败的任务不计费,会自动返还预扣点数。

本页目录