Skip to content

Qwen MT Lite

alibaba/qwen-mt-lite — a llm model by Alibaba. Call it through the gateway’s standard OpenAI-compatible door using the catalog slug; the full parameter schema is reproduced in full below.

Catalog slugalibaba/qwen-mt-lite
Kindllm
VendorAlibaba
Native model idqwen-mt-lite

Through the Sociaro SDK / OpenAI-compatible door

Section titled “Through the Sociaro SDK / OpenAI-compatible door”
from sociaro_ai import Sociaro
client = Sociaro(api_key="gw_live_...") # base_url defaults to https://api.sociaro.com
resp = client.chat.completions.create(
model="alibaba/qwen-mt-lite", # always the catalog slug
messages=[{"role": "user", "content": "Hello"}],
# any parameter from the schema below is passed through unchanged
)
print(resp.choices[0].message.content)

TypeScript: client.chat.completions.create({ model: "alibaba/qwen-mt-lite", messages: [...] }) — see the TypeScript SDK.

Through Alibaba DashScope’s native API (advanced)

Section titled “Through Alibaba DashScope’s native API (advanced)”

Optional: send Alibaba DashScope’s native request to the /alibaba prefix, using the native model id qwen-mt-lite. The gateway injects the upstream Alibaba DashScope credential and forwards the body unchanged (catalog, pricing and entitlements still apply).

Terminal window
curl https://api.sociaro.com/alibaba/<native-path> \
-H "Authorization: Bearer $SOCIARO_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "model": "qwen-mt-lite", ... }'

The exact path, request body and response shape are documented in full in the schema below.

The complete, one-to-one API schema for this model, transcribed from the official source. Nothing omitted. Examples in the schema may use a representative model of the family — for this model use the slug alibaba/qwen-mt-lite (or the native id qwen-mt-lite for the native API) as shown in How to call above.

Author slug (catalog)Model name (API model)Covered by this schemaLanguagesIncremental streamingDomain promptingStatus
alibaba/qwen-mt-plusqwen-mt-plusYes92No (non-incremental)YesBest quality / Standard speed / High cost
alibaba/qwen-mt-flashqwen-mt-flashYes92Yes (incremental)YesRecommended default — Good / Fast / Low cost
alibaba/qwen-mt-liteqwen-mt-liteYes31 (subset)Yes (incremental)NoBasic / Fastest / Lowest cost
(legacy)qwen-mt-turboListed as supported model value92No (non-incremental)Yes”This model will not be updated in the future. Use flash instead.” Fair / Fast / Low

All four model names are accepted in the model field. The target catalog family is flash/lite/plus; qwen-mt-turbo is documented for completeness (legacy, deprecated for updates).

  1. qwen-mt-lite supports only 31 languages, NOT the full 92. (plus/flash/turbo = 92.) See section D for both lists.
  2. qwen-mt-lite does not support domain prompting (translation_options.domains). Confirmed by the official Java SDK example comment in the user guide: // Note: qwen-mt-lite does not support domain prompting. plus/flash/turbo support it.
  3. Incremental streaming: qwen-mt-flash and qwen-mt-lite stream incrementally (each chunk = only the new content). qwen-mt-plus and qwen-mt-turbo stream non-incrementally (each chunk = the entire sequence generated so far). This behavior cannot be changed.
  4. Everything else (parameter set, defaults, value ranges, request/response shape, the translation_options schema) is identical across all four models.

Family-wide notes (important for gateway transparent-first passthrough)

Section titled “Family-wide notes (important for gateway transparent-first passthrough)”
  • translation_options with source_lang + target_lang is required on every translation request. source_lang: "auto" = automatic source-language detection.
  • Exactly one user message; system role and multi-turn dialogues are not supported. (Translation behavior is set via translation_options, not via a system message.)
  • Custom prompts feature: you can instead drive the model with a plain instruction prompt in content and omit translation_options. The two approaches are mutually exclusive — if you supply both, translation_options may be ignored. For best results the docs recommend using translation_options.
  • Hard input limit: 8,192 input tokens per request. terms / tm_list / domains also consume input tokens. Long text must be segmented at semantic boundaries.
  • top_k (default 1) and repetition_penalty (default 1.0) are non-standard OpenAI parameters: in the Python OpenAI SDK they go into extra_body; in the Node.js SDK / direct HTTP they are top-level. Same handling applies to translation_options itself.
  • Sampling defaults are Qwen-MT-specific: temperature=0.65 (NOT 0.7/1.0), top_p=0.8, top_k=1, repetition_penalty=1.0.
  • The domains prompt text must be written in English, regardless of the source/target language pair.
  • Two protocols: OpenAI-compatible (/compatible-mode/v1/chat/completions) and native DashScope (/api/v1/services/aigc/text-generation/generation). In native DashScope: messagesinput.messages; all params → parameters.*; auth header has no Bearer; Java SDK 2.20.6+; streaming via X-DashScope-SSE: enable header + incremental_output.
  • Context-window limits and pricing are in the Model Studio console; concurrency/rate limits are on the rate-limit page (Qwen Translation Models).
  • For the gateway: translation_options passes through in the body; billing uses input_tokens/output_tokens (native) or prompt_tokens/completion_tokens (OpenAI-compatible) from usage.

  1. Provide text to translate: messages must contain a single message with role: "user"; its content is the text to translate.
  2. Set languages: specify source_lang and target_lang inside translation_options. Set source_lang: "auto" for auto-detection.
  3. Optional quality controls: Term intervention (terms), Translation memory (tm_list), Domain prompting (domains).

Limitations (verbatim intent):

  • Single-turn translation only — Qwen-MT does not support multi-turn conversations.
  • System messages not supported — global behavior is configured through translation_options, not a system-role message.
  • Max 8,192 input tokens per request.
  • Language support: qwen-mt-plus/flash/turbo = 92; qwen-mt-lite = 31.
  • Domain prompting not supported by qwen-mt-lite.
  • Streaming incremental vs non-incremental as in the per-model differences above; cannot be changed.

Regionbase_url (SDK)HTTP endpoint
Beijinghttps://dashscope.aliyuncs.com/compatible-mode/v1POST https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions
Singaporehttps://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions
Virginia (US)https://dashscope-us.aliyuncs.com/compatible-mode/v1POST https://dashscope-us.aliyuncs.com/compatible-mode/v1/chat/completions

Auth header: Authorization: Bearer $DASHSCOPE_API_KEY.

All fields are top-level in the JSON body. translation_options, top_k, repetition_penalty are non-standard for OpenAI: in the Python OpenAI SDK pass them via extra_body; in the Node.js SDK / direct HTTP they are ordinary top-level fields.

{
"model": "qwen-mt-plus",
"messages": [
{ "role": "user", "content": "<text to translate>" }
],
"stream": false,
"stream_options": { "include_usage": false },
"max_tokens": 0,
"seed": 0,
"temperature": 0.65,
"top_p": 0.8,
"top_k": 1,
"repetition_penalty": 1.0,
"translation_options": {
"source_lang": "auto",
"target_lang": "English",
"terms": [ { "source": "...", "target": "..." } ],
"tm_list": [ { "source": "...", "target": "..." } ],
"domains": "<english domain prompt>"
}
}

All request parameters (OpenAI-compatible)

Section titled “All request parameters (OpenAI-compatible)”
ParameterTypeRequiredDefaultAllowed values / rangeDescription
modelstringYesqwen-mt-plus, qwen-mt-flash, qwen-mt-lite, qwen-mt-turboModel name.
messagesarrayYesarray of exactly 1 user messageMessages providing context. Only user messages are supported.
messages[].rolestringYesuserMust be user.
messages[].contentstringYesany textSentence/text to translate.
streambooleanNofalsetrue | falseStreaming output. true → response in chunks; client reconstructs. flash/lite → incremental; plus/turbo → non-incremental (cannot be changed).
stream_optionsobjectNoStreaming config. Takes effect only when stream:true.
stream_options.include_usagebooleanNofalsetrue | falseInclude token-usage info in the last chunk.
max_tokensintegerNomodel max output lengthup to model max output lengthMax tokens to generate; output truncated if exceeded. Default and max = model’s max output length.
seedintegerNo[0, 2^31 − 1]Seed for reproducibility. Same seed + same params → consistent output.
temperaturefloatNo0.65[0, 2)Sampling temperature; higher → more diverse. Set only one of temperature/top_p.
top_pfloatNo0.8(0, 1.0]Nucleus sampling threshold; higher → more diverse. Set only one of temperature/top_p.
top_kintegerNo1>= 0; if None or > 100 → top_k disabled, only top_p appliesCandidate-set size for sampling. Non-standard OpenAI param: Python SDK → extra_body={"top_k": ...}; Node.js SDK / HTTP → top-level.
repetition_penaltyfloatNo1.0> 0, no strict upper limit; 1.0 = no penaltyPenalty for repetition in consecutive sequences; higher → less repetition. Non-standard: Python SDK → extra_body; Node.js SDK / HTTP → top-level.
translation_optionsobjectYessee belowTranslation parameters. Non-standard OpenAI param: Python SDK → extra_body={"translation_options": ...}; Node.js SDK / HTTP → top-level.

translation_options — full nested schema (identical in both protocols)

Section titled “translation_options — full nested schema (identical in both protocols)”
FieldTypeRequiredAllowed valuesDescription
source_langstringYesfull English language name (see language tables) OR autoSource language. auto → model auto-detects input language. Specifying the explicit language improves accuracy.
target_langstringYesfull English language name (see language tables)Target language.
termsarrayNoarray of objectsTerm list for the Term intervention feature (terminology override).
terms[].sourcestringYes (within terms)stringTerm in the source language.
terms[].targetstringYes (within terms)stringTerm in the target language.
tm_listarrayNoarray of objectsTranslation-memory entries for the Translation memory feature.
tm_list[].sourcestringYes (within tm_list)stringStatement in the source language.
tm_list[].targetstringYes (within tm_list)stringStatement in the target language.
domainsstringNostring (in English)Domain prompt for the Domain prompting feature. Must be in English. Not supported by qwen-mt-lite.

Note on terms / tm_list: both use the same object shape { "source": "...", "target": "..." }. For terms it is “source term → desired target term”; for tm_list it is “source sentence → its translation”.

Response shape — non-streaming (OpenAI-compatible)

Section titled “Response shape — non-streaming (OpenAI-compatible)”
{
"id": "chatcmpl-999a5d8a-f646-4039-968a-167743ae0f22",
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "I didn't laugh after watching this video.",
"refusal": null,
"role": "assistant",
"annotations": null,
"audio": null,
"function_call": null,
"tool_calls": null
}
}
],
"created": 1762346157,
"model": "qwen-mt-plus",
"object": "chat.completion",
"service_tier": null,
"system_fingerprint": null,
"usage": {
"completion_tokens": 9,
"prompt_tokens": 53,
"total_tokens": 62,
"completion_tokens_details": null,
"prompt_tokens_details": null
}
}

Response fields (non-streaming):

FieldTypeDescription
idstringUnique request ID.
choices[]arrayModel-generated content.
choices[].finish_reasonstringstop (complete) | length (output length limit reached).
choices[].indexintegerIndex in the choices array.
choices[].logprobsPresent in payload; null.
choices[].message.contentstringTranslation result.
choices[].message.rolestringFixed assistant.
choices[].message.refusalstringCurrently fixed null.
choices[].message.annotationsPresent in payload; null.
choices[].message.audioobjectCurrently fixed null.
choices[].message.function_callobjectCurrently fixed null.
choices[].message.tool_callsarrayCurrently fixed null.
createdintegerUNIX timestamp of request creation.
modelstringModel used.
objectstringAlways chat.completion.
service_tierstringCurrently fixed null.
system_fingerprintstringCurrently fixed null.
usage.prompt_tokensintegerInput tokens.
usage.completion_tokensintegerOutput tokens.
usage.total_tokensintegerprompt + completion.
usage.completion_tokens_detailsobjectCurrently fixed null.
usage.prompt_tokens_detailsobjectCurrently fixed null.

Response shape — streaming chunk (OpenAI-compatible)

Section titled “Response shape — streaming chunk (OpenAI-compatible)”

object: "chat.completion.chunk". Each chunk carries choices[].delta instead of choices[].message.

FieldTypeDescription
idstringSame ID across all chunks of the call.
choices[]arrayGenerated content. Empty [] in the last chunk when include_usage:true.
choices[].delta.contentstringTranslation increment. flash/lite → incremental (only new content); plus/turbo → non-incremental (full sequence to date).
choices[].delta.rolestringHas a value only in the first chunk (assistant); null afterward.
choices[].delta.function_callobjectCurrently fixed null.
choices[].delta.refusalobjectCurrently fixed null.
choices[].delta.tool_callsarrayCurrently fixed null.
choices[].finish_reasonstringnull during generation; then stop (complete) | length.
choices[].indexintegerIndex in choices.
choices[].logprobsnull.
createdintegerUNIX timestamp; same across chunks.
modelstringModel used.
objectstringAlways chat.completion.chunk.
service_tierstringFixed null.
system_fingerprintstringFixed null.
usageobjectnull on normal chunks; populated only in the last chunk when include_usage:true (same shape as non-streaming usage).

Example last chunk (with include_usage:true):

{"id":"chatcmpl-...","choices":[],"created":1762504029,"model":"qwen-mt-flash","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":null,"usage":{"completion_tokens":9,"prompt_tokens":56,"total_tokens":65,"completion_tokens_details":null,"prompt_tokens_details":null}}

Example incremental chunk (flash/lite):

{"id":"chatcmpl-...","choices":[{"delta":{"content":" didn","function_call":null,"refusal":null,"role":null,"tool_calls":null},"finish_reason":null,"index":0,"logprobs":null}],"created":1762504029,"model":"qwen-mt-flash","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":null,"usage":null}

Example non-incremental chunk (plus/turbo — note delta.content carries the full string so far):

{"id":"chatcmpl-...","choices":[{"delta":{"content":"I didn't laugh after","function_call":null,"refusal":null,"role":null,"tool_calls":null},"finish_reason":null,"index":0,"logprobs":null}],"created":1762346453,"model":"qwen-mt-plus","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":null,"usage":null}

RegionHTTP endpointbase_http_api_url (SDK)
BeijingPOST https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generationhttps://dashscope.aliyuncs.com/api/v1 (default, can be omitted)
SingaporePOST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/text-generation/generationhttps://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1
Virginia (US)POST https://dashscope-us.aliyuncs.com/api/v1/services/aigc/text-generation/generationhttps://dashscope-us.aliyuncs.com/api/v1

Auth header: Authorization: $DASHSCOPE_API_KEY (no Bearer, unlike OpenAI mode). DashScope Java SDK requires version 2.20.6+.

Request body shape (native DashScope HTTP)

Section titled “Request body shape (native DashScope HTTP)”

messages lives under input; all parameters live under parameters:

{
"model": "qwen-mt-plus",
"input": {
"messages": [
{ "content": "<text to translate>", "role": "user" }
]
},
"parameters": {
"translation_options": {
"source_lang": "auto",
"target_lang": "English",
"terms": [ { "source": "...", "target": "..." } ],
"tm_list": [ { "source": "...", "target": "..." } ],
"domains": "<english domain prompt>"
},
"max_tokens": 0,
"seed": 0,
"temperature": 0.65,
"top_p": 0.8,
"top_k": 1,
"repetition_penalty": 1.0,
"incremental_output": true
}
}

Parameters (native DashScope) — placement differences from OpenAI mode

Section titled “Parameters (native DashScope) — placement differences from OpenAI mode”

Same parameters, same defaults and ranges as OpenAI mode; the table notes where each goes and the Java SDK name.

ParameterTypeRequiredDefaultRangePlacementDescription / Java SDK name
modelstringYesqwen-mt-plus/flash/lite/turbotop-levelModel name.
messagesarrayYesexactly 1 user messageinside input (HTTP); SDK param messagesOne user message (role+content). Only user messages supported.
messages[].contentstringYesany textinside input.messages[]Sentence to translate.
messages[].rolestringYesuserinside input.messages[]Must be user.
max_tokensintegerNomodel max outputup to model max outputparameters (HTTP); Java SDK: maxTokensMax output tokens; truncated if exceeded.
seedintegerNo[0, 2^31 − 1]parameters (HTTP)Reproducibility seed.
temperaturefloatNo0.65[0, 2)parameters (HTTP)Set only one of temperature/top_p.
top_pfloatNo0.8(0, 1.0]parameters (HTTP); Java SDK: topPSet only one of temperature/top_p.
top_kintegerNo1>= 0; None or >100 → disabled (only top_p)parameters (HTTP); Java SDK: topKCandidate-set size.
repetition_penaltyfloatNo1.0> 0; 1.0 = no penaltyparameters (HTTP); Java SDK: repetitionPenaltyRepetition penalty.
streambooleanNotrue | falsePython SDK onlyJava SDK: use streamCall. HTTP: header X-DashScope-SSE: enable. Same incremental/non-incremental per-model behavior.
incremental_outputbooleanNotrue | falseparameters (HTTP); Java SDK: incrementalOutputIncremental streaming (effective only on flash/lite).
translation_optionsobjectYessee section A nested schemaparameters (HTTP); Java SDK: translationOptionsSame nested schema (source_lang/target_lang/terms/tm_list/domains).
result_formatstring(recommended)messageSDKSDK examples set result_format='message' (Python) / ResultFormat.MESSAGE (Java).

In the Python DashScope SDK, translation_options, max_tokens, etc. are passed as ordinary named arguments to dashscope.Generation.call(...).

Response shape (native DashScope — same for streaming and non-streaming)

Section titled “Response shape (native DashScope — same for streaming and non-streaming)”
{
"status_code": 200,
"request_id": "9b4ec3b2-6d29-40a6-a08b-7e3c9a51c289",
"code": "",
"message": "",
"output": {
"text": null,
"finish_reason": "stop",
"choices": [
{
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": "I didn't laugh after watching this video."
}
}
],
"model_name": "qwen-mt-plus"
},
"usage": {
"input_tokens": 53,
"output_tokens": 9,
"total_tokens": 62
}
}

Response fields (native DashScope):

FieldTypeDescription
status_codestring/int200 = success; other = failure. Java SDK does not return this (throws an exception; the message contains status_code + message).
request_idstringUnique request ID. Java SDK: requestId.
codestringError code; empty on success. Only the Python SDK returns this.
messagestringError message; empty on success.
outputobjectCall result.
output.textstringCurrently fixed null.
output.finish_reasonstringnull during generation | stop (natural stop) | length.
output.choices[]arrayModel output.
output.choices[].finish_reasonstringnull | stop | length.
output.choices[].message.rolestringFixed assistant.
output.choices[].message.contentstringTranslation result.
output.model_namestringModel used.
usage.input_tokensintegerInput tokens.
usage.output_tokensintegerOutput tokens.
usage.total_tokensintegerinput + output.

ModelScenarioResultSpeedCostLanguagesIncremental stream
qwen-mt-plusProfessional fields, formal documents, academic papers, technical reportsBestStandardHigh92Unsupported
qwen-mt-flashRecommended for general use. Website/app content, product descriptions, daily communication, blog postsGoodFastLow92Supported
qwen-mt-turboWill not be updated in the future; use flash insteadFairFastLow92Unsupported
qwen-mt-liteSimple, latency-sensitive scenarios: real-time chat, live comment translationBasicFastestLowest31Supported

Model selection guidance: general → flash; highest quality (professional) → plus; fastest (simple real-time) → lite. Context-window limits and pricing: Model Studio console. Concurrency limits: rate-limit page (Qwen Translation Models).


In a request, use either the English name or the Code. source_lang: "auto" enables auto-detection.

qwen-mt-plus / flash / turbo (92 languages): English(en), Chinese(zh, Simplified), Traditional Chinese(zh_tw), Russian(ru), Japanese(ja), Korean(ko), Spanish(es), French(fr), Portuguese(pt), German(de), Italian(it), Thai(th), Vietnamese(vi), Indonesian(id), Malay(ms), Arabic(ar), Hindi(hi), Hebrew(he), Burmese(my), Tamil(ta), Urdu(ur), Bengali(bn), Polish(pl), Dutch(nl), Romanian(ro), Turkish(tr), Khmer(km), Lao(lo), Cantonese(yue), Czech(cs), Greek(el), Swedish(sv), Hungarian(hu), Danish(da), Finnish(fi), Ukrainian(uk), Bulgarian(bg), Serbian(sr), Telugu(te), Afrikaans(af), Armenian(hy), Assamese(as), Asturian(ast), Basque(eu), Belarusian(be), Bosnian(bs), Catalan(ca), Cebuano(ceb), Croatian(hr), Egyptian Arabic(arz), Estonian(et), Galician(gl), Georgian(ka), Gujarati(gu), Icelandic(is), Javanese(jv), Kannada(kn), Kazakh(kk), Latvian(lv), Lithuanian(lt), Luxembourgish(lb), Macedonian(mk), Maithili(mai), Maltese(mt), Marathi(mr), Mesopotamian Arabic(acm), Moroccan Arabic(ary), Najdi Arabic(ars), Nepali(ne), North Azerbaijani(az), North Levantine Arabic(apc), Northern Uzbek(uz), Norwegian Bokmål(nb), Norwegian Nynorsk(nn), Occitan(oc), Odia(or), Pangasinan(pag), Sicilian(scn), Sindhi(sd), Sinhala(si), Slovak(sk), Slovenian(sl), South Levantine Arabic(ajp), Swahili(sw), Tagalog(tl), Ta’izzi-Adeni Arabic(acq), Tosk Albanian(sq), Tunisian Arabic(aeb), Venetian(vec), Waray(war), Welsh(cy), Western Persian(fa).

qwen-mt-lite (31 languages): English(en), Chinese(zh, Simplified), Traditional Chinese(zh_tw), Russian(ru), Japanese(ja), Korean(ko), Spanish(es), French(fr), Portuguese(pt), German(de), Italian(it), Thai(th), Vietnamese(vi), Indonesian(id), Malay(ms), Arabic(ar), Hindi(hi), Hebrew(he), Urdu(ur), Bengali(bn), Polish(pl), Dutch(nl), Turkish(tr), Khmer(km), Czech(cs), Swedish(sv), Hungarian(hu), Danish(da), Finnish(fi), Tagalog(tl), Persian(fa).

Note: in the 92-language table the Persian entry is “Western Persian” (English name Western Persian, code fa); in the 31-language qwen-mt-lite table the same code fa is listed simply as “Persian”.


E. Minimal example (OpenAI-compatible, curl)

Section titled “E. Minimal example (OpenAI-compatible, curl)”
Terminal window
curl -X POST https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-mt-flash",
"messages": [{"role": "user", "content": "No me reí después de ver este video"}],
"translation_options": {
"source_lang": "auto",
"target_lang": "English"
}
}'

Result text: I didn't laugh after watching this video.

Python (OpenAI SDK), minimal:

completion = client.chat.completions.create(
model="qwen-mt-flash",
messages=[{"role": "user", "content": "No me reí después de ver este video"}],
extra_body={"translation_options": {"source_lang": "auto", "target_lang": "English"}},
)
print(completion.choices[0].message.content)

F. Full example (OpenAI-compatible, curl) — all three features + sampling + streaming

Section titled “F. Full example (OpenAI-compatible, curl) — all three features + sampling + streaming”
Terminal window
curl -X POST https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-mt-plus",
"messages": [
{"role": "user", "content": "Este conjunto de biosensores utiliza grafeno..."}
],
"stream": true,
"stream_options": {"include_usage": true},
"max_tokens": 2048,
"seed": 1234,
"temperature": 0.65,
"top_p": 0.8,
"top_k": 1,
"repetition_penalty": 1.0,
"translation_options": {
"source_lang": "auto",
"target_lang": "English",
"terms": [
{"source": "biosensor", "target": "biological sensor"},
{"source": "grafeno", "target": "graphene"}
],
"tm_list": [
{"source": "Puede instalar el SDK a través de PyPI...", "target": "You can run the following command in PyPI to install the SDK..."}
],
"domains": "The sentence is from Ali Cloud IT domain. It mainly involves computer-related software development and usage methods... Translate into this IT domain style."
}
}'

domains is not supported by qwen-mt-lite. The domains text must be in English.

Terminal window
curl -X POST https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation \
-H "Authorization: $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-mt-plus",
"input": {
"messages": [
{"content": "Este conjunto de biosensores utiliza grafeno...", "role": "user"}
]
},
"parameters": {
"translation_options": {
"source_lang": "auto",
"target_lang": "English",
"terms": [
{"source": "biosensor", "target": "biological sensor"}
]
}
}
}'

DashScope streaming over HTTP: add header X-DashScope-SSE: enable and "incremental_output": true in parameters (incremental output effective only on flash/lite).

H. Custom prompts (alternative to translation_options)

Section titled “H. Custom prompts (alternative to translation_options)”

You can drive Qwen-MT with a plain instruction prompt in content (controlling target language, tone, domain, etc.) and omit translation_options. This is mutually exclusive with translation_options — if you supply both, translation_options may be ignored. For best results the docs recommend translation_options.

# OpenAI-compatible, no translation_options — instructions live in the prompt content.
completion = client.chat.completions.create(
model="qwen-mt-plus",
messages=[{"role": "user", "content": "<detailed translation instructions + source text>"}],
)
print(completion.choices[0].message.content)