Best Local LLM for Coding: Qwen3-Coder, Devstral, gpt-oss
Our picks: Qwen3-Coder 30B for most desks, gpt-oss-20b for 16 GB cards, Devstral Small 2 for a 32 GB Mac. All free to download, Apache-2.0.
In this story (8 sections)
Our pick for most decent GPUs and Macs is Qwen3-Coder 30B, with gpt-oss-20b for 16 GB machines and Devstral Small 2 for a 32 GB Mac. All three are free Apache-2.0 downloads, and Ollama's and LM Studio's docs describe connecting them to Claude Code (Anthropic doesn't support non-Claude models there), Codex, Continue or Cline.
Facts, sizes and prices below are as of November 30, 2026.
Our picks by coding need
These picks are ours, built from license, size and what each card says the model is for. Each vendor publishes its own scores, and we found no neutral official ranking that covers them all.
- Most desks: Qwen3-Coder-30B-A3B-Instruct. It has 30.5B total and 3.3B active parameters, 262,144 tokens of native context, and 1.93M downloads on Hugging Face as of our read. Ollama's
qwen3-codertag is a 19GB download. - A 16 GB GPU or 16 GB Mac: gpt-oss-20b. OpenAI's card says it runs "within 16GB of memory", with 128k context and text input. Deep dive: /gpt-oss/.
- A 32 GB Mac or one RTX 4090: Devstral Small 2. Mistral says it's "light enough to run on a single RTX 4090 or a Mac with 32GB RAM". It's 24B with a 256k context window and takes images too.
- Coding agents on big hardware: Qwen3-Coder-Next, 80B total and 3B activated, "designed specifically for coding agents and local development". Ollama lists it at 52GB (q4_K_M) and 85GB (q8_0).
- An MIT-licensed option: GLM-4.7-Flash, 31.2B parameters, a 19GB download in Ollama.
- A general model that also codes: Qwen3.6, which Ollama says brings "upgrades in agentic coding". Family guide: /qwen3/.
Skip Qwen3-Coder 480B (a 290GB download) and DeepSeek V4: both are too big for a desk. On 8 GB of VRAM, the news is thin: no coding card we read says it fits.
System requirements for local coding models
"Not stated" means the card and official docs give no figure. Download size isn't the same as memory needed: context and buffers come on top. For how quantization changes this, see /vram-for-local-llm/.
| Model | GPU memory (VRAM) or unified memory | System RAM | Download size | OS | License and commercial use |
|---|---|---|---|---|---|
| Qwen3-Coder-30B-A3B | not stated | at least 15 GB (LM Studio) | 19GB (Ollama) | not stated | Apache-2.0 |
| Qwen3-Coder-Next | not stated | not stated | 52GB q4_K_M, 85GB q8_0 (Ollama) | not stated | Apache-2.0 |
| Devstral Small 2 (24B) | "a single RTX 4090 or a Mac with 32GB RAM" (Mistral) | not stated | 15GB (Ollama) | not stated | Apache-2.0 |
| gpt-oss-20b | "within 16GB of memory" (OpenAI) | 12 GB (LM Studio) | 14GB (Ollama) | not stated | Apache 2.0, commercial use allowed |
| GLM-4.7-Flash | not stated | not stated | 19GB q4_K_M (Ollama) | not stated | MIT |
| Qwen3.6-35B-A3B | not stated | not stated | 23GB (Ollama) | not stated | Apache 2.0 |
The OS column says "not stated" because model cards don't list one. The model runs wherever your app runs: Ollama needs macOS 14 or newer (Intel Macs run it on the CPU) or Windows 10 22H2 or newer. If Coder-Next runs out of memory, Qwen's card suggests a shorter context "such as 32,768".
Vendor coding scores, graded by the vendors
Every vendor here grades its own homework. Each number comes from the vendor's card, run on its own harness against rivals it picked, so don't line them up against each other.
- Mistral's card gives Devstral Small 2 (24B) 68.0% on SWE Bench Verified.
- Qwen's Qwen3.6-35B-A3B card gives it 73.4 on SWE-bench Verified.
- Z.ai's card gives GLM-4.7-Flash 59.2 on SWE-bench Verified.
Qwen3-Coder-Next's card shows its scores as images, so we quote none. Read all of these as marketing with a methodology attached.
Why run a coding model locally
A local model is a familiar that lives in your GPU and never phones home.
The good part:
- Your code stays home. Prompts and files never leave your machine, which matters for client work or anything under NDA.
- No meter. No weekly allowance, no credit burn.
- Offline works. A plane seat becomes a workstation.
- You pick the version. Nothing changes until you pull an update.
- Licenses are friendly. Every pick above is Apache-2.0 or MIT, and Apache 2.0 permits commercial use.
The honest downsides:
- Setup is on you. Context length, quantization and tool-calling settings all need attention.
- Your hardware sets the ceiling. Quality and speed depend on your GPU and memory, and agents need long context, which eats memory. Ollama's docs say "Setting a larger context length will increase the amount of memory required to run a model."
- Nobody to call. You're your own help desk when an agent loops or a model won't load.
The ritual: wiring a local model into your editor
Pick a runner first (our LM Studio vs Ollama comparison helps), then:
- Continue: add a model entry with
provider: ollamaandmodel: <MODEL_ID>, per Continue's docs. If it complains about memory, lowercontextLengthor pick a smaller model. - Cline: run
ollama pull <model-name>, pick the Ollama provider, set the base URL tohttp://localhost:11434, choose the model and turn on "Use Compact Prompt", per Cline's docs. Cline suggests 32 to 64GB of RAM for mid-size coding models. - VS Code chat: Microsoft's language models page says to "Add a model provider extension, such as Ollama." Check that page for which Copilot plans apply.
Claude Code and Codex with local models
Codex supports this out of the box. Its config docs say Codex "can run against a local 'open source' provider such as Ollama or LM Studio when you pass --oss."
Claude Code is different. Anthropic's gateway docs say it "doesn't support routing Claude Code to non-Claude models through any gateway." The runners document the connection themselves:
- Ollama: run
ollama launch claude, pick a model with tool calling and "set a 64k+ context window". - LM Studio: start the server with
lms server start --port 1234, pointANTHROPIC_BASE_URLat it, and use "more than ~25k context length".
So the support comes from Ollama and LM Studio, not Anthropic. If it breaks, don't file the ticket with Anthropic.
Local vs cloud cost: the arithmetic
Time for the receipts.
Assumptions:
- You already own a PC that can take the card.
- GPU: GeForce RTX 5070 Ti, 16 GB, $749 one-time launch price (MSRP) from NVIDIA's announcement, 300 W total graphics power. Street prices vary.
- 4 hours of full GPU load a day, 22 working days a month (88 hours). That's a worst case for power.
- Electricity: 18.17 cents per kWh, the EIA US residential average for September 2026.
Electricity: 300 ÷ 1000 × 88 hours × $0.1817 = about $4.80 a month.
Cloud plans (monthly):
- GitHub Copilot Pro: $10 a month.
- Cursor Plus: $8 a month. Premium: $30 a month.
- Claude Pro, which includes Claude Code: $20 a month billed monthly. Max: $100 a month.
Payback on the $749 card:
- vs Claude Pro: $20 − $4.80 = $15.20 saved a month. $749 ÷ $15.20 = about 49 months.
- vs Copilot Pro: $10 − $4.80 = $5.20 a month. $749 ÷ $5.20 = about 144 months.
- vs Claude Max: $100 − $4.80 = $95.20 a month. $749 ÷ $95.20 = about 8 months.
Bigger card: an RTX 5090 (32 GB, 575 W, $1,999 one-time launch price) costs 575 ÷ 1000 × 88 × $0.1817 = about $9.19 a month to run. Against Claude Max that's $90.81 saved a month, so $1,999 ÷ $90.81 = about 22 months.
Renting instead: RunPod lists an RTX 4090 at $0.89 an hour on Secure Cloud. 88 hours × $0.89 = about $78 a month.
Our verdict: a local model isn't the model a cloud plan gives you, so these paybacks assume local quality is enough for your work. Against a $10 or $20 a month plan, a card bought for coding takes years to pay back. Against a $100 a month plan, it can pay back within a year. More scenarios: /is-local-ai-cheaper/ and /gpu-for-ai/.
What to do next
- Light coder on a $10 or $20 plan: stay in the cloud. Compare Copilot, Cursor and Claude Code prices.
- Already own a 16 GB GPU or Mac: pull gpt-oss-20b and wire it into Continue or Cline. Your sole new cost is power.
- Paying $100 a month and privacy matters: the math above says a card can pay back within a year. Try Devstral Small 2 or Qwen3-Coder 30B on it.
- Still choosing a model for chat and writing too: start at /best-local-llm/.
Receipts
Official pages behind this story, read Nov 30, 2026- huggingface.coDoes Qwen3-Coder-Next exist, and what are its size, license, context and requirements?
- ollama.comWhat are Qwen3-Coder-Next download sizes?
- huggingface.coWhat is Qwen3-Coder-30B-A3B-Instruct (the mid-size coding pick)?
- ollama.comWhat is Qwen3-Coder 480B in Ollama?
- huggingface.coWhat are Devstral Small 2: size, license, requirement, benchmarks?
- huggingface.coIs gpt-oss usable for coding, and what does the card say?
14 more receipts
- huggingface.coWhat does the GLM-4.7-Flash card say for coding?
- huggingface.coWhat coding numbers does Qwen's card give for Qwen3.6 and Qwen3.8?
- ollama.comHow does Ollama describe Qwen3.6 and 3.8 for coding?
- huggingface.coWhat other code models trend on HF (excluding uncensored)?
- docs.ollama.comHow does Ollama connect Claude Code to local models?
- code.claude.comDoes Anthropic officially support Claude Code with non-Claude (local) models? · Where do Copilot, Cursor and Claude Code prices come from?
- lmstudio.aiHow does LM Studio connect to Claude Code?
- learn.chatgpt.comDoes OpenAI Codex officially support local models?
- code.visualstudio.comDoes GitHub Copilot / VS Code officially support local models?
- docs.continue.devHow to wire Ollama into Continue?
- docs.cline.botHow to wire Ollama into Cline?
- docs.ollama.comWhich tools does Ollama document, and what is `ollama launch`?
- docs.ollama.comWhat do docs say about context length for coding agents?
- docs.ollama.comWhere is the memory and quantization explanation?
Filed under
Local AI: The Hearth“best local llm for coding”