The Codex app is genuinely useful, and it also costs $20/month plus a metered rate limit that most people burn through by day nineteen (see our real Cursor+SaaS cost breakdown for the same pattern in another tool). In 2026 you can get 85–90% of that same experience running entirely on your own machine — no API keys, no rate limits, no latency, no code leaving your laptop — using Ollama or LM Studio with a decent local coding model. This guide walks the actual setup step by step: which model to pick for your hardware, how to wire it into VS Code, and what breaks when you try to go fully offline.
Author: PromptSpace. This is the practical follow-up to our Codex app guide — that one covers the paid product; this one covers the free local alternative. Both are valid depending on your codebase, machine, and privacy posture.
Why run coding models locally at all?
Three concrete reasons, ranked by how much they actually matter in day-to-day work:
- Codebase privacy. If you work on client code, medical software, financial systems, or anything under an NDA, sending source to a US-based cloud model is often literally illegal in your jurisdiction. Local models keep every character of your codebase on your machine.
- No rate limits, no latency. Cloud coding models add 400–2000ms latency per request. Local inference on a decent GPU is 40–120ms. Over eight hours of pair-coding, that difference compounds.
- Cost, but only barely. Ollama is free. LM Studio is free. A one-time GPU purchase or a laptop with 32GB unified memory pays for itself in 3–4 months versus the pro tiers. If you're on a rented laptop, the math is different.
Pro Tip: Don't try to use local models for your daily driver on day one. Set up a local model alongside your paid Codex subscription for a week, run every prompt through both, and see which one wins on which type of task. Local models are usually as good or better at refactoring, comment-writing, and small-file edits, and noticeably weaker at multi-file reasoning and API-shape questions. Once you know the split, you can drop the paid plan for real work you know the local model handles.
Hardware requirements, honestly
The single biggest lie in local-LLM content is "you can run a coding model on any laptop." You can technically. It will be so slow you will hate your life. Here are the real thresholds:
| Hardware | Model size you can actually run | Tokens/sec (rough) | Verdict for coding |
|---|---|---|---|
| M1/M2/M3 MacBook, 16GB RAM | 7B (Q4 quant) | 15–25 t/s | Autocomplete only, don't try full-function generation |
| M2/M3 MacBook, 32GB RAM | 14B–32B (Q4 quant) | 18–35 t/s | Fully usable for daily coding |
| M3 Max / M4 Pro, 64GB+ | 70B (Q4) or 32B FP16 | 25–45 t/s | Excellent — this is the sweet spot |
| PC with RTX 4070 (12GB VRAM) | 14B (Q4) or 7B FP16 | 50–80 t/s | Fast, but VRAM limits your context window |
| PC with RTX 4090 (24GB VRAM) | 32B (Q4) | 60–95 t/s | Best price/performance for coding |
| Windows/Linux without dedicated GPU | 7B on CPU | 3–8 t/s | Not viable for interactive use |
The rule of thumb: model weight in GB should fit in ~60% of your RAM/VRAM to leave room for context. A 32B model at Q4 quantization is around 20GB — comfortable on 32GB unified memory, tight on 16GB.
The four coding models actually worth downloading in 2026
Ignore anything not on this list. The local-LLM ecosystem produces 40+ coding models per year and 95% of them are worse than what you already have.
1. Qwen2.5-Coder 32B (best overall)
Alibaba's Qwen2.5-Coder 32B is the current state of the art for open-weight coding models, full stop. It matches or beats GPT-4-level performance on HumanEval, MBPP, and BigCodeBench, and it's the model most local-LLM developers I know have standardized on for daily work. Ollama tag: qwen2.5-coder:32b. Download size: ~20GB at Q4.
2. DeepSeek-Coder V2 Lite 16B (best for 16GB machines)
If you're on a 16GB MacBook or lower-VRAM GPU, DeepSeek-Coder V2 Lite 16B is what you want. Mixture-of-experts architecture — only 2.4B parameters activate per token — so real memory footprint at Q4 is around 10GB. Ollama tag: deepseek-coder-v2:16b.
3. Codestral 22B (best for multi-language code)
Mistral's Codestral 22B is trained on 80+ programming languages including a lot of niche ones (Fortran, COBOL, R, Julia). If you work in something exotic, Codestral is your friend. Ollama tag: codestral:22b. Note: apache-licensed for research, so double-check terms for commercial use.
4. StarCoder2 15B (best for fill-in-the-middle / autocomplete)
If your primary use case is inline autocomplete (not chat/refactor), StarCoder2 15B is the strongest FIM (fill-in-the-middle) model in this size range. Faster than Qwen for pure completion because it's a smaller architecture. Ollama tag: starcoder2:15b.
Ollama setup: exact commands
Ollama is the easiest way to get started. It's a single binary, it handles model downloads, quantization, and serves an OpenAI-compatible API on localhost:11434.
# Install (macOS)
brew install ollama
Or Linux
curl -fsSL https://ollama.com/install.sh | sh
Or Windows: download from ollama.com/download
Start the daemon
ollama serve # runs in background; leave this terminal open OR use launchd/systemd
Pull the model (~20GB download for Qwen 32B — coffee break)
ollama pull qwen2.5-coder:32b
Test it works
ollama run qwen2.5-coder:32b "Write a Python function that reverses a linked list"
Verify the OpenAI-compatible endpoint
curl http://localhost:11434/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "qwen2.5-coder:32b",
"messages": [{"role":"user","content":"Explain closures in JavaScript"}]
}'
Did You Know? Ollama's
/v1endpoint is fully OpenAI-compatible. Any tool that accepts an OpenAI base URL — Cursor, Continue.dev, Zed, aider, Cline — can point athttp://localhost:11434/v1and get the local model as if it were GPT-4. This is the single most important thing to know about the local-LLM setup: the whole ecosystem works with one endpoint.
LM Studio setup: the GUI option
LM Studio is a desktop app (macOS/Windows/Linux) that gives you a GUI over the same underlying inference (llama.cpp). If you prefer clicking to typing, this is the tool.
# 1. Download from lmstudio.ai
2. Open the app
3. Search for "qwen2.5-coder" in the discover tab
4. Download the "Q4_K_M" quantization (best size/quality tradeoff for coding)
5. Load the model (Local Server tab → select the model → Start Server)
6. Server is now at http://localhost:1234/v1 — same OpenAI-compatible shape
LM Studio's advantage over Ollama: it exposes GPU utilization, memory pressure, and per-request logs in the UI. If you're debugging why your model is slow, LM Studio's telemetry is genuinely useful. Ollama is more terminal-native and integrates more cleanly with launchd/systemd for background operation.
Wiring it into VS Code with Continue.dev
The best OSS IDE integration for local coding models in 2026 is Continue.dev — it's free, actively maintained, and supports both chat and autocomplete against any OpenAI-compatible endpoint.
// ~/.continue/config.json (or via Continue's config panel)
{
"models": [
{
"title": "Qwen 2.5 Coder 32B (local)",
"provider": "openai",
"model": "qwen2.5-coder:32b",
"apiBase": "http://localhost:11434/v1",
"apiKey": "ollama-does-not-need-one"
}
],
"tabAutocompleteModel": {
"title": "Qwen 2.5 Coder 7B (autocomplete)",
"provider": "openai",
"model": "qwen2.5-coder:7b",
"apiBase": "http://localhost:11434/v1"
},
"customCommands": [
{
"name": "test",
"prompt": "Write a comprehensive test suite for the following code. Use pytest for Python, jest for JavaScript, or the standard test framework for the language shown.",
"description": "Generate tests"
}
]
}
Notice the two-model setup: the 32B for chat/refactor (where quality matters), the 7B for tab autocomplete (where latency matters more than depth). This is the pattern serious local-LLM users converge on within about a week.
Wiring it into Cursor
Cursor supports custom OpenAI endpoints since version 0.40. Settings → Models → toggle "Override OpenAI Base URL" and paste http://localhost:11434/v1. Add your Ollama model name (e.g. qwen2.5-coder:32b) as a custom model. You lose Cursor's cloud-side context indexing but keep the tab-completion, chat, and edit-mode UI.
Real talk: Cursor's edge over VS Code + Continue is not the model; it's the tab-completion prediction and the multi-file edit UI. If you replace Cursor's model with a local one, you're paying $20/month for those features alone. Some people happily do; others switch to Continue + VS Code and pocket the savings.
Real performance on real machines
Numbers from actual daily use (August 2026), coding in Python and TypeScript:
- M3 Max 64GB, Qwen 32B Q4: ~35 t/s. Multi-file refactor of a 400-line file returns in ~14 seconds. Tab completion feels instant (12ms first-token).
- M2 Pro 32GB, Qwen 32B Q4: ~22 t/s. Same refactor: ~22 seconds. Autocomplete: ~40ms first-token. Perfectly usable.
- M1 Pro 16GB, DeepSeek Coder V2 Lite 16B: ~28 t/s (MoE helps a lot). Same refactor: ~18 seconds.
- RTX 4090 desktop, Qwen 32B Q4: ~85 t/s. Refactor: ~6 seconds. Feels faster than cloud GPT-4.
Pro Tip: If your first token takes more than 200ms, you're not GPU-bound — you're on CPU inference. Check your Ollama logs for "using Metal" (macOS) or "using CUDA" (Linux/Windows). If neither is present, you have a driver problem, not a hardware one.
What breaks going fully offline
Local models are not identical to Codex. Here are the honest gaps:
- Web search / documentation lookup. Codex can hit web docs live. Ollama can't. You'll want to keep a browser open with the docs you need, or use a RAG tool like an offline code assistant that indexes your local documentation.
- Multi-file reasoning at scale. Local 32B models handle 3–5 file context well. Codex-4o handles 30+ files. If you're doing a monorepo-wide refactor, cloud still wins.
- Very-recent API knowledge. Qwen 2.5 Coder's training cutoff is late 2024. If you're using an API that shipped in 2026, the model doesn't know it. Paste the docs into the chat context and it will do fine, but out of the box it's blind to newer surfaces.
- Vision / screenshot understanding. If your workflow depends on "here's a screenshot of the failing UI, fix it," Qwen 2.5 Coder is text-only. You need a multimodal model (Qwen 2.5 VL, or Llama 3.2 Vision) — different setup, weaker at code.
The actual cost math over 12 months
| Setup | Year 1 cost | Year 2+ cost | Notes |
|---|---|---|---|
| Codex Pro subscription | ~$240 | ~$240/yr | Includes GPT-4o and rate-limited GPT-5 |
| Ollama on existing 32GB MacBook | $0 | $0 | If you already own it |
| Buy MacBook Pro M4 32GB for local LLMs | ~$2,400 one-time | $0 | Breaks even at ~year 10 vs subscription (but you get a laptop) |
| Build PC with RTX 4090 | ~$2,800 one-time | ~$60/yr electricity | Best raw performance |
| Hybrid: keep Codex + local for privacy work | ~$240 | ~$240/yr | Most people end up here in practice |
Honest answer: if you already own a 32GB+ MacBook, adding Ollama to your workflow is a no-brainer — free upside. If you're deciding whether to buy new hardware just for local LLMs, the math only works out if you have a privacy requirement that forces it, or you code enough hours per day that the latency savings compound meaningfully.
Related PromptSpace resources
- How to Use OpenAI Codex App with Local Models (2026 Guide) — the parent post this piece amplifies, covers the paid Codex app in depth.
- GPT-5.5 Codex: What Changed and What Didn't — release-note deep dive on the current Codex model.
- Gemini CLI Agent Skills: A Practical Tour — the Google-side alternative if you prefer their ecosystem.
- ChatGPT prompts for developers — copy-paste starter prompts across languages and frameworks.
- Free AI Prompt Library — the full 5,000+ prompt directory.
FAQ
Is Qwen 2.5 Coder actually as good as GPT-4 for coding?
On the standard benchmarks (HumanEval, MBPP, BigCodeBench) — yes, essentially tied with GPT-4o. On day-to-day feel — very close, with the gap showing mostly in multi-file reasoning and recent-API knowledge. For 80% of tasks a working programmer actually does (function-level edits, refactoring, comment writing, test generation), you will not notice a quality difference in blind side-by-side testing.
Can I run local models on a Windows laptop without a dedicated GPU?
Technically yes, practically no. CPU-only inference of a 7B model gets you around 3–8 tokens per second, which means autocomplete requests take 5–15 seconds and chat responses take 30+ seconds. This is fine for occasional queries but breaks your flow for interactive coding. If you're on integrated graphics, either upgrade to a machine with 32GB unified memory (Mac) or an entry-level dGPU (NVIDIA 4060 8GB minimum), or stick with cloud tools.
How much disk space do I need for a full local coding setup?
Budget 40–60GB for two models (one big chat model at 20GB, one small autocomplete model at 5GB, plus Ollama's overhead and llama.cpp cache). If you plan to experiment with multiple 32B models before settling on one, 100GB is safer. Models can be deleted with ollama rm <model:tag> — nothing is permanent.
Does Ollama work offline once the model is downloaded?
Yes, 100%. Ollama only touches the network during ollama pull. Once a model is on disk, you can disconnect from the internet entirely and the model works — this is the whole point for privacy-critical workflows. LM Studio is the same.
What's the difference between Q4, Q5, and Q8 quantization?
Quantization is compression. Q4 (4-bit) is the standard for local coding models — about 95% of the original quality at 30% of the file size. Q5 gives you a tiny quality bump at 20% larger file. Q8 is nearly full quality but takes twice the disk and RAM. For coding models specifically, Q4_K_M is the sweet spot and what almost everyone uses. Only go higher if you have overhead RAM to burn.
Can I fine-tune a local coding model on my own codebase?
Yes — this is one of the strongest arguments for going local. Tools like Axolotl, Unsloth, and LoRA-based fine-tuning let you take Qwen 2.5 Coder and specialize it on your own repo's style, conventions, and internal APIs. Requires a bigger GPU (24GB VRAM minimum for a 32B fine-tune, less for smaller models) but the payoff for a large private codebase is significant — the model starts writing code that matches your team's patterns exactly.
The bottom line
Local coding models in 2026 are genuinely good. Not "good considering they're free" — good, period. Qwen 2.5 Coder 32B running on a 32GB MacBook is close enough to Codex that most professional developers won't notice the difference on 80% of tasks. The remaining 20% — multi-file reasoning, live web docs, very-recent API knowledge — is where cloud still wins, and it's why most people end up in a hybrid setup rather than fully offline. Start with Ollama, pull Qwen 32B, wire Continue.dev into VS Code, and use it for a week alongside your existing paid tools. You'll figure out fast where local wins and where it doesn't.
Ready to build your prompt library? Browse 5,000+ free AI prompts on PromptSpace — copy-paste ready for coding, image, and video generation. Also worth reading: Codex vs Claude Code vs Copilot 2026, GPT-5.5 Codex features, and the best Claude Code skills for solo devs.












