>_CLI agent· 11 local models ranked

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.

Claude Code: ModelFit

Best pick

Qwen3.6 35B-A3B

Agent-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.

Claude Code Local LLM Tier List

SS: Best in class
Qwen3.6 35B-A3B35B· 32GB RAM

Agent-tuned MoE with the strongest open-weight tool-calling here; 100K+ context, runs on a 24GB Mac.

Qwen3.5 35B-A3B Instruct35B· 32GB RAM

The model leading "Claude Code locally" guides actually deploy; disables internal CoT so Claude Code drives reasoning.

AA: Strong, reliable
Qwen2.5 Coder 14B14B· 16GB RAM

Trained for tool use; the most dependable mid-size coding workhorse for agent CLIs.

Gemma 4 31B31B· 32GB RAM

Low tool-call error rates in agentic testing; run with thinking off.

LFM2 24B-A2B Instruct24B· 24GB RAM

Liquid's tool-dispatch MoE, built for on-device agents, fits ~14.5GB.

BB: Usable with caveats
Qwen3 30B30B· 32GB RAM

Capable agentic MoE; reliable tool calls but a generation behind the 3.5/3.6 agent models.

Qwen2.5 Coder 7B7B· 8GB RAM

Solid 8GB fallback with real tool-use training; weaker on long multi-step chains.

Mistral Small 22B22B· 32GB RAM

Decent function calling, fits ~32GB Macs, but long tool sequences can hit format errors.

CC: Works, but not recommended
DeepSeek-R1 Distill Qwen 14B14B· 16GB RAM

Strong reasoning, but R1 distills drop tool calls into content instead of the tool_calls array.

Phi-4 14B14B· 24GB RAM

Lacks proper tool-calling; fine as a chat model, unreliable as an agent.

Qwen3.5 4B Instruct4B· 6GB RAM

Agent-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.

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.

Claude Code official site ↗

The weekly local-AI refresh

New open-weight models, real Apple Silicon benchmarks, and the one model worth running on your Mac this week. Free, one email a week, unsubscribe anytime.

By subscribing you agree to our Privacy Policy and to receive the weekly email. Unsubscribe anytime.

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

Other AI Coding Tools

Explore More

modelfit.io