# Run Claude Code Locally
Kill the $300 AI Bill with Free, Private Coding Agents on Ollama and Open Models

- Price: $12.99 (Kindle ebook)
- Level: Intermediate
- Pages: 182
- Best for: Coders sick of the $300 AI bill
- You finish with: Run the real Claude Code, Codex, and OpenCode 100% local on Ollama
- Series: Open-Source AI Coding Playbooks, book 2 of 2
- Buy on Amazon: https://amzn.to/4ay1KdP
- Web page: https://youcanbuildthings.com/books/run-claude-code-locally

## What you get

Stop renting your coding agent. Wire the real Claude Code, Codex, and OpenCode to a model on your own machine: no $300 bill, no rate limits, nothing leaving your laptop, with an honest map of where local still loses to cloud.

You hit the rate limit mid-refactor, then the monthly bill lands. Again. Meanwhile other developers run the same coding agents locally for the price of electricity, with nothing leaving the laptop. This book wires the real Claude Code, Codex, and OpenCode to a model running on your own machine: a local agent editing real code in 15 minutes, Claude Code running fully local through a LiteLLM proxy you control, a model-picker tuned to your hardware, a break-even calculator with your name on it, and a troubleshooting runbook for the failure modes that make people quit on day one. It's an honest map of where local wins and where you still reach for cloud, not another "local AI is magic" pamphlet. 182 pages of real wiring, real model picks, and the truth about both sides.

## Chapters

1. The $300 Bill You'll Never Pay Again: Why local coding works now, the three reasons to switch, and the honest catch nobody mentions.
2. How a Coding Agent Actually Talks to a Model: The agent / model / API-shape mental model that makes every later config step obvious.
3. The Honest Map: Where Local Wins and Where It Doesn't: A green/amber decision matrix so you know, before you start, whether local will nail a task or choke.
4. Your First Local Agent in 15 Minutes: Install, pull a model, and watch an agent edit real code offline, no proxy required.
5. Wiring Claude Code to Your Own Machine: Stand up the LiteLLM proxy and config.yaml that make Claude Code run 100% local, verified.
6. Picking the Right Model for the Job: Choose your model by tool-call reliability and a benchmark you run yourself, not a leaderboard.
7. Choosing Your Harness and Runtime: Pick your agent and runtime (Ollama, llama.cpp, vLLM, MLX) on purpose, with the tradeoffs on the table.
8. Running on the Hardware You Already Own: Three knobs (model size, quantization, context) that turn a 52-second tool call into a 4-second one.
9. The Cost-Kill Math: Fill in a calculator with your real usage and walk out with your personal break-even month.
10. Private, Offline, and Yours: Prove your code never leaves the machine, and run fully offline on a plane or in an air-gapped facility.
11. When It Breaks: Troubleshooting Local Agents: A five-symptom runbook for every way local breaks, with the fix for each.
12. Going Fully Local: Your Daily-Driver Stack: Lock every choice into one safe, sandboxed stack and run a real day on it.

## Free guides from this book

- [How to Pick a Local Model for Coding](https://youcanbuildthings.com/articles/best-local-llm-for-coding.md): The best local LLM for coding isn't the leaderboard winner. Pick by tool-call reliability and speed, with a model table and a benchmark you run yourself.
- [Local vs Cloud AI Coding: When Local Loses](https://youcanbuildthings.com/articles/are-local-coding-models-good-enough.md): Are local coding models good enough? For most of your day, yes. The honest map of where local wins, where it loses, and how to decide before you fire a task.
- [Run a Local AI Coding Agent Free in 15 Minutes](https://youcanbuildthings.com/articles/local-ai-coding-agent-ollama.md): Build a local AI coding agent on Ollama that edits real code offline. Install, pull qwen2.5-coder, run Codex, ship your first edit with the Wi-Fi off.
- [Run Claude Code Locally with Ollama](https://youcanbuildthings.com/articles/run-claude-code-locally-with-ollama.md): Point the real Claude Code CLI at a local Ollama model through a LiteLLM proxy. The exact env vars, the config.yaml, and the version you must never install.
- [Why Your Local AI Coding Agent Is Slow](https://youcanbuildthings.com/articles/why-is-ollama-slow-for-coding.md): Why is Ollama slow for coding? Almost never your hardware. Fix the 52-second tool call with three knobs: model size, quantization, and context length.
