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

Wan — Recuperar resultado da animação

Verifique o status da animação

Verifique o status da tarefa e recupere a animação.

Estratégia de votação

  1. Depois de criar uma tarefa, você receberá um task_id.
  2. Faça pesquisas a cada 15 segundos até task_status é SUCCEEDED ou FAILED.
  3. Em caso de sucesso, recupere a animação de output.results.video_url.

Notas importantes

OpenAPI

openapi: 3.1.0
info:
  title: Wan Image-to-Animation API
  description: Animate a character image by transferring actions and expressions from a reference video using the wan2.2-animate-move model.
  version: 1.0.0
servers:
  - url: https://maas.qwencloudapi.com/api/v1
    description: Singapore
security:
  - BearerAuth: []
paths:
  /tasks/{task_id}:
    get:
      operationId: getImageToAnimationTaskStatus
      summary: Query task result
      description: Query the status and result of the animation task.
      parameters:
        - name: task_id
          in: path
          required: true
          description: The task ID returned by the POST endpoint.
          schema:
            type: string
      responses:
        "200":
          description: Task status retrieved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TaskStatusResponse"
              examples:
                SUCCEEDED:
                  summary: Task succeeded
                  value:
                    request_id: a67f8716-18ef-447c-a286-xxxxxx
                    output:
                      task_id: 0385dc79-5ff8-4d82-bcb6-xxxxxx
                      task_status: SUCCEEDED
                      submit_time: 2025-09-18 15:32:00.105
                      scheduled_time: 2025-09-18 15:32:15.066
                      end_time: 2025-09-18 15:34:41.898
                      results:
                        video_url: https://dashscope-result-sh.oss-accelerate.aliyuncs.com/xxxxx.mp4?Expires=xxxxxx
                    usage:
                      video_duration: 5.2
                      video_ratio: standard
                FAILED:
                  summary: Task failed
                  value:
                    request_id: daad9007-6acd-9fb3-a6bc-xxxxxx
                    output:
                      task_id: fe8aa114-d9f1-4f76-b598-xxxxxx
                      task_status: FAILED
                      code: InternalError
                      message: xxxxxx
                RUNNING:
                  summary: Task running
                  value:
                    request_id: c1209113-8437-424f-a386-xxxxxx
                    output:
                      task_id: 0385dc79-5ff8-4d82-bcb6-xxxxxx
                      task_status: RUNNING
        "400":
          description: Invalid request
          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:
    ImageToAnimationRequest:
      type: object
      required:
        - model
        - input
        - parameters
      properties:
        model:
          type: string
          description: Model name. Must be `wan2.2-animate-move`.
          enum:
            - wan2.2-animate-move
          example: wan2.2-animate-move
        input:
          type: object
          required:
            - image_url
            - video_url
          description: Input data including the character image and reference video.
          properties:
            image_url:
              type: string
              description: |-
                A publicly accessible URL of the input character image.

                **Image constraints:**
                - Format: JPG, JPEG, PNG, BMP, or WEBP.
                - Dimensions: Width and height must both be in the range of [200, 4096] pixels. The aspect ratio must be between 1:3 and 3:1.
                - File size: Up to 5 MB.
                - Content: The image must show a single front-facing person with an unobstructed face, occupying a moderate portion of the frame.

                URLs containing non-ASCII characters (such as Chinese characters) must be URL-encoded.
              example: https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250919/adsyrp/move_input_image.jpeg
            video_url:
              type: string
              description: |-
                A publicly accessible URL of the reference video. The model transfers actions and expressions from this video to the character image.

                **Video constraints:**
                - Format: MP4, AVI, or MOV.
                - Duration: 2 to 30 seconds.
                - Dimensions: Width and height must both be in the range of [200, 2048] pixels. The aspect ratio must be between 1:3 and 3:1.
                - File size: Up to 200 MB.
                - Content: The video must show a single front-facing person with an unobstructed face, occupying a moderate portion of the frame.

                For better results, use a reference video with higher resolution and frame rate. URLs containing non-ASCII characters must be URL-encoded.
              example: https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250919/kaakcn/move_input_video.mp4
            watermark:
              type: boolean
              description: Whether to add a "Generated by Qwen AI" watermark in the lower-right corner of the video.
              default: false
              example: true
        parameters:
          $ref: "#/components/schemas/ImageToAnimationParameters"
    ImageToAnimationParameters:
      type: object
      required:
        - mode
      description: Video generation parameters.
      properties:
        mode:
          type: string
          description: |-
            The service mode.
            - `wan-std`: Standard mode. Faster generation at lower cost. Suitable for quick previews and basic animation.
            - `wan-pro`: Professional mode. Smoother animation and higher quality, with longer processing time and higher cost.
          enum:
            - wan-std
            - wan-pro
          example: wan-std
        check_image:
          type: boolean
          description: Whether to validate the input image.
          default: true
          example: true
    AsyncTaskSubmitResponse:
      type: object
      description: Response from an asynchronous task submission.
      properties:
        request_id:
          type: string
          description: Unique request identifier for tracing and troubleshooting.
          example: 4909100c-7b5a-9f92-bfe5-xxxxxx
        output:
          type: object
          properties:
            task_id:
              type: string
              description: Task ID for polling status. Use with `GET /tasks/{task_id}`. Valid for 24 hours.
              example: 0385dc79-5ff8-4d82-bcb6-xxxxxx
            task_status:
              type: string
              description: Initial task status, typically `PENDING`.
              enum:
                - PENDING
                - RUNNING
                - SUCCEEDED
                - FAILED
                - CANCELED
                - UNKNOWN
              example: PENDING
    TaskStatusResponse:
      type: object
      description: Response from polling a task's status.
      properties:
        request_id:
          type: string
          description: Unique request identifier.
          example: a67f8716-18ef-447c-a286-xxxxxx
        output:
          type: object
          properties:
            task_id:
              type: string
              description: The task ID.
              example: 0385dc79-5ff8-4d82-bcb6-xxxxxx
            task_status:
              type: string
              description: "Current task status. Transitions: PENDING → RUNNING → SUCCEEDED or FAILED. UNKNOWN means the task does not exist or has expired."
              enum:
                - PENDING
                - RUNNING
                - SUCCEEDED
                - FAILED
                - CANCELED
                - UNKNOWN
            submit_time:
              type: string
              description: "Time when the task was submitted. UTC+8 format: YYYY-MM-DD HH:mm:ss.SSS."
              example: 2025-09-18 15:32:00.105
            scheduled_time:
              type: string
              description: "Time when the task started running. UTC+8 format: YYYY-MM-DD HH:mm:ss.SSS."
              example: 2025-09-18 15:32:15.066
            end_time:
              type: string
              description: "Time when the task completed. UTC+8 format: YYYY-MM-DD HH:mm:ss.SSS."
              example: 2025-09-18 15:34:41.898
            results:
              type: object
              description: Task results. Returned only when `task_status` is `SUCCEEDED`.
              properties:
                video_url:
                  type: string
                  description: URL of the generated video. Valid for 24 hours. Download promptly. MP4 format with H.264 encoding.
                  example: https://dashscope-result-sh.oss-accelerate.aliyuncs.com/xxxxx.mp4?Expires=xxxxxx
            code:
              type: string
              description: 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. Returned only for successful tasks.
          properties:
            video_duration:
              type: number
              description: Duration of the generated video in seconds.
              example: 5.2
            video_ratio:
              type: string
              description: The service mode used. `standard` for `wan-std`, `pro` for `wan-pro`.
              enum:
                - standard
                - pro
              example: standard
    DashScopeErrorResponse:
      type: object
      description: DashScope API error response.
      properties:
        request_id:
          type: string
          description: Unique request identifier.
        code:
          type: string
          description: Error code (e.g., `InvalidApiKey`, `InvalidParameter`, `Throttling`).
          example: InvalidApiKey
        message:
          type: string
          description: Human-readable error message.
          example: No API-key provided.