API 参考

生成视频 API:文生视频、图生视频、参考生视频

提交一次生成并立即返回任务。积分在创建任务时扣除,失败后自动退回。

获取 API 密钥Wan 3 API 团队 ·
POSThttps://api.wan3api.org/v1/videos/generations

请求体

字段类型说明
model必填string模型 ID,见 GET /models。
prompt必填string视频里要发生什么,最多 5000 个字符。
modestringtext、frames 或 reference。不传时根据媒体推断:有首尾帧为 frames,有参考素材为 reference,都没有为 text。
durationinteger输出时长(整数秒)。默认 5 秒,超出范围会被修正到模型支持的区间。
resolutionstring模型支持的分辨率,如 480P、1080P。默认最便宜的一档。
aspect_ratiostring16:9、9:16、1:1 等。frames 模式下忽略,由首帧决定画幅。
first_frame_urlstringframes 模式:视频开头的图片,需为公开 HTTPS 地址。
last_frame_urlstringframes 模式:视频结尾的图片。
image_urlsstring[]reference 模式:需要保持一致的人物、产品或风格图片。
video_urlsstring[]reference 模式:参考动作或运镜的视频,按上传秒数计费。
audio_urlsstring[]reference 模式:参考音频。
callback_urlstring接收完成任务的公开 HTTPS 地址。
curl -X POST "https://api.wan3api.org/v1/videos/generations" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "model": "wan-3",
  "prompt": "A red fox runs through fresh snow at sunrise, slow motion, cinematic",
  "duration": 5,
  "resolution": "480P",
  "aspect_ratio": "16:9"
}'

模式

  • text — 文生视频:只需提示词。
  • frames — 图生视频:首帧(可选尾帧)加描述动作的提示词。
  • reference — 参考生视频:最多 10 张图片、5 段视频和 5 段音频,视频会忠实保留它们(Wan 3.0 和 Wan 3.0 Prime)。

图生视频

json
{
  "model": "wan-3",
  "prompt": "The camera slowly pushes in as she turns and smiles",
  "duration": 5,
  "resolution": "480P",
  "first_frame_url": "https://example.com/first-frame.jpg"
}

参考生视频

json
{
  "model": "wan-3",
  "prompt": "Image 1 walks through a neon-lit night market, handheld camera",
  "duration": 5,
  "resolution": "480P",
  "aspect_ratio": "16:9",
  "image_urls": [
    "https://example.com/character.png"
  ],
  "callback_url": "https://your-app.com/webhooks/video"
}

媒体 URL

提交时我们会下载每个 URL,因此必须是公开 HTTPS 地址,且 20 秒内响应。大小和时长限制与网页上传相同。无法下载的 URL 返回 400 media_unreachable,不会扣费。

幂等

发送 Idempotency-Key 请求头(任意唯一字符串,最长 255 个字符)即可安全重试。相同的 key 重复请求会返回原任务,并带 Idempotent-Replayed: true 头,不会重复扣费。

响应

返回 200 和任务对象。生成完成前 status 为 processing。

json
{
  "id": "3f1c9a52-6d1e-4c1b-9a77-2f4d8f0c9e10",
  "object": "video.generation",
  "model": "wan-3",
  "mode": "text",
  "status": "processing",
  "progress": 0,
  "prompt": "A red fox runs through fresh snow at sunrise, slow motion, cinematic",
  "duration": 5,
  "resolution": "480P",
  "aspect_ratio": "16:9",
  "video_url": null,
  "credits": 15,
  "refunded": false,
  "error": null,
  "source": "api",
  "created_at": "2026-11-01T08:00:00.000Z",
  "completed_at": null
}

价格

输出秒数乘以该模型在对应分辨率下的每秒单价,再加上按相同单价计算的参考视频秒数。参考图片免费。响应里的 credits 字段就是实际扣除的积分。单价见「模型与价格」。 模型与价格 →