> ## 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.6 image图像生成模型支持图像编辑、图文混排输出, 满足多样化生成与集成需求。通义万相-通用图像编辑wan2.5模型仅需文本指令，即可基于单张或多张参考图像，实现主体一致的图像编辑、多图融合等能力。

### 模型参数

* 模型ID：`wan2.6-image`/`wan2.5-i2i-preview`
* 模型价格：你可以在[模型广场](https://geekai.co/models?platform=dashscope\&type=image)查看最新价格信息
* 调用入口：`https://geekai.co/api/v1/images/generations`
* 模型参数：参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations)
* API认证：[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start)

<Note>
  不支持画图 API 中的以下参数：

  * `strength`
  * `aspect_ratio`
  * `quality`
  * `style_preset`
  * `response_format`
  * `output_format`
  * `mask`
  * `background`

  附：[通义万相-图像生成与编辑2.6  官方 API 文档](https://help.aliyun.com/zh/model-studio/wan-image-generation-api-reference)
</Note>

wan2.6-image 可以通过 `size` 字段实现输出图像的分辨率，格式为宽x高:

常见推荐的分辨率及其对应的图像宽高比例为：

| 宽高比  | 像素值                  |
| ---- | -------------------- |
| 1:1  | 1280x1280 或 1024x024 |
| 2:3  | 800x1200             |
| 3:2  | 1200x800             |
| 4:3  | 1280x960             |
| 3:4  | 960x1280             |
| 16:9 | 1280x720             |
| 9:16 | 720x1280             |
| 21:9 | 1344x576             |

总像素在 `[768x768, 1280x1280]`之间，且宽高比范围为 `[1:4, 4:1]`

输入图像数量限制:

* wan2.6-image 输入图像的URL或Base64编码字符串:

  * 当`enable_interleave=true`时（图文混排输出）, 可输入0-1张图像
  * 当`enable_interleave=false`时（图像编辑模式）, 必须输入1-4张图像

通过`enable_interleave`来控制生图模式：

* false: 默认值， 表示图像编辑模式（支持多图输入及主体一致性生成）

  * 用途: 基于1-4张输入图像进行编辑、风格迁移或主体一致性生成
  * 输入: 必须提供至少1张参考图像
  * 输出: 可生成1至4张结果图像

* true ：表示启用图文混排输出模式（仅支持传入一张图像或不传图像）

  * 用途：根据文本描述生成图文并茂的内容，或进行纯文本生成图像（文生图）
  * 输入: 可以不提供图像（文生图）,或提供最多1张参考图像
  * 输出: 固定生成1个包含文本和图像的混合内容块

通过`n`来指定生成图片的数量。该参数的取值范围与含义取决于 `enable_interleave` 的状态：

* `enable_interleave=false`（图像编辑模式）:

  * 用途: 直接控制生成图像的数量
  * 取值范围:1-4

* `enable_interleave=true`（图文混排模式）:

  * 限制: 此参数默认为1,且必须固定为1。若设置为其他值,接口将报错
  * 说明：在此模式下，实际生成数量由模型推理决定。如需控制生成图像的数量上限，请使用 max\_images 参数

通过`max_images`代表数量上限, 取值范围为1-5。实际生成的图像数量由模型推理决定,由模型来生成, 可能会少于设定值。例如: 设置为 5,模型可能根据内容仅生成 3 张，非随机而是内容驱动，不能具体指定数量了。

wan2.5-i2i-preview 可以通过 `size` 字段实现输出图像的分辨率，格式为宽x高:

推荐分辨率及对应宽高比:

| 宽高比  | 像素值       |
| ---- | --------- |
| 1:1  | 1280x1280 |
| 1:1  | 1024x1024 |
| 2:3  | 800x1200  |
| 3:2  | 1200x800  |
| 4:3  | 1280x960  |
| 3:4  | 960x1280  |
| 16:9 | 1280x720  |
| 9:16 | 720x1280  |
| 21:9 | 1344x576  |

总像素在 `[768x768, 1280x1280]` 之间，且宽高比范围为 `[1:4, 4:1]`

输入图像数量限制: wan2.5-i2i-preview模型最多支持输入3张图片

通过`n`来指定生成图片的数量, 该参数的取值范围1-4张

### wan2.6-image

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model": "wan2.6-image",
    "prompt": "参考图1的风格和图2的背景，生成番茄炒蛋",
    "image": ["https://cdn.wanx.aliyuncs.com/tmp/pressure/umbrella1.png","https://img.alicdn.com/imgextra/i3/O1CN01SfG4J41UYn9WNt4X1_!!6000000002530-49-tps-1696-960.webp"],
    "negative_prompt": "低质量",
    "size": "1280x1280"
}'
```

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

```json theme={null}
{
    "model": "wan2.6-image",
    "created": 1767774573,
    "task_id": "46b38e93-9be0-451f-91f4-3db020dd3bcb",
    "task_status": "succeed",
    "data": [
        {
            "url": "https://static.geekai.co/image/2026/01/07/8fee7dbc22368ada8a77ed4c67a73a51.png"
        }
    ],
    "usage": {
        "billed_units": 1
    }
}
```

当启用图文混排输出模式 enable\_interleave为true的时候：

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model": "wan2.6-image",
    "prompt": "生成狗狗趴在草地上的近景画面",
    "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imageToimage.png",
    "negative_prompt": "低质量",
    "size": "960x1280",
    "n": 1,
    "extra_body": {
        "enable_interleave": true,
        "max_images": 4
    }
}'
```

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

```json theme={null}
{
    "model": "wan2.6-image",
    "created": 1767775609,
    "task_id": "7014d7ce-5b9a-44e0-8ef3-51d09e01dbf6",
    "task_status": "succeed",
    "data": [
        {
            "url": "https://static.geekai.co/image/2026/01/07/16d7161ced1a067dce8f4a3a65185f11.png"
        },
        {
            "url": "https://static.geekai.co/image/2026/01/07/0fb6b10bf130d59e6b89f2254912dae1.png"
        },
        {
            "url": "https://static.geekai.co/image/2026/01/07/167939c7a8593a3ae903a0f28ea9ca61.png"
        }
    ],
    "usage": {
        "billed_units": 3
    }
}
```

### wan2.5-i2i-preview

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model": "wan2.5-i2i-preview",
    "prompt": "根据这张小猫图片，生成一张和毛线球玩耍的图片",
    "image": "https://static.geekai.co/image/2025/12/29/398b72b457492fbe36c9ac6efc69121b.jpeg",
    "negative_prompt": "低质量",
    "size": "1280x1280",
    "watermark": false,
    "n": 2
}'
```

响应是一个 JSON 列表，包含生成图片的 URL：

```json theme={null}
{
    "model": "wan2.5-i2i-preview",
    "created": 1767844458,
    "task_id": "def5729d-756d-4f43-8e3c-d18611e9f85d",
    "task_status": "succeed",
    "data": [
        {
            "url": "https://static.geekai.co/image/2026/01/08/e882ee78e340213091c2587ed46aa7bd.png"
        },
        {
            "url": "https://static.geekai.co/image/2026/01/08/da2210a94d64b523408bfe67d4aa2568.png"
        }
    ],
    "usage": {
        "billed_units": 2
    }
}
```
