This page covers which Qwen model to use for writing code and for agents that call tools, as of 2 December 2026, what each choice costs, and the models that do the job better. It is one part of Which Qwen model should I use?, which covers the other tasks.

Coding

Pick. Hosted, Qwen4-Max (released 16 November 2026) has 1M context and costs $1.50/$4.50 per million tokens. On Alibaba's launch table it scores 75.7 on DeepSWE v1.1, level with Claude Opus 5.5 (74.2) and GPT-6.1 Sol (75.2) (llm-stats). Locally on a 24 GB GPU, Qwen3.6-35B-A3B at a 4-bit quant: users report about 140 tokens per second on an RTX 4090 with 150K context (Hacker News). With 32 GB or more, the dense Qwen3.8-27B (card) or Qwen3-Coder-Next, which has 80B parameters with 3B active and never thinks, so it answers faster (card).

Tradeoffs. The dense 27B is slower than the 35B-A3B; one user measured it at "about 7-8x slower" (Hacker News). Users disagree on which one loops less in agent runs. Settings differ per model: the 35B-A3B has a precise-coding preset at temperature 0.6 and needs 128K context or more to keep its thinking (card).

Where Qwen loses. On the same Alibaba launch table, Claude Opus 5.5 leads Qwen4-Max on Terminal-Bench 4.0 (59.6 against 48.5) and on ProgramBench (65.0 against 31.5), and Kimi K3.1 leads Terminal-Bench 4.0 at 67.2 (llm-stats). These are Alibaba's own numbers. In The New Stack's test of three scored tasks, Opus 5.5 beat Qwen4-Max on two (76/76 against 71/76 on a multi-app workflow, 45/47 against 40/47 on a bug fix) and Qwen4-Max led on one (59/60 against 58/60 on an incident investigation). Qwen cost about two-thirds less in total and took 214% longer (The New Stack). Artificial Analysis measures Qwen4-Max at 20.2 minutes and $3.27 per task on its index (Artificial Analysis), and on Arena's coding index its xHigh setting ranks 21st of 69 (Arena). At the small end, in one video test of four coding tasks, Claude Haiku 5.5 passed all four and finished faster, while a local Qwen3.8-27B at Q4 missed reference updates in a rename (YouTube).

Users also accuse Qwen of tuning for benchmarks (Hacker News). Benjamin Marie used NVIDIA's CoDeC metric to compare Qwen3.5-27B with Gemma 4 31B, found Qwen more familiar with benchmark data, and reads that as a sign Gemma may generalize better (X). That is his interpretation; it does not prove the benchmarks were in Qwen's training data. For cheap, fast loops, one test found DeepSeek V4 Pro the fastest and cheapest (EmpirioLabs). At the local tier Qwen is still the default: Qwen3.6-35B-A3B scores 73.4 on SWE-bench Verified against 52.0 for Gemma 4 31B on Qwen's card (card).

Agents and tool calls

Pick. Qwen4-Max hosted (llm-stats), or Qwen3.6-35B-A3B and Qwen3.8-27B locally. For Qwen3.6, turn preserve_thinking on for agents; it is off by default (card).

Tradeoffs. Most local tool-call failures come from the serving software. Claude Code against llama.cpp's server with Qwen3.8-27B failed with "Unable to generate parser for this template" until users patched the chat template (llama.cpp #27107). Ollama hung on Qwen3.8-27B tool calls until versions 0.32.15 and 0.33.0 (BetterClaw). Ollama also defaults to a 4K context on GPUs with less than 24 GiB, which cuts agent prompts short; it recommends at least 64,000 tokens for coding tools (Ollama docs). Quantization matters too: one user running Qwen3.8-27B at Q4 for 30 days reports repeated malformed tool calls at long context (Reddit). Record the quant, chat template and context when you report or reproduce a failure.

Where Qwen loses. Kimi K3.1 for terminal agents (above). For long tasks, users find local models "prone to fall into loops, forget their tasks" and pair them with a closed model (Hacker News).