Wan 视频生成 - 创建视频任务

Wan 视频生成 · 创建任务

提交 Wan 模型族视频任务。用户只对接平台统一接口;平台会按 model 选择对应能力,并负责参数过滤、任务入库、扣点冻结和轮询转存。

<details>
<summary>基本信息</summary>

字段内容
类型应用 API
应用编码wan
API 编码create
请求方式POST
请求路径/api/v1/apps/wan/create
调用模式异步

</details>

鉴权

Authorization: Bearer <YOUR_API_KEY>
Content-Type: application/json

请求路径

POST /api/v1/apps/wan/create

提交成功后返回平台 task_id。请使用 GET /api/v1/apps/wan/query?task_id={task_id} 查询结果,或在请求中传 callback_url 接收任务完成/失败回调。

模型能力

model场景必填参数说明
wan2.7文生视频model, prompt不需要素材输入
wan2.7-r2v角色/参考图生视频model, prompt, image_with_roles传参考图和图片角色
wan2.7-videoedit视频编辑model, prompt, video_urls传待编辑视频 URL,按含视频输入档计费

业务参数

参数类型必填默认值可选值 / 范围示例说明
modelstring是wan2.7wan2.7 / wan2.7-r2v / wan2.7-videoeditwan2.7Wan 模型版本,也是能力选择开关
promptstring是--一辆复古跑车沿着海岸公路行驶,电影感光影视频画面、动作、镜头、风格描述
resolutionstring否720p720p / 1080p720p输出分辨率,同时参与价格矩阵匹配
durationinteger否5wan2.7/wan2.7-r2v: 2-15;wan2.7-videoedit: 2-105生成视频时长,单位秒;平台按该值乘以单价扣点
sizestring否-16:9 / 9:16 / 1:1 / 4:3 / 3:416:9视频画幅比例
image_with_rolesarraywan2.7-r2v 必填-最多 2 张;role: reference_image / first_frame / last_frame[{"url":"https://example.com/role.png","role":"reference_image"}]参考图列表;每项至少传 url
image_urlsarray否-wan2.7 最多 2 张;wan2.7-videoedit 最多 4 张["https://example.com/reference.png"]参考图片 URL 列表
video_urlsarraywan2.7-videoedit 必填-最多 1 段["https://example.com/input.mp4"]待编辑视频 URL 列表;传入后按 with_video 档位计费
audio_urlstring否-HTTP/HTTPS URLhttps://example.com/audio.mp3参考音频 URL
negative_promptstring否--低清晰度、畸形、闪烁不希望出现在画面中的内容
prompt_extendboolean否-true / falsefalse是否启用提示词扩展
seedinteger否-0-214748364742随机种子,用于尽量复现结果
watermarkboolean否-true / falsefalse是否添加水印
callback_urlstring否-HTTPS URLhttps://your-domain.com/webhook/wan任务完成或失败时的平台回调地址
metadataobject否-audio_setting: auto / origin{"biz_id":"order_1001","audio_setting":"auto"}业务透传字段;视频编辑可指定音频处理方式

请求示例

文生视频

{
  "model": "wan2.7",
  "prompt": "一辆复古跑车沿着海岸公路行驶,电影感光影,镜头缓慢推进",
  "resolution": "720p",
  "duration": 5,
  "seed": 42
}

角色/参考图生视频

{
  "model": "wan2.7-r2v",
  "prompt": "让参考图中的人物在城市街头自然行走,保持人物身份一致",
  "resolution": "1080p",
  "duration": 5,
  "image_with_roles": [
    {
      "url": "https://example.com/role.png",
      "role": "reference_image"
    }
  ]
}

视频编辑

{
  "model": "wan2.7-videoedit",
  "prompt": "将视频改成赛博朋克夜景风格,增强霓虹灯和雨夜反光",
  "resolution": "720p",
  "duration": 5,
  "video_urls": [
    "https://example.com/input.mp4"
  ]
}

成功响应

{
  "code": 1,
  "msg": "success",
  "data": {
    "task_id": "task_xxxxxxxxxxxx",
    "status": "queued",
    "app": "wan",
    "api": "create"
  }
}

计费说明

计费公式:duration × 当前租户价格矩阵单价。

价格矩阵按 model + resolution + 输入类型 匹配。wan2.7-videoedit 因传入 video_urls,会使用 with_video 档位;其它未传视频输入的场景使用 without_video 档位。平台会在提交任务时冻结点数,任务完成后按实际计费结果结算。

失败响应

{
  "error": {
    "message": "点数余额不足",
    "type": "insufficient_points",
    "code": "insufficient_points"
  }
}

常见错误码

HTTPcode含义
400missing_model / missing_prompt必填参数缺失
400unsupported_modelmodel 不在当前 Wan 版本规格中
400missing_image_with_roleswan2.7-r2v 未传参考图
400missing_video_urlswan2.7-videoedit 未传视频素材
401auth_failedAPI Key 缺失或无效
402insufficient_points点数余额不足
403permission_denied当前 API Key 无权调用该应用
429queue_limit_exceeded排队任务已达上限
5xxserver_error / task_error平台服务异常或任务处理失败

同类文章