Qwen3 VL 30B A3B Instruct
alibaba/qwen3-vl-30b-a3b-instruct — 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-vl-30b-a3b-instruct |
| Kind | llm |
| Vendor | Alibaba |
| Context window | 1,000,000 tokens |
| Native model id | qwen3-vl-30b-a3b-instruct |
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-vl-30b-a3b-instruct", # 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-vl-30b-a3b-instruct", 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 qwen3-vl-30b-a3b-instruct. The gateway injects the upstream Alibaba DashScope credential and forwards the body unchanged (catalog, pricing and entitlements still apply).
curl https://api.sociaro.com/alibaba/<native-path> \ -H "Authorization: Bearer $SOCIARO_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "qwen3-vl-30b-a3b-instruct", ... }'The exact path, request body and response shape are documented in full in the schema below.
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-vl-30b-a3b-instruct (or the native id qwen3-vl-30b-a3b-instruct for the native API) as shown in How to call above.
0. Family coverage map
Section titled “0. Family coverage map”ONE door, ONE parameter contract. All slugs are invoked through either:
- OpenAI-compatible:
POST /compatible-mode/v1/chat/completions, OR - Native DashScope:
POST /api/v1/services/aigc/multimodal-generation/generation
The parameter set is identical across the family; only defaults / numeric ranges (pixel limits, thinking defaults) differ per sub-family.
| Model group (slugs) | Vision | OCR tasks | enable_thinking | top_k def | presence_penalty def | px/token | hi-res cap |
|---|---|---|---|---|---|---|---|
qwen3-vl-plus, qwen3-vl-flash (hybrid) | yes | no | toggleable (def per Supported-models table) | 20 | 1.5 (non-thinking) | 32×32 | 16,777,216 |
qwen3-vl-235b-a22b-instruct / -thinking (close-source) | yes | no | instruct=toggleable; -thinking = always-on (cannot disable) | 20 | 1.5 (non-thinking) | 32×32 | 16,777,216 |
qwen3-vl-* other open-source (8b/30b-a3b/32b × instruct/thinking) | yes | no | -thinking always-on; -instruct toggleable | 20 | 1.5 (non-thinking) | 32×32 | 16,777,216 |
qwen3.7-max-vision | yes | no | toggleable (def per Supported-models table) | 20 | 1.5 (non-thinking) | 32×32 | 16,777,216 |
qwen-vl-ocr, qwen-vl-ocr-latest, qwen-vl-ocr-2025-11-20, qwen-vl-ocr-2025-08-28, qwen-vl-ocr-2025-04-13, qwen-vl-ocr-2024-10-28 | yes (OCR-specialized) | yes (ocr_options, enable_rotate) | n/a | — | 1.5 rec. for OCR extraction | 32×32 for ocr / latest / 2025-11-20; 28×28 for older snapshots | — |
NOTE on adjacent families that ride the SAME door (NOT part of qwen-vl, but params appear because the contract is shared):
Qwen3.7/3.6/3.5text series,Qwen3.5-Omni/Qwen-Omni(modalities/audio),DeepSeek-V4(reasoning_effort),MiniMax-M3(thinking object),GLM,Kimi. Pixel rows for these are kept in the value tables for completeness because the official pixel tables enumerate them together.
Critical per-model differences (read first)
Section titled “Critical per-model differences (read first)”- OCR built-ins (
ocr_options,enable_rotate) exist ONLY onqwen-vl-ocr*and ONLY via native DashScope SDK/HTTP. In OpenAI-compatible mode you must hand-write the task prompt into thetextpart. - Pixel-per-token = 32×32 for the Qwen3-VL series,
qwen3.7-max-vision, and the Qwen3-VL-architecture OCR snapshots (qwen-vl-ocr/-latest/-2025-11-20). = 28×28 for the older OCR snapshots (-2025-08-28/-2025-04-13/-2024-10-28). This drives the hi-res cap (16,777,216 vs 12,845,056) and token counts. - Thinking:
-thinkingslugs always reason and ignoreenable_thinking=false. Hybridqwen3-vl-plus/-flashandqwen3.7-max-visionhonorenable_thinking. Per-modelenable_thinkingdefaults are listed in the “Supported models” table referenced from the chat-completions page. - OCR
max_tokens: defaults to4096forqwen-vl-ocr,qwen-vl-ocr-2025-04-13,qwen-vl-ocr-2025-08-28; raisable to 4097–8192 only by contacting the commercial manager. - Audio-from-video is NOT supported by any Qwen-VL model (only Qwen-Omni).
modalities/audiooutput params apply only to Qwen-Omni.
1. Request body — shape (OpenAI-compatible mode)
Section titled “1. Request body — shape (OpenAI-compatible mode)”{ "model": "qwen3-vl-plus", "messages": [ { "role": "user", "content": [ { "type": "image_url", "image_url": { "url": "https://.../img.jpg" }, "min_pixels": 65536, "max_pixels": 2621440 }, { "type": "text", "text": "Describe this image." } ] } ], "stream": false, "temperature": 0.7, "max_tokens": 2048, "vl_high_resolution_images": false, "enable_thinking": false, "thinking_budget": 81920}Non-standard OpenAI fields (
vl_high_resolution_images,enable_thinking,thinking_budget,top_k,repetition_penalty,enable_search,search_options,tool_stream,preserve_thinking,reasoning_effort,enable_code_interpreter,thinking): in Python SDK pass viaextra_body={...}; in Node.js SDK as top-level fields; in curl/HTTP (compatible-mode) as top-level body fields; in native DashScope HTTP inside"parameters".
1b. Request body — shape (native DashScope mode)
Section titled “1b. Request body — shape (native DashScope mode)”{ "model": "qwen3-vl-plus", "input": { "messages": [ { "role": "user", "content": [ { "image": "https://.../img.jpg", "min_pixels": 65536, "max_pixels": 2621440 }, { "text": "Describe this image." } ] } ] }, "parameters": { "vl_high_resolution_images": false, "incremental_output": false, "result_format": "message", "ocr_options": { "task": "advanced_recognition" } }}Native mode: content keys are
image/video/text(noimage_url/video_url/type); all generation params live in theparametersobject.
2. Top-level request parameters (complete table)
Section titled “2. Top-level request parameters (complete table)”| name | type | required | default | allowed / range | description |
|---|---|---|---|---|---|
model | string | yes | — | model slug | Model name (qwen3-vl-*, qwen-vl-ocr*, qwen3.7-max-vision). |
messages | array | yes | — | System / User / Assistant / Tool message objects | Conversation history in chronological order. content structure see §3. |
stream | boolean | no | false | true / false | Stream output in chunks. Recommended true for long outputs (else 300s timeout risk). |
stream_options | object | no | — | { "include_usage": bool } | Effective only when stream=true. include_usage (bool, def false) adds a final usage chunk. |
temperature | float | no | model-dependent (console) | [0, 2) | Sampling temperature. Set ONLY temperature OR top_p. |
top_p | float | no | model-dependent (console) | (0, 1.0] | Nucleus sampling. Set ONLY top_p OR temperature. |
top_k | integer | no | Qwen3-VL series, qwen3.7-max-vision & “all other models”: 20; Qwen3-Omni-Flash: 50 | integer ≥ 0; null or >100 → top_k disabled (top_p only) | Number of candidate tokens. Non-OpenAI → extra_body. DeepSeek/Kimi/MiniMax do NOT support top_k. |
repetition_penalty | float | no | model-dependent | > 0, no strict upper bound; 1.0 = no penalty | Penalty on repeated consecutive sequences. Non-OpenAI → extra_body. |
presence_penalty | float | no | Qwen3-VL (non-thinking) / qwen3.7-max-vision: 1.5; thinking modes of qwen3-8b…235b etc.: 0.5; all other: 0.0 | [-2.0, 2.0] | Presence penalty (independent of frequency). Positive → less repetition. 1.5 recommended for OCR text extraction. |
response_format | object | no | {"type":"text"} | {"type":"text"} / {"type":"json_object"} | Response format. With json_object you MUST explicitly request JSON in the prompt, else error. |
max_tokens | integer | no (Deprecated) | model max output (console) | integer | Max response tokens; on hit finish_reason=length. Does NOT limit CoT. Replacement → max_completion_tokens. (OCR qwen-vl-ocr/-2025-04-13/-2025-08-28: default 4096, raisable to 8192 by contacting commercial manager.) |
max_completion_tokens | integer | no | model max output (console) | integer | Max response tokens INCLUDING CoT. Recommended for reasoning models. |
vl_high_resolution_images | boolean | no | false | true / false | Increases the max input-image pixel limit to the pixel value of 16384 tokens. true → fixed-resolution strategy, max_pixels is IGNORED (image downscaled to the cap). Cap = 16,777,216 (Qwen3-VL series / qwen3.7-max-vision / OCR snapshots on the Qwen3-VL architecture); = 12,845,056 (older 28×28 OCR snapshots). false → limit follows max_pixels. Non-OpenAI → extra_body. Applies to image inputs. |
n | integer | no | 1 | 1..4 | Number of response candidates. Qwen3 (non-thinking) only; with tools → n=1. Increases output tokens. |
enable_thinking | boolean | no | varies per model (see Supported-models table) | true / false | Enables thinking for hybrid models. With true, CoT in reasoning_content. Non-OpenAI → extra_body. No effect on -thinking (always-on) models. DeepSeek-V4 uses reasoning_effort; MiniMax-M3 uses thinking instead. |
thinking_budget | integer | no | model max CoT length | integer | Token cap on reasoning; on exceed → CoT truncated and answer emitted immediately. Applies to Qwen3-VL. Non-OpenAI → extra_body. |
reasoning_effort | string | no | high | high / max (low,medium→high; xhigh→max) | Reasoning intensity for DeepSeek-V4 (deepseek-v4-pro / -flash). Non-OpenAI → extra_body. (Listed for door completeness; not a Qwen-VL knob.) |
thinking | object | no | {"type":"adaptive"} | type ∈ adaptive / disabled | Thinking mode for MiniMax/MiniMax-M3 (Xiyu direct) — alternative to enable_thinking. Non-OpenAI → extra_body. (Door-shared.) |
preserve_thinking | boolean | no | false | true / false | Add prior assistant reasoning_content into the input (billed). Non-OpenAI → extra_body. Supported on qwen3.7-max/-2026-05-20+ and later snapshots. |
seed | integer | no | — | [0, 2^31−1] | Seed for reproducibility. |
logprobs | boolean | no | false | true / false | Return log-probabilities. Supported on Qwen-plus snapshots (excluding stable), incl. qwen3-vl-plus / qwen3-vl-flash. reasoning_content has no logprobs. |
top_logprobs | integer | no | 0 | 0..5 | Top candidates per step. Effective only when logprobs=true. |
stop | string | array | no | — | string / array of strings OR token_id; do not mix strings and token_id in one array | Stop words/tokens — generation halts. |
tools | array | no | — | array of {type:"function", function:{name, description, parameters}} | Tools for function calling. name ≤ 64 chars, [A-Za-z0-9_-]. |
tool_choice | string | object | no | auto | auto / none / {"type":"function","function":{"name":"..."}} | Tool selection policy. Forcing a specific tool is NOT supported in thinking mode. |
parallel_tool_calls | boolean | no | false | true / false | Enable parallel tool calling. |
tool_stream | boolean | no | false | true / false | Stream complex tool arguments (only when stream=true; Qwen & GLM series). Non-OpenAI → extra_body. |
enable_search | boolean | no | false | true / false | Enable web search (increases token consumption; may need forced_search). Non-OpenAI → extra_body. |
search_options | object | no | — | see §2a | Web search strategy (effective when enable_search=true). Non-OpenAI → extra_body. |
enable_code_interpreter | boolean | no | false | true / false | Enable the Code Interpreter feature. Non-OpenAI → extra_body. (Door-shared.) |
ocr_options | object | no | — | { "task": <enum>, "task_config": {...} } | Native DashScope SDK/HTTP only (absent in OpenAI mode). Built-in OCR tasks. See §4. |
modalities | array | no | ["text"] | ["text"] / ["text","audio"] | Output modalities. Qwen-Omni only (NOT Qwen-VL). |
audio | object | no | — | {voice (required), format (required, only "wav")} | Output audio voice/format. Qwen-Omni only, requires modalities=["text","audio"]. |
2a. search_options sub-schema
Section titled “2a. search_options sub-schema”| property | type | required | default | allowed | description |
|---|---|---|---|---|---|
forced_search | boolean | no | false | true / false | Force web search (only when enable_search=true). |
search_strategy | string | no | turbo | turbo / max / agent / agent_max | Search scale. turbo=balanced; max=multi-engine; agent=multi-round (qwen3.5-plus/flash, qwen3-max snapshots, qwen3.5-omni-plus/flash); agent_max=agent+web extraction (thinking mode of qwen3-max / qwen3-max-2026-01-23 only). |
enable_search_extension | boolean | no | false | true / false | Domain-specific search (only when enable_search=true). Non-OpenAI → extra_body. |
2b. Native-DashScope parameters (not on the OpenAI-compatible page)
Section titled “2b. Native-DashScope parameters (not on the OpenAI-compatible page)”These live in the parameters object on the native DashScope generation API (and in the Python/Java/Node native SDKs).
| name | type | default | scope | description |
|---|---|---|---|---|
incremental_output | boolean | false | native only | Native streaming: emit incremental deltas instead of the full cumulative text each chunk. The OpenAI-compatible equivalent is stream + stream_options (deltas are returned natively in compatible mode). |
result_format | string | message | native only | Shape of the returned data: message (OpenAI-style messages) or text. Must be message when using tools (function calling). |
vl_enable_image_hw_output | boolean | false | native only | Return the height/width of the scaled input image. Casing differs by SDK: vl_enable_image_hw_output in the HTTP parameters object and the Python SDK; vlEnableImageHwOutput in the Java SDK (≥ 2.20.8). |
max_frames | integer | model-dependent | native only | Cap on the number of extracted video frames. Not supported on the OpenAI-compatible path — that path uses each model’s default. Default/max are model-dependent (8000 for the top qwen3.x series). |
3. messages[].content structure (multimodal input)
Section titled “3. messages[].content structure (multimodal input)”content is a string (text only) or an array of part objects.
| field | type | required | values / description |
|---|---|---|---|
type | string | yes (OpenAI mode) | text / image_url / input_audio / video / video_url. (Native mode: no type; the part key IS the type.) |
text | string | when type=text | Input text. |
image_url | object | when type=image_url | { "url": <string, required> }. url = HTTP(S) or Base64 Data URL. |
input_audio | object | when type=input_audio | { "data": <url/base64, required>, "format": <"mp3"/"wav", required> }. (Omni.) |
video | array | when type=video | Image list (frames), e.g. ["https://f1.jpg", ...]. |
video_url | object | when type=video_url | { "url": <required> } + optional fps. Only some Qwen-VL accept a video file. |
fps | float | no (inside video/video_url) | [0.1, 10], default 2.0. Frames extracted per second (1 frame each 1/fps s); also informs the model of inter-frame interval. (MiniMax-M3: range [0.2, 5], default 1.) |
min_pixels | integer | no (inside image/video part) | Lower pixel threshold; below → upscale. Defaults see §3a. |
max_pixels | integer | no (inside image/video part) | Upper pixel threshold; above → downscale. Defaults see §3a. |
total_pixels | integer | no (inside video/image-list part) | Caps total pixels across ALL extracted frames (px/frame × frame count); per-frame stays within [min_pixels, max_pixels]. Lower it for long videos to cut tokens. Defaults/max see §3a. |
enable_rotate | boolean | no (inside image part, OCR) | false default. Auto image-rotation correction. Native DashScope SDK/HTTP only, qwen-vl-ocr. |
cache_control | object | no (on a system- or user-message content block) | { "type": "ephemeral" } — marks the block for explicit context caching. Gated to a supported-model subset. Available on the native path AND the OpenAI-/Anthropic-compatible paths. Min 1024 tokens per cached block, up to 4 markers per request, 5-minute TTL. |
Native content keys: {"image": <url>}, {"video": <url|list>}, {"text": <str>} (instead of image_url/video_url/type).
3a. min_pixels / max_pixels / total_pixels / vl_high_resolution_images per-model values
Section titled “3a. min_pixels / max_pixels / total_pixels / vl_high_resolution_images per-model values”min_pixels — IMAGE input (default = minimum):
| Family | default = min |
|---|---|
Qwen3.7 / Qwen3.6 / Qwen3.5 / Qwen3-VL / qwen3.7-max-vision | 65536 |
Qwen3.5-Omni | 24576 |
min_pixels — VIDEO file / image-list input:
| Family | default | min |
|---|---|---|
Qwen3.7/3.6/3.5-Omni/3.5/Qwen3-VL (close-source+open-source), qwen3.7-max-vision | 65536 | 4096 |
max_pixels — IMAGE input, vl_high_resolution_images=false:
| Family | default | max |
|---|---|---|
Qwen3.7/3.6/3.5 / Qwen3-VL / qwen3.7-max-vision | 2621440 | 16777216 |
Qwen3.5-Omni | 1310720 | 16777216 |
vl_high_resolution_images=true → max_pixels invalid, fixed cap:
| Family | fixed cap (px) | px/token |
|---|---|---|
Qwen3.7/3.6/3.5-Omni/3.5 / Qwen3-VL / qwen3.7-max-vision / OCR snapshots on the Qwen3-VL arch | 16777216 (16384×32×32) | 32×32 |
older 28×28 OCR snapshots (qwen-vl-ocr-2025-08-28 / -2025-04-13 / -2024-10-28) | 12845056 (16384×28×28) | 28×28 |
total_pixels — VIDEO file / image-list (default = max, per token math at 32×32):
| Family | default = max | tokens |
|---|---|---|
Qwen3.7 / Qwen3.6 / Qwen3.5 series | 819200000 | 800,000 image tokens |
Qwen3.5-Omni | 184549376 | 180,224 image tokens |
close-source Qwen3-VL (qwen3-vl-235b-a22b-thinking / -instruct), qwen3.7-max-vision | 134217728 | 131,072 image tokens |
other open-source Qwen3-VL (8b / 30b-a3b / 32b) | 67108864 | 65,536 image tokens |
Image-token formula: tokens = h_bar*w_bar / token_pixels + 2 (h_bar, w_bar = scaled dims, multiples of 32 or 28).
4. OCR — ocr_options (native DashScope SDK/HTTP only; qwen-vl-ocr*)
Section titled “4. OCR — ocr_options (native DashScope SDK/HTTP only; qwen-vl-ocr*)”"ocr_options": { "task": "key_information_extraction", "task_config": { "result_schema": { "Ride Date": "ride date, format YYYY-MM-DD", "Invoice Code": "invoice code", "Invoice Number": "invoice number" } }}task value | Purpose | Built-in prompt (auto-injected) | Output format |
|---|---|---|---|
advanced_recognition | Hi-precision recognition + text-line localization | ”Locate all text lines and return the coordinates of the rotated rectangle ([cx, cy, width, height, angle]).” | Plain text OR JSON in ocr_result.words_info[] with text, location ([x1,y1..x4,y4], 4 vertices TL→TR→BR→BL, origin top-left), rotate_rect ([center_x, center_y, width, height, angle], angle ∈ [-90, 90]). Requires versions later than qwen-vl-ocr-2025-08-28 or latest. |
key_information_extraction | KIE from receipts/forms/certs | ”Assume you are an information extraction expert. You are given a JSON schema. Fill the value part of this schema with information from the image…” | JSON object in ocr_result.kv_result. With task_config.result_schema (key→hint, up to 3 nested layers) → custom fields; without schema → all detected fields. |
table_parsing | Table parsing | ”…converting tables from a synthetic image into HTML. Transcribe each table using <tr> and <td> tags…merged cells accurately represented…” | Text in HTML (<tr>/<td>, merged cells). |
document_parsing | Document/scan/PDF-as-image parsing | ”…transcribe the text, tables, and equations…into LaTeX format without modification…” | Text in LaTeX. |
formula_recognition | Formula recognition | ”Extract and output the LaTeX representation of the formula from the image, without any additional text or descriptions.” | Text in LaTeX. |
text_recognition | General text (zh/en) | “Please output only the text content from the image without any additional descriptions or formatting.” | Plain text. |
multi_lan | Multilingual text (ar, fr, de, it, ja, ko, pt, ru, es, vi) | “Please output only the text content from the image without any additional descriptions or formatting.” | Plain text. |
task_config properties: result_schema (object) — JSON field template (key → description/hint) for KIE custom-field extraction; supports up to 3 nested layers; omit to extract all fields.
In the OpenAI-compatible SDK these built-in tasks are NOT available as a parameter — hand-write the task’s fixed prompt into
text. Default prompt whentextis empty:"Please output only the text content from the image without any additional descriptions or formatting."
enable_rotate (boolean, default false) — auto image-rotation correction; passed inside the image content-item (NOT inside ocr_options); native DashScope SDK/HTTP only.
OCR snapshots (verified on the OCR page): qwen-vl-ocr, qwen-vl-ocr-latest, qwen-vl-ocr-2025-11-20 (Qwen3-VL architecture, 32×32 px/token), qwen-vl-ocr-2025-08-28, qwen-vl-ocr-2025-04-13, qwen-vl-ocr-2024-10-28.
OCR max_tokens: qwen-vl-ocr / -2025-04-13 / -2025-08-28 default 4096, raisable to 4097–8192 only via commercial manager.
5. Response — shape (chat.completion, non-streaming, OpenAI mode)
Section titled “5. Response — shape (chat.completion, non-streaming, OpenAI mode)”{ "id": "chatcmpl-6ada9ed2-...", "object": "chat.completion", "created": 1735120033, "model": "qwen3-vl-plus", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "These images show a person and a dog on a beach...", "reasoning_content": null, "tool_calls": null, "refusal": null }, "finish_reason": "stop", "logprobs": null } ], "usage": { "prompt_tokens": 1277, "completion_tokens": 81, "total_tokens": 1358, "prompt_tokens_details": { "image_tokens": 2497, "text_tokens": 209, "cached_tokens": 2048 }, "completion_tokens_details": { "text_tokens": 81 } }, "system_fingerprint": null, "service_tier": null}| response field | type | description |
|---|---|---|
id | string | Unique request identifier. |
object | string | Always chat.completion. |
created | integer | Unix timestamp (s). |
model | string | Model used. |
choices[] | array | Output candidates (1..n). |
choices[].index | integer | Index in choices. |
choices[].finish_reason | string | stop (natural / stop word) / length (max_tokens hit) / tool_calls (tool invoked). |
choices[].logprobs | object|null | content[] with token, bytes, logprob, top_logprobs[]. |
choices[].message.role | string | Always assistant. |
choices[].message.content | string | Answer text. |
choices[].message.reasoning_content | string|null | Chain of thought (thinking mode). |
choices[].message.tool_calls[] | array | {id, type:"function", function:{name, arguments(JSON string)}, index}. |
choices[].message.refusal / audio / function_call | — | null (function_call deprecated). |
usage.prompt_tokens / completion_tokens / total_tokens | integer | Token accounting. |
usage.prompt_tokens_details.image_tokens / text_tokens / cached_tokens | integer | Input breakdown (image tokens, cached tokens). |
usage.completion_tokens_details.text_tokens | integer | Output breakdown. |
system_fingerprint / service_tier | string|null | Currently null. |
5b. Response — shape (native DashScope)
Section titled “5b. Response — shape (native DashScope)”{ "output": { "choices": [ { "finish_reason": "stop", "message": { "role": "assistant", "content": [ { "text": "..." } ] } } ] }, "usage": { "output_tokens": 81, "input_tokens": 1277, "image_tokens": 2497, "input_tokens_details": { "text_tokens": 33, "image_tokens": 1377 }, "output_tokens_details": { "text_tokens": 38 }, "total_tokens": 1358 }, "request_id": "ccf845a3-..."}OCR
advanced_recognition: insideoutput.choices[0].message.content[0], alongsidetext, there isocr_result.words_info[](see §4). KIE returnsocr_result.kv_result.
6. Minimal example (OpenAI-compatible, single image)
Section titled “6. Minimal example (OpenAI-compatible, single image)”from openai import OpenAIimport osclient = 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="qwen3-vl-plus", messages=[{"role": "user", "content": [ {"type": "image_url", "image_url": {"url": "https://.../img.jpg"}}, {"type": "text", "text": "What is in this image?"}, ]}],)print(completion.choices[0].message.content)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-vl-plus","messages":[{"role":"user","content":[ {"type":"image_url","image_url":{"url":"https://.../img.jpg"}}, {"type":"text","text":"What is in this image?"}]}]}'7. Full example (hi-res + thinking + video + per-image pixel limits + total_pixels, streaming)
Section titled “7. Full example (hi-res + thinking + video + per-image pixel limits + total_pixels, streaming)”completion = client.chat.completions.create( model="qwen3-vl-235b-a22b-thinking", messages=[{"role": "user", "content": [ {"type": "image_url", "image_url": {"url": "https://.../doc.jpg"}, "min_pixels": 65536, "max_pixels": 16384 * 32 * 32}, {"type": "video_url", "video_url": {"url": "https://.../clip.mp4"}, "fps": 2, "min_pixels": 65536, "max_pixels": 2621440, "total_pixels": 134217728}, {"type": "text", "text": "Solve the problem in the image and summarize the video."}, ]}], stream=True, temperature=0.7, top_p=0.8, # NOTE: official guidance — set only temperature OR top_p seed=1234, max_completion_tokens=4096, stream_options={"include_usage": True}, extra_body={ "vl_high_resolution_images": True, # max_pixels ignored "enable_thinking": True, # -thinking models always reason regardless "thinking_budget": 81920, "top_k": 20, "repetition_penalty": 1.05, },)for chunk in completion: if not chunk.choices: print(chunk.usage) else: d = chunk.choices[0].delta if getattr(d, "reasoning_content", None): print(d.reasoning_content, end="") elif d.content: print(d.content, end="")8. Full example (OCR built-in KIE task with custom schema, native DashScope)
Section titled “8. Full example (OCR built-in KIE task with custom schema, native DashScope)”import os, dashscopedashscope.base_http_api_url = 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1'messages = [{"role": "user", "content": [{ "image": "http://.../receipt.jpg", "min_pixels": 32 * 32 * 3, # 3072 "max_pixels": 32 * 32 * 8192, # 8388608 "enable_rotate": False, # auto-rotation correction (OCR, native only)}]}]response = dashscope.MultiModalConversation.call( api_key=os.getenv('DASHSCOPE_API_KEY'), model='qwen-vl-ocr-2025-11-20', messages=messages, ocr_options={ "task": "key_information_extraction", "task_config": {"result_schema": { "Ride Date": "ride date, format YYYY-MM-DD", "Invoice Code": "invoice code", "Invoice Number": "invoice number" }} },)print(response["output"]["choices"][0]["message"].content[0]["text"])# native HTTP (advanced_recognition with text localization)curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation' \ --header "Authorization: Bearer $DASHSCOPE_API_KEY" --header 'Content-Type: application/json' \ --data '{"model":"qwen-vl-ocr-2025-11-20", "input":{"messages":[{"role":"user","content":[ {"image":"https://.../book.jpg","min_pixels":3072,"max_pixels":8388608,"enable_rotate":false}]}]}, "parameters":{"ocr_options":{"task":"advanced_recognition"}}}'9. Endpoints / Auth / input limits (vision)
Section titled “9. Endpoints / Auth / input limits (vision)”- OpenAI-compatible:
https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions(Singapore;ap-southeast-1). Beijing:https://dashscope.aliyuncs.com/compatible-mode/v1(andhttps://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/...for workspace-scoped). - Native:
.../api/v1/services/aigc/multimodal-generation/generation. Auth:Authorization: Bearer $DASHSCOPE_API_KEY. - Image: both sides > 10 px; long/short ratio ≤ 200:1; keep ≤ 8K (7680×4320). Formats < 4K: BMP/JPEG/PNG/TIFF/WEBP/HEIC; 4K–8K: only JPEG/JPG/PNG. Size: public URL ≤ 20 MB (Qwen3.7/3.6/3.5) / ≤ 10 MB (others); local ≤ 10 MB; Base64 ≤ 10 MB (source < 7 MB pre-encode).
- Image count: Qwen3-VL plus/flash + 235b-a22b instruct/thinking → image-list 4..2000, URL/path up to 2000; other open-source Qwen3-VL (8b / 30b-a3b / 32b) → 4..512, URL/path up to 256; Base64 up to 250.
- Video: Qwen3-VL up to 2 GB (URL), 2 s..1 h (plus/flash/235b) / up to 20 min (open-source); Base64 < 10 MB; local ≤ 100 MB. Up to 64 videos. Audio-from-video NOT supported (Qwen-Omni only).
max_frames(frame cap) — native DashScope SDK only. - Timeout: non-streaming aborts at 300 s, returns partial (header
x-dashscope-partialresponse: true). For long outputs usestream=true.