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

Resultado da tarefa de consulta

Consulta qwen-mt-image status e resultado da tarefa de tradução de imagens

OpenAPI

openapi: 3.0.0
info:
  title: Qwen-MT-Image API Reference
  description: |-
    Qwen-MT-Image accurately translates text in images while preserving the original layout. It supports domain hints, sensitive word filtering, and terminology intervention.

    `qwen-mt-image-2.0` supports both synchronous and asynchronous modes. See [Synchronous calls](/api-reference/image-translation/qwen-mt-image/synchronous) for the sync API.

    Asynchronous workflow:
    1. **Create task**: POST to submit a task and receive a task_id.
    2. **Query result**: Poll by task_id until the task completes and returns the image URL.
  version: 1.0.0
servers:
  - url: https://maas.qwencloudapi.com/api/v1
    description: DashScope International API
security:
  - BearerAuth: []
paths:
  /tasks/{task_id}:
    get:
      operationId: getImageTranslationTaskStatus
      summary: Query task result
      description: |-
        Query the status and result of an image translation task.

        Notes:
        - `task_id` is valid for **24 hours**. Expired IDs return status `UNKNOWN`.
        - The `image_url` in successful results is valid for **24 hours** — download promptly.
      parameters:
        - name: task_id
          in: path
          required: true
          description: Task identifier returned by the create endpoint.
          schema:
            type: string
      responses:
        "200":
          description: Task status and result retrieved successfully.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ImageTranslationTaskStatusResponse"
              examples:
                SUCCEEDED:
                  summary: Task succeeded (translatable content found)
                  value:
                    request_id: 5fec62eb-bf94-91f8-b9f4-f7f758e4e27e
                    output:
                      task_id: 72c52225-8444-4cab-ad0c-xxxxxx
                      task_status: SUCCEEDED
                      submit_time: 2025-08-13 18:11:16.954
                      scheduled_time: 2025-08-13 18:11:17.003
                      end_time: 2025-08-13 18:11:23.860
                      image_url: http://dashscope-result-sg.oss-ap-southeast-1.aliyuncs.com/xxx?Expires=xxx
                    usage:
                      image_count: 1
                SUCCEEDED (no text):
                  summary: Task succeeded (no translatable content)
                  value:
                    request_id: 0ccb84aa-e034-431d-9d54-08e14fxxxxxx
                    output:
                      task_id: 34ec4208-97d6-498b-a390-9173f7xxxxxx
                      task_status: SUCCEEDED
                      submit_time: 2026-01-12 17:56:23.625
                      scheduled_time: 2026-01-12 17:56:23.656
                      end_time: 2026-01-12 17:56:25.324
                      image_url: http://dashscope-result-sg.oss-ap-southeast-1.aliyuncs.com/xxx.jpg?Expires=xxx
                      message: No text detected for translation
                    usage:
                      image_count: 1
                FAILED:
                  summary: Task failed
                  value:
                    request_id: daad9007-6acd-9fb3-a6bc-d55902b9c9ff
                    output:
                      task_id: fe8aa114-d9f1-4f76-b598-xxxxxx
                      task_status: FAILED
                      submit_time: 2025-08-20 09:54:21.911
                      scheduled_time: 2025-08-20 09:54:21.984
                      end_time: 2025-08-20 12:55:00.818
                      code: InternalError
                      message: xxxxxx
                RUNNING:
                  summary: Task running
                  value:
                    request_id: c1209113-8437-424f-a386-xxxxxx
                    output:
                      task_id: 72c52225-8444-4cab-ad0c-xxxxxx
                      task_status: RUNNING
                PENDING:
                  summary: Task pending
                  value:
                    request_id: 4909100c-7b5a-9f92-bfe5-xxxxxx
                    output:
                      task_status: PENDING
                      task_id: 0385dc79-5ff8-4d82-bcb6-xxxxxx
        "400":
          description: Invalid request parameters.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DashScopeErrorResponse"
      x-codeSamples:
        - lang: curl
          label: cURL - Query task result
          source: |-
            # Replace 86ecf553-d340-4e21-xxxxxxxxx with your actual task_id
            curl -X GET https://maas.qwencloudapi.com/api/v1/tasks/86ecf553-d340-4e21-xxxxxxxxx \
              --header "Authorization: Bearer $DASHSCOPE_API_KEY"
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Qwen Cloud API Key. See [Get API Key](/api-reference/preparation/api-key).
  schemas:
    ImageTranslationRequest:
      type: object
      description: Image translation request body.
      required:
        - model
        - input
      properties:
        model:
          type: string
          enum:
            - qwen-mt-image
          description: "Model name: `qwen-mt-image-2.0` or `qwen-mt-image`."
        input:
          type: object
          description: Input parameters.
          required:
            - image_url
            - source_lang
            - target_lang
          properties:
            image_url:
              type: string
              description: |-
                Public URL of the image (HTTP/HTTPS).

                - **Formats**: JPG, JPEG, PNG, BMP, PNM, PPM, TIFF, WEBP
                - **Dimensions**: 15-8192px width/height, aspect ratio 1:10 to 10:1
                - **Size**: max 100MB
                - URL must not contain Chinese characters
            source_lang:
              type: string
              description: |-
                Source language. Accepts full name, language code, or `auto` (auto-detect), case-insensitive.

                **qwen-mt-image-2.0**: supports 55 languages with no restrictions. See [Supported languages](/api-reference/image-translation/qwen-mt-image/synchronous#supported-languages).

                **qwen-mt-image** (legacy): source or target must be Chinese or English. Supported: `zh`, `en`, `ko`, `ja`, `ru`, `es`, `fr`, `pt`, `it`, `vi`, `de`.

                Example: `Chinese`, `en`, `auto`
            target_lang:
              type: string
              description: |-
                Target language. Accepts full name or language code, case-insensitive.

                **qwen-mt-image-2.0**: supports 55 languages with no restrictions. See [Supported languages](/api-reference/image-translation/qwen-mt-image/synchronous#supported-languages).

                **qwen-mt-image** (legacy): source or target must be Chinese or English. Supported: `zh`, `en`, `ko`, `ja`, `ru`, `es`, `fr`, `pt`, `it`, `vi`, `ms`, `th`, `id`, `ar`. Note: German (`de`) is source-only.

                Example: `Chinese`, `en`
            ext:
              type: object
              description: Optional extension parameters.
              properties:
                domainHint:
                  type: string
                  description: Domain hint in English describing the translation context and style requirements. Max 200 words.
                sensitives:
                  type: array
                  description: |-
                    Sensitive words list — exact matches are skipped during translation, case-sensitive. Max 50 per request.

                    Example: ["SALE", "Limited Time"]
                  items:
                    type: string
                  maxItems: 50
                terminologies:
                  type: array
                  description: |-
                    Terminology pairs for domain-specific translation. Language must match `source_lang` and `target_lang`.

                    Example: [{"src": "API", "tgt": "API"}, {"src": "ML", "tgt": "ML"}]
                  items:
                    type: object
                    required:
                      - src
                      - tgt
                    properties:
                      src:
                        type: string
                        description: Source term, must match `source_lang`.
                      tgt:
                        type: string
                        description: Target term, must match `target_lang`.
                config:
                  type: object
                  description: Additional configuration options.
                  properties:
                    imageSegment:
                      type: boolean
                      default: false
                      description: |-
                        Enable image subject segmentation. When enabled, text on subjects (people, products, logos) is not translated.

                        - `false` (default): translate all text
                        - `true`: skip text on subjects
    AsyncTaskSubmitResponse:
      type: object
      description: Async task submission response.
      properties:
        request_id:
          type: string
          description: Unique request identifier for tracing and troubleshooting.
        output:
          type: object
          description: Task output.
          properties:
            task_id:
              type: string
              description: Task ID. Valid for 24 hours.
            task_status:
              type: string
              enum:
                - PENDING
              description: Task status. Newly created tasks always return `PENDING`.
    ImageTranslationTaskStatusResponse:
      type: object
      description: Task status and result response.
      properties:
        request_id:
          type: string
          description: Unique request identifier for tracing and troubleshooting.
        output:
          type: object
          description: Task output.
          properties:
            task_id:
              type: string
              description: Task ID. Valid for 24 hours.
            task_status:
              type: string
              enum:
                - PENDING
                - RUNNING
                - SUCCEEDED
                - FAILED
                - CANCELED
                - UNKNOWN
              description: |-
                Task status.
                - PENDING: task is queued
                - RUNNING: task is processing
                - SUCCEEDED: task completed successfully
                - FAILED: task failed
                - CANCELED: task was canceled
                - UNKNOWN: task does not exist or status is unknown
            submit_time:
              type: string
              description: "Task submission time. Format: YYYY-MM-DD HH:mm:ss.SSS."
            scheduled_time:
              type: string
              description: "Task execution start time. Format: YYYY-MM-DD HH:mm:ss.SSS."
            end_time:
              type: string
              description: "Task completion time. Format: YYYY-MM-DD HH:mm:ss.SSS."
            image_url:
              type: string
              description: URL of the translated image, same dimensions as the original, JPG format. Valid for 24 hours — download and save promptly.
            message:
              type: string
              description: Additional information. Usually not returned. When the image contains no translatable text, the task still succeeds (and is billed), returning `No text detected for translation`. On failure, contains error details.
            code:
              type: string
              description: Error code. Not returned on success.
        usage:
          type: object
          description: Usage statistics. Only counts successful results.
          properties:
            image_count:
              type: integer
              description: Number of images generated, always 1.
    DashScopeErrorResponse:
      type: object
      description: DashScope API error response.
      properties:
        code:
          type: string
          description: Error code (e.g. `InvalidApiKey`, `InvalidParameter`).
        message:
          type: string
          description: Human-readable error description.
        request_id:
          type: string
          description: Unique request identifier.