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

Criar tarefa de tradução de imagens

Envie um qwen-mt-image tarefa de tradução de imagem assíncrona

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:
  /services/aigc/image2image/image-synthesis:
    post:
      operationId: createImageTranslationTask
      summary: Create image translation task
      description: Create an asynchronous image translation task. The image must contain text in a supported language.
      parameters:
        - name: X-DashScope-Async
          in: header
          required: true
          description: |-
            Async processing flag. Must be set to `enable` for async calls.

            `qwen-mt-image-2.0` supports [synchronous calls](/api-reference/image-translation/qwen-mt-image/synchronous) — omit this header for sync mode. `qwen-mt-image` only supports async.
          schema:
            type: string
            enum:
              - enable
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ImageTranslationRequest"
      responses:
        "200":
          description: Task created successfully. Returns task_id for polling.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AsyncTaskSubmitResponse"
        "400":
          description: Invalid request parameters.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DashScopeErrorResponse"
      x-codeSamples:
        - lang: curl
          label: cURL
          source: |-
            curl --location 'https://maas.qwencloudapi.com/api/v1/services/aigc/image2image/image-synthesis' \
            --header 'X-DashScope-Async: enable' \
            --header "Authorization: Bearer $DASHSCOPE_API_KEY" \
            --header 'Content-Type: application/json' \
            --data '{
                "model": "qwen-mt-image",
                "input": {
                    "image_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250916/ordhsk/1.webp",
                    "source_lang": "zh",
                    "target_lang": "en",
                    "ext": {
                        "config": {
                            "imageSegment": false
                        }
                    }
                }
            }'
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.