# Alibaba Wan Image Generation

## 1.Overview

A text-to-image/image-to-image model launched by Alibaba.

**Model List:**

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

## 2. Request Description

* **Request Method**:`POST`
* **Request URL**:

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

***

## 3. Request Parameters

### 3.1 Header Parameters

### 3.1 Header Parameters

| Parameter Name  | Type   | Required | Description                                                         | Example                |
| --------------- | ------ | -------- | ------------------------------------------------------------------- | ---------------------- |
| `Content-Type`  | string | Yes      | Set the request header type, must be `application/json`             | `application/json`     |
| `Accept`        | string | Yes      | Set the response type, recommended to use `application/json`        | `application/json`     |
| `Authorization` | string | Yes      | API\_KEY required for authentication, format `Bearer $YOUR_API_KEY` | `Bearer $YOUR_API_KEY` |

### 3.2 Body Parameters (application/json)

| Parameter Name              | Type    | Required | Description                                                                                                                                                                                                                                                                                        | Example (Default)                                                                       |
| --------------------------- | ------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| **model**                   | string  | Yes      | The model ID to use. See the available versions listed above, e.g. `wan2.7-image-pro`.                                                                                                                                                                                                             | `wan2.7-image-pro`                                                                      |
| input.messages\[0].role     | string  | Yes      | The role of the message. This parameter must be set to user                                                                                                                                                                                                                                        | `user`                                                                                  |
| input.messages\[0].text     | string  | Yes      | Positive prompt describing the desired image content, style, and composition. Supports both Chinese and English, with a maximum length of 2100 characters. Each Chinese character, letter, number, or symbol counts as one character. Content exceeding the limit will be automatically truncated. | `A sitting orange cat with a happy expression, lively and cute, realistic and accurate` |
| parameters.negative\_prompt | string  | No       | Negative prompt describing content you do not want to appear in the image, used to constrain the output. Supports both Chinese and English, with a maximum length of 500 characters. Content exceeding the limit will be automatically truncated.                                                  |                                                                                         |
| parameters.size             | string  | No       | Output image resolution, in the format width\*height                                                                                                                                                                                                                                               | `1280*1280`                                                                             |
| parameters.n                | integer | No       | Number of images to generate. Value range: 1\~4.                                                                                                                                                                                                                                                   | `4`                                                                                     |
| parameters.prompt\_extend   | bool    | No       | Whether to enable intelligent prompt rewriting. When enabled, a large model will optimize the positive prompt, significantly improving results for shorter prompts, but adding 3-4 seconds of processing time.                                                                                     | `true`                                                                                  |
| parameters.watermark        | bool    | No       | Whether to add a watermark. The watermark is located in the bottom-right corner of the image, with fixed text "AI Generated".                                                                                                                                                                      | `false`                                                                                 |
| parameters.seed             | integer | No       | Random seed, value range \[0, 2147483647].                                                                                                                                                                                                                                                         |                                                                                         |

## 4.Request Examples

{% tabs %}
{% tab title="Text to Image" %}

```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": "A flower shop with exquisite windows, a beautiful wooden door, displaying flowers"}
                ]
            }
        ]
    },
    "parameters": {
        "size": "2K",
        "n": 1,
        "watermark": false,
        "thinking_mode": true
    }
}'
```

{% endtab %}

{% tab title="Image Editing" %}

```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": "Spray the graffiti from image 2 onto the car in image 1"}
                ]
            }
        ]
    },
    "parameters": {
        "size": "2K",
        "n": 1,
        "watermark": false
    }
}'
```

{% endtab %}

{% tab title="Interactive Editing" %}

```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": "Place the alarm clock from image 1 at the selected position in image 2, keeping the scene and lighting naturally blended"}
                ]
            }
        ]
    },
    "parameters": {
        "bbox_list": [[],[[989, 515, 1138, 681]]],
        "size": "2K",
        "n": 1,
        "watermark": false
    }
}'
```

{% endtab %}

{% tab title="Multi-Image Generation" %}

```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": "A cinematic photo series documenting the same stray orange cat, with consistent features throughout. First image: Spring, the orange cat walks under blooming cherry blossom trees; Second image: Summer, the orange cat rests in the shade of trees on an old street; Third image: Autumn, the orange cat steps on golden fallen leaves covering the ground; Fourth image: Winter, the orange cat walks in the snow leaving footprints."}
                ]
            }
        ]
    },
    "parameters": {
        "enable_sequential": true,
        "n": 4,
        "size": "2K"
    }
}'
```

{% endtab %}
{% endtabs %}

## 5.Response Example

```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
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.console.zenlayer.com/api/compute/aig/image-generation/alibaba-wan-image-generation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
