Alibaba released Qwen4-35B-A3BHow to Run Qwen4-35B-A3B as a Free Local Coding Agent as the first open-weight model in the Qwen4 series, under Apache 2.0. That makes a Qwen4-35B-A3B local coding agent a practical setup for a team: one GPU box serves the model, and every coding agent on the team points at it. No per-token bill, and no code leaves your network.
This guide covers what the model is, the hardware it needs, how to serve it with Ollama or vLLM, how to connect Claude Code and OpenCode, where it falls short, and the cost math against the hosted API. If you already run several agents, Sharkly puts them on one board, so moving some of them to a local model is a settings change, not a new workflow.
TL;DR
Serve qwen4 from one GPU box with Ollama (a 36 to 37 GB download) or vLLM (one H200 or Blackwell GPU for the FP8 weights). Raise Ollama’s context window well past its 4,096-token default. Point Claude Code at the box with ANTHROPIC_BASE_URL, or launch OpenCode against it. Give it routine, well-scoped Tasks; keep the hardest terminal and repo-scale work on a stronger model.
What Qwen4-35B-A3B is
Qwen4-35B-A3B is a mixture-of-experts (MoE) model: 35B parameters in total, of which only 3B are active per token. A router picks 8 of 256 experts plus 1 shared expert for each token, so each token costs about the compute of a 3B model while the full 35B holds what it knows.
The model card lists these facts:
| Spec | Value |
|---|---|
| License | Apache 2.0 |
| Parameters | 35B total, 3B activated, plus 20B n-gram embedding and 2B MTP |
| Layers | 40: ten blocks of 3 Gated DeltaNet layers and 1 Qwen Sparse Attention layer, each followed by MoE |
| Context | 1,048,576 tokens, native |
| Input | Text, image, video |
| Thinking control | reasoning_effort: xhigh, high (default), low, off |
In its launch post, Qwen says the model outperforms the dense Qwen3.8-27B, matches Qwen3.8-Flash-Next at about a third of the size, and “runs on a single GPU when quantized.”
The card adds one warning that matters for agents: in multi-turn agentic work, a lower reasoning_effort can raise total task time, because thin analysis leads to failures and retries. Leave it at high for agent runs.
Hardware: what one GPU box needs
Here is what three published sources say about the size of the weights:
| Route | Size | Source |
|---|---|---|
Ollama qwen4 (default tag, the same build as qwen4:35b-a3b) |
36 to 37 GB | Ollama library |
Unsloth UD-Q4_K_XL GGUF |
24.7 GB model file plus an 11.5 GB n-gram table | Unsloth GGUFs |
| vLLM, FP8 checkpoint | 39.7 GB on the GPU plus 20.5 GB of host RAM for the n-gram table | vLLM recipe |
The n-gram table is the 20B embedding block. Its lookups don’t need the GPU, so vLLM offloads it to host RAM by default, and Unsloth says its desktop app can keep it on SSD, letting the 3-bit GGUF run in 18 GB of RAM.
For a team server, the vLLM recipe names one H200 or a datacenter Blackwell GPU, and says an H100 fits the FP8 checkpoint. A smaller card can run a 3-bit or 4-bit GGUF, but it has less memory left for long contexts and parallel requests.
How one GPU box serves a team’s coding agents

The model runs in one place. Each developer’s coding agent runs on their own Computer and sends model calls across the network to that box.
Option A: Ollama
Ollama is the shortest path. Set the variables before the server starts:
# On the GPU box
export OLLAMA_HOST=0.0.0.0:11434 # listen on the LAN, not only localhost
export OLLAMA_CONTEXT_LENGTH=65536 # default is 4096, far too small for agents
export OLLAMA_NUM_PARALLEL=4 # requests served at once
ollama serve &
ollama pull qwen4
The context line is the one people miss. Ollama’s FAQ sets the default window at 4,096 tokens, and its Claude Code guide asks for 64k or more with local models. The local Ollama API asks for no key, so keep the port on a private network or VPN.
Option B: vLLM
For heavier traffic, use vLLM. This command is trimmed from the vLLM recipe, which serves the FP8 checkpoint with tool calling and reasoning parsers on:
vllm serve Qwen/Qwen4-35B-A3B-FP8 \
--trust-remote-code \
--enable-prefix-caching \
--tensor-parallel-size 1 \
--max-model-len auto \
--kv-cache-dtype nvfp4 \
--attention-config.indexer_kv_dtype fp8 \
--enable-auto-tool-choice \
--tool-call-parser qwen4 \
--reasoning-parser qwen4
That exposes an OpenAI-compatible endpoint at http://<gpu-box>:8000/v1, which OpenCode and any OpenAI-client tool can use.
One caveat for llama.cpp and Ollama users: Qwen ships its own tokenizer as the reference. The Jinja chat template in tokenizer-compat/ exists for backward compatibility, and the card notes its token IDs can differ from the reference tokenizer’s.
Connect your coding agents
Claude Code speaks the Anthropic Messages API, and Ollama serves a compatible subset of it. Per Ollama’s guide, three variables and a model flag do it:
export ANTHROPIC_BASE_URL=http://gpu-box.lan:11434
export ANTHROPIC_AUTH_TOKEN=ollama
export ANTHROPIC_API_KEY=""
claude --model qwen4
The Ollama library page also lists one-line launchers, ollama launch claude --model qwen4 and ollama launch opencode --model qwen4, for a laptop or workstation that runs Ollama itself.
Use the sampling settings from the card. Thinking mode: temperature=1.0, top_p=0.95, top_k=20. Non-thinking: temperature=0.7, top_p=0.80, top_k=20, presence_penalty=1.5.
Where it falls short
Qwen’s benchmark chart compares the model with Qwen3.8-Flash-Next, Qwen3.8-27B and Inkling2 Mini. Here are the four coding rows:
| Benchmark | Qwen4-35B-A3B | Qwen3.8-Flash-Next | Qwen3.8-27B |
|---|---|---|---|
| DeepSWE v1.1 | 61.8 | 58.7 | 42.2 |
| NL2Repo | 51.7 | 48.1 | 42.3 |
| Terminal Bench 4.1 | 21.2 | 24.2 | 5.6 |
| FrontierCode-AA 2.0 | 16.1 | 27.1 | 14.9 |
The card cites Terminal Bench 4.1 and FrontierCode-AA 2.0 from Artificial Analysis. The pattern is clear: it leads on software engineering and repository tasks, and trails Flash-Next on long terminal sessions and frontier-level code.
Qwen4-Max, the API-only flagship, isn’t in this chart, so there is no head-to-head number. Route work by the evidence you have: bug fixes, tests, refactors and docs to the local model; hard terminal work and cross-repo changes to a stronger one. Our guide to matching models to agent roles covers that split.
Cost math: local vs the Qwen Cloud API
The same weights are on Qwen Cloud as qwen4-35b-a3b. The model page lists $0.06 per million input tokens, $0.36 per million output, $0.003 for cached input, and a 5,000,000 tokens-per-minute limit .
Take one agent Task at 1.5M input tokens across its turns and 60K output:
| Model | Per Task, no cache | Per Task, 80% of input cached | 200 Tasks a month, no cache |
|---|---|---|---|
qwen4-35b-a3b on Qwen Cloud |
$0.11 | $0.04 | $22 |
qwen4-max (list price in our Nov 16 guide) |
$2.52 | not computed | $504 |
| Local GPU box | $0 per token | $0 per token | the box’s monthly cost |
The honest read: the hosted 35B is cheap enough that a GPU box rarely wins on token cost alone. The box earns its place elsewhere: code and prompts never leave your network, no rate limit or quota sits between agents and the model, and a GPU you already own costs nothing extra.
Put the local model to work with Sharkly
Sharkly manages the agents, not the model. Model usage is bring-your-own-key, so nothing about the box changes when you put agents on the board.
Per the Agents docs, each Agent carries its own environment variables and custom arguments, and an Agent’s value overrides the Runtime default on that Computer. That makes the local model a per-Agent choice. In a demo organization we duplicated a Claude Code agent, added the two Ollama variables, and set --model qwen4 in Custom arguments. Sharkly then notes that custom arguments supply the agent’s default model.

From there, a Task assigned to that Agent runs through the usual flow, and the model calls stay on your network:

Three settings keep a shared box healthy:
- Max concurrency per Agent. Cap it so the agents together don’t exceed
OLLAMA_NUM_PARALLEL. - Mixed models on one board. Keep a frontier-model Agent beside the local one, and assign the hard Tasks to it.
- Review before merge. Treat the local Agent’s output like any other agent’s: a person approves it.
Run one Task end to end before you hand the local Agent a queue. To trial it against your current model, follow our guide to testing a new model on real tasks.
Conclusion
Qwen4-35B-A3B gives a team an Apache 2.0 model that fits on one server-class GPU, takes a 1M-token context, and beats Qwen3.8-27B on the coding rows Qwen published. Serve it once, raise the context window, point your agents at it, and keep a stronger model for terminal-heavy work. Sharkly is free to start: connect a Computer, duplicate one Agent, and give it a local endpoint today.
FAQ
Is Qwen4-35B-A3B free to use?
The weights are free under Apache 2.0, including commercial use. You pay for your own hardware. The hosted qwen4-35b-a3b on Qwen Cloud is billed per token at $0.06 input and $0.36 output per million.
How much VRAM does Qwen4-35B-A3B need?
The vLLM recipe puts the FP8 weights at 39.7 GB of GPU memory, plus 20.5 GB of host RAM for the n-gram table. Ollama’s default qwen4 build is a 36 to 37 GB download. Unsloth says its 3-bit GGUF runs in 18 GB of RAM with the n-gram table on SSD.
Can Claude Code use Qwen4-35B-A3B?
Yes, through Ollama’s Anthropic-compatible API. Set ANTHROPIC_BASE_URL to the Ollama server, ANTHROPIC_AUTH_TOKEN=ollama, an empty ANTHROPIC_API_KEY, and run claude --model qwen4.
How does Qwen4-35B-A3B compare with Qwen4-Max?
Qwen hasn’t published a head-to-head. Qwen4-Max is API-only and the series flagship; see what Qwen4-Max is. The 35B is the open model you can run yourself.
What context window does it support?
1,048,576 tokens natively. A local server only gives you what you configure, so set Ollama’s context length or vLLM’s --max-model-len to fit your memory.
Is it better than Qwen3.8-27B for coding?
On Qwen’s chart, yes: 61.8 vs 42.2 on DeepSWE v1.1 and 21.2 vs 5.6 on Terminal Bench 4.1. If you run the older model today, Apidog’s guide to running Qwen3.8-27B locally covers the setup you’re replacing.



