Run Claude Code on Linux with a local model¶
On Linux, Claude Code Local runs the model with llama.cpp and puts a small Anthropic Messages API server in front of it on http://localhost:4000, so Claude Code works against a model on your own machine with no API key. One command installs everything and you start it with claude-local.
What you need¶
gitandpython3. The installer stops and tells you if either is missing (on Debian or Ubuntu:sudo apt-get install -y git python3).- Disk space for the model, which can be large.
- The Claude Code CLI. If
claudeis not found, setup installs it with the officialcurl -fsSL https://claude.ai/install.sh | bash.
1. Install¶
On Linux, install.sh clones the repo to ~/claude-code-local (set CCL_DIR to change it) and runs portable/setup-linux.sh, which:
- Detects your hardware: an NVIDIA card (
nvidia-smi), an AMD or other Vulkan GPU (vulkaninfo), or CPU only. - Downloads the matching llama.cpp release, pinned by version and checksum in
portable/llamacpp.json. - Picks the strongest vision model that fits your memory at the highest precision it can, and downloads it from Hugging Face. Every file is checked by size and SHA-256 from
portable/catalog.json. - Writes the
claude-locallauncher to~/.local/bin, a desktop entry named Claude Code Local, and thekeep goingcommand.
Some examples of what it picks:
| Your hardware | What you get |
|---|---|
| 24 GB NVIDIA card | Qwen 3.5 9B at full BF16 |
| 12 GB NVIDIA card | Qwen 3.5 4B at full BF16 |
| AMD or Vulkan GPU | the largest that fits in VRAM |
| No GPU (CPU only) | a 4B or 9B vision model, sized to your RAM |
To see the pick before downloading anything:
2. Start Claude Code¶
This starts llama-server on port 8080, starts the Anthropic proxy on port 4000, waits for both to answer /health, and opens Claude Code pointed at http://localhost:4000 with the placeholder key sk-local.
If claude-local is not found, add ~/.local/bin to your PATH:
3. Pick a different model¶
install downloads that model and writes it into the config claude-local reads. The IDs are in portable/catalog.json. Every model in it can read images, so screenshots you paste into Claude Code work.
Hit your Claude limit? Keep going¶
When your Claude plan runs out mid-task, type exit in Claude Code, then in the same folder:
The same conversation resumes on the local model. Open a new terminal after installing so the command is on your PATH. More on the usage limit page.
If something does not start¶
llama-server can't start, these libraries are missing: install GNU OpenMP (Debian or Ubuntu:sudo apt-get install -y libgomp1), then runclaude-localagain. Stock Ubuntu 24.04 does not ship it.llama-server did not come up on :8080: another program owns that port. SetCCL_LLAMA_PORT(andCCL_PORTfor 4000).bash scripts/doctor.shchecks the model server, the model files, the llama.cpp binary andkeep going.--fixrepairs what it safely can.
More in Troubleshooting.