POST
/
v1
/
chat
/
completions
Chat Completions Qwen MT Turbo
curl --request POST \
  --url https://api.example.com/v1/chat/completions \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "messages": [
    {}
  ],
  "temperature": 123,
  "max_tokens": 123,
  "source_lang": "<string>",
  "target_lang": "<string>"
}
'
Use Qwen MT Turbo model for high-quality machine translation tasks.

Overview

Qwen MT Turbo is a specialized model optimized for machine translation tasks. It provides fast and accurate translations between multiple languages.

Authentication

All requests require a Bearer token in the Authorization header:
Authorization: Bearer YOUR_API_KEY

Request Parameters

model
string
required
ID of the model to use. Use qwen-mt-turbo for translation tasks.
messages
array
required
A list of messages containing the text to translate.
temperature
number
default:"0.3"
Sampling temperature. Lower values recommended for translation accuracy.
max_tokens
integer
Maximum number of tokens to generate.
source_lang
string
Source language code (e.g., en, zh, ja).
target_lang
string
Target language code (e.g., en, zh, ja).

Request Example

curl -X POST https://api.example.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-mt-turbo",
    "messages": [
      {"role": "system", "content": "You are a professional translator. Translate the following text from English to Chinese."},
      {"role": "user", "content": "Hello, how are you today?"}
    ],
    "temperature": 0.3,
    "max_tokens": 1000
  }'

Response Example

{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1677652288,
  "model": "qwen-mt-turbo",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "你好,今天过得怎么样?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 35,
    "completion_tokens": 12,
    "total_tokens": 47
  }
}

Supported Languages

CodeLanguage
enEnglish
zhChinese
jaJapanese
koKorean
frFrench
deGerman
esSpanish
ruRussian

Available Models

  • qwen-mt-turbo