Skip to content

Wan - Flash 图转视频 ​

本页由 ModelFold 文档站根据上游官方 OpenAPI 文档同步生成。接口路径、参数、示例与官方保持一致;品牌与 API 域名已替换为 ModelFold。

接口 ​

POST /jobs/createTask

完整 URL: https://ai.modelfold.online/v1/jobs/createTask

鉴权:所有请求都需要 Authorization: Bearer <API_KEY> 请求头。

使用 Wan 先进的 AI 模型将静态图像转换为动态视频

查询任务状态 ​

提交任务后,使用统一的查询端点检查进度并检索结果:

TIP

对于生产使用,我们建议使用 callBackUrl 参数接收生成完成时的自动通知,而不是轮询状态端点。

TIP

开启音频价格更高。当前价格见 ai.modelfold.online/pricing。

相关资源 ​

请求参数 ​

请求体 (application/json) ​

参数类型必填说明
modelstring是用于生成的模型名称。必填字段。
- 此端点必须为 wan/2-6-flash-image-to-video 默认值:"wan/2-6-flash-image-to-video"。 可选值:wan/2-6-flash-image-to-video。 示例:wan/2-6-flash-image-to-video。
callBackUrlstring否接收生成任务完成更新的 URL。生产环境可选但推荐使用。
- 系统会在生成完成时向此 URL 发送 POST 请求,包含任务状态和结果
- 回调包含生成的内容 URL 和任务信息
- 您的回调端点应接受包含 JSON 有效负载的 POST 请求
- 或者使用获取任务详情端点轮询任务状态
- 为确保回调安全性,请参阅 Webhook 校验指南 了解签名验证实现方法 示例:https://your-domain.com/api/callback。
inputobject否生成任务的输入参数
  input.promptstring是视频生成的文本提示。支持中英文,2–1500 个字符。 示例:Anthopmopric fox singing a Christmas song at the rubbish dump in the rain.。
  input.image_urlsarray&lt;string&gt;是图片 URL 列表。所有图片至少为 256x256 像素。(上传后的文件 URL,非文件内容;接受类型:image/jpeg, image/png, image/webp;最大大小:10.0MB)
  input.durationstring否生成视频的时长(秒) 默认值:"5"。 可选值:5 / 10 / 15。 示例:5。
  input.resolutionstring否视频分辨率等级 默认值:"1080p"。 可选值:720p / 1080p。 示例:720p。
  input.audioboolean是是否生成带音频的视频。音频会直接影响费用,带声音与静音视频的计费不同。(布尔值 true/false) 示例:false。
  input.multi_shotsboolean否multi_shots 参数控制 AI 视频生成时的镜头构图风格,决定生成视频为单一连续镜头还是多镜头带转场。(布尔值 true/false) 示例:false。

请求示例 ​

bash
curl -X POST "https://ai.modelfold.online/v1/jobs/createTask" \
  -H "Authorization: Bearer $MODELFOLD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "wan/2-6-flash-image-to-video",
  "callBackUrl": "https://your-domain.com/api/callback",
  "input": {
    "prompt": "Anthopmopric fox singing a Christmas song at the rubbish dump in the rain.",
    "image_urls": [
      "https://static.aiquickdraw.com/tools/example/1765957673717_awiBAidD.webp"
    ],
    "duration": "5",
    "resolution": "720p",
    "audio": false,
    "multi_shots": false
  }
}'
json
{
  "model": "wan/2-6-flash-image-to-video",
  "callBackUrl": "https://your-domain.com/api/callback",
  "input": {
    "prompt": "Anthopmopric fox singing a Christmas song at the rubbish dump in the rain.",
    "image_urls": [
      "https://static.aiquickdraw.com/tools/example/1765957673717_awiBAidD.webp"
    ],
    "duration": "5",
    "resolution": "720p",
    "audio": false,
    "multi_shots": false
  }
}

响应 ​

200 — 请求成功 ​

参数类型必填说明
codeinteger是请求状态码。请求失败时 HTTP 状态仍为 200,请始终以本字段判断:200 表示成功,其他值均表示失败,原因见 msg。常见值:401 API key 无效或缺失;402 积分不足;429 超出频率限制;422 或 500 请求未能处理(请先查看 msg、检查参数,再决定是否重试)。 可选值:200 / 401 / 402 / 404 / 422 / 429 / 433 / 455 / 500 / 501 / 505。 示例:200。
msgstring是响应消息,失败时的错误描述
dataobject是—
  data.taskIdstring否任务 ID,可与获取任务详情端点一起使用来查询任务状态 示例:task_wan_1772011327514。
json
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "task_wan_1772011327514"
  }
}

回调 ​

videoTaskCompleted ​

回调地址:{request.body#/callBackUrl}(即请求体里的 callBackUrl)。

当 wan/2-6-flash-image-to-video 任务成功或失败时,系统会发送此回调。

回调体参数

参数类型必填说明
codeinteger是统一回调状态码:成功为 200,失败为 501。 可选值:200 / 501。 示例:200。
msgstring是统一回调消息。 可选值:Playground task completed successfully. / Playground task failed.。 示例:Playground task completed successfully.。
dataobject是—
  data.taskIdstring是任务唯一标识符。
  data.modelstring是任务使用的模型。 可选值:wan/2-6-flash-image-to-video。 示例:wan/2-6-flash-image-to-video。
  data.statestring是任务最终状态。 可选值:success / fail。 示例:success。
  data.paramstring是包含已提交任务参数的 JSON 字符串。
  data.resultJsonstring否任务成功时,包含 resultUrls、firstFrameUrl、lastFrameUrl 或 resultObject 的 JSON 字符串。仅在 state 为 success 时出现。
  data.failCodestring否失败码,数字字符串,如 "400"、"500"。仅在 state 为 fail 时出现。
  data.failMsgstring否失败原因,仅在 state 为 fail 时出现。
  data.costTimeinteger否处理耗时(秒),成功和失败回调都会返回。
  data.completeTimeinteger否任务完成时间戳。
  data.createTimeinteger否任务创建时间戳。
  data.updateTimeinteger否完成时间请以 completeTime 为准;updateTime 可能与 createTime 相同。
  data.creditsConsumednumber否本任务消耗的积分;失败任务为 0。

任务成功完成

json
{
  "code": 200,
  "msg": "Playground task completed successfully.",
  "data": {
    "taskId": "task_example_video_webhook_001",
    "model": "wan/2-6-flash-image-to-video",
    "state": "success",
    "param": "{\"input\":\"{\\\"prompt\\\":\\\"Anthopmopric fox singing a Christmas song at the rubbish dump in the rain.\\\",\\\"image_urls\\\":[],\\\"duration\\\":\\\"5\\\",\\\"resolution\\\":\\\"1080p\\\",\\\"audio\\\":false,\\\"multi_shots\\\":false,\\\"nsfw_checker\\\":false}\",\"callBackUrl\":\"https://example.com/callback\",\"model\":\"wan/2-6-flash-image-to-video\"}",
    "resultJson": "{\"resultUrls\":[\"https://example.com/generated-video.mp4\"]}",
    "costTime": 12,
    "completeTime": 1234567890,
    "createTime": 1234560000,
    "updateTime": 1234567890,
    "creditsConsumed": 1.23
  }
}

任务失败

json
{
  "code": 501,
  "msg": "Playground task failed.",
  "data": {
    "taskId": "task_example_video_webhook_001",
    "model": "wan/2-6-flash-image-to-video",
    "state": "fail",
    "param": "{\"input\":\"{\\\"prompt\\\":\\\"Anthopmopric fox singing a Christmas song at the rubbish dump in the rain.\\\",\\\"image_urls\\\":[],\\\"duration\\\":\\\"5\\\",\\\"resolution\\\":\\\"1080p\\\",\\\"audio\\\":false,\\\"multi_shots\\\":false,\\\"nsfw_checker\\\":false}\",\"callBackUrl\":\"https://example.com/callback\",\"model\":\"wan/2-6-flash-image-to-video\"}",
    "failCode": "400",
    "failMsg": "<error detail>",
    "costTime": 12,
    "creditsConsumed": 0
  }
}

ModelFold — 一个 API,接入所有主流 AI 模型。