> ## Documentation Index
> Fetch the complete documentation index at: https://docs.geekai.co/llms.txt
> Use this file to discover all available pages before exploring further.

# 通义万相2.7

通义万相2.7视频生成模型,支持文生视频，图生视频，参考生视频，视频编辑，文生视频通过提示词控制生成多镜头视频，支持自动配音和传入自定义音频文件，图生视频支持首帧生视频、首尾帧生视频、视频续写三大任务，视频编辑支持输入多模态（文本/图像/视频），可完成指令编辑和视频迁移任务

### 模型参数

* 模型ID：`wan2.7-t2v`/`wan2.7-i2v`/`wan2.7-r2v`/`wan2.7-videoedit`
* 模型价格：你可以在[模型广场](https://geekai.co/models?platform=dashscope\&type=video)查看最新价格信息
* 调用入口：`https://geekai.co/api/v1/videos/generations`
* 模型参数：参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations)
* API认证：[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start)

<Note>
  不支持视频 API 中的以下参数：

  * `with_audio`
  * `size`
  * `quality`
  * `fps`

  附：[万相2.7 官方 API 文档](https://help.aliyun.com/zh/model-studio/use-video-generation)
</Note>

`aspect_ratio` 参数支持以下取值：

* `1:1`
* `16:9`
* `9:16`
* `4:3`
* `3:4`

不同宽高比对应的输出视频分辨率：

| 分辨率   | 宽高比  | 输出视频分辨率（宽x高） |
| ----- | ---- | ------------ |
| 720P  | 16:9 | 1280x720     |
|       | 9:16 | 720x1280     |
|       | 1:1  | 960x960      |
|       | 4:3  | 1104x832     |
|       | 3:4  | 832x1104     |
| 1080P | 16:9 | 1920x1080    |
|       | 9:16 | 1080x1920    |
|       | 1:1  | 1440x1440    |
|       | 4:3  | 1648x1248    |
|       | 3:4  | 1248x1648    |

注意： 在使用 `resolution` 参数时，请确保分辨率中的P需要大写，如：`720P`，`1080P`。

### 文生视频

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model":"wan2.7-t2v",
    "prompt": "一段紧张刺激的侦探追查故事，展现电影级叙事能力。第1个镜头[0-3秒] 全景：雨夜的纽约街头，霓虹灯闪烁，一位身穿黑色风衣的侦探快步行走。 第2个镜头[3-6秒] 中景：侦探进入一栋老旧建筑，雨水打湿了他的外套，门在他身后缓缓关闭。 第3个镜头[6-9秒] 特写：侦探的眼神坚毅专注，远处传来警笛声，他微微皱眉思考。 第4个镜头[9-12秒] 中景：侦探在昏暗走廊中小心前行，手电筒照亮前方。 第5个镜头[12-15秒] 特写：侦探发现关键线索，脸上露出恍然大悟的表情。",
    "resolution": "720P",
    "aspect_ratio": "16:9"
}'
```

`wan2.7-t2v`也支持传入音频文件，通过`audio_url`参数传递即可：

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model":"wan2.7-t2v",
    "prompt": "一幅史诗级可爱的场景。一只小巧可爱的卡通小猫将军，身穿细节精致的金色盔甲，头戴一个稍大的头盔，勇敢地站在悬崖上。他骑着一匹虽小但英勇的战马，说：”青海长云暗雪山，孤城遥望玉门关。黄沙百战穿金甲，不破楼兰终不还。“。悬崖下方，一支由老鼠组成的、数量庞大、无穷无尽的军队正带着临时制作的武器向前冲锋。这是一个戏剧性的、大规模的战斗场景，灵感来自中国古代的战争史诗。远处的雪山上空，天空乌云密布。整体氛围是“可爱”与“霸气”的搞笑和史诗般的融合。",
    "audio_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250923/hbiayh/%E4%BB%8E%E5%86%9B%E8%A1%8C.mp3",
    "resolution": "720P",
    "aspect_ratio": "16:9",
    "duration": 10
}'
```

响应是一个 JSON 对象，包含生成视频的 URL：

```json theme={null}
{
    "model": "wan2.7-t2v",
    "task_id": "da83f740-b46b-40c9-bae3-5e92eaaeffbe",
    "task_status": "succeed",
    "video_result": [
        {
            "id": "5e395454-749b-4520-8da5-f778d3e589fb",
            "url": "https://static.geekai.co/video/2026/04/10/b8953f0104c94770acf4563779207106.mp4"
        }
    ]
}
```

下面图生视频等生成响应结构是一样的，不再列举。

### 图生视频

**基于首帧**

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model":"wan2.7-i2v",
    "prompt": "一幅都市奇幻艺术的场景。一个充满动感的涂鸦艺术角色。一个由喷漆所画成的少年，正从一面混凝土墙上活过来。他一边用极快的语速演唱一首英文rap，一边摆着一个经典的、充满活力的说唱歌手姿势。场景设定在夜晚一个充满都市感的铁路桥下。灯光来自一盏孤零零的街灯，营造出电影般的氛围，充满高能量和惊人的细节。视频的音频部分完全由rap构成，没有其他对话或杂音。",
    "image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png",
    "audio_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3",
    "resolution": "720P"
}'
```

**基于首尾帧**

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model":"wan2.7-i2v",
    "prompt": "写实风格,一只小黑猫好奇地仰望天空,镜头从平视角度逐渐升高,最后以俯视角度捕捉到它好奇的眼神。",
    "image": "https://wanx.alicdn.com/material/20250318/first_frame.png",
    "image_tail": "https://wanx.alicdn.com/material/20250318/last_frame.png",
    "resolution": "720P"
}'
```

**视频续写**

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model":"wan2.7-i2v",
    "prompt": "一个女孩对镜自拍，自拍结束后背着书包出门",
    "video": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/hfugmr/wan-r2v-role1.mp4",
    "resolution": "720P",
    "duration": 10
}'
```

<Note> wan2.7-i2v 的`resolution`可选值：720P、1080P </Note>

### 参考生视频

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model":"wan2.7-r2v",
    "prompt": "视频2抱着图3在咖啡厅里弹奏一支舒缓的美式乡村民谣，视频1笑着看着视频2",
    "resolution": "720P",
    "duration": 10,
    "extra_body": {
        "media": [
            {
                "type": "reference_video",
                "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/hfugmr/wan-r2v-role1.mp4"
            },
            {
                "type": "reference_video",
                "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qigswt/wan-r2v-role2.mp4"
            },
            {
                "type": "reference_image",
                "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qpzxps/wan-r2v-object4.png"
            }
        ]
    }
}'
```

### 视频编辑

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model":"wan2.7-videoedit",
    "prompt": "将视频中女孩的衣服替换为图片中的衣服",
    "resolution": "720P",
    "extra_body": {
        "media": [
            {
                "type": "video",
                "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260403/nlspwm/T2VA_22.mp4"
            },
            {
                "type": "reference_image",
                "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260402/fwjpqf/wan2.7-videoedit-change-clothes.png"
            }
        ]
    }
}'
```

### 异步任务

由于视频生成通常比较耗时，建议通过极客智坊提供的通用异步方式生成视频。

[视频 API](https://docs.geekai.co/cn/api/video/generations) 中的 `async` 参数用于控制是否异步生成视频，默认为 `false`，表示创建视频接口会同步等待视频生成完毕并返回。如果设置为 `true`，则会异步生成视频并返回任务ID，你可以使用该任务ID轮询视频生成状态。

具体操作请参考[Sora-2示例](https://docs.geekai.co/cn/docs/video/openai/sora-2#异步任务)，流程完全一样。
