How to connect Claude Code CLI to a local llama.cpp server
r/LocalLLaMA
•
Generative AI
Open Source AI
How to connect Claude Code CLI to a local llama.cpp server I’ve seen a lot of people struggling to get Claude Code working with a local llama.cpp setup, so here’s a quick guide that worked for me. 1. CLI (Terminal) Add this to your.bashrc (or.zshrc ): bash export ANTHROPIC_AUTH_TOKEN="not_set" export ANTHROPIC_API_KEY="not_set_either!" export ANTHROPIC_BASE_URL=" Reload your shell: bash source ~/.bashrc and run the cli with the model argument: bash claude --model Qwen3.5-35B-Thinking 2.