Best Local LLMs for Coding (2026)
The best local LLM for coding depends on how much memory your machine has. This list ranks open-weight models you can run yourself, by independent benchmark runs and by developers who use them in coding agents.
Qwen3.8-27B
The model most local-coding write-ups now start from. Piotr Migdał at Quesma found the 17 GB 4-bit file matched the full 55 GB model on Terminal-Bench 2.1, and Simon Willison drove the Pi coding agent with it on a 128 GB M5 Max MacBook Pro and an NVIDIA DGX Spark. The catch is speed: Willison saw 15 to 30 tokens a second, and it thinks at its highest effort by default, so turn reasoning down first.
- Maker
- Alibaba (Qwen team)
- Size
- 27B parameters, dense
- Memory needed
- 17 GB at Q4_K_M; fits a 24 GB RTX 4090 with about 64k tokens of context
- License
- Apache 2.0
- Context window
- 262,144 tokens
- Runs in
- Ollama 0.32.12 or newer, LM Studio, llama.cpp (update it first)
Qwen3.8-Flash-Next
For a 128 GB machine. It posted the best result in WonderRico's benchmark, 97 of 100 SWE-bench Verified tasks, on a single 96 GB RTX PRO 6000. Deepu K Sasidharan writes most of his Rust code with it on a 128 GB ASUS ROG Flow Z13 at about 46 tokens a second, though one feature took 130 minutes against 18 for Claude Opus. It is labelled an experimental preview, and its license is not Apache.
- Maker
- Alibaba (Qwen team)
- Size
- 125B, 6B active, plus a 51B n-gram embedding table
- Memory needed
- About 100 GB at UD-Q4_K_S with 180K context on a 128 GB M5 Max
- License
- Qwen Community License 1.0; hosted-model and AI-assistant vendors need a deal
- Context window
- 262,144 tokens
- Runs in
- llama.cpp, vLLM, SGLang; Ollama has only a 105 GB MLX build for Macs
Qwen3.6-27B
Georgi Gerganov, who wrote llama.cpp, said he used this almost daily for maintainer chores, at 100 to 150 tokens a second on an RTX 5090 and about 40 on an M2 Ultra. It is the older sibling of Qwen3.8-27B, with the same size and memory needs. On a Mac Studio M3 Ultra, TerminalBytes measured it at twice the newer model's speed in Ollama, which is the reason to still pick it.
- Maker
- Alibaba (Qwen team)
- Size
- 27B parameters, dense
- Memory needed
- Q4 on a 32 GB RTX 5090, Q8 on an M2 Ultra (Georgi Gerganov's setup)
- License
- Apache 2.0
- Context window
- 262,144 tokens
- Runs in
- Ollama (qwen3.6:27b, 18 to 19 GB), LM Studio, llama.cpp, vLLM
Gemma 4 31B
Google's largest open model is the one to try if you would rather not run a Qwen. In WonderRico's benchmark it scored 67 to 73 of 100 and needed fewer requests per solved task than most local models. Incept5's test on an Apple Silicon Mac had it ahead of Qwen3.5-27B, 59.4% to 42.2%. Its tool calling was broken at launch and fixed later, so use current files and a current runtime.
- Maker
- Google DeepMind
- Size
- 30.7B parameters, dense
- Memory needed
- 19 to 20 GB download as gemma4:31b in Ollama
- License
- Apache 2.0
- Context window
- 256K tokens
- Runs in
- Ollama (gemma4:31b), LM Studio, llama.cpp, vLLM
Qwen3.6-35B-A3B
The fast one. It computes with only 3B of its 35B parameters per token, so it answers quickly on Macs and older cards. Red Hat's Coding Agent Bench ran it through all 500 SWE-bench Verified tasks: 65% with the Pi agent and 54.8% with OpenCode, same weights. WonderRico scored it 60 of 100, below the dense 27B models, and found this kind of model loses more when compressed.
Muse Glimmer-30B
Meta built this one for agents and tool use, not for code alone. WonderRico scored it 73 to 76 of 100, level with Qwen3.6-27B, but it needed about twice as many requests to get there. In rickyzzzzz's test on an M1 Max with 64 GB it passed 24 of 30 agent tasks where Qwen3.8-27B passed all 30. Hacker News user pram uses it as the agent that explores a codebase and leaves the coding to Qwen.
- Maker
- Meta Superintelligence Lab
- Size
- About 29.6B parameters, dense
- Memory needed
- Meta's K-Quant-17GB build targets 24 GB of VRAM
- License
- Apache 2.0
- Context window
- 131,072 tokens
- Runs in
- Ollama (muse-glimmer:30b, 18 GB), LM Studio, llama.cpp
gpt-oss-20b
The pick for a 16 GB graphics card, because it fits whole. Abhinav Raj at XDA used it for a week on a 16 GB RTX 4070 Ti Super and it found and explained all three planted bugs, where Qwen3-Coder 30B and Devstral Small 2 did not. Rost Glukhov measured 139.93 tokens a second on an RTX 4080. It dates from August 2025 and takes text only, and some developers now consider it outclassed by newer Qwen models.
- Maker
- OpenAI
- Size
- 21B total, 3.6B active (mixture of experts)
- Memory needed
- 14 GB loaded, all on the GPU, on a 16 GB RTX 4080 in Ollama
- License
- Apache 2.0
- Context window
- 128K tokens
- Runs in
- Ollama (gpt-oss:20b, 14 GB), LM Studio, llama.cpp, vLLM
Gemma 4 26B-A4B
Speed is the reason to choose it. George Liu got 51 tokens a second on a 14-inch MacBook Pro M4 Pro with 48 GB and wired it into Claude Code, where he says it slowed down noticeably. For agent work the results are weaker: WonderRico scored it 54 of 100 and called it fast but quite poor. Developers on Hacker News rate it higher for writing, SQL and PHP than for long coding sessions.
- Maker
- Google DeepMind
- Size
- 25.2B total, about 4B active (mixture of experts)
- Memory needed
- 17.99 GB Q4_K_M ran on a 14-inch MacBook Pro M4 Pro with 48 GB
- License
- Apache 2.0
- Context window
- 256K tokens
- Runs in
- Ollama (gemma4:26b), LM Studio, llama.cpp
DeepSeek-V4-Flash-0731
Only for big machines. WonderRico ran compressed builds across three GPUs with 192 GB of VRAM and got 90 to 92 of 100, second only to Qwen3.8-Flash-Next. Hemant Kumar at TerminalBytes puts the need at roughly 100 to 170 GB of memory, so a 256 GB Mac Studio holds it. The smallest file WonderRico tested, at 2 bits, is 96.8 GB. It takes text only, and a newer V4.1 Flash is larger.
- Maker
- DeepSeek
- Size
- 284B total, 13B active (mixture of experts)
- Memory needed
- 96.8 GB at UD-Q2_K_XL, 155.1 GB at UD-Q4_K_XL (Unsloth GGUF files)
- License
- MIT
- Context window
- 1M tokens
- Runs in
- llama.cpp (GGUF), vLLM
Qwen3.5-9B
What to run when you have 8 GB. Rost Glukhov measured 90.89 tokens a second with all of it on a 16 GB RTX 4080, and Hacker News users name it for small tasks and as a helper model inside the Pi agent. Keep the jobs short. One user who tried it for coding gave up after it kept getting stuck rethinking the same step, and no independent test here shows it finishing long agent sessions.
- Maker
- Alibaba (Qwen team)
- Size
- 9B parameters, dense
- Memory needed
- 9.3 GB loaded, all on the GPU, on a 16 GB RTX 4080 in Ollama
- License
- Apache 2.0
- Context window
- 262,144 tokens
- Runs in
- Ollama (qwen3.5:9b, 6.6 to 7.6 GB), LM Studio, llama.cpp
Gemma 4 12B
A small model that reads images and audio as well as code, in a 7 GB file from Google. Hacker News user dofm, who runs it on an M1 Max, calls it quite good at coding jobs but weaker on nuance and not suited to long agent sessions. Another user found Gemma 4 models looping until he went back to the chat template Google first shipped. Use it for snippets, reviews and screenshots.
- Maker
- Google DeepMind
- Size
- 11.95B parameters, dense
- Memory needed
- 7.0 GB for Google's own QAT 4-bit GGUF file
- License
- Apache 2.0
- Context window
- 256K tokens
- Runs in
- Ollama (gemma4:12b, 7.7 to 8.0 GB), LM Studio, llama.cpp
GLM-4.7-Flash
An MIT-licensed alternative in the 24 GB class. Hacker News user kamranjon ran it as a main model for months and calls it tenacious and very fast. It does not fit a 16 GB card: Rost Glukhov saw it load at 21 GB on an RTX 4080 with 27% spilling to the CPU, at 33.86 tokens a second. Another user who has run it locally says it was far behind the best models even at launch.
- Maker
- Z.ai
- Size
- 30B total, 3B active (mixture of experts)
- Memory needed
- 21 GB loaded on a 16 GB RTX 4080, 27% on the CPU, in Ollama
- License
- MIT
- Context window
- 198K tokens in Ollama
- Runs in
- Ollama (glm-4.7-flash, 19 GB), LM Studio, llama.cpp, vLLM, SGLang
How to choose
With 24 to 32 GB, start with Qwen3.8-27B. Its 17 GB 4-bit file matched the full model on Terminal-Bench 2.1 in Quesma's test. With 128 GB of unified memory, Qwen3.8-Flash-Next posted the top score in WonderRico's benchmark. With 16 GB, gpt-oss-20b fits whole on the card, and one developer reports useful work from a 2-bit Qwen3.8-27B. With 8 GB, try Qwen3.5-9B and keep the jobs small. At 64 GB, run the 27B models at 8-bit, a 29 GB file, with a longer context. The step above that needs about 100 GB.
A coding agent only works if the model emits tool calls your server can parse. Gemma 4 shipped with broken tool calling that was fixed later, and Qwen chat templates have needed community fixes, so update Ollama, LM Studio or llama.cpp before blaming the model. Agents also need room: LM Studio loads models with an 8,192-token context unless you raise it.
Scores on a model card are the maker's own. A mixture-of-experts model computes with a few billion parameters per token but still has to hold all of them in memory, and context takes memory on top of the file. Qwen3.8 thinks at its highest effort by default, which is slow on home hardware. Qwen3.8-Flash-Next is not Apache licensed. Older guides still recommend Qwen2.5-Coder, Qwen3-Coder and Devstral, which general-purpose models beat in the hands-on tests cited here.
The list is ordered by how many independent testers and developers recommend each model for coding, then by downloads.
Numbers checked October 11, 2026.
More guides like this
Best OpenCode Alternatives (2026)
The best OpenCode alternatives are the terminal coding agents developers say they moved to in blog posts and Hacker News threads, checked against independent hands-on reviews. If OpenCode feels bloated, get Pi, or oh-my-pi if you want Pi with the tools already built in. If you want one vendor's best models at a flat monthly price, get Claude Code or Codex CLI. Codex is the one that sandboxes commands by default. If you want open source with any model and no single company in charge, get Goose. If you want the nicest terminal interface, get Crush. If you already pay for GitHub Copilot, its CLI is included. A few things the makers' pages won't tell you. OpenCode 2 has a new plugin API, so OpenCode 1 plugins don't run on it, and that is a reason recent switchers give on Hacker News. Crush grew out of an older Go project that was also called OpenCode, and its license is source-available, not open source. Gemini CLI stopped serving personal accounts on June 18, 2026, and Antigravity CLI replaced it. Aider has had no commits since May 22, 2026. Kilo CLI is built on OpenCode, so switching to it changes little. A free agent still needs a model: you pay a provider per token or run one on your own hardware. The list is ordered by how many independent developers and reviewers recommend each agent, then by GitHub stars, then by price. Prices checked October 11, 2026.
OpenRouter Alternatives (2026): Cheaper or Self-Hosted
The best OpenRouter alternatives, hosted routers and gateways you run yourself, picked from developers who switched and reviewers who measured them. Each one still gives you one API for many AI models. Match the pick to your reason for leaving. If it is the 5.5% fee on credits, Vercel AI Gateway charges no markup, and Cloudflare AI Gateway is free when you bring your own provider keys. If you want no middleman at all, self-host LiteLLM, or Bifrost if LiteLLM's latency bothers you. If your data must stay in Europe, look at Cortecs or Requesty. If you are tired of one model behaving differently from host to host, buy from a single host such as Fireworks AI, Together AI or Groq, or use OpenCode Zen's short tested list. This market changed fast in 2026, so older guides are wrong in places. Stripe announced in August that it is buying OpenRouter. Palo Alto Networks bought Portkey in May. Helicone has been in maintenance mode since Mintlify bought it in March, and TensorZero's repository is archived, which is why neither is here. LiteLLM had two poisoned releases on PyPI in March (1.82.7 and 1.82.8), so pin your version. Self-hosting takes the gateway company out of the path, but your prompts still go to whichever model provider you call. And OpenRouter's fee is charged when you buy credits, with an $0.80 minimum, so small top-ups cost more than 5.5%. The list is ordered by how many independent developers and reviewers recommend each option, then by adoption, then by price. Prices checked October 11, 2026.
Best Small Models for Text Classification on a Laptop (2026)
Small models for text classification you can run on a laptop: spam, intent, routing and moderation with no API bill, picked from independent tests by Red Hat's AI safety team, Oliver Borchers and the BTZSC benchmark. It started with a build on Made with Jev: a developer swapped Jev, TypeSafe's hosted decision model, for a DeBERTa large classifier on a base M1 Mac to decide, inside a Claude Code hook, whether a message was just a question, and found it just as fast and just as good for that job. Jev is the yardstick here. In Borchers' field test on 400 fresh arXiv papers it scored 86.3% with no training, for about $0.04 per million input tokens. How to choose comes down to labels. With none, try Clef-flash on a 16 GB Mac with a Pro or Max chip, or GLiClass on anything else. With a few dozen examples per label, embed the text and train a logistic regression on top. With a few hundred, fine-tune DeBERTa-v3 or ModernBERT. No labels yet? Have Jev or a large LLM label a few hundred of your own examples, then train the small model on those. Skip facebook/bart-large-mnli, still the default in Hugging Face's zero-shot pipeline: it dates from 2019, runs a full pass for every label, and trails newer models in both the 28-task zero-shot benchmark and BTZSC. The list is ordered by how well each model did in those tests for the work it takes to set up, with the specialists for PII, prompt injection and secrets after the general-purpose models. Numbers checked October 5, 2026.
OpenCode Plugins (2026): Which Still Work on OpenCode 2
The best OpenCode plugins, and which ones work on OpenCode 2, ranked by how many developers outside each project say they use them, in blog posts, hands-on reviews and Hacker News threads. If your sessions run out of context, start with Dynamic Context Pruning. If you want the agent to plan before it codes, get Superpowers, or Plannotator to review plans in a browser. For a team of subagents, oh-my-opencode-slim is the one that runs on the current version. For memory that stays on your machine, opencode-mem. The thing no plugin page says loudly: OpenCode 2.0 came out in September 2026 with a new plugin system, and plugins written for OpenCode 1 do not load on it. Older guides tell you to add a package name to the "plugin" list in opencode.json, which OpenCode 1 then installs at startup. On OpenCode 2 the list is called "plugins" and there is a command for it, opencode plugin add <package>. Check the Works with line on each pick before you upgrade. OpenCode 1 still gets releases. Two names to keep straight. The OpenCode here is the one at opencode.ai, now in the anomalyco/opencode repository on GitHub. An earlier Go project with the same name, opencode-ai/opencode, is archived and continues as Crush. And oh-my-opencode was renamed oh-my-openagent. Plugins that sign you in with a Claude or Gemini subscription are left out. Google and Anthropic treat that as against their terms, the popular Antigravity one is archived, and accounts have been flagged. A plugin runs with your full permissions, so read what you install. Ordered by how many independent recommendations each plugin has, then by downloads and stars. A plugin that does not load on the current OpenCode ranks below the ones that do. Numbers checked October 17, 2026.
Best Pi Coding Agent Extensions (2026)
The best extensions for the Pi coding agent (some people call them plugins), picked from the setups developers publish and the write-ups that tested them, not from download counts alone. Pi is deliberately bare: no sub-agents, no plan mode, no permission prompts. You add what you miss with one command, pi install npm:<package>. If you are starting out, three cover most of the gap with Claude Code: pi-subagents for delegation, pi-web-access for search, and rpiv-ask-user-question so the model asks before it guesses. Add Plannotator if you want plan mode, and pi-permission-system if you don't want the agent free to run anything. Two things have changed that older guides miss. Pi has had MCP support built in since version 0.99, so pi-mcp-adapter is now an upgrade and no longer a requirement. And several popular names have lookalikes: npm has at least four other packages named pi-mcp-adapter under other people's scopes, and more than one /btw extension, so install by the exact name shown here. Extensions run with the same access to your machine that Pi has. Pi's catalog lists more than 5,000 packages, so read the source of anything that touches your shell or credentials, and pin versions you depend on. Ordered by how many independent users and reviewers recommend each one (Kay Rhodes's setup guide, Composio's tested top ten, developers on Hacker News and Pi's own GitHub discussions), then by npm downloads and GitHub stars. Downloads count automated installs too, so treat them as a rough signal. Numbers checked October 10, 2026.