QwenCloudBRASIL
Tradução de apoio para consulta. Código e identificadores técnicos preservados. Consultar referência original ↗

Qwen

Edite imagens via texto

Obtenha uma chave de API e defini-lo como uma variável de ambiente. Se estiver usando o SDK, instale-o.

Baixe a imagem do resultado

O URL da imagem na resposta é válido por 24 horas. Baixe-o imediatamente após a tarefa ser bem-sucedida.

# You need to install requests to download the image: pip install requests
import requests

def download_image(image_url, save_path='output.png'):
    try:
        response = requests.get(image_url, stream=True, timeout=300)  # Set a timeout.
        response.raise_for_status()  # Raise an exception if the HTTP status code is not 200.
        with open(save_path, 'wb') as f:
            for chunk in response.iter_content(chunk_size=8192):
                f.write(chunk)
        print(f"Image successfully downloaded to: {save_path}")

    except requests.exceptions.RequestException as e:
        print(f"Image download failed: {e}")

image_url = "https://dashscope-result-sz.oss-cn-shenzhen.aliyuncs.com/xxx.png?Expires=xxx"
download_image(image_url, save_path='output.png')
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

public class ImageDownloader {
    public static void downloadImage(String imageUrl, String savePath) {
        try {
            URL url = new URL(imageUrl);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setConnectTimeout(5000);
            connection.setReadTimeout(300000);
            connection.setRequestMethod("GET");
            InputStream inputStream = connection.getInputStream();
            FileOutputStream outputStream = new FileOutputStream(savePath);
            byte[] buffer = new byte[8192];
            int bytesRead;
            while ((bytesRead = inputStream.read(buffer)) != -1) {
                outputStream.write(buffer, 0, bytesRead);
            }
            inputStream.close();
            outputStream.close();

            System.out.println("Image downloaded successfully to: " + savePath);
        } catch (Exception e) {
            System.err.println("Image download failed: " + e.getMessage());
        }
    }

    public static void main(String[] args) {
        String imageUrl = "http://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxx?Expires=xxx";
        String savePath = "output.png";
        downloadImage(imageUrl, savePath);
    }
}

OpenAPI

openapi: 3.1.0
info:
  title: qwen-image-3.0 Editing API
  description: qwen-image-3.0 editing API. Supports single-image editing, multi-image fusion, style transfer, text editing, element manipulation, and more.
  version: 1.0.0
servers:
  - url: https://maas.qwencloudapi.com/api/v1
    description: Singapore
security:
  - BearerAuth: []
paths:
  /services/aigc/multimodal-generation/generation:
    post:
      operationId: createQwenImageEdit
      summary: Edit images with qwen-image-3.0
      description: |-
        Edit images using qwen-image-3.0 models. Supports single-image editing, multi-image fusion (up to 3 input images), style transfer, text editing, element manipulation, pose transfer, and detail enhancement.

        For text-to-image generation (no input images), see [qwen-image-3.0 text-to-image](/api-reference/image-generation/qwen-text-to-image).

        ## Model overview

        | Model | Description | Output |
        |-------|-------------|--------|
        | qwen-image-3.0-pro (Recommended) | 3.0 series. Supports long-text input and complex layout generation, 10-pixel fine-grained text rendering, 12 languages, and 20+ fonts. Also supports [text-to-image](/api-reference/image-generation/qwen-text-to-image). | Width and height: 512–2048 pixels each. Default: model auto-recommends a resolution based on the prompt. PNG. 1-6 images. |
        | qwen-image-3.0 (Recommended) | 3.0 series standard model. Balances quality and speed. Also supports [text-to-image](/api-reference/image-generation/qwen-text-to-image). | Width and height: 512–2048 pixels each. Default: model auto-recommends a resolution based on the prompt. PNG. 1-6 images. |
        | qwen-image-2.0-pro | Pro series. Enhanced text rendering, realism, and semantic adherence. Also supports [text-to-image](/api-reference/image-generation/qwen-text-to-image). | Width and height: 512–2048 pixels each. Default: matches the input image. PNG. 1-6 images. |
        | qwen-image-2.0 | Accelerated version. Balances quality and speed. Also supports [text-to-image](/api-reference/image-generation/qwen-text-to-image). | Width and height: 512–2048 pixels each. Default: matches the input image. PNG. 1-6 images. |

        ## Notes

        - Generated image URLs are valid for **24 hours**. Download images promptly.
        - Only single-turn conversations are supported. The `messages` array must contain exactly one message.
        - You can provide 1 to 3 input images per request.
        - For multi-image input, images are referenced by position (Image 1, Image 2, Image 3). The output aspect ratio is determined by the last image.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/QwenImageEditRequest"
      responses:
        "200":
          description: Image edited successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/QwenImageEditResponse"
        "400":
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DashScopeErrorResponse"
      x-codeSamples:
        - lang: curl
          label: cURL (single image)
          source: |-
            curl --location 'https://maas.qwencloudapi.com/api/v1/services/aigc/multimodal-generation/generation' \
            --header 'Content-Type: application/json' \
            --header "Authorization: Bearer $DASHSCOPE_API_KEY" \
            --data '{
              "model": "qwen-image-3.0-pro",
              "input": {
                "messages": [
                  {
                    "role": "user",
                    "content": [
                      {
                        "image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/fpakfo/image36.webp"
                      },
                      {
                        "text": "Generate an image that matches the depth map, following this description: A dilapidated red bicycle is parked on a muddy path with a dense primeval forest in the background."
                      }
                    ]
                  }
                ]
              },
              "parameters": {
                "n": 2,
                "negative_prompt": " ",
                "prompt_extend": true,
                "watermark": false,
                "size": "1536*1024"
              }
            }'
        - lang: curl
          label: cURL (multi-image fusion)
          source: |-
            curl --location 'https://maas.qwencloudapi.com/api/v1/services/aigc/multimodal-generation/generation' \
            --header 'Content-Type: application/json' \
            --header "Authorization: Bearer $DASHSCOPE_API_KEY" \
            --data '{
              "model": "qwen-image-3.0-pro",
              "input": {
                "messages": [
                  {
                    "role": "user",
                    "content": [
                      {
                        "image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/thtclx/input1.png"
                      },
                      {
                        "image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/iclsnx/input2.png"
                      },
                      {
                        "image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/gborgw/input3.png"
                      },
                      {
                        "text": "Make the girl from Image 1 wear the black dress from Image 2 and sit in the pose from Image 3."
                      }
                    ]
                  }
                ]
              },
              "parameters": {
                "n": 2,
                "negative_prompt": " ",
                "prompt_extend": true,
                "watermark": false,
                "size": "1024*1536"
              }
            }'
        - lang: python
          label: Python (DashScope SDK)
          source: |-
            import os
            import dashscope
            from dashscope import MultiModalConversation

            dashscope.base_http_api_url = 'https://maas.qwencloudapi.com/api/v1'

            # The model supports 1 to 3 input images
            messages = [
              {
                "role": "user",
                "content": [
                  {"image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/thtclx/input1.png"},
                  {"image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/iclsnx/input2.png"},
                  {"image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/gborgw/input3.png"},
                  {"text": "Make the girl from Image 1 wear the black dress from Image 2 and sit in the pose from Image 3."}
                ]
              }
            ]

            api_key = os.getenv("DASHSCOPE_API_KEY")

            response = MultiModalConversation.call(
              api_key=api_key,
              model="qwen-image-3.0-pro",
              messages=messages,
              stream=False,
              n=2,
              watermark=False,
              negative_prompt=" ",
              prompt_extend=True,
              size="1024*1536",
            )

            if response.status_code == 200:
              for i, content in enumerate(response.output.choices[0].message.content):
                print(f"URL of output image {i+1}: {content['image']}")
            else:
              print(f"HTTP status code: {response.status_code}")
              print(f"Error code: {response.code}")
              print(f"Error message: {response.message}")
        - lang: java
          label: Java (DashScope SDK)
          source: |-
            import com.alibaba.dashscope.aigc.multimodalconversation.MultiModalConversation;
            import com.alibaba.dashscope.aigc.multimodalconversation.MultiModalConversationParam;
            import com.alibaba.dashscope.aigc.multimodalconversation.MultiModalConversationResult;
            import com.alibaba.dashscope.common.MultiModalMessage;
            import com.alibaba.dashscope.common.Role;
            import com.alibaba.dashscope.utils.Constants;

            import java.util.*;

            public class QwenImageEdit {
              static {
                    Constants.baseHttpApiUrl = "https://maas.qwencloudapi.com/api/v1";
              }

              static String apiKey = System.getenv("DASHSCOPE_API_KEY");

              public static void main(String[] args) throws Exception {
                MultiModalConversation conv = new MultiModalConversation();

                // The model supports 1 to 3 input images
                MultiModalMessage userMessage = MultiModalMessage.builder()
                  .role(Role.USER.getValue())
                  .content(Arrays.asList(
                    Collections.singletonMap("image", "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/thtclx/input1.png"),
                    Collections.singletonMap("image", "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/iclsnx/input2.png"),
                    Collections.singletonMap("image", "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/gborgw/input3.png"),
                    Collections.singletonMap("text", "Make the girl from Image 1 wear the black dress from Image 2 and sit in the pose from Image 3.")
                  )).build();

                Map<String, Object> parameters = new HashMap<>();
                parameters.put("watermark", false);
                parameters.put("negative_prompt", " ");
                parameters.put("n", 2);
                parameters.put("prompt_extend", true);
                parameters.put("size", "1024*1536");

                MultiModalConversationParam param = MultiModalConversationParam.builder()
                  .apiKey(apiKey)
                  .model("qwen-image-3.0-pro")
                  .messages(Collections.singletonList(userMessage))
                  .parameters(parameters)
                  .build();

                MultiModalConversationResult result = conv.call(param);
                List<Map<String, Object>> contentList = result.getOutput().getChoices().get(0).getMessage().getContent();
                int imageIndex = 1;
                for (Map<String, Object> content : contentList) {
                  if (content.containsKey("image")) {
                    System.out.println("URL of output image " + imageIndex + ": " + content.get("image"));
                    imageIndex++;
                  }
                }
              }
            }
        - lang: python
          label: Python (Base64 input)
          source: |-
            import os
            import dashscope
            from dashscope import MultiModalConversation
            import base64
            import mimetypes

            dashscope.base_http_api_url = 'https://maas.qwencloudapi.com/api/v1'

            # --- For Base64 encoding ---
            # Format: data:{mime_type};base64,{base64_data}
            def encode_file(file_path):
              mime_type, _ = mimetypes.guess_type(file_path)
              if not mime_type or not mime_type.startswith("image/"):
                raise ValueError("Unsupported or unrecognized image format")

              try:
                with open(file_path, "rb") as image_file:
                  encoded_string = base64.b64encode(
                    image_file.read()).decode('utf-8')
                return f"data:{mime_type};base64,{encoded_string}"
              except IOError as e:
                raise IOError(f"Error reading file: {file_path}, Error: {str(e)}")

            # Get the Base64 encoding of the image.
            # Replace "/path/to/your/image.png" with the path to your local image file.
            image = encode_file("/path/to/your/image.png")

            messages = [
              {
                "role": "user",
                "content": [
                  {"image": image},
                  {"text": "Generate an image that matches the depth map, following this description: A dilapidated red bicycle is parked on a muddy path with a dense primeval forest in the background."}
                ]
              }
            ]

            api_key = os.getenv("DASHSCOPE_API_KEY")

            response = MultiModalConversation.call(
              api_key=api_key,
              model="qwen-image-3.0-pro",
              messages=messages,
              stream=False,
              n=2,
              watermark=False,
              negative_prompt=" ",
              prompt_extend=True,
              size="1536*1024",
            )

            if response.status_code == 200:
              for i, content in enumerate(response.output.choices[0].message.content):
                print(f"URL of output image {i+1}: {content['image']}")
            else:
              print(f"HTTP status code: {response.status_code}")
              print(f"Error code: {response.code}")
              print(f"Error message: {response.message}")
        - lang: java
          label: Java (Base64 input)
          source: |-
            import com.alibaba.dashscope.aigc.multimodalconversation.MultiModalConversation;
            import com.alibaba.dashscope.aigc.multimodalconversation.MultiModalConversationParam;
            import com.alibaba.dashscope.aigc.multimodalconversation.MultiModalConversationResult;
            import com.alibaba.dashscope.common.MultiModalMessage;
            import com.alibaba.dashscope.common.Role;
            import com.alibaba.dashscope.exception.ApiException;
            import com.alibaba.dashscope.exception.NoApiKeyException;
            import com.alibaba.dashscope.exception.UploadFileException;
            import com.alibaba.dashscope.utils.Constants;

            import java.io.IOException;
            import java.nio.file.Files;
            import java.nio.file.Path;
            import java.nio.file.Paths;
            import java.util.Arrays;
            import java.util.Base64;
            import java.util.Collections;
            import java.util.HashMap;
            import java.util.Map;
            import java.util.List;

            public class QwenImageEditBase64 {

              static {
                    Constants.baseHttpApiUrl = "https://maas.qwencloudapi.com/api/v1";
              }

              static String apiKey = System.getenv("DASHSCOPE_API_KEY");

              public static void call() throws ApiException, NoApiKeyException, UploadFileException, IOException {

                // Replace "/path/to/your/image.png" with the path to your local image file.
                String image = encodeFile("/path/to/your/image.png");

                MultiModalConversation conv = new MultiModalConversation();

                MultiModalMessage userMessage = MultiModalMessage.builder().role(Role.USER.getValue())
                    .content(Arrays.asList(
                        Collections.singletonMap("image", image),
                        Collections.singletonMap("text", "Generate an image that matches the depth map, following this description: A dilapidated red bicycle is parked on a muddy path with a dense primeval forest in the background.")
                    )).build();

                Map<String, Object> parameters = new HashMap<>();
                parameters.put("watermark", false);
                parameters.put("negative_prompt", " ");
                parameters.put("n", 2);
                parameters.put("prompt_extend", true);
                parameters.put("size", "1536*1024");

                MultiModalConversationParam param = MultiModalConversationParam.builder()
                    .apiKey(apiKey)
                    .model("qwen-image-3.0-pro")
                    .messages(Collections.singletonList(userMessage))
                    .parameters(parameters)
                    .build();

                MultiModalConversationResult result = conv.call(param);
                List<Map<String, Object>> contentList = result.getOutput().getChoices().get(0).getMessage().getContent();
                int imageIndex = 1;
                for (Map<String, Object> content : contentList) {
                  if (content.containsKey("image")) {
                    System.out.println("URL of output image " + imageIndex + ": " + content.get("image"));
                    imageIndex++;
                  }
                }
              }

              /**
                 * Encodes a file into a Base64 string.
                 * @param filePath The file path.
                 * @return A Base64 string in the format: data:{mime_type};base64,{base64_data}
                 */
              public static String encodeFile(String filePath) {
                Path path = Paths.get(filePath);
                if (!Files.exists(path)) {
                  throw new IllegalArgumentException("File does not exist: " + filePath);
                }
                String mimeType = null;
                try {
                  mimeType = Files.probeContentType(path);
                } catch (IOException e) {
                  throw new IllegalArgumentException("Unable to detect file type: " + filePath);
                }
                if (mimeType == null || !mimeType.startsWith("image/")) {
                  throw new IllegalArgumentException("Unsupported or unrecognized image format");
                }
                byte[] fileBytes = null;
                try {
                  fileBytes = Files.readAllBytes(path);
                } catch (IOException e) {
                  throw new IllegalArgumentException("Unable to read file content: " + filePath);
                }

                String encodedString = Base64.getEncoder().encodeToString(fileBytes);
                return "data:" + mimeType + ";base64," + encodedString;
              }

              public static void main(String[] args) {
                try {
                  call();
                } catch (ApiException | NoApiKeyException | UploadFileException | IOException e) {
                  System.out.println(e.getMessage());
                }
              }
            }
        - lang: python
          label: Python (Download image)
          source: |-
            # You need to install requests to download the image: pip install requests
            import requests

            def download_image(image_url, save_path='output.png'):
              try:
                response = requests.get(image_url, stream=True, timeout=300)  # Set a timeout.
                response.raise_for_status()  # Raise an exception if the HTTP status code is not 200.
                with open(save_path, 'wb') as f:
                  for chunk in response.iter_content(chunk_size=8192):
                    f.write(chunk)
                print(f"Image successfully downloaded to: {save_path}")

              except requests.exceptions.RequestException as e:
                print(f"Image download failed: {e}")

            image_url = "https://dashscope-result-sz.oss-cn-shenzhen.aliyuncs.com/xxx.png?Expires=xxx"
            download_image(image_url, save_path='output.png')
        - lang: java
          label: Java (Download image)
          source: |-
            import java.io.FileOutputStream;
            import java.io.InputStream;
            import java.net.HttpURLConnection;
            import java.net.URL;

            public class ImageDownloader {
              public static void downloadImage(String imageUrl, String savePath) {
                try {
                  URL url = new URL(imageUrl);
                  HttpURLConnection connection = (HttpURLConnection) url.openConnection();
                  connection.setConnectTimeout(5000);
                  connection.setReadTimeout(300000);
                  connection.setRequestMethod("GET");
                  InputStream inputStream = connection.getInputStream();
                  FileOutputStream outputStream = new FileOutputStream(savePath);
                  byte[] buffer = new byte[8192];
                  int bytesRead;
                  while ((bytesRead = inputStream.read(buffer)) != -1) {
                    outputStream.write(buffer, 0, bytesRead);
                  }
                  inputStream.close();
                  outputStream.close();

                  System.out.println("Image downloaded successfully to: " + savePath);
                } catch (Exception e) {
                  System.err.println("Image download failed: " + e.getMessage());
                }
              }

              public static void main(String[] args) {
                String imageUrl = "http://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxx?Expires=xxx";
                String savePath = "output.png";
                downloadImage(imageUrl, savePath);
              }
            }
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: DashScope API Key. Create one in the [QwenCloud console](https://home.qwencloud.com/api-keys).
  schemas:
    QwenImageEditRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          description: Model name.
          enum:
            - qwen-image-3.0-pro
            - qwen-image-3.0
            - qwen-image-2.1-pro
            - qwen-image-2.1-turbo
            - qwen-image-2.0-pro
            - qwen-image-2.0-pro-2026-06-22
            - qwen-image-2.0-pro-2026-04-22
            - qwen-image-2.0-pro-2026-03-03
            - qwen-image-2.0
            - qwen-image-2.0-2026-03-03
          example: qwen-image-3.0-pro
        input:
          type: object
          required:
            - messages
          description: Input data containing the messages array.
          properties:
            messages:
              type: array
              description: Single-turn only. Exactly one message with role `user`.
              minItems: 1
              maxItems: 1
              items:
                $ref: "#/components/schemas/QwenImageEditMessage"
        parameters:
          $ref: "#/components/schemas/QwenImageEditParameters"
    QwenImageEditMessage:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - user
          description: Must be `user`.
        content:
          type: array
          description: "Message content array. Must contain image objects and exactly one text object: the qwen-image-2.1 series accepts 1 to 10 image objects, other models accept 1 to 3. For multi-image input, images are referenced by position (Image 1, Image 2, Image 3, and so on). The output aspect ratio is determined by the last image."
          minItems: 2
          maxItems: 11
          items:
            $ref: "#/components/schemas/QwenImageEditContentPart"
    QwenImageEditContentPart:
      type: object
      description: Either an image or text content part.
      properties:
        image:
          type: string
          description: "Input image as a public URL (HTTP/HTTPS) or Base64-encoded string (`data:{mime_type};base64,{data}`). Supported formats: JPG, JPEG, PNG, BMP, TIFF, WEBP, GIF (first frame only). For optimal results, width and height should be between 384 and 3072 pixels. The aspect ratio (longer side to shorter side) must not exceed 10:1. Maximum file size: 10 MB."
          example: https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/fpakfo/image36.webp
        text:
          type: string
          description: Image editing instruction describing elements and visual features you want in the output image. Supports Chinese and English. The recommended maximum for the qwen-image-3.0 series and qwen-image-2.1-pro is 4,500 tokens. The qwen-image-2.0 series accept up to 1,300 tokens. Other models accept up to 800 tokens. The system truncates excess tokens. Only one text input is supported per request.
          example: "Generate an image that matches the depth map, following this description: A dilapidated red bicycle is parked on a muddy path with a dense primeval forest in the background."
    QwenImageEditParameters:
      type: object
      description: Image editing parameters.
      properties:
        n:
          type: integer
          description: "Number of images to generate. All currently supported models in the qwen-image-3.0 series, qwen-image-2.1-pro, and qwen-image-2.0 series support 1-6 images. Default: 1."
          minimum: 1
          maximum: 6
          default: 1
        negative_prompt:
          type: string
          description: Describes content you do NOT want in the image. Supports Chinese and English, max 500 characters. Excess is auto-truncated. qwen-image-2.1-pro does not support this parameter.
          maxLength: 500
        size:
          type: string
          description: |-
            Output resolution as `width*height`.

            - **qwen-image-3.0 series and qwen-image-2.1-pro**: total pixels between 512\*512 and 2048\*2048, aspect ratio between 1:8 and 8:1; when omitted, the model auto-recommends a resolution based on the prompt.
            - **qwen-image-2.0 series**: total pixels between 512\*512 and 2048\*2048. Default: same as the input image (or the last image in a multi-image request).

            Recommended sizes: `1024*1024` (1:1), `768*1152` / `1024*1536` (2:3), `1152*768` / `1536*1024` (3:2), `720*1280` / `1080*1920` (9:16), `1280*720` / `1920*1080` (16:9), `960*1280` / `1080*1440` (3:4), `1280*960` / `1440*1080` (4:3), `1344*576` / `2048*872` (21:9).
          example: 1024*1536
        prompt_extend:
          type: boolean
          description: Enable prompt rewriting. When enabled, the model rewrites the editing instruction, which significantly improves results when prompts lack detail; for the qwen-image-3.0 series and qwen-image-2.1-pro, rewriting follows the mode set by `prompt_extend_mode`.
          default: true
        prompt_extend_mode:
          type: string
          description: |-
            Prompt rewriting mode. Supported by the qwen-image-3.0 series and qwen-image-2.1-pro only.

            - `direct` (default): direct prompt enhancement (DPE). Suitable for most scenarios.
            - `agent`: agent prompt enhancement (APE). Text-to-image only; passing it for image editing returns a 400 error.
          enum:
            - direct
            - agent
          default: direct
        watermark:
          type: boolean
          description: Add a "Qwen-Image" watermark to the bottom-right corner of the image.
          default: false
        enable_thinking:
          type: boolean
          description: "Enable thinking mode. Default: `true`. When enabled, the model enhances reasoning to improve image quality, but increases generation time. Only effective when `prompt_extend=true`. Supported for Direct T2I, Direct I2I, and Agent T2I; I2I Agent is not yet supported."
          default: true
        seed:
          type: integer
          description: "Random number seed. Range: [0, 2147483647]. Same seed produces more consistent (but not identical) results. If omitted, a random seed is used."
          minimum: 0
          maximum: 2147483647
    QwenImageEditResponse:
      type: object
      description: qwen-image-3.0 editing response.
      example:
        output:
          rewrite_status: not_use
          choices:
            - finish_reason: stop
              message:
                content:
                  - image: https://dashscope-result-sz.oss-cn-shenzhen.aliyuncs.com/xxx.png?Expires=xxx
                  - image: https://dashscope-result-sz.oss-cn-shenzhen.aliyuncs.com/xxx.png?Expires=xxx
                role: assistant
        usage:
          output_height: 1024
          output_width: 1536
          input_image_count: 1
          input_image_type: qima_input_1k
          output_image_count: 2
          output_image_type: qima_output_1k
        request_id: bf37ca26-0abe-98e4-8065-xxxxxx
      properties:
        output:
          type: object
          properties:
            rewrite_status:
              type: string
              description: The prompt rewriting status. The value depends on whether rewriting was enabled in the request and the result of the rewrite.
            choices:
              type: array
              description: List of generated results.
              items:
                $ref: "#/components/schemas/QwenImageEditChoice"
        usage:
          type: object
          description: "Usage statistics (successful results only). Fields vary by model series: the qwen-image-3.0 series returns the `output_*` / `input_*` fields; other series return `image_count` / `width` / `height`."
          properties:
            output_width:
              type: integer
              description: Width of the final output image, in pixels. Returned by the qwen-image-3.0 series only.
            output_height:
              type: integer
              description: Height of the final output image, in pixels. Returned by the qwen-image-3.0 series only.
            input_image_count:
              type: integer
              description: Number of input images in the request. 0 for text-to-image; the actual input count for image editing. Returned by the qwen-image-3.0 series only.
            input_image_type:
              type: string
              description: "Input image billing tier, determined by the output resolution pixel area: `qima_input_1k` when the area is 2,250,000 or less, `qima_input_2k` when greater. Returned by the qwen-image-3.0 series only."
            output_image_count:
              type: integer
              description: Number of output images actually returned. Returned by the qwen-image-3.0 series only.
            output_image_type:
              type: string
              description: "Output image billing tier, determined by the output resolution pixel area: `qima_output_1k` when the area is 2,250,000 or less, `qima_output_2k` when greater. Returned by the qwen-image-3.0 series only."
            image_count:
              type: integer
              description: Number of images generated. Not returned by the qwen-image-3.0 series, which uses `output_image_count` instead.
            width:
              type: integer
              description: Width of the generated image, in pixels. Not returned by the qwen-image-3.0 series, which uses `output_width` instead.
            height:
              type: integer
              description: Height of the generated image, in pixels. Not returned by the qwen-image-3.0 series, which uses `output_height` instead.
        request_id:
          type: string
          description: Unique request identifier for tracing and troubleshooting.
          example: bf37ca26-0abe-98e4-8065-xxxxxx
    QwenImageEditChoice:
      type: object
      properties:
        finish_reason:
          type: string
          description: "`stop` means normal completion."
          example: stop
        message:
          type: object
          properties:
            role:
              type: string
              description: Always `assistant`.
              enum:
                - assistant
            content:
              type: array
              description: Response content array containing generated image URLs.
              items:
                $ref: "#/components/schemas/QwenImageEditResponseContentPart"
    QwenImageEditResponseContentPart:
      type: object
      properties:
        image:
          type: string
          description: URL of the generated image (PNG). **Valid for 24 hours.** Download promptly.
    DashScopeErrorResponse:
      type: object
      description: DashScope API error response.
      example:
        request_id: 31f808fd-8eef-9004-xxxxx
        code: InvalidApiKey
        message: Invalid API-key provided.
      properties:
        request_id:
          type: string
          description: Unique request identifier.
        code:
          type: string
          description: Error code (e.g., `InvalidParameter`, `Throttling`, `InvalidApiKey`).
          example: InvalidApiKey
        message:
          type: string
          description: Human-readable error message.
          example: Invalid API-key provided.