qwen3-max
alibaba/qwen3-max — 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 slug | alibaba/qwen3-max |
| Kind | llm |
| Vendor | Alibaba |
How to call
Section titled “How to call”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/qwen3-max", # 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/qwen3-max", messages: [...] }) — see the TypeScript SDK.
Parameters — full schema
Section titled “Parameters — full schema”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/qwen3-max as shown in How to call above.
Scope / model coverage map
Section titled “Scope / model coverage map”A SINGLE OpenAI-compatible contract (POST .../compatible-mode/v1/chat/completions) covers all Qwen text-chat families. There is no per-model parameter reference; only defaults and per-feature support lists differ. The same endpoint also serves Qwen-VL, Qwen-Omni, Qwen-Math, Qwen-Coder, and third-party models (DeepSeek, Kimi, GLM, MiniMax) routed through Model Studio.
| Family / model group | Same /chat/completions contract | Notable family-specific behavior |
|---|---|---|
| qwen3.7-max / qwen3.7-plus | yes | thinking ON by default; max_completion_tokens, tool_stream, preserve_thinking supported |
| qwen3.6-max / qwen3.6-plus / qwen3.6-flash | yes | thinking ON by default; tool_stream (plus/flash); preserve_thinking (plus) |
| qwen3.5-plus / qwen3.5-flash | yes | thinking ON by default; max_completion_tokens; tool_stream; search_strategy=agent |
| qwen3-max / qwen-max | yes | qwen3-max: thinking OFF by default; search_strategy=agent, agent_max (thinking only) |
| qwen-plus / qwen-flash | yes | hybrid thinking OFF by default; presence_penalty default 0.5 in thinking mode |
| qwen3-coder-flash / -next / -plus | yes | text-chat contract; thinking-family rules apply per snapshot |
| qwen3 open-source (8b/14b/32b/30b-a3b/235b-a22b, -instruct/-thinking) | yes | n (1-4) only in non-thinking mode; logprobs supported; /think /no_think suffixes |
| Qwen-VL / Qwen3-VL | yes | adds multimodal content parts + vl_high_resolution_images, min/max/total_pixels, fps |
| Qwen-Omni (qwen3.5-omni-*, Qwen3-Omni-Flash) | yes | adds modalities, audio; audio output tokens |
| DeepSeek (v3.x/v4/r1) | yes | uses reasoning_effort (V4); enable_thinking for V4/V3.x; does NOT support top_k |
| Kimi (k2.x) | yes | thinking_budget supported; preserve_thinking (k2.6/k2.7-code); no top_k |
| GLM (4.6/4.7/5/5.1) | yes | tool_stream; top_k default 20 (Alibaba direct); thinking ON by default |
| MiniMax (M2.x/M3) | yes | uses thinking object instead of enable_thinking; no top_k |
Note:
qwen-mt-*(machine translation) is a different family. It also posts to/chat/completionsbut adds atranslation_optionsobject (source_lang/target_lang/terms/tm_list/domains) that is NOT part of this chat contract.
Critical per-model differences (quick reference)
Section titled “Critical per-model differences (quick reference)”enable_thinkingdefault is per-model — NOT a fixed global default:- thinking ON by default: qwen3.7-max/plus, qwen3.6-max/plus/flash, qwen3.5-plus/flash, all open-source qwen3.5/qwen3.6/qwen3 hybrid models, GLM series (glm-4.5+).
- thinking OFF by default: qwen3-max, qwen-max, qwen-plus, qwen-flash, DeepSeek-V4/V3.x (commercial hybrid), Kimi k2.6/k2.5.
- thinking-only (cannot disable, no
enable_thinkingneeded): qwen3.7-max-preview, qwen3-*-thinking, kimi-k2.7-code, deepseek-r1 family, MiniMax-M2.5/M2.1.
max_completion_tokenssupport: Qwen3.7-Max+, Qwen3.5-Plus+, Qwen3.5-Flash+, Kimi k2.5+, GLM glm-5+, MiniMax-M2.5+, DeepSeek (v3/r1/v3.1/v3.2/v4 list). Third-party direct-sale models excluded.n(1-4): ONLY Qwen3 non-thinking mode; setn=1whentoolsis passed.presence_penaltydefault: 1.5 / 0.5 / 0.0 / 1 by model (full table below).top_kdefault: 20 (most); Qwen3-Omni-Flash 50; GLM (Alibaba direct) 20. DeepSeek/Kimi/MiniMax do NOT supporttop_k.reasoning_effort: ONLY DeepSeek-V4 (deepseek-v4-pro/-flash). Not for Qwen.thinkingobject: ONLY MiniMax/MiniMax-M3 (Xiyu direct). Qwen usesenable_thinking.tool_stream: qwen3.7-max/plus, qwen3.6-plus/flash, qwen3.5-plus/flash + GLM (4.6/4.7/5/5.1).preserve_thinking: qwen3.7-max(+snapshots/-preview/-2026-05-17), qwen3.6-max-preview, qwen3.7-plus(-2026-05-26), qwen3.6-plus(-2026-04-02), kimi-k2.6, kimi-k2.7-code (and Moonshot-direct equivalents). NOT qwen3.5 / qwen-coder.search_strategy=agent/agent_max: limited list (qwen3.5-plus/flash, qwen3-max, qwen3.5-omni-plus/flash);agent_maxonly thinking-mode qwen3-max.logprobs: qwen-plus snapshots (not stable), qwen3-vl-plus/flash (incl. stable), Qwen3 open-source.
Endpoint / base_url
Section titled “Endpoint / base_url”OpenAI-compatible mode. Method: POST {base_url}/chat/completions.
Auth: Authorization: Bearer $DASHSCOPE_API_KEY, Content-Type: application/json.
API keys are region-specific (a key from one region does not work in another).
| Region | OpenAI-compatible base_url | Notes |
|---|---|---|
| Singapore (International) — current | https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1 | New per-workspace MaaS domain; substitute real WorkspaceId. |
| Singapore (International) — legacy | https://dashscope-intl.aliyuncs.com/compatible-mode/v1 | Docs recommend migrating to the MaaS form. |
| China (Beijing) — current | https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1 | New per-workspace MaaS domain. |
| China (Beijing) — legacy | https://dashscope.aliyuncs.com/compatible-mode/v1 | Docs recommend migrating to the MaaS form. |
| China (Hong Kong) — current | https://{WorkspaceId}.cn-hongkong.maas.aliyuncs.com/compatible-mode/v1 | Workspaces isolate API keys; create a workspace first. |
| China (Hong Kong) — legacy | https://cn-hongkong.dashscope.aliyuncs.com/compatible-mode/v1 | Docs recommend migrating to the MaaS form. |
| US (Virginia) | https://dashscope-us.aliyuncs.com/compatible-mode/v1 | Fixed domain (no WorkspaceId). |
| Germany (Frankfurt / EU) | https://{WorkspaceId}.eu-central-1.maas.aliyuncs.com/compatible-mode/v1 | Workspaces isolate API keys; create a workspace first. |
Request body — shape
Section titled “Request body — shape”{ "model": "qwen-plus", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Who are you?"} ]}DashScope extensions (enable_thinking, thinking, thinking_budget, preserve_thinking, reasoning_effort, enable_search, search_options, top_k, repetition_penalty, vl_high_resolution_images, tool_stream, enable_code_interpreter) are not standard OpenAI parameters. Via the Python OpenAI SDK they go inside extra_body={...}. Via direct HTTP/curl they go at the JSON body root.
Correctness guard:
frequency_penaltyis NOT supported in DashScope’s OpenAI-compatible mode. The source exposes onlypresence_penalty(verified: the compatibility page containsfrequency_penalty0 times). Do not addfrequency_penalty. Constraint: streaming output cannot be combined with thetoolsparameter (per compatibility page); and when usingtools, setn=1.
Request — ALL parameters (top-level)
Section titled “Request — ALL parameters (top-level)”| Parameter | Type | Required | Default | Allowed values / range | Description |
|---|---|---|---|---|---|
model | string | Yes | — | a model name (Qwen LLM commercial/open-source, Qwen-VL, Qwen-Coder, Qwen-Omni, Qwen-Math; DeepSeek, Kimi, GLM, MiniMax) | The model to call. Exact names + billing: check console. |
messages | array | Yes | — | chronological message array | Conversation history. Message types: System / User / Assistant / Tool (nested spec below). |
stream | boolean | No | false | true | false | Streaming (SSE). false returns full content after generation; true returns chunks incrementally. For non-stream calls, if the request does not finish within 300 s the service interrupts and returns content generated so far (not an error) — prefer true for long outputs. |
stream_options | object | No | — | effective only when stream=true | Streaming options. Property include_usage (boolean, default false): include token-usage info in the last chunk. |
modalities | array | No | ["text"] | ["text"] | ["text","audio"] | Qwen-Omni only. Output modalities. |
audio | object | No | — | requires modalities=["text","audio"] | Qwen-Omni only. Output audio config. Properties: voice (string, Required); format (string, Required) — only wav. |
temperature | float | No | model-dependent | 0 ≤ x < 2 | Sampling temperature. Set EITHER temperature OR top_p, not both. |
top_p | float | No | model-dependent | (0, 1.0] | Nucleus sampling. Set EITHER temperature OR top_p. |
top_k | integer | No | 20 (most); Qwen3-Omni-Flash 50; GLM (Alibaba direct) 20 | integer ≥ 0; null or >100 disables top_k (only top_p applies) | Candidate-token count for sampling. Non-standard OpenAI → extra_body. DeepSeek/Kimi/MiniMax do NOT support it. |
repetition_penalty | float | No | model-dependent | > 0, no strict upper limit; 1.0 = no penalty | Penalty on repeated consecutive sequences. Non-standard → extra_body. |
presence_penalty | float | No | model-dependent (table below) | -2.0 … 2.0 | Penalty on tokens already present. Positive reduces repetition; negative increases. Supported by commercial Qwen + open-source models. |
response_format | object | No | {"type":"text"} | {"type":"text"} | {"type":"json_object"} | Response format. For json_object you MUST also instruct JSON in the prompt or an error occurs. Property type (string, Required): text | json_object. |
max_tokens | integer | No (Deprecated) | model max output length | integer | Deprecated — use max_completion_tokens. Caps response tokens; on hit finish_reason="length". Does NOT limit chain-of-thought length. |
max_completion_tokens | integer | No | model max output length | integer | Caps total response tokens including chain-of-thought; on hit finish_reason="length". Recommended for reasoning models. Supported: Qwen3.7-Max+, Qwen3.5-Plus+, Qwen3.5-Flash+, Kimi k2.5+, GLM glm-5+, MiniMax-M2.5+, DeepSeek (v3/r1/r1-0528/v3.1/v3.2/v3.2-exp/v4-pro/v4-flash and later). Third-party direct-sale models excluded. Actual output may differ by up to 10 tokens. |
vl_high_resolution_images | boolean | No | false | true | false | Qwen-VL only. Raises image pixel cap to the 16384-token equivalent (fixed-resolution strategy, ignores max_pixels). true cap: Qwen3.7/3.6/3.5/Qwen3-VL → 16777216 px (32×32/token). Non-standard → extra_body. |
n | integer | No | 1 | 1 … 4 | Number of candidate responses. Only Qwen3 non-thinking mode. Set to 1 when tools is passed. Increases only output tokens (not input). |
enable_thinking | boolean | No | model-dependent (see per-model differences) | true | false | Toggles hybrid thinking. Models: Qwen3.7/3.6/3.5/Qwen3/Qwen3-Omni-Flash/Qwen3-VL, DeepSeek-V4-Pro/V4-Flash, DeepSeek-V3.2/V3.2-exp/V3.1, Kimi-K2.7-code (thinking-only)/K2.6/K2.5, GLM. When true, reasoning returns in reasoning_content. Non-standard → extra_body. MiniMax/MiniMax-M3 (Xiyu direct) uses thinking instead. |
thinking | object | No | {"type":"adaptive"} | type: adaptive | disabled | MiniMax/MiniMax-M3 (Xiyu direct) only. adaptive = model decides; disabled = no thinking. Non-standard → extra_body. |
preserve_thinking | boolean | No | false | true | false | Re-feed prior assistant reasoning_content into input. Models: qwen3.7-max (+ -2026-05-20/-06-08 snapshots, -preview, -2026-05-17), qwen3.6-max-preview, qwen3.7-plus(-2026-05-26), qwen3.6-plus(-2026-04-02), kimi-k2.6, kimi-k2.7-code (default-on), kimi/kimi-k2.7-code (Moonshot direct, default-on). Re-fed reasoning is billed as input. Enabling with no prior reasoning_content is not an error. Non-standard → extra_body. |
thinking_budget | integer | No | model max chain-of-thought length | integer | Max tokens for the thinking process; on reaching it the model stops reasoning and answers. Supported by Qwen3 (in thinking mode) — Qwen3.7, Qwen3.6, Qwen3.5, Qwen3-VL and the Qwen3 commercial and open-source models — and by Kimi models. Non-standard → extra_body. |
reasoning_effort | string | No | high | high | max (low/medium→high, xhigh→max) | DeepSeek-V4 only (deepseek-v4-pro/-flash). Reasoning intensity. Non-standard → extra_body. |
tool_stream | boolean | No | false | true | false; effective only when stream=true | Stream complex tool arguments (array/object types). Qwen: qwen3.7-max (text), qwen3.7-plus/qwen3.6-plus (text), qwen3.5-plus (all modalities), qwen3.6-flash/qwen3.5-flash (all modalities). GLM: glm-4.6/4.7/5/5.1. Simple args stream whenever stream=true. Non-standard → extra_body. |
enable_code_interpreter | boolean | No | false | true | false | Enables the code interpreter feature. Non-standard → extra_body. |
seed | integer | No | — | [0, 2^31−1] | RNG seed for reproducibility (same seed + unchanged params → same result when possible). |
logprobs | boolean | No | false | true | false | Return log-probabilities of output tokens (reasoning_content excluded). Models: qwen-plus snapshots (not stable), qwen3-vl-plus (incl. stable), qwen3-vl-flash (incl. stable), Qwen3 open-source. |
top_logprobs | integer | No | 0 | 0 … 5 | Number of top candidate tokens per step. Effective only when logprobs=true. |
stop | string or array | No | — | string / array of strings or token_ids | Stop words: generation stops immediately on appearance. Do NOT mix strings and token_ids in one array (e.g. ["Hello",104307] is invalid). |
tools | array | No | — | array of tool objects | Function-calling tool definitions. When a tool fires, the response carries tool_calls. Properties: type (string, Required, only function); function (object, Required) → name (string, Required; letters/digits/_/-; ≤64 tokens), description (string, Required), parameters (object, Optional, default {}, valid JSON Schema). |
tool_choice | string or object | No | auto | auto | none | {"type":"function","function":{"name":"..."}} | Tool-selection policy. none disables; object forces a specific tool. Thinking-mode models cannot force a specific tool. |
parallel_tool_calls | boolean | No | false | true | false | Enable parallel tool calling. |
enable_search | boolean | No | false | true | false | Enable web search. May increase token usage. If search does not trigger, optimize the prompt or set search_options.forced_search. Non-standard → extra_body. |
search_options | object | No | — | effective only when enable_search=true | Web-search strategy (sub-properties below). Non-standard → extra_body. |
search_options — sub-properties
Section titled “search_options — sub-properties”| Property | Type | Required | Default | Allowed values | Description |
|---|---|---|---|---|---|
forced_search | boolean | Optional | false | true | false | Force web search (true) vs. let the model decide (false). Effective only when enable_search=true. |
search_strategy | string | Optional | turbo | turbo | max | agent | agent_max | turbo = balanced; max = broader multi-engine search (slower); agent = multi-round retrieve+integrate (only qwen3.5-plus/-2026-02-15, qwen3.5-flash/-2026-02-23, qwen3-max/-2026-01-23/-2025-09-23, qwen3.5-omni-plus/-2026-03-15, qwen3.5-omni-flash/-2026-03-15); agent_max = agent + web extraction (only thinking-mode qwen3-max & qwen3-max-2026-01-23). |
enable_search_extension | boolean | Optional | false | true | false | Domain-specific search. Effective only when enable_search=true. |
DashScope-native protocol additionally exposes
enable_source(return search sources inoutput.search_info.search_results); this is a DashScope-API field, not part of the OpenAI-compatible body.
presence_penalty — defaults by model
Section titled “presence_penalty — defaults by model”- 1.5: Qwen3.7 (non-thinking), Qwen3.6 (non-thinking), Qwen3.5-Omni, Qwen3.5 (non-thinking), qwen3-max-preview (thinking), Qwen3 (non-thinking), Qwen3-Instruct/1.7b/4b (thinking), qwen-max, Qwen3-VL (non-thinking).
- 0.5: qwen3-8b/14b/32b/30b-a3b/235b-a22b (thinking), qwen-plus/qwen-plus-latest/2025-04-28 (thinking).
- 0.0: all other models; Kimi (k2.7-code/k2.6/k2.5, Alibaba & Moonshot direct); MiniMax (M2.5/M2.1).
- 1: DeepSeek deepseek-r1, deepseek-r1-0528, deepseek-r1-distill-qwen distill series.
- Other DeepSeek/Kimi/GLM/MiniMax models: no default value.
messages — message types (nested)
Section titled “messages — message types (nested)”System Message (object, Optional; place at start of array):
| Property | Type | Required | Description |
|---|---|---|---|
content | string | Yes | System instruction: role/behavior/style/constraints. |
role | string | Yes | Fixed system. |
User Message (object, Required):
| Property | Type | Required | Description |
|---|---|---|---|
content | string or array | Yes | String for text-only; array for multimodal input or explicit caching. |
role | string | Yes | Fixed user. |
content array elements (multimodal models / explicit caching) — each element has a type:
| Field | Type | Description |
|---|---|---|
type | string (Required) | text | image_url | input_audio | video (video as image list) | video_url (video file). Only some Qwen-VL accept video files; Qwen-Omni accept direct video files. |
text | string | Text (when type=text). Required when type=text. |
image_url | object | {url: string (Required)} — URL or Base64 Data URL (when type=image_url). |
input_audio | object | {data: string (Required) — URL/Base64; format: string (Required), e.g. mp3/wav} (when type=input_audio). |
video | array | List of image URLs treated as a video (when type=video). |
video_url | object | {url: string (Required)} — URL/Base64 of a video file (when type=video_url). |
fps | float (Optional) | default 2.0; range [0.1, 10] (MiniMax/MiniMax-M3: [0.2, 5], default 1). Frame-extraction rate (1 frame per 1/fps s) and inter-frame interval hint. |
min_pixels | integer (Optional) | Min pixel threshold per image/frame; upscales below it. Per-model defaults (image): Qwen3.7/3.6/3.5/Qwen3-VL 65536; Qwen3.5-Omni 24576. (Video/list defaults differ — see source.) |
max_pixels | integer (Optional) | Max pixel threshold per image/frame; downscales above it. Interacts with vl_high_resolution_images (when true, max_pixels is ignored). Per-model defaults vary (image, vl_high=false): Qwen3.7/3.6/3.5/Qwen3-VL 2621440 (max 16777216); Qwen3.5-Omni 1310720. |
total_pixels | integer (Optional) | Cap on summed pixels across all extracted video frames (keeps each frame within [min_pixels,max_pixels]). Per-model defaults: Qwen3.7/3.6/3.5 819200000 (=800000 img tokens @32×32); Qwen3.5-Omni 184549376; close-source Qwen3-VL & 235b-a22b 134217728; other Qwen3-VL open-source 67108864; others 51380224. |
cache_control | object (Optional) | Explicit caching. {type: string (Required), only ephemeral}. |
Assistant Message (object, Optional):
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
content | string | Optional | — | Reply text. May be empty if tool_calls present; otherwise required. |
role | string | Yes | — | Fixed assistant. |
partial | boolean | Optional | false | Enable partial mode (prefix continuation). |
tool_calls | array | Optional | — | From a prior response. Elements: id (string, Req), type (string, Req, only function), function (object, Req → name string Req, arguments string Req — JSON string), index (integer, Req). |
Tool Message (object, Optional):
| Property | Type | Required | Description |
|---|---|---|---|
content | string | Yes | Tool function output (must be a string; serialize structured/JSON output). |
role | string | Yes | Fixed tool. |
tool_call_id | string | Yes | ID from completion.choices[0].message.tool_calls[$index].id. |
Response — non-streaming (object: "chat.completion")
Section titled “Response — non-streaming (object: "chat.completion")”{ "choices": [ { "message": { "role": "assistant", "content": "I am a large-scale language model developed by Alibaba Cloud. My name is Qwen." }, "finish_reason": "stop", "index": 0, "logprobs": null } ], "object": "chat.completion", "usage": { "prompt_tokens": 3019, "completion_tokens": 104, "total_tokens": 3123, "prompt_tokens_details": {"cached_tokens": 2048} }, "created": 1735120033, "system_fingerprint": null, "model": "qwen-plus", "id": "chatcmpl-6ada9ed2-7f33-9de2-8bb0-78bd4035025a"}| Field | Type | Description |
|---|---|---|
id | string | Unique request identifier. |
choices | array | Generated content. Per element: finish_reason (stop|length|tool_calls), index (integer), logprobs (object), message (object). |
choices[].logprobs | object | content[] → token (string), bytes[] (array of UTF-8 bytes), logprob (float; null = extremely low), top_logprobs[] → token/bytes/logprob. |
choices[].message | object | content (string), reasoning_content (string — chain-of-thought), refusal (always null), role (always assistant), audio (always null in non-stream), function_call (deprecated, always null), tool_calls[] → id, type (function), function{name,arguments}, index. |
created | integer | Unix timestamp (s) of request creation. |
model | string | Model used. |
object | string | Always chat.completion. |
service_tier | string | Currently always null. |
system_fingerprint | string | Currently always null. |
usage | object | completion_tokens, prompt_tokens, total_tokens, completion_tokens_details{audio_tokens(null in non-stream), reasoning_tokens(null in non-stream), text_tokens}, prompt_tokens_details{audio_tokens(null in non-stream), cached_tokens, text_tokens, image_tokens, video_tokens}, cache_creation{ephemeral_5m_input_tokens, cache_creation_input_tokens}, cache_type(ephemeral when explicit cache used; otherwise absent). |
Response — streaming (object: "chat.completion.chunk")
Section titled “Response — streaming (object: "chat.completion.chunk")”Each chunk:
id(shared across all chunks of one response)choices[]with:delta:content(string, incremental),reasoning_content(string, incremental CoT),function_call(null),audio{data(Base64, incremental),expires_at(UNIX ts)} (Qwen-Omni),refusal(null),role(first chunk only),tool_calls[]{index,id,function{arguments(concatenate across chunks),name(first chunk only)},type(function)}finish_reason:stop|length|tool_calls|null(before completion)index(integer; use to reassemble per-candidate output whenn>1)logprobs(object, same shape as non-stream)
created,model,object(chat.completion.chunk),service_tier(null),system_fingerprint(null)usage: present only in the final chunk whenstream_options.include_usage=true; in that final chunkchoicesis empty.
In streaming usage, completion_tokens_details carries real audio_tokens/reasoning_tokens/text_tokens, and prompt_tokens_details carries audio_tokens (incl. audio-in-video tokens), text_tokens, video_tokens, image_tokens, cached_tokens; plus cache_creation{ephemeral_5m_input_tokens, cache_creation_input_tokens} and cache_type (ephemeral).
Final-chunk usage example:
{"id":"chatcmpl-...","choices":[],"created":1735113344,"model":"qwen-plus","object":"chat.completion.chunk","service_tier":null,"system_fingerprint":null,"usage":{"completion_tokens":17,"prompt_tokens":22,"total_tokens":39,"completion_tokens_details":null,"prompt_tokens_details":{"audio_tokens":null,"cached_tokens":0}}}Async create / poll
Section titled “Async create / poll”The OpenAI-compatible /chat/completions endpoint for Qwen text-chat is synchronous (streaming or non-streaming). There is no async create/poll job model for chat completions in this contract. (Asynchronous job-based invocation in DashScope applies to other modalities — e.g. video generation, file-based ASR — via the DashScope-native /api/v1 task endpoints, not this OpenAI-compatible chat contract.)
Billing / usage notes (gateway)
Section titled “Billing / usage notes (gateway)”usageis returned in the final chunk whenstream_options.include_usage=true(the gateway’s exact-billing path injects this).prompt_tokens_details.cached_tokensreflects context-cache hits.reasoning_content(CoT) is billed as output; whenpreserve_thinking=true, re-fed prior reasoning is billed as input.- Audio output (Qwen-Omni) and audio-in-video tokens surface under the respective
*_tokens_detailsfields.
Minimal example (curl)
Section titled “Minimal example (curl)”curl -X POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions \ -H "Authorization: Bearer $DASHSCOPE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "qwen-plus", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Who are you?"} ] }'Python (OpenAI SDK):
import osfrom openai import OpenAIclient = OpenAI( api_key=os.getenv("DASHSCOPE_API_KEY"), base_url="https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",)completion = client.chat.completions.create( model="qwen-plus", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Who are you?"}, ],)print(completion.model_dump_json())Full example (curl, with DashScope extensions)
Section titled “Full example (curl, with DashScope extensions)”curl -X POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions \ -H "Authorization: Bearer $DASHSCOPE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "qwen3.5-plus", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is the weather like in Hangzhou?"} ], "stream": true, "stream_options": {"include_usage": true}, "temperature": 0.7, "top_p": 0.8, "top_k": 20, "presence_penalty": 1.5, "repetition_penalty": 1.0, "max_completion_tokens": 2048, "seed": 1234, "stop": ["<end>"], "logprobs": true, "top_logprobs": 3, "response_format": {"type": "text"}, "enable_thinking": true, "thinking_budget": 8192, "enable_search": true, "search_options": {"forced_search": true, "search_strategy": "turbo", "enable_search_extension": false}, "tool_stream": true, "parallel_tool_calls": true, "tool_choice": "auto", "tools": [ { "type": "function", "function": { "name": "get_current_weather", "description": "Get weather for a city.", "parameters": { "type": "object", "properties": {"location": {"type": "string", "description": "City name"}}, "required": ["location"] } } } ] }'Via the Python OpenAI SDK, move non-standard fields into
extra_body={...}:enable_thinking,thinking,thinking_budget,preserve_thinking,reasoning_effort,enable_search,search_options,enable_code_interpreter,tool_stream,top_k,repetition_penalty,vl_high_resolution_images.
Python (extra_body for thinking + search + budget):
completion = client.chat.completions.create( model="qwen3.5-plus", messages=[{"role": "user", "content": "Latest Alibaba stock price?"}], stream=True, stream_options={"include_usage": True}, extra_body={ "enable_thinking": True, "thinking_budget": 8192, "enable_search": True, "search_options": {"forced_search": True, "search_strategy": "agent"}, },)