Qwen4-Max
Qwen’s flagship model: a 2.4-trillion-parameter sparse Mixture-of-Experts transformer with 71 billion active per token. Reads text, images and video and returns text, across a one-million-token window. Built for agentic work, coding and complex office tasks, with deliberation enabled by default and switchable off, plus tool calling, structured output and prompt caching.

- Tools
- Vision
- Video input
- Reasoning
- Reasoning
- On by default
reasoning_effort- none
- low
- medium
- high
Can be turned off
- Tool choice
requiredfunction
Use Qwen4-Max in VS Code, Cursor and Antigravity
DEVUP Code, the DEVUP AI extension, is free to install. Requests are paid from your DEVUP balance.
Qwen4-Max

Qwen4-Max is Qwen's flagship model and the first of the Qwen4 generation. It reads text, images and video, and writes text. The design targets long-horizon professional work: agentic systems, coding, industrial and office workflows, and multi-step research.
It is a sparse Mixture-of-Experts transformer with a 2.4-trillion-parameter backbone, 71 billion active for any single token, and a further 328 billion N-gram embedding parameters. Activating 71B of 2.4T means a frontier-scale knowledge base running at the compute cost of a far smaller model.
Weights are closed; the model is available through the API only. Qwen has said smaller Qwen4 models will be open-sourced later.
At a glance
| Model type | Multimodal autoregressive transformer |
| Backbone parameters | 2.4T |
| Active parameters per token | 71B |
| Embedding parameters | 328B (N-gram) |
| Architecture | Sparse Mixture-of-Experts |
| Input | Text, images, video |
| Output | Text |
| Maximum context size | 1,000,000 tokens |
| Maximum input, reasoning off | 991,808 tokens |
| Maximum input, reasoning on | 983,616 tokens |
| Maximum output, reasoning off | 131,072 tokens |
| Maximum reasoning + answer combined | 262,144 tokens |
| Weights | Closed |
Maximum context size counts input and output together.
Architecture

The Qwen4 architecture upgrades the sparse MoE design in three places at once — attention, residual connections, and embeddings — to improve efficiency, capacity and training stability together.
GDN + Qwen Sparse Attention (QSA). Three Gated DeltaNet layers compress history into fixed-size states feeding every QSA layer. QSA then uses a lightweight indexer to select relevant context at micro-block granularity, which cuts both attention and indexing cost as sequences grow. This is what makes a million-token window tractable rather than merely declared.
Gated Residual (GR). Four parallel residual branches carry information between layers through dynamic read and write gates, strengthening information flow and stabilising training.
N-gram Embedding. Context-based lookups at the second layer supply representations of local token patterns, expanding capacity for very little extra computation.
Qwen reports that training at 2.4T parameters ran without loss spikes, and attributes that stability mainly to these architectural changes.
On in-house base-model evaluations across Knowledge, Code, QA and STEM, Qwen4-Max-Base reports roughly 5–13% lower bits-per-byte than the previous generation while activating 25% fewer parameters.
Getting started
curl https://api.devupai.com/v1/chat/completions \
-H "Authorization: Bearer $DEVUP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "Qwen/Qwen4-Max",
"messages": [
{ "role": "user", "content": "Outline a migration plan from a monolith to event-driven services." }
]
}'Python, using the OpenAI client:
from openai import OpenAI
import os
client = OpenAI(
api_key=os.environ["DEVUP_API_KEY"],
base_url="https://api.devupai.com/v1",
)
response = client.chat.completions.create(
model="Qwen/Qwen4-Max",
messages=[
{"role": "user", "content": "Outline a migration plan from a monolith to event-driven services."}
],
)
print(response.choices[0].message.content)Node.js:
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.DEVUP_API_KEY,
baseURL: "https://api.devupai.com/v1",
});
const response = await client.chat.completions.create({
model: "Qwen/Qwen4-Max",
messages: [
{ role: "user", content: "Outline a migration plan from a monolith to event-driven services." },
],
});
console.log(response.choices[0].message.content);Reasoning
Deliberation runs by default. It arrives as readable text in the response's reasoning field, with a count of the tokens it consumed, so you can show it, log it, or discard it.
Effort is set through reasoning_effort. The default is high.
| Level | Behaviour | Fits |
|---|---|---|
none | Reasoning switched off | Classification, extraction, routing, formatting |
low | Short deliberation | Light judgement calls |
medium | Balanced | Chat, drafting, everyday analysis |
high | Extended deliberation — the default | Planning, debugging, multi-constraint problems |
xhigh | Maximum deliberation | Research-grade reasoning, hard proofs, deep agent planning |
Qwen's own documentation names three levels — low, high and xhigh — and sets a default reasoning budget of 131,072 tokens. The two extra levels above are accepted on this endpoint and behave as described, but they are not part of the published set; if you need guaranteed behaviour, stay with the documented three and switch reasoning off through the parameter below.
curl https://api.devupai.com/v1/chat/completions \
-H "Authorization: Bearer $DEVUP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "Qwen/Qwen4-Max",
"reasoning_effort": "xhigh",
"messages": [
{ "role": "user", "content": "Three servers hold 40%, 35% and 25% of traffic. The first fails and its load splits in proportion to the others. What share does each now carry?" }
]
}'Reading the deliberation and its cost:
response = client.chat.completions.create(
model="Qwen/Qwen4-Max",
reasoning_effort="high",
messages=[{"role": "user", "content": "Why does this query plan do a full scan?"}],
)
message = response.choices[0].message
print(getattr(message, "reasoning", None))
print(response.usage.completion_tokens_details.reasoning_tokens)
print(message.content)Two ways to switch deliberation off, both producing a response with no reasoning:
{ "reasoning_effort": "none" }{ "reasoning": { "enabled": false } }Budgeting around deliberation
Reasoning tokens are drawn from the same output budget as the answer, and they are spent first. A request with max_tokens set tightly and effort left high can stop before the answer begins — the reply comes back with finish_reason: "length" and empty or truncated content.
Three ways out, in order of preference:
- Raise
max_tokensso the budget covers deliberation plus the answer. - Lower
reasoning_effortfor work that does not need it. - Set
reasoning_efforttononefor anything purely mechanical.
The ceilings are asymmetric and worth memorising: with reasoning off, output can reach 131,072 tokens; with reasoning on, deliberation and answer share a combined 262,144. A long chain of thought therefore eats directly into how much answer is left.
This matters most with response_format, where a truncated reply is also invalid JSON.
Images
Images are passed as image_url content parts.
curl https://api.devupai.com/v1/chat/completions \
-H "Authorization: Bearer $DEVUP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "Qwen/Qwen4-Max",
"messages": [{
"role": "user",
"content": [
{ "type": "text", "text": "Which bar in this chart breaks the trend, and by how much?" },
{ "type": "image_url", "image_url": { "url": "https://example.com/chart.png" } }
]
}]
}'A data URI works in place of a hosted link:
{ "type": "image_url", "image_url": { "url": "data:image/png;base64,iVBORw0KGgo..." } }Several images in one message, each as its own part — useful for comparisons and for a document split into pages:
response = client.chat.completions.create(
model="Qwen/Qwen4-Max",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "These are two versions of the same screen. List every difference."},
{"type": "image_url", "image_url": {"url": "https://example.com/before.png"}},
{"type": "image_url", "image_url": {"url": "https://example.com/after.png"}},
],
}],
)PDF files are not accepted. Convert a document's pages to images first, and send them in page order so references like "the table on page 3" resolve correctly.
Video
Video is passed as a video_url content part, as a hosted link or a data URI.
curl https://api.devupai.com/v1/chat/completions \
-H "Authorization: Bearer $DEVUP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "Qwen/Qwen4-Max",
"messages": [{
"role": "user",
"content": [
{ "type": "text", "text": "Describe what happens in this clip, in order." },
{ "type": "video_url", "video_url": { "url": "https://example.com/clip.mp4" } }
]
}]
}'response = client.chat.completions.create(
model="Qwen/Qwen4-Max",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "At what point does the user get stuck, and what did they click just before?"},
{"type": "video_url", "video_url": {"url": "https://example.com/session-recording.mp4"}},
],
}],
)A data URI works for short clips:
{ "type": "video_url", "video_url": { "url": "data:video/mp4;base64,AAAAIGZ0eXBpc29t..." } }Working with video sensibly
Video consumes far more of the window than text, and a long clip can fill a large part of it on its own. Three habits keep this manageable:
- Trim before sending. A thirty-second segment that contains the answer beats a ten-minute recording that buries it.
- Prefer a hosted link for anything beyond a few seconds; base64 inflates the payload by roughly a third in transit.
- Ask a located question. "When does X happen and what precedes it" gets a more useful answer than "summarise this video".
Audio is not an accepted input, so a clip's soundtrack is not read. For spoken content, transcribe separately and pass the transcript as text alongside the video.
Typical uses: screen recordings and bug reproductions, UI walkthroughs, physical inspection footage, sports or process analysis, and lecture or demo summarisation.
Tool calling
Functions are declared in tools, and tool_choice accepts auto, required, none or a named function. Several calls can come back in a single response when a request needs them.
curl https://api.devupai.com/v1/chat/completions \
-H "Authorization: Bearer $DEVUP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "Qwen/Qwen4-Max",
"messages": [{ "role": "user", "content": "Compare the weather in Seattle and Boston." }],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Current weather for a city",
"parameters": {
"type": "object",
"properties": { "city": { "type": "string" } },
"required": ["city"]
}
}
}],
"tool_choice": "auto"
}'That request returns two calls to get_weather, one per city — they are independent, so run them concurrently rather than in sequence.
The full round trip
import json
tools = [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Current weather for a city",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"],
},
},
}]
messages = [{"role": "user", "content": "Compare the weather in Seattle and Boston."}]
first = client.chat.completions.create(
model="Qwen/Qwen4-Max",
messages=messages,
tools=tools,
tool_choice="auto",
)
reply = first.choices[0].message
messages.append(reply)
for call in reply.tool_calls or []:
args = json.loads(call.function.arguments)
result = get_weather(args["city"]) # your function
messages.append({
"role": "tool",
"tool_call_id": call.id,
"content": json.dumps(result),
})
second = client.chat.completions.create(
model="Qwen/Qwen4-Max",
messages=messages,
tools=tools,
)
print(second.choices[0].message.content)The assistant message carrying the tool calls must go back into the history before the tool results, and every tool_call_id must match. A missing one breaks the turn.
Forcing a named function — useful when the next step is fixed and you only want the arguments filled in:
{ "tool_choice": { "type": "function", "function": { "name": "get_weather" } } }tool_choice: "required" forces some call without naming which; "none" keeps the tools visible as context while blocking the model from calling them.
Writing tool definitions that work
- Describe when to use a function, not just what it does. "Current weather for a city" is weaker than "Current weather for a city; call this whenever the user asks about conditions, temperature or forecasts."
- Mark every genuinely needed parameter as
required. Optional parameters with no default invite guessing. - Use
enumfor closed sets instead of describing the options in prose. - Return errors as data the model can act on (
{"error": "city not found", "suggestions": [...]}) rather than as an exception that ends the loop.
Tool use at scale is where this model is reported strongest: Qwen's own showcases describe agent runs making hundreds of tool calls in a single task.
Structured output
Both json_object and json_schema are accepted. Prefer json_schema with strict: true — it constrains the shape rather than merely requesting it.
curl https://api.devupai.com/v1/chat/completions \
-H "Authorization: Bearer $DEVUP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "Qwen/Qwen4-Max",
"messages": [
{ "role": "user", "content": "Extract the carrier, tracking number and delivery date from: DHL, 4729118026, arriving 2026-12-09." }
],
"max_tokens": 4096,
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "shipment",
"strict": true,
"schema": {
"type": "object",
"properties": {
"carrier": { "type": "string" },
"tracking_number": { "type": "string" },
"delivery_date": { "type": "string" }
},
"required": ["carrier", "tracking_number", "delivery_date"],
"additionalProperties": false
}
}
}
}'Extraction from an image, combining the two features:
response = client.chat.completions.create(
model="Qwen/Qwen4-Max",
reasoning_effort="none",
max_tokens=2048,
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "Extract every line item from this receipt."},
{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,/9j/4AAQ..."}},
],
}],
response_format={
"type": "json_schema",
"json_schema": {
"name": "receipt",
"strict": True,
"schema": {
"type": "object",
"properties": {
"merchant": {"type": "string"},
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"description": {"type": "string"},
"quantity": {"type": "number"},
"unit_price": {"type": "number"},
},
"required": ["description", "quantity", "unit_price"],
"additionalProperties": False,
},
},
"total": {"type": "number"},
},
"required": ["merchant", "items", "total"],
"additionalProperties": False,
},
},
},
)Notes that save debugging time:
- Keys may arrive in a different order from the schema. The values and types follow it; the order does not. Parse, never pattern-match on position.
additionalProperties: falseis what stops extra keys appearing.- Set
reasoning_efforttononefor pure extraction. Deliberation adds cost and latency without improving a mechanical mapping. - Always check
finish_reason."length"means the budget ran out and the JSON is incomplete.
Streaming
stream = client.chat.completions.create(
model="Qwen/Qwen4-Max",
messages=[{"role": "user", "content": "Explain consistent hashing."}],
stream=True,
)
for chunk in stream:
delta = chunk.choices[0].delta
if delta.content:
print(delta.content, end="", flush=True)With reasoning on, deliberation streams before the answer. Render it in a separate region from the final content, or hide it until the answer begins — mixing the two confuses readers who do not expect the model to think out loud.
Prompt caching
A repeated opening section of a conversation is served from cache and billed at the cached-input rate. The rule is simple: stable content first, variable content last.
messages = [
{"role": "system", "content": LONG_SYSTEM_INSTRUCTIONS}, # unchanged every call
{"role": "user", "content": REFERENCE_DOCUMENTS}, # unchanged every call
{"role": "user", "content": todays_question}, # changes
]The cache matches on an exact prefix. One edited character near the top invalidates everything after it, so anything that varies — a timestamp, a user ID, a request counter — belongs at the end, never in the system message.
This compounds with long context: a half-million-token reference set is expensive once and cheap thereafter.
Long context
The window holds a million tokens across input and output combined — an entire codebase, a full case file, or a long conversation with every document and screenshot it refers to.
Practical limits worth knowing:
- Media counts against the same budget as text. Images and video consume it quickly.
- Leave headroom for the answer and for deliberation tokens when reasoning is on.
- Position still matters. Put the question near the end, after the material it refers to.
- A million tokens is a ceiling, not a target. Retrieval that sends the right ten thousand tokens usually beats sending everything.
Performance

Figures below are grouped by who produced them. Qwen ran most of these itself; treat self-reported numbers as a vendor's claim rather than an independent measurement, and measure on your own task before relying on either set.
Reported by Qwen
| Benchmark | Score |
|---|---|
| DeepSWE v1.1 (agentic coding) | 75.7 |
| Terminal-Bench 4.0 (terminal coding) | 48.5 |
| ProgramBench (software replication) | 31.5 |
| Agents' Last Exam v1.1 | 46.7 |
| Humanity's Last Exam | 51.7 |
| HealthBench Professional | 60.0 |
| Chartography (chart understanding) | 54.2 |
| Video-Index (video understanding) | 68.1 |
| Work360 (Qwen's own industry-task benchmark) | 52.69 |
Work360 is Qwen's own framework for modelling professional work, with a taxonomy of 26 top-level domains, 182 subdomains and 721 specialised fields. The score rose from 47.74 for the previous generation.
Reported by third parties
| Benchmark | Score | Source |
|---|---|---|
| Artificial Analysis Intelligence Index v5.0.1 | 43 | Artificial Analysis |
| AA-Briefcase Elo (knowledge work) | 1686 | Artificial Analysis |
| AutomationBench-AA (SaaS workflows) | 72.5 | Artificial Analysis |
| CodeArena Elo (web development) | 1750 | Arena, preliminary |
| APEX-Agents v1.1 (professional services) | 72.1 | Mercor |
| HLAB-Vals-1.1 (legal agent work) | 21.3 | Vals |
The independent index places it well above mid-tier models and below the strongest frontier systems. A fair summary: a capable generalist with unusually strong agentic and tool-use results for its class, rather than an outright leader on raw intelligence.
Token efficiency

Qwen reports that the model reaches its results using fewer tokens than the previous generation — roughly 24% fewer on Work360 at xhigh effort and 35% fewer at high, and roughly 48–49% fewer on Terminal-Bench 4.0. Qwen's own cost measurement on Work360 reports a 62% drop in average cost per task.
This matters more than it first appears. On a per-token basis the headline price tells you little; what you pay is tokens spent times rate, and a model that reasons more economically can be cheaper in practice than a nominally cheaper one. Worth verifying on your own workload rather than assuming it transfers.
What it is built for
Qwen positions the model around long-horizon professional work rather than chat. Its published showcases cover:
- 3D and game development — modelling and scene work in Blender; building playable games in Unity, Unreal and Godot, iterating from visual and interaction feedback.
- Manufacturing — production-line modelling, part design and machining verification, catching overcuts before material is removed. One reported case cut programming a single workpiece from about 475 minutes to 24.
- Finance, law and healthcare — multi-tool research across market data; due-diligence work over hundreds of inconsistently named documents with citations back to source; review of large clinical records including imaging series.
- Long-running agents — autonomous planning with staged delivery, so a usable first version arrives early and is refined through successive releases rather than appearing only at the end.
- Scientific discovery — multi-day autonomous loops combining literature review, computational screening and laboratory execution.
These are the vendor's own demonstrations, not independent reproductions. Read them as a statement of intended scope, which is useful for deciding whether the model fits your problem shape — not as evidence it will perform that way on yours.
Choosing settings
| Task | Suggested configuration |
|---|---|
| Classification, routing, extraction | reasoning_effort: "none" |
| Chat and drafting | reasoning_effort: "medium" |
| Planning, hard debugging, multi-step analysis | reasoning_effort: "high" or "xhigh" |
| Agent loops | tools plus tool_choice: "auto", concurrent execution |
| Machine-readable results | response_format with json_schema, strict: true, generous max_tokens |
| Screenshots, charts, scanned pages | image_url parts, in page order |
| Clips, screen recordings, demos | video_url parts, trimmed to the relevant segment |
| Repeated long preambles | Stable content first, variable content last |
| Interactive interfaces | stream: true, deliberation rendered separately |
Common pitfalls
| Symptom | Cause | Fix |
|---|---|---|
Empty or truncated reply, finish_reason: "length" | Deliberation consumed the output budget | Raise max_tokens or lower reasoning_effort |
| Invalid JSON from a schema request | Same cause — the object was cut off | Check finish_reason before parsing; raise the budget |
| Tool results ignored | The assistant message with the calls was not added back, or an id mismatched | Append the assistant message, then one tool message per tool_call_id |
| PDF rejected | PDF is not an accepted input | Convert pages to images |
| Audio in a video not understood | Audio is not an accepted input | Transcribe separately, pass the text alongside |
| Caching never seems to hit | Something variable sits near the top of the prompt | Move every changing value to the end |
| Keys in the wrong order | Order is not constrained by the schema | Parse the JSON; do not read by position |
Safety and responsible use
Qwen reports safety work across secure code generation, cybersecurity and CBRN. On a secure-coding benchmark, the share of generated code passing both functionality and security checks rose from 22.0% to 31.8% over the previous generation, and the share secure at function, file and repository level together rose from 8% to 14.7%. For cybersecurity, training data was filtered to keep defensive tasks and drop offensive ones.
These are internal evaluations. The practical reading: generated code is less likely to carry obvious injection, memory-safety or access-control flaws than before — not that it can skip review.
Qwen's stated terms require lawful use, prohibit harm, and place particular weight on two points worth passing to your own users: the model assists professional judgement rather than replacing it in high-impact decisions, and any images or video supplied as input must be lawfully obtained with the consent of the people in them.
References
- Qwen4-Max announcement — the launch post, with architecture detail, benchmark footnotes and the showcases above.
- Qwen4-Max model specification — the published parameter reference: context and output ceilings, effort levels, supported features by region.
@misc{qwen4,
title = {Qwen4-Max: Your New Teammate Has Arrived},
url = {https://qwen.ai/blog?id=qwen4-max},
author = {{Qwen Team}},
month = {Nov},
year = {2026}
}Limits to keep in mind
Like any model of this kind, Qwen4-Max can state something false with confidence, miss part of a precise instruction, and lose coherence over very long multi-turn exchanges. Quality varies across languages and domains, and its knowledge ends at its training cutoff. Benchmark strength on agentic tasks does not transfer automatically to your own workflow, and nearly every headline figure above comes from the team that built the model.
For consequential work, measure it on your own task before relying on it, add checks in your application, and keep a person in the loop. Medical, legal and safety-critical decisions need domain validation and human oversight.