> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/api-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/api-reference/cn/compute/aig/image-generation/alibaba-wan-image-generation.md).

# 阿里巴巴 万象

## 1.概述

阿里巴巴推出的文生图/图生图模型。

**模型列表：**

* `wan2.7-image`
* `wan2.7-image-pro`

## 2. 请求说明

* **请求方法**:`POST`
* **请求地址**:

  > `https://gateway.theturbo.ai/v1/services/aigc/multimodal-generation/generation`

***

## 3. 请求参数

### 3.1 Header 参数

### 3.1 Header 参数

| 参数名称            | 类型     | 必填 | 说明                                        | 示例值                    |
| --------------- | ------ | -- | ----------------------------------------- | ---------------------- |
| `Content-Type`  | string | 是  | 设置请求头类型，必须为`application/json`             | `application/json`     |
| `Accept`        | string | 是  | 设置响应类型，建议统一为`application/json`            | `application/json`     |
| `Authorization` | string | 是  | 身份验证所需的 API\_KEY，格式`Bearer $YOUR_API_KEY` | `Bearer $YOUR_API_KEY` |

### 3.2 Body 参数 (application/json)

| 参数名称                        | 类型      | 必填 | 说明                                                                          | 示例（默认值）                     |
| --------------------------- | ------- | -- | --------------------------------------------------------------------------- | --------------------------- |
| **model**                   | string  | 是  | 要使用的模型 ID。详见列出的可用版本，如 `wan2.7-image-pro`。                                   | `wan2.7-image-pro`          |
| input.messages\[0].role     | string  | 是  | 消息的角色。此参数必须设置为user                                                          | `user`                      |
| input.messages\[0].text     | string  | 是  | 正向提示词，用于描述期望生成的图像内容、风格和构图。支持中英文，长度不超过2100个字符，每个汉字、字母、数字或符号计为一个字符，超过部分会自动截断。 | `一只坐着的橘黄色的猫，表情愉悦，活泼可爱，逼真准确` |
| parameters.negative\_prompt | string  | 否  | 反向提示词，用于描述不希望在图像中出现的内容，对画面进行限制.支持中英文，长度不超过500个字符，超出部分将自动截断。                 |                             |
| parameters.size             | string  | 否  | 输出图像的分辨率，格式为宽\*高                                                            | `1280*1280`                 |
| parameters.n                | integer | 否  | 生成图片的数量。取值范围为1\~4张。                                                         | `4`                         |
| parameters.prompt\_extend   | bool    | 否  | 是否开启提示词智能改写。开启后，将使用大模型优化正向提示词，对较短的提示词有明显提升效果，但增加3-4秒耗时。                     | `true`                      |
| parameters.watermark        | bool    | 否  | 是否添加水印标识，水印位于图片右下角，文案固定为"AI生成"。                                             | `false`                     |
| parameters.seed             | integer | 否  | 随机数种子，取值范围\[0,2147483647]。                                                  |                             |

## 4.请求示例

{% tabs %}
{% tab title="文生图" %}

```sh
curl https://gateway.theturbo.ai/v1/services/aigc/multimodal-generation/generation \
	-H "Content-Type: application/json" \
	-H "Accept: application/json" \
	-H "Authorization: Bearer $YOUR_API_KEY" \
	-d '{
    "model": "wan2.7-image-pro",
    "input": {
        "messages": [
            {
                "role": "user",
                "content": [
                    {"text": "一间有着精致窗户的花店，漂亮的木质门，摆放着花朵"}
                ]
            }
        ]
    },
    "parameters": {
        "size": "2K",
        "n": 1,
        "watermark": false,
        "thinking_mode": true
    }
}'
```

{% endtab %}

{% tab title="图像编辑" %}

```sh
curl https://gateway.theturbo.ai/v1/services/aigc/multimodal-generation/generation \
	-H "Content-Type: application/json" \
	-H "Accept: application/json" \
	-H "Authorization: Bearer $YOUR_API_KEY" \
	-d '{
    "model": "wan2.7-image-pro",
    "input": {
        "messages": [
            {
                "role": "user",
                "content": [
                    {"image": "https://image.***/car.webp"},
                    {"image": "https://image.***/paint.webp"},
                    {"text": "把图2的涂鸦喷绘在图1的汽车上"}
                ]
            }
        ]
    },
    "parameters": {
        "size": "2K",
        "n": 1,
        "watermark": false
    }
}'
```

{% endtab %}

{% tab title="交互式编辑" %}

```sh
curl https://gateway.theturbo.ai/v1/services/aigc/multimodal-generation/generation \
	-H "Content-Type: application/json" \
	-H "Accept: application/json" \
	-H "Authorization: Bearer $YOUR_API_KEY" \
	-d '{
    "model": "wan2.7-image-pro",
    "input": {
        "messages": [
            {
                "role": "user",
                "content": [
                    {"image": "https://img.***.webp"},
                    {"image": "https://img.***.webp"},
                    {"text": "把图1的闹钟放在图2的框选的位置，保持场景和光线融合自然"}
                ]
            }
        ]
    },
    "parameters": {
        "bbox_list": [[],[[989, 515, 1138, 681]]],
        "size": "2K",
        "n": 1,
        "watermark": false
    }
}'
```

{% endtab %}

{% tab title="组图生成" %}

```sh
curl https://gateway.theturbo.ai/v1/services/aigc/multimodal-generation/generation \
	-H "Content-Type: application/json" \
	-H "Accept: application/json" \
	-H "Authorization: Bearer $YOUR_API_KEY" \
	-d '{
    "model": "wan2.7-image-pro",
    "input": {
        "messages": [
            {
                "role": "user",
                "content": [
                    {"text": "电影感组图，记录同一只流浪橘猫，特征必须前后一致。第一张：春天，橘猫穿梭在盛开的樱花树下；第二张：夏天，橘猫在老街的树荫下乘凉避暑；第三张：秋天，橘猫踩在满地的金色落叶上；第四张：冬天，橘猫在雪地上走留下足迹。"}
                ]
            }
        ]
    },
    "parameters": {
        "enable_sequential": true,
        "n": 4,
        "size": "2K"
    }
}'
```

{% endtab %}
{% endtabs %}

## 5.响应示例

```json
{
  "request_id": "71400058-94be-9abc-8673-9969cf8fdf41",
  "output": {
    "choices": [
      {
        "finish_reason": "stop",
        "message": {
          "content": [
            {
              "image": "https://*****/d61e4293900c_0.png?Expires=1775877761&OSSAccessKeyId=LTAI5tPxpiCM2hjmWrFXrym1&Signature=oelW64P1zG1ZLjNMqAPOxedxu5k%3D",
              "type": "image"
            },
            {
              "image": "https://***/d61e4293900c_1.png?Expires=1775877761&OSSAccessKeyId=LTAI5tPxpiCM2hjmWrFXrym1&Signature=xpqFenmsjk3s5AaUqpN47gSuZ3o%3D",
              "type": "image"
            }
          ],
          "role": "assistant"
        }
      }
    ],
    "finished": true
  },
  "usage": {
    "image_count": 2,
    "input_tokens": 720,
    "output_tokens": 5,
    "size": "2048*2048",
    "total_tokens": 725
  }
}
```
