Best Local LLMs for Claude Code

Anthropic's terminal coding agent, driven by a local model

Claude Code is Anthropic's agentic terminal coder, and out of the box it talks only to Anthropic's API. But its Messages API can be translated by a local proxy (LiteLLM) onto any OpenAI-compatible server, and the fully open-source Open Claude Code reimplementation exposes an OpenAI-compatible base URL directly. That is how the "Claude Code locally" guides actually run: an open-weight model with reliable structured tool-calling, doing the same 25-tool agentic loop without any code leaving your machine. This page ranks the local models that hold up in Claude Code's tool-call-heavy loop, where tool-calling reliability comes first.

Best pick
Qwen3.6 35B-A3BAgent-tuned MoE with the strongest open-weight tool-calling here; 100K+ context, runs on a 24GB Mac.
What Claude Code needs
Claude Code chains many tool calls over a long, growing context, so it rewards models with strong agentic tool use and ample context. Tool-calling reliability is the first filter: models that drop or mangle tool_calls break the loop no matter how good their prose is.
Table 1Tier list

Claude Code local LLM tier list

11 models
SS: Best in class2
ModelSizeRAMWhyRun
Qwen3.6 35B-A3B35B32GBAgent-tuned MoE with the strongest open-weight tool-calling here; 100K+ context, runs on a 24GB Mac.
Qwen3.5 35B-A3B Instruct35B32GBThe model leading "Claude Code locally" guides actually deploy; disables internal CoT so Claude Code drives reasoning.
AA: Strong, reliable3
ModelSizeRAMWhyRun
Qwen2.5 Coder 14B14B16GBTrained for tool use; the most dependable mid-size coding workhorse for agent CLIs.
Gemma 4 31B31B32GBLow tool-call error rates in agentic testing; run with thinking off.
LFM2 24B-A2B Instruct24B24GBLiquid's tool-dispatch MoE, built for on-device agents, fits ~14.5GB.
BB: Usable with caveats3
ModelSizeRAMWhyRun
Qwen3 30B30B32GBCapable agentic MoE; reliable tool calls but a generation behind the 3.5/3.6 agent models.
Qwen2.5 Coder 7B7B8GBSolid 8GB fallback with real tool-use training; weaker on long multi-step chains.
Mistral Small 22B22B32GBDecent function calling, fits ~32GB Macs, but long tool sequences can hit format errors.
CC: Works, but not recommended3
ModelSizeRAMWhyRun
DeepSeek-R1 Distill Qwen 14B14B16GBStrong reasoning, but R1 distills drop tool calls into content instead of the tool_calls array.
Phi-4 14B14B24GBLacks proper tool-calling; fine as a chat model, unreliable as an agent.
Qwen3.5 4B Instruct4B6GBAgent-tuned but too small to stay coherent across long Claude Code loops.

Tiers weigh tool-calling reliability, context window, and coding quality for Claude Code specifically. A model can rank higher for one tool than another. RAM figures are for Q4 quantization. Sources are listed below.

Setup

Local setup notes

Run a local OpenAI-compatible server (Ollama, llama.cpp, or LM Studio), then either point the official Claude Code at it through a LiteLLM proxy that translates the Messages API, or use the open-source Open Claude Code fork and set its OPENAI_BASE_URL to your server (e.g. http://localhost:11434/v1) with any dummy API key. Raise the context window to 32K+ for the agentic loop, and disable internal chain-of-thought on Qwen3.x models so the agent drives the reasoning.

FAQ

Frequently asked questions

Which local model is best for Claude Code?
Qwen3.6 35B-A3B leads: agent-tuned tool-calling with 100K+ context, and it runs on a 24GB Mac. Qwen3.5 35B-A3B is the model the "Claude Code locally" guides actually deploy, with internal chain-of-thought disabled so Claude Code drives the reasoning. On 16GB, Qwen2.5 Coder 14B is the dependable workhorse; on 8GB, the 7B.
Can Claude Code run on a local model?
Not officially with Anthropic's API. The two working paths are a LiteLLM proxy that translates Claude Code's Messages API onto a local OpenAI-compatible server (Ollama, llama.cpp, LM Studio), or the open-source Open Claude Code fork, whose OPENAI_BASE_URL can be pointed at a local server with any dummy API key. Reliability depends on the model's tool-calling: weak tool-callers break the loop.
How much RAM does Claude Code need for local models?
The top agent-tier Qwen3.6/Qwen3.5 35B-A3B models load in roughly 20-22GB at Q4 and run on 24GB Macs. Qwen2.5 Coder 14B fits 16GB; the 7B fits 8GB. Leave headroom for the KV cache: the agent loop grows context across many tool calls, so more RAM directly buys longer, more reliable sessions.
Sources

Sources

Directory

Other AI coding tools

Related

Explore more