Qwen Code with a local model: setup for Ollama, LM Studio or llama.cpp
Qwen Code is Alibaba's open-source (Apache-2.0) terminal coding agent, with VS Code, Zed and JetBrains integrations and an experimental web UI. Its docs show local servers such as Ollama and LM Studio configured as OpenAI-compatible providers in ~/.qwen/settings.json, which suits people already running Qwen-family models locally.
At a glance
- Type
- cli
- Licence
- Apache-2.0
- Latest release
- 0.25.3 (2026-10-19)
- Status
- Maintained
- Local backends
- ollama, vllm, openai-compatible
- Needs native tool calling
- Not verified
- MCP support
- Yes
- Recommended minimum context
- Not stated in its docs
- Start-up prompt
- Not measured
- GitHub stars
- 27.3k (2026-10-19)
How to set it up with a local model
Pick your backend. Each command has its own Copy button. Where a step uses an example model, swap in the one you run; the table below lists the ones that fit your machine.
Install it (macOS / Linux):
curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen-standalone.sh | bashStart Ollama with a 64k context window (or set the context slider in the Ollama app's settings).
OLLAMA_CONTEXT_LENGTH=64000 ollama serveIn a second terminal, pull a tool-capable coding model (replace qwen3-coder:30b with any model you prefer).
ollama pull qwen3-coder:30bAdd Ollama as an OpenAI-compatible provider in your user settings (replace qwen3-coder:30b with the model you pulled; the key is a placeholder Ollama ignores).
~/.qwen/settings.json{ "env": { "OLLAMA_API_KEY": "ollama" }, "modelProviders": { "openai": [ { "id": "qwen3-coder:30b", "envKey": "OLLAMA_API_KEY", "baseUrl": "http://localhost:11434/v1", "generationConfig": { "contextWindowSize": 64000 } } ] }, "security": { "auth": { "selectedType": "openai" } }, "model": { "name": "qwen3-coder:30b" } }Start Qwen Code in your project; switch models later with /model.
qwen
Other ways to install
npm (Node.js 22+)
npm install -g @qwen-code/qwen-code@latestHomebrew
brew install qwen-codeCheck that it works
Run a one-shot headless prompt. Inside an interactive session, /doctor shows the current authentication.
qwen -p "List the files in this directory and say which language the project uses."Which local models fit, by machine
Checked by this site's engine at the context Qwen Code needs, with 32 GB of system RAM for MoE offload. A Mac counts three quarters of unified memory as usable.
| Machine | Model | Quant | Context | Fit | Ollama |
|---|---|---|---|---|---|
| 12 GB GPU | Qwen 3.5 9B | Q4_K_M | 32,768 | Comfortable (7.4 GB of 12 GB) | qwen3.5:9b |
| Qwen 3.6 35B-A3B | Q4_K_M | 32,768 | With CPU offload (MoE) (22.7 GB of 12 GB) | qwen3.6:35b-a3b | |
| 16 GB GPU | Qwen 3.5 9B | Q4_K_M | 32,768 | Comfortable (7.4 GB of 16 GB) | qwen3.5:9b |
| Qwen 3.6 35B-A3B | Q4_K_M | 32,768 | With CPU offload (MoE) (22.7 GB of 16 GB) | qwen3.6:35b-a3b | |
| 24 GB GPU | Qwen3.8 27B | Q4_K_M | 32,768 | Comfortable (19.9 GB of 24 GB) | qwen3.8:27b |
| Qwen 3.6 27B | Q4_K_M | 32,768 | Comfortable (19.9 GB of 24 GB) | qwen3.6:27b | |
| Devstral Small 2 24B | Q4_K_M | 32,768 | Comfortable (20.7 GB of 24 GB) | devstral-small-2:24b | |
| Qwen 3.6 35B-A3B | Q4_K_M | 65,536 | Tight (23.3 GB of 24 GB) | qwen3.6:35b-a3b | |
| 32 GB GPU | Qwen3.8 27B | Q4_K_M | 32,768 | Comfortable (19.9 GB of 32 GB) | qwen3.8:27b |
| Qwen 3.6 27B | Q4_K_M | 32,768 | Comfortable (19.9 GB of 32 GB) | qwen3.6:27b | |
| Devstral Small 2 24B | Q4_K_M | 32,768 | Comfortable (20.7 GB of 32 GB) | devstral-small-2:24b | |
| Qwen 3.6 35B-A3B | Q4_K_M | 65,536 | Comfortable (23.3 GB of 32 GB) | qwen3.6:35b-a3b | |
| Qwen3-Coder 30B-A3B (MoE) | Q4_K_M | 65,536 | Comfortable (25.7 GB of 32 GB) | qwen3-coder:30b | |
| Mac, 64 GB | Qwen 3.6 35B-A3B | Q8_0 | 131,072 | Comfortable (40.7 GB of 48 GB) | — |
Your exact machine: filter the matrix or check any model in the analyzer.
Common problems with local models
- contextWindowSize only tells Qwen Code the window size. Set the real window on the server: OLLAMA_CONTEXT_LENGTH for Ollama, --context-length in LM Studio, -c for llama-server.
- Slow local servers can trip timeouts: the docs' local example raises generationConfig.timeout, and streamIdleTimeoutMs controls how long a model may stay silent between streamed chunks.
- The settings file needs security.auth.selectedType = "openai" and model.name matching a provider id; without them you have to run /auth interactively.
Other coding agents
How they rank for local models: the best agent harness for local LLMs.
- OpenCode
- Codex CLI
- Cline
- Kilo Code
- Aider
- Pi coding agent
- Claude Code
- Crush
- Goose
- OpenHands
- Zed agent
- GitHub Copilot BYOK
- Continue (discontinued)
- Roo Code (discontinued)
- Void (discontinued)