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

Wan 2.7 síncrono

Síncrono Wan 2.7 geração e edição de imagens

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

Este endpoint síncrono suporta wan2.7-image-pro e wan2.7-image. Recupere imagens geradas diretamente em uma única solicitação, sem pesquisa.

Para processamento assíncrono, use o async submit ponto final.

OpenAPI

openapi: 3.1.0
info:
  title: Wan2.7 Image Generation and Editing API
  description: Wan2.7 image generation and editing API. Supports text-to-image, multi-image editing, interactive editing with bounding boxes, and image set generation.
  version: 1.0.0
servers:
  - url: https://maas.qwencloudapi.com/api/v1
    description: Singapore
security:
  - BearerAuth: []
paths:
  /services/aigc/multimodal-generation/generation:
    post:
      operationId: createWan27Image
      summary: Generate or edit images synchronously
      description: Generate or edit images synchronously using Wan2.7. Supports text-to-image generation, multi-image editing, interactive editing with bounding boxes, and image set generation.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Wan27ImageRequest"
      responses:
        "200":
          description: Image generated or edited successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Wan27ImageResponse"
        "400":
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DashScopeErrorResponse"
      x-codeSamples:
        - lang: curl
          label: cURL (text-to-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": "wan2.7-image-pro",
              "input": {
                "messages": [
                  {
                    "role": "user",
                    "content": [
                      {
                        "text": "A serene mountain lake at sunrise, with mist rising from the water, surrounded by pine trees, photorealistic"
                      }
                    ]
                  }
                ]
              },
              "parameters": {
                "n": 1,
                "size": "2K",
                "watermark": false,
                "thinking_mode": true
              }
            }'
        - lang: curl
          label: cURL (image editing)
          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": "wan2.7-image-pro",
              "input": {
                "messages": [
                  {
                    "role": "user",
                    "content": [
                      {
                        "image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20251229/pjeqdf/car.webp"
                      },
                      {
                        "image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20251229/xsunlm/paint.webp"
                      },
                      {
                        "text": "Spray the graffiti from image 2 onto the car in image 1"
                      }
                    ]
                  }
                ]
              },
              "parameters": {
                "n": 1,
                "size": "2K",
                "watermark": false
              }
            }'
        - lang: curl
          label: cURL (interactive editing)
          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": "wan2.7-image-pro",
              "input": {
                "messages": [
                  {
                    "role": "user",
                    "content": [
                      {
                        "image": "https://img.alicdn.com/imgextra/i3/O1CN0157XGE51l6iL9441yX_!!6000000004770-49-tps-1104-1472.webp"
                      },
                      {
                        "image": "https://img.alicdn.com/imgextra/i3/O1CN01SfG4J41UYn9WNt4X1_!!6000000002530-49-tps-1696-960.webp"
                      },
                      {
                        "text": "Place the alarm clock from image 1 in the selected area of image 2, ensuring the scene and lighting blend naturally"
                      }
                    ]
                  }
                ]
              },
              "parameters": {
                "n": 1,
                "size": "2K",
                "watermark": false,
                "bbox_list": [[], [[989, 515, 1138, 681]]]
              }
            }'
        - lang: curl
          label: cURL (image set generation)
          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": "wan2.7-image-pro",
              "input": {
                "messages": [
                  {
                    "role": "user",
                    "content": [
                      {
                        "text": "Cinematic image group, documenting the same stray orange cat, features must be consistent throughout. First image: Spring, an orange cat walks under blooming cherry trees; Second image: Summer, an orange cat rests in the shade of an old street to escape the heat; Third image: Autumn, an orange cat walks on golden fallen leaves; Fourth image: Winter, an orange cat walks on snow, leaving paw prints."
                      }
                    ]
                  }
                ]
              },
              "parameters": {
                "enable_sequential": true,
                "n": 4,
                "size": "2K"
              }
            }'
        - lang: python
          label: Python - image editing (sync)
          source: |-
            import os
            import base64
            import mimetypes
            import dashscope
            from dashscope.aigc.image_generation import ImageGeneration
            from dashscope.api_entities.dashscope_response import Message

            # SDK version >= 1.25.15 required
            dashscope.base_http_api_url = 'https://maas.qwencloudapi.com/api/v1'

            api_key = os.getenv("DASHSCOPE_API_KEY")

            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")
              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}"

            # Three input methods: public URL, local file path, Base64 encoding
            image_1 = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20251229/pjeqdf/car.webp"
            image_2 = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20251229/xsunlm/paint.webp"
            # image_1 = "file:///path/to/your/car.png"
            # image_1 = encode_file("/path/to/your/car.png")

            message = Message(
              role="user",
              content=[
                {"text": "Spray the graffiti from image 2 onto the car in image 1"},
                {"image": image_1},
                {"image": image_2}
              ]
            )

            print("----sync call, please wait a moment----")
            rsp = ImageGeneration.call(
              model='wan2.7-image-pro',
              api_key=api_key,
              messages=[message],
              n=1,
              # wan2.7-image-pro only supports 4K for text-to-image;
              # image editing and sequential generation support up to 2K
              size="2K",
              watermark=False
            )

            print(rsp)
        - lang: python
          label: Python - image set generation (sync)
          source: |-
            import os
            import base64
            import mimetypes
            import dashscope
            from dashscope.aigc.image_generation import ImageGeneration
            from dashscope.api_entities.dashscope_response import Message

            # SDK version >= 1.25.15 required
            dashscope.base_http_api_url = 'https://maas.qwencloudapi.com/api/v1'

            api_key = os.getenv("DASHSCOPE_API_KEY")

            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")
              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}"

            # Text-to-sequential generation (default)
            message = Message(
              role="user",
              content=[
                {"text": "Cinematic image group, documenting the same stray orange cat, features must be consistent throughout. First image: Spring, an orange cat walks under blooming cherry trees; Second image: Summer, an orange cat rests in the shade of an old street to escape the heat; Third image: Autumn, an orange cat walks on golden fallen leaves; Fourth image: Winter, an orange cat walks on snow, leaving paw prints."}
              ]
            )

            # Image-to-sequential generation (uncomment to use)
            # Three input methods: public URL, local file path, Base64 encoding
            # image_1 = "https://example.com/your-image.png"
            # image_1 = "file:///path/to/your/image.png"
            # image_1 = encode_file("/path/to/your/image.png")
            # message = Message(
            #   role="user",
            #   content=[
            #     {"text": "Generate a sequential image set based on the input image"},
            #     {"image": image_1}
            #   ]
            # )

            print("----sync call, please wait a moment----")
            rsp = ImageGeneration.call(
              model='wan2.7-image-pro',
              api_key=api_key,
              messages=[message],
              enable_sequential=True,
              n=4,
              # wan2.7-image-pro only supports 4K for text-to-image;
              # image editing and sequential generation support up to 2K
              size="2K"
            )

            print(rsp)
        - lang: java
          label: Java - image editing (sync)
          source: |-
            import com.alibaba.dashscope.aigc.imagegeneration.*;
            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 com.alibaba.dashscope.utils.JsonUtils;

            import java.io.IOException;
            import java.nio.file.Files;
            import java.nio.file.Paths;
            import java.util.Arrays;
            import java.util.Base64;
            import java.util.Collections;

            /**
             * wan2.7-image-pro Image Editing - Synchronous Call Example
             * SDK version >= 2.22.13 required
             */
            public class Main {

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

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

                public static String encodeFile(String filePath) throws IOException {
                    byte[] fileContent = Files.readAllBytes(Paths.get(filePath));
                    String base64String = Base64.getEncoder().encodeToString(fileContent);
                    String mimeType = Files.probeContentType(Paths.get(filePath));
                    return "data:" + mimeType + ";base64," + base64String;
                }

                public static void basicCall() throws ApiException, NoApiKeyException, UploadFileException {
                    // Three input methods: public URL, local file path, Base64 encoding
                    String image1 = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20251229/pjeqdf/car.webp";
                    String image2 = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20251229/xsunlm/paint.webp";
                    // String image1 = "file:///path/to/your/car.png";
                    // String image1 = encodeFile("/path/to/your/car.png");

                    ImageGenerationMessage message = ImageGenerationMessage.builder()
                            .role("user")
                            .content(Arrays.asList(
                                    Collections.singletonMap("text", "Spray the graffiti from image 2 onto the car in image 1"),
                                    Collections.singletonMap("image", image1),
                                    Collections.singletonMap("image", image2)
                            )).build();

                    ImageGenerationParam param = ImageGenerationParam.builder()
                            .apiKey(apiKey)
                            .model("wan2.7-image-pro")
                            .messages(Arrays.asList(message))
                            .n(1)
                            // wan2.7-image-pro only supports 4K for text-to-image;
                            // image editing and sequential generation support up to 2K
                            .size("2K")
                            .build();

                    ImageGeneration imageGeneration = new ImageGeneration();
                    ImageGenerationResult result = null;
                    try {
                        System.out.println("---synchronous call for image editing, please wait a moment----");
                        result = imageGeneration.call(param);
                    } catch (ApiException | NoApiKeyException | UploadFileException e) {
                        throw new RuntimeException(e.getMessage());
                    }
                    System.out.println(JsonUtils.toJson(result));
                }

                public static void main(String[] args) {
                    try {
                        basicCall();
                    } catch (ApiException | NoApiKeyException | UploadFileException e) {
                        System.out.println(e.getMessage());
                    }
                }
            }
        - lang: java
          label: Java - image set generation (sync)
          source: |-
            import com.alibaba.dashscope.aigc.imagegeneration.*;
            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 com.alibaba.dashscope.utils.JsonUtils;

            import java.io.IOException;
            import java.nio.file.Files;
            import java.nio.file.Paths;
            import java.util.Arrays;
            import java.util.Base64;
            import java.util.Collections;

            /**
             * wan2.7-image-pro Image Group Generation - Synchronous Call Example
             * SDK version >= 2.22.13 required
             */
            public class Main {

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

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

                public static String encodeFile(String filePath) throws IOException {
                    byte[] fileContent = Files.readAllBytes(Paths.get(filePath));
                    String base64String = Base64.getEncoder().encodeToString(fileContent);
                    String mimeType = Files.probeContentType(Paths.get(filePath));
                    return "data:" + mimeType + ";base64," + base64String;
                }

                public static void basicCall() throws ApiException, NoApiKeyException, UploadFileException {
                    // Text-to-sequential generation (default)
                    ImageGenerationMessage message = ImageGenerationMessage.builder()
                            .role("user")
                            .content(Collections.singletonList(
                                    Collections.singletonMap("text", "Cinematic image group, documenting the same stray orange cat, features must be consistent throughout. First image: Spring, an orange cat walks under blooming cherry trees; Second image: Summer, an orange cat rests in the shade of an old street to escape the heat; Third image: Autumn, an orange cat walks on golden fallen leaves; Fourth image: Winter, an orange cat walks on snow, leaving paw prints.")
                            )).build();

                    // Image-to-sequential generation (uncomment to use)
                    // Three input methods: public URL, local file path, Base64 encoding
                    // String image1 = "https://example.com/your-image.png";
                    // String image1 = "file:///path/to/your/image.png";
                    // String image1 = encodeFile("/path/to/your/image.png");
                    // ImageGenerationMessage message = ImageGenerationMessage.builder()
                    //         .role("user")
                    //         .content(Arrays.asList(
                    //                 Collections.singletonMap("text", "Generate a sequential image set based on the input image"),
                    //                 Collections.singletonMap("image", image1)
                    //         )).build();

                    ImageGenerationParam param = ImageGenerationParam.builder()
                            .apiKey(apiKey)
                            .model("wan2.7-image-pro")
                            .messages(Collections.singletonList(message))
                            .enableSequential(true)
                            .n(4)
                            // wan2.7-image-pro only supports 4K for text-to-image;
                            // image editing and sequential generation support up to 2K
                            .size("2K")
                            .build();

                    ImageGeneration imageGeneration = new ImageGeneration();
                    ImageGenerationResult result = null;
                    try {
                        System.out.println("----sync call, please wait a moment----");
                        result = imageGeneration.call(param);
                    } catch (ApiException | NoApiKeyException | UploadFileException e) {
                        throw new RuntimeException(e.getMessage());
                    }
                    System.out.println(JsonUtils.toJson(result));
                }

                public static void main(String[] args) {
                    try {
                        basicCall();
                    } catch (ApiException | NoApiKeyException | UploadFileException e) {
                        System.out.println(e.getMessage());
                    }
                }
            }
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: DashScope API Key. Create one in the [QwenCloud console](https://home.qwencloud.com/api-keys).
  schemas:
    Wan27ImageRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          description: "The model name. Valid values: wan2.7-image-pro, wan2.7-image."
          enum:
            - wan2.7-image-pro
            - wan2.7-image
          example: wan2.7-image-pro
        input:
          type: object
          required:
            - messages
          description: Input data containing the messages array.
          properties:
            messages:
              type: array
              description: An array of request content. Currently, only single-turn conversations are supported. This means you can pass only one set of role and content parameters. Multi-turn conversations are not supported.
              minItems: 1
              maxItems: 1
              items:
                $ref: "#/components/schemas/Wan27ImageMessage"
        parameters:
          $ref: "#/components/schemas/Wan27ImageParameters"
    Wan27ImageMessage:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - user
          description: Message role. Must be `user`.
        content:
          type: array
          description: |-
            Message content array. Must contain exactly one `text` object and 0 to 9 `image` objects.

            When using multiple images, include multiple `image` objects in the array. Image order is determined by array position.
          items:
            $ref: "#/components/schemas/Wan27ImageContentPart"
    Wan27ImageContentPart:
      type: object
      description: Either an image or text content part.
      properties:
        text:
          type: string
          description: The user-entered prompt. Supports Chinese and English. The length cannot exceed 5,000 characters. Each Chinese character, letter, number, or symbol counts as one character. Any excess is automatically truncated. The `content` array must contain exactly one `text` object.
          maxLength: 5000
          example: Spray the graffiti from image 2 onto the car in image 1
        image:
          type: string
          description: |-
            Input image as a public URL (HTTP/HTTPS) or Base64-encoded string (`data:{mime_type};base64,{data}`).

            **Image constraints:**
            - Formats: JPEG, JPG, PNG (alpha channel not supported), BMP, WEBP.
            - Resolution: Width and height each between 240 and 8,000 pixels. Aspect ratio [1:8, 8:1].
            - File size: Max 20 MB.
            - Quantity: 0 to 9 images per request.
          example: https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20251229/pjeqdf/car.webp
    Wan27ImageParameters:
      type: object
      description: Image processing parameters.
      properties:
        size:
          type: string
          description: |-
            Output image resolution. Two specification methods are available; they cannot be used together.

            **wan2.7-image-pro:**
            - Method 1 (recommended): `1K`, `2K` (default), or `4K`.
              - Scope: Text-to-image (no image input, not generating an image set) supports 1K, 2K, and 4K. Other scenarios support 1K and 2K only.
              - Total pixels: 1K = 1024×1024, 2K = 2048×2048, 4K = 4096×4096.
              - Aspect ratio: With image input, output matches the aspect ratio of the last input image scaled to the selected resolution. Without image input, output is square.
            - Method 2: Specify `width*height` in pixels, aspect ratio [1:8, 8:1].
              - Text-to-image: total pixels in [768×768, 4096×4096].
              - Other scenarios: total pixels in [768×768, 2048×2048].

            **wan2.7-image:**
            - Method 1 (recommended): `1K` or `2K` (default). 4K is not supported.
            - Method 2: Specify `width*height` in pixels. All scenarios: total pixels in [768×768, 2048×2048], aspect ratio [1:8, 8:1].

            The pixel value of the output image may differ slightly from the specified value.
          example: 2K
        n:
          type: integer
          description: |-
            Number of images to generate.

            **Note:** The value of `n` directly affects the cost. Cost = Unit Price × Number of successfully generated images.

            - When image set mode is disabled (`enable_sequential=false`): This value represents the number of images to generate. Range: 1–4. Default: 1.
            - When image set mode is enabled (`enable_sequential=true`): This value represents the maximum number of images to generate. Range: 1–12. Default: 12. The actual number is determined by the model and will not exceed `n`.
          minimum: 1
          maximum: 12
          default: 1
        enable_sequential:
          type: boolean
          description: |-
            Controls the image generation mode.
            - `false`: Default value.
            - `true`: Enables image set output mode.
          default: false
        thinking_mode:
          type: boolean
          description: Specifies whether to enable thinking mode. The default is `true` (enabled). This parameter is effective only when image set mode is disabled and there is no image input. When enabled, the model enhances its inference capabilities to improve image quality, but this increases generation time.
          default: true
        bbox_list:
          type: array
          description: |-
            The selected area for interactive editing.

            - Correspondence: The length of the list must match the number of input images. If an image does not require editing, pass an empty list `[]` at the corresponding position.
            - Coordinate format: `[x1, y1, x2, y2]` (top-left x, top-left y, bottom-right x, bottom-right y). Use absolute pixel coordinates of the original image. The top-left coordinate is (0, 0).
            - Condition: A single image supports a maximum of 2 bounding boxes.
          items:
            type: array
            description: Bounding boxes for one input image. Empty array means no bounding box.
            items:
              type: array
              description: A single bounding box [x1, y1, x2, y2].
              items:
                type: integer
              minItems: 4
              maxItems: 4
            maxItems: 2
        color_palette:
          type: array
          description: A custom color theme. An array of objects containing color (`hex`) and proportion (`ratio`). It must include 3 to 10 colors. We recommend setting it to 8. Available only when image set mode is disabled (`enable_sequential=false`).
          minItems: 3
          maxItems: 10
          items:
            type: object
            required:
              - hex
              - ratio
            properties:
              hex:
                type: string
                description: "The color value in hexadecimal (HEX) format. Example: `#C2D1E6`."
              ratio:
                type: string
                description: The percentage of the color. It must be accurate to two decimal places (for example, `"25.00%"`). The sum of all `ratio` values must be 100.00%.
          example:
            - hex: "#C2D1E6"
              ratio: 60.00%
            - hex: "#636574"
              ratio: 25.00%
            - hex: "#CBD4E4"
              ratio: 15.00%
        watermark:
          type: boolean
          description: Adds a watermark label in the bottom-right corner of the image with fixed text "AI Generated".
          default: false
        seed:
          type: integer
          description: "Random number seed. Valid range: [0, 2147483647]. Using the same seed yields similar outputs. If omitted, the algorithm uses a random seed. Note: Image generation is probabilistic. Even with the same seed, results may vary."
          minimum: 0
          maximum: 2147483647
    Wan27ImageResponse:
      type: object
      description: Wan2.7 image generation response.
      example:
        output:
          choices:
            - finish_reason: stop
              message:
                content:
                  - image: https://dashscope-result-intl.oss-cn-singapore.aliyuncs.com/xxx.png?Expires=xxx
                    type: image
                role: assistant
          finished: true
        usage:
          image_count: 1
          input_tokens: 18790
          output_tokens: 2
          size: 2985*1405
          total_tokens: 18792
        request_id: a3f4befe-cacd-49c9-8298-xxxxxx
      properties:
        output:
          type: object
          properties:
            choices:
              type: array
              description: List of generated results.
              items:
                $ref: "#/components/schemas/Wan27ImageChoice"
            finished:
              type: boolean
              description: Whether the generation has completed.
        usage:
          type: object
          description: Usage statistics.
          properties:
            image_count:
              type: integer
              description: Number of images generated.
            input_tokens:
              type: integer
              description: Number of input tokens consumed.
            output_tokens:
              type: integer
              description: Number of output tokens consumed.
            total_tokens:
              type: integer
              description: Total tokens consumed.
            size:
              type: string
              description: Actual output image dimensions (width×height).
              example: 2985*1405
        request_id:
          type: string
          description: Unique request identifier.
          example: a3f4befe-cacd-49c9-8298-xxxxxx
    Wan27ImageChoice:
      type: object
      properties:
        finish_reason:
          type: string
          description: Reason for generation completion.
          example: stop
        message:
          type: object
          properties:
            role:
              type: string
              example: assistant
            content:
              type: array
              items:
                type: object
                properties:
                  image:
                    type: string
                    description: URL of the generated image. **URLs expire in 24 hours.** Download and save promptly.
                    example: https://dashscope-result-intl.oss-cn-singapore.aliyuncs.com/xxx.png?Expires=xxx
                  type:
                    type: string
                    example: image
    AsyncTaskSubmitResponse:
      type: object
      description: Response returned when an async task is successfully submitted.
      example:
        request_id: ccf4b2f4-bf30-9e13-9461-3a28c6a7bxxx
        output:
          task_id: 8811b4a4-00ac-4aa2-a2fd-017d3b90cxxx
          task_status: PENDING
      properties:
        request_id:
          type: string
          description: Unique request identifier.
          example: ccf4b2f4-bf30-9e13-9461-3a28c6a7bxxx
        output:
          type: object
          properties:
            task_id:
              type: string
              description: Task identifier. Use this to poll the result endpoint. Valid for 24 hours.
              example: 8811b4a4-00ac-4aa2-a2fd-017d3b90cxxx
            task_status:
              type: string
              description: Initial task status. Always `PENDING` immediately after creation.
              example: PENDING
    Wan27TaskStatusResponse:
      type: object
      description: Response from the task status query endpoint.
      properties:
        request_id:
          type: string
          description: Unique request identifier.
          example: 43d9e959-25bc-4dc7-9888-xxxxxx
        output:
          type: object
          properties:
            task_id:
              type: string
              description: Task identifier.
              example: 858cad55-4bdc-4ba3-ae6c-xxxxxx
            task_status:
              type: string
              description: "Current task status: `PENDING` (queued), `RUNNING` (processing), `SUCCEEDED` (complete), `FAILED` (error), `CANCELED` (canceled), `UNKNOWN` (invalid or expired task ID)."
              enum:
                - PENDING
                - RUNNING
                - SUCCEEDED
                - FAILED
                - CANCELED
                - UNKNOWN
              example: SUCCEEDED
            submit_time:
              type: string
              description: Task submission time.
              example: 2026-03-31 19:57:58.840
            scheduled_time:
              type: string
              description: Task scheduling time.
              example: 2026-03-31 19:57:58.877
            end_time:
              type: string
              description: Task completion time.
              example: 2026-03-31 19:58:11.563
            finished:
              type: boolean
              description: Whether the task has finished.
              example: true
            choices:
              type: array
              description: Generated images. Only present when `task_status` is `SUCCEEDED`.
              items:
                $ref: "#/components/schemas/Wan27ImageChoice"
            code:
              type: string
              description: Error code. Only present when `task_status` is `FAILED`.
            message:
              type: string
              description: Error message. Only present when `task_status` is `FAILED`.
        usage:
          type: object
          description: Usage statistics. Only present when `task_status` is `SUCCEEDED`.
          properties:
            image_count:
              type: integer
              description: Number of images generated.
            input_tokens:
              type: integer
              description: Number of input tokens consumed.
            output_tokens:
              type: integer
              description: Number of output tokens consumed.
            total_tokens:
              type: integer
              description: Total tokens consumed.
            size:
              type: string
              description: Actual output image dimensions.
              example: 2985*1405
    DashScopeErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code.
          example: InvalidParameter
        message:
          type: string
          description: Error message.
          example: Invalid parameter value
        request_id:
          type: string
          description: Unique request identifier.
          example: a3f4befe-cacd-49c9-8298-xxxxxx