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

Wan 2.5 — Recuperar resultado da edição

Verifique Wan2.5 editar status

Consulte o status e os resultados da tarefa.

Estratégia de votação

  1. Envie uma tarefa através de Criar tarefa para receber um task_id.
  2. Faça pesquisas a cada 10 segundos até task_status é SUCCEEDED ou FAILED.
  3. No sucesso, results contém URLs de download de imagens.

Notas importantes

OpenAPI

openapi: 3.1.0
info:
  title: Wan2.5 General Image Editing API
  description: Wan2.5 general image editing API. Edits images using text prompts, preserving subject consistency. Supports single-image editing and multi-image fusion with up to three reference images.
  version: 1.0.0
servers:
  - url: https://maas.qwencloudapi.com/api/v1
    description: Singapore
security:
  - BearerAuth: []
paths:
  /tasks/{task_id}:
    get:
      operationId: getWan25ImageEditTaskStatus
      summary: Query task result
      description: Query the status and result of the image editing task.
      parameters:
        - name: task_id
          in: path
          required: true
          description: Task identifier returned by the image editing creation endpoint.
          schema:
            type: string
      responses:
        "200":
          description: Task status retrieved successfully.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ImageEditTaskStatusResponse"
              examples:
                SUCCEEDED:
                  summary: Task succeeded
                  value:
                    request_id: d1f2a1be-9c58-48af-b43f-xxxxxx
                    output:
                      task_id: 7f4836cd-1c47-41b3-b3a4-xxxxxx
                      task_status: SUCCEEDED
                      submit_time: 2025-09-23 22:14:10.800
                      scheduled_time: 2025-09-23 22:14:10.825
                      end_time: 2025-09-23 22:15:23.456
                      results:
                        - orig_prompt: Change the floral dress to a vintage-style lace long dress with exquisite embroidery details on the collar and cuffs.
                          actual_prompt: Replace the pink pleated dress with a vintage-style lace long dress with exquisite embroidery details on the collar and cuffs. Keep the person's hairstyle, makeup, and posture unchanged. The overall style should be consistent with the soft tones and classic atmosphere of the original image.
                          url: https://dashscope-result-sh.oss-cn-shanghai.aliyuncs.com/xxx.png?Expires=xxx
                      task_metrics:
                        TOTAL: 1
                        FAILED: 0
                        SUCCEEDED: 1
                    usage:
                      image_count: 1
                FAILED:
                  summary: Task failed
                  value:
                    request_id: e5d70b02-ebd3-98ce-9fe8-759d7d7b107d
                    output:
                      task_id: 86ecf553-d340-4e21-af6e-xxxxxx
                      task_status: FAILED
                      code: InvalidParameter
                      message: The specified parameter is not valid.
                      task_metrics:
                        TOTAL: 4
                        SUCCEEDED: 0
                        FAILED: 4
                RUNNING:
                  summary: Task running
                  value:
                    request_id: c1209113-8437-424f-a386-xxxxxx
                    output:
                      task_id: 966cebcd-dedc-4962-af88-xxxxxx
                      task_status: RUNNING
                      task_metrics:
                        TOTAL: 1
                        SUCCEEDED: 0
                        FAILED: 0
        "400":
          description: Invalid request parameters.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DashScopeErrorResponse"
      x-codeSamples:
        - lang: curl
          label: cURL - Query task result
          source: |-
            # Replace {task_id} with the actual task ID from the submit response
            curl -X GET 'https://maas.qwencloudapi.com/api/v1/tasks/{task_id}' \
              -H "Authorization: Bearer $DASHSCOPE_API_KEY"
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: DashScope API Key. Create one in the [QwenCloud console](https://home.qwencloud.com/api-keys).
  schemas:
    Wan25ImageEditRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          description: Model name.
          enum:
            - wan2.5-i2i-preview
          example: wan2.5-i2i-preview
        input:
          $ref: "#/components/schemas/Wan25ImageEditInput"
        parameters:
          $ref: "#/components/schemas/Wan25ImageEditParameters"
    Wan25ImageEditInput:
      type: object
      required:
        - prompt
        - images
      description: Input data for image editing.
      properties:
        prompt:
          type: string
          description: "A positive prompt describes the elements and visual characteristics that you want the generated image to include. Accepts Chinese and English. Maximum: 2,000 characters; longer content is truncated."
          example: Change the floral dress to a vintage-style lace long dress with exquisite embroidery details on the collar and cuffs.
        images:
          type: array
          description: |-
            An array of URLs pointing to the input images. Maximum: 3 images per request. For multiple images, array order defines the sequence (Image 1, Image 2, etc.).

            **Image limits:**
            - Supported formats: JPEG, JPG, PNG, BMP, and WEBP. PNG alpha channels are ignored.
            - Resolution: Width and height must each be between 384 and 5,000 pixels.
            - Maximum file size: 10 MB.

            **Supported input formats:**
            - **Public URL**: Both HTTP and HTTPS are supported.
            - **Base64-encoded string**: Format: `data:{MIME_type};base64,{base64_data}`.
          items:
            type: string
          minItems: 1
          maxItems: 3
          example:
            - https://img.alicdn.com/imgextra/i2/O1CN01vHOj4h28jOxUJPwY8_!!6000000007968-49-tps-1344-896.webp
        negative_prompt:
          type: string
          description: "The negative prompt. Elements to exclude from the generated image. Accepts Chinese and English. Maximum: 500 characters; longer content is truncated."
          example: low resolution, error, worst quality, low quality, disfigured, extra fingers, bad proportions
    Wan25ImageEditParameters:
      type: object
      description: Controls output resolution, prompt rewriting, watermarks, and other processing options.
      properties:
        size:
          type: string
          description: |-
            Output resolution in `width*height` format. Default: `1280*1280`. Total pixels must fall between 589,824 (`768*768`) and 1,638,400 (`1280*1280`). Aspect ratio must be between 1:4 and 4:1.

            Recommended resolutions:
            - `1280*1280` (1:1)
            - `1024*1024` (1:1)
            - `800*1200` (2:3)
            - `1200*800` (3:2)
            - `960*1280` (3:4)
            - `1280*960` (4:3)
            - `720*1280` (9:16)
            - `1280*720` (16:9)
            - `1344*576` (21:9)

            If not specified, the system outputs an image with `1280*1280` total pixels and preserves an aspect ratio similar to the input:
            - Single-image input: The aspect ratio matches the input image.
            - Multi-image input: The aspect ratio matches the last input image.
          default: 1280*1280
          example: 1280*1280
        n:
          type: integer
          description: "The number of images to generate. Valid values: 1 to 4. Default: 4. The `n` parameter directly impacts billing -- higher values mean higher costs. To control costs, it is recommended to explicitly set it to 1 for testing."
          default: 4
          minimum: 1
          maximum: 4
          example: 1
        watermark:
          type: boolean
          description: Whether to add a watermark in the bottom-right corner of the image that displays the fixed text "AI-generated".
          default: false
          example: false
        prompt_extend:
          type: boolean
          description: Enables smart prompt rewriting. When enabled, the Large Language Model enhances your prompt for better results, at the cost of longer processing time.
          default: true
          example: true
        seed:
          type: integer
          description: "The random number seed. Value range: [0, 2147483647]. If not specified, the algorithm automatically generates a random number as the seed. If specified, the algorithm generates a separate seed value for each of the `n` images (seed, seed+1, seed+2, ...). To reproduce specific results, use a fixed seed value. Note: Due to inherent randomness, identical seeds may not produce exactly identical results."
          minimum: 0
          maximum: 2147483647
    AsyncTaskSubmitResponse:
      type: object
      properties:
        output:
          type: object
          properties:
            task_id:
              type: string
              description: The ID of the task. Can be used to query the task for up to 24 hours.
            task_status:
              type: string
              description: The status of the task.
              enum:
                - PENDING
                - RUNNING
                - SUCCEEDED
                - FAILED
                - CANCELED
                - UNKNOWN
        request_id:
          type: string
          description: Unique identifier for the request. Use for tracing and troubleshooting issues.
    ImageEditTaskStatusResponse:
      type: object
      properties:
        request_id:
          type: string
          description: Unique identifier for the request.
        output:
          type: object
          properties:
            task_id:
              type: string
              description: The ID of the task. Can be used to query the task for up to 24 hours.
            task_status:
              type: string
              description: The status of the task.
              enum:
                - PENDING
                - RUNNING
                - SUCCEEDED
                - FAILED
                - CANCELED
                - UNKNOWN
            submit_time:
              type: string
              description: "The time when the task was submitted. Time is in UTC+8. Format: `YYYY-MM-DD HH:mm:ss.SSS`."
            scheduled_time:
              type: string
              description: "The time when the task started running. Time is in UTC+8. Format: `YYYY-MM-DD HH:mm:ss.SSS`."
            end_time:
              type: string
              description: "The time when the task was completed. Time is in UTC+8. Format: `YYYY-MM-DD HH:mm:ss.SSS`."
            results:
              type: array
              description: An array of generation results. Each entry contains the image URL, prompt, or error details for failed generations.
              items:
                type: object
                properties:
                  orig_prompt:
                    type: string
                    description: The original input prompt.
                  actual_prompt:
                    type: string
                    description: The actual optimized prompt used when prompt rewriting is enabled. Not returned when this feature is disabled.
                  url:
                    type: string
                    description: The URL of the generated image. Valid for 24 hours.
                  code:
                    type: string
                    description: The error code for a failed image generation. Returned only for partial failures.
                  message:
                    type: string
                    description: The error message for a failed image generation. Returned only for partial failures.
            task_metrics:
              type: object
              description: Statistics about the task results.
              properties:
                TOTAL:
                  type: integer
                  description: Total number of tasks.
                SUCCEEDED:
                  type: integer
                  description: Number of successful tasks.
                FAILED:
                  type: integer
                  description: Number of failed tasks.
            code:
              type: string
              description: The error code. Returned only when the task fails.
            message:
              type: string
              description: Detailed error message. Returned only when the task fails.
        usage:
          type: object
          description: Output statistics. Only successful results are counted.
          properties:
            image_count:
              type: integer
              description: "Number of images successfully generated. Billing formula: Fee = (Number of images) x (Unit price)."
    DashScopeErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code identifying the type of error.
        message:
          type: string
          description: Detailed error message.
        request_id:
          type: string
          description: Unique request identifier for troubleshooting.