跳转到内容
打开 Castaly控制台

视频

wan2.7-r2v API

通过 Modelflare 异步视频入口使用精确的 wan2.7-r2v 模型 ID。

使用精确模型 ID wan2.7-r2v。请求中的模型名必须与本页完全一致。

示例输出wan2.7-r2vPOST /v1/videos5.0s

请求参数:duration=5resolution=1080Pratio=16:9参考图片

提示词:One continuous take, no cuts. Keep the glass flowers from the reference exactly as they are and carry them into a new place: a wide city crossing at night in the rain. The whole bed of glass blooms now grows straight out of the wet asphalt across the junction, ringing as the rain strikes them, headlights firing caustics along the road. The camera starts at kerb height among the stems, moves forward through them and rises to look down the length of the crossing. One hard pink key from a shopfront on the left, cold blue signals behind. Real weight and inertia, glass and water, no text.

生成该示例的请求(输入媒体地址已替换)
{
"model": "wan2.7-r2v",
"input": {
"prompt": "One continuous take, no cuts. Keep the glass flowers from the reference exactly as they are and carry them into a new place: a wide city crossing at night in the rain. The whole bed of glass blooms now grows straight out of the wet asphalt across the junction, ringing as the rain strikes them, headlights firing caustics along the road. The camera starts at kerb height among the stems, moves forward through them and rises to look down the length of the crossing. One hard pink key from a shopfront on the left, cold blue signals behind. Real weight and inertia, glass and water, no text.",
"media": [
{
"type": "reference_image",
"url": "https://example.com/input-image.png"
}
]
},
"parameters": {
"duration": 5,
"resolution": "1080P",
"ratio": "16:9"
}
}

使用 Modelflare API Key,通过 https://modelflare.dev/v1 发送请求。网关入口为 POST /v1/videos。

HTTP
Authorization: Bearer YOUR_MODELFLARE_API_KEY
终端窗口bash
curl https://modelflare.dev/v1/videos \
-H "Authorization: Bearer YOUR_MODELFLARE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "wan2.7-r2v",
"input": {"prompt": "Image 1 中的人物走过 Video 1 中的街道。", "media": [{"type": "reference_image", "url": "https://example.com/reference.png"}, {"type": "reference_video", "url": "https://example.com/reference.mp4"}]},
"parameters": {"resolution": "1080P", "ratio": "16:9", "duration": 5, "prompt_extend": false, "watermark": false}
}'

提交成功后保存任务 ID。使用 GET /v1/videos/{task_id} 轮询,完成后使用 GET /v1/videos/{task_id}/content 下载;结果地址可能过期,应及时转存。

终端窗口bash
curl https://modelflare.dev/v1/videos/TASK_ID \
-H "Authorization: Bearer YOUR_MODELFLARE_API_KEY"

Wan 通常使用 input 与 parameters;帧引导和 reference media 不能混用。

Wan2.7 R2V 用 reference_image / reference_video 构成参考输入;可在参考媒体上附加 reference_voice。不要与 first_frame / last_frame 工作流混用。

字段 必填 说明
model 是 wan2.7-r2v
input.prompt 是 描述场景并按官方语法引用媒体
input.media[] 是 至少一个 reference_image 或 reference_video
input.media[].reference_voice 否 WAV/MP3 的公开 URL,用于声音特征
parameters.resolution 否 720P / 1080P(默认 1080P)
parameters.ratio 否 16:9 / 9:16 / 1:1 / 4:3 / 3:4(提供 first_frame 时忽略)
parameters.duration 否 有参考视频时遵守更短的时长上限
parameters.prompt_extend 否 该独立模型按模型契约设为 false
parameters.watermark 否 是否添加水印
parameters.seed 否 可选随机种子

R2V 至少需要一个 reference_image 或 reference_video,参考图/视频合计不超过 5 个; 可附一个 first_frame 和 reference_voice。 包含参考视频时,时长上限更短;

终端窗口bash
curl https://modelflare.dev/v1/videos \
-H "Authorization: Bearer YOUR_MODELFLARE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "wan2.7-r2v",
"input": {"prompt": "让图像主体沿视频动作自然移动", "media": [
{"type": "reference_image", "url": "https://example.com/subject.png"},
{"type": "reference_video", "url": "https://example.com/motion.mp4"}
]},
"parameters": {"resolution": "1080P", "duration": 8, "prompt_extend": false}
}'

参数不符合模型契约时,创建接口会返回带 request ID 的 4xx。异步任务也可能在创建成功后进入 failed;轮询响应中的 error_code 和 error_message 才是该任务的最终原因。不要把同一请求改成另一种 JSON 结构重试。

本页只覆盖 Modelflare 的模型生成/编辑调用。搜索或地图增强、声音管理、元素库管理等资源型接口不属于本页的公开调用范围,也不需要作为模型请求字段传入。

本模型按视频秒计费。请查看模型价格页查看当前销售价、参考原价和完整规格。

模型 ID 差异
wan2.7-r2v 本页说明的模型。
媒体契约 · v1

契约 ID: media.wan2-7-r2v.v1Adapter: video.wan.r2v.v1@v1指纹: 6f91913f171eb3e1e3ee31dbe85b9609d9ddbacc33bb89810a5c580807650414

官方来源: Alibaba Cloud Model Studio

契约参数

Intent 字段控件选项
ratioselect16:9 / 9:16 / 1:1 / 4:3 / 3:4
resolutionselect720p / 1080p
durationselect2 / 3 / 4 / 5 / 6 / 7 / 8 / 9 / 10 / 11 / 12 / 13 / 14 / 15

支持能力

  • allowed_values · ratio · 16:9, 9:16, 1:1, 4:3, 3:4
  • allowed_values · resolution · 720p, 1080p
  • allowed_values · duration · 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
  • required_assets · reference_asset_ids
  • max_assets · reference_asset_ids · 6

结构化请求示例

reference

Intent

{
  "duration": 2,
  "prompt": "A red paper kite over a quiet harbour at dusk.",
  "ratio": "16:9",
  "reference_asset_ids": [
    "asset_example"
  ],
  "resolution": "720p"
}

上游请求

{
  "input": {
    "media": [
      {
        "type": "reference_image",
        "url": "https://example.com/reference.png"
      }
    ],
    "prompt": "A red paper kite over a quiet harbour at dusk."
  },
  "model": "wan2.7-r2v",
  "parameters": {
    "duration": 2,
    "resolution": "720P"
  }
}