๐ง Claude Code Local
Run a 122 billion parameter AI on your MacBook.
No cloud. No fees. No data leaves your machine.
๐ค What Is This?
Your MacBook has a powerful GPU built right into the chip. This project uses that GPU to run a massive AI model โ the same kind that powers ChatGPT and Claude โ entirely on your computer.
๐ซ No internet needed
๐ฐ No monthly subscription
๐ No one sees your code or data
โ
Full Claude Code experience โ write code, edit files, manage projects, control your browser
๐ฑ You (Mac or Phone)
โ
๐ค Claude Code โ the AI coding tool you know
โ
โก MLX Native Server โ our server (200 lines of Python)
โ
๐ง Qwen 3.5 122B โ 122 billion parameter brain
โ
๐ฅ๏ธ Apple Silicon GPU โ your M-series chip does all the work
๐ฑ Control From Your Phone
You don't have to be at your Mac to use this. We built a remote control pipeline:
๐ฑ Your iPhone ๐ป Your Mac
โ โ
โโโ iMessage โโโโโโโโโโโโโโโโโโ>โ
โ โโโ Claude Code
โ โโโ MLX Server
โ โโโ Qwen 3.5 122B
โ โโโ (does the work)
โ<โโ iMessage response โโโโโโโโโ
โ โ
๐๏ธ From your couch ๐ฅ๏ธ At your desk
How it works:
- ๐ฒ Send a message from your phone via iMessage
- ๐ค Claude Code receives it and runs the task on your local AI
- ๐ฌ Response comes back to your phone
- โ๏ธ Works anywhere your Mac has power โ even offline for the AI part
We built this before Anthropic shipped their Dispatch feature. Same concept, but ours uses iMessage and runs on your local model instead of cloud.
๐ก Pro tip: Anthropic's Dispatch doesn't read your CLAUDE.md. Mention it in your message or it'll miss your custom setup. Our iMessage system doesn't have this problem.
๐ Benchmarks
We built and tested three different approaches. Each one got faster.
โก Speed Comparison
Tokens per Second
๐ Ollama (Gen 1) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 30 tok/s
๐ llama.cpp (Gen 2) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 41 tok/s
๐ MLX Native (Gen 3) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 65 tok/s
โฑ๏ธ Real-World Claude Code Task
How long to ask Claude Code to write a function:
๐ด Ollama + Proxy โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 133 seconds
๐ llama.cpp + Proxy โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 133 seconds
๐ฅ MLX Native (no proxy) โโโโโโ 17.6 seconds
7.5x faster โก
๐ Side-by-Side
|
๐ Ollama |
๐ llama.cpp + TurboQuant |
๐ MLX Native (ours) |
| Speed |
30 tok/s |
41 tok/s |
65 tok/s |
| Claude Code task |
133s |
133s |
17.6s |
| Needs a proxy? |
โ Yes |
โ Yes |
โ
No |
| Lines of code |
N/A |
N/A (C++ fork) |
~200 Python |
| Apple native? |
โ Generic |
โ Ported |
โ
MLX |
โ๏ธ vs Cloud APIs
|
๐ฅ๏ธ Our Local Setup |
โ๏ธ Claude Sonnet |
โ๏ธ Claude Opus |
| Speed |
65 tok/s |
~80 tok/s |
~40 tok/s |
| Monthly cost |
$0 ๐ |
$20-100+ |
$20-100+ |
| Privacy |
100% local ๐ |
Cloud |
Cloud |
| Works offline |
Yes โ๏ธ |
No |
No |
| Data leaves your Mac |
Never |
Always |
Always |
๐ก Our local setup beats cloud Opus on raw speed (65 vs 40 tok/s) at $0/month.
๐ก How We Got Here
Most people trying to run Claude Code locally hit the same wall:
Claude Code speaks Anthropic API. Local models speak OpenAI API. Different languages. ๐คท
So everyone builds a proxy to translate between them. That proxy adds latency, complexity, and breaks things.
We took a different approach:
| ๐ What everyone else does |
๐ What we did |
| Claude Code โ Proxy โ Ollama โ Model |
Claude Code โ Our Server โ Model |
| 3 processes, 2 API translations |
1 process, 0 translations |
| 133 seconds per task |
17.6 seconds per task |
๐ฏ That one change โ eliminating the proxy โ made it 7.5x faster.
๐ป What You Need
| Your Mac |
RAM |
What You Can Run |
| M1/M2/M3/M4 (base) |
8-16 GB |
๐ก Small models (4B) |
| M1/M2/M3/M4 Pro |
18-36 GB |
๐ Medium models (32B) |
| M2/M3/M4/M5 Max |
64-128 GB |
๐ข Large models (122B) |
| M2/M3/M4 Ultra |
128-192 GB |
๐ต Multiple large models |
Also need:
- ๐ Python 3.12+ (for MLX)
- ๐ค Claude Code (
npm install -g @anthropic-ai/claude-code)
๐ Quick Start (4 Steps)
1๏ธโฃ Set up Python environment
python3.12 -m venv ~/.local/mlx-server
~/.local/mlx-server/bin/pip install mlx-lm
2๏ธโฃ Download the AI model
First run downloads ~50 GB (one time only):
~/.local/mlx-server/bin/python3 -c "
from mlx_lm.utils import load
load('mlx-community/Qwen3.5-122B-A10B-4bit')
print('Done!')
"
3๏ธโฃ Start the server
~/.local/mlx-server/bin/python3 proxy/server.py
4๏ธโฃ Launch Claude Code
ANTHROPIC_BASE_URL=http://localhost:4000 \
ANTHROPIC_API_KEY=sk-local \
claude --model claude-sonnet-4-6
๐ก Or just double-click Claude Local.command on your Desktop. It does all of this automatically.
๐ง How It Works
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Your MacBook (M5 Max) โ
โ โ
โ ๐ฑ You type โโ> ๐ค Claude Code โ
โ โ โ
โ โผ โ
โ โก MLX Server (port 4000) โ
โ โ โ
โ โผ โ
โ ๐ง Qwen 3.5 122B โโ> ๐ฅ๏ธ GPU โ
โ โ โ
โ โผ โ
โ ๐ฑ Answer <โโโ โจ Clean response โ
โ โ
โ ๐ Nothing leaves this box. Ever. โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
The server (proxy/server.py) is one file, ~200 lines. It does three things:
- ๐ฆ Loads the model โ Apple's MLX framework, native Metal GPU, unified memory
- ๐ Speaks Anthropic API โ Claude Code thinks it's talking to Anthropic's cloud. It's not.
- ๐งน Cleans the output โ Qwen thinks out loud in
<think> tags. We strip those.
๐ Browser Control
Claude Code can control your real web browser โ not a sandbox. Your actual browser with all your logins. ๐
|
๐ข Chrome DevTools (CDP) |
๐ต Playwright |
| Controls |
Your real Brave/Chrome |
Separate sandboxed browser |
| Logged in? |
โ
All your sessions |
โ Starts fresh |
| Speed |
โก Fast |
๐ Slower |
| Best for |
Daily tasks |
Automated jobs |
๐ก Example: "Go to my GitHub and check which PRs need review" โ it opens your actual browser, already logged in, and does it. No re-authenticating. Ever.
โ๏ธ When To Use This
| Situation |
Use This? |
Why |
| On a plane |
โ
|
Full AI coding, no internet needed |
| Sensitive client code |
โ
|
Nothing leaves your machine |
| Don't want API fees |
โ
|
$0/month forever |
| Want fastest possible |
โ๏ธ |
Cloud API is still faster |
| Need Claude-level reasoning |
โ๏ธ |
Local model is good, not Claude-level |
| Controlling from phone |
โ
|
iMessage pipeline works offline |
๐ What's In This Repo
๐ฆ claude-code-local/
โโโ โก proxy/
โ โโโ server.py โ The entire server. 200 lines. This IS the project.
โโโ ๐ launchers/
โ โโโ Claude Local.command โ Double-click to start everything
โ โโโ Browser Agent.command โ Double-click for browser control
โโโ ๐ ๏ธ scripts/
โ โโโ download-and-import.sh โ Download models
โ โโโ persistent-download.sh โ Auto-retry downloader
โ โโโ start-mlx-server.sh โ Alternative config
โโโ ๐ docs/
โ โโโ BENCHMARKS.md โ Detailed speed comparisons
โ โโโ TWITTER-THREAD.md โ Social media content
โโโ setup.sh โ One-command installer
๐ Security
We audited every component before running it:
| Component |
Source |
Network Calls |
Verdict |
| server.py |
We wrote it |
0 |
โ
Safe |
| MLX framework |
Apple |
0 |
โ
Safe |
| Qwen 3.5 model |
HuggingFace verified |
0 |
โ
Safe |
๐ซ No telemetry
๐ซ No analytics
๐ซ No phone-home
๐ซ No sketchy pip packages
โ ๏ธ We removed LiteLLM after supply chain attack concerns were raised. Every dependency was audited.
๐ค๏ธ The Journey
We didn't start here. We went through three generations in one night:
| Gen |
What We Tried |
Speed |
๐ก What We Learned |
| 1๏ธโฃ |
Ollama + custom proxy |
30 tok/s |
Ollama works but Claude Code can't talk to it directly |
| 2๏ธโฃ |
llama.cpp TurboQuant + proxy |
41 tok/s |
TurboQuant compresses KV cache 4.9x, but the proxy is the bottleneck |
| 3๏ธโฃ |
MLX native server |
65 tok/s |
Kill the proxy. Speak Anthropic API directly. 7.5x faster. |
๐ฏ Each generation taught us something. The final insight โ the proxy was the bottleneck, not the model โ changed everything.
๐ Credits
Built on the shoulders of giants:
| Project |
What It Does |
By |
| ๐ค Claude Code |
AI coding agent |
Anthropic |
| ๐ MLX |
Apple Silicon ML framework |
Apple |
| ๐ฆ mlx-lm |
Model loading + inference |
Apple |
| ๐ง Qwen 3.5 |
The 122B model |
Alibaba |
| โก TurboQuant |
KV cache compression research |
Google Research |
Tested on Apple M5 Max with 128 GB unified memory.
๐ MIT License โ Use it however you want.
โญ Star this repo if it helped you! โญ