Claude Code Local: Run Claude Code with Local AI Models

An open-source backend that connects Claude Code to local models for code editing, terminal commands, and MCP tools on Mac, Linux, or Windows.

Claude Code Local runs Claude Code with open-weight AI models on macOS, Linux, and Windows. You can inspect repositories, edit code, run shell commands, and use project instructions and MCP servers from the familiar Claude Code terminal while the model runs on your own computer.

An MLX server handles inference on Apple Silicon, and a llama.cpp backend runs models on Linux and Windows. Both connect to Claude Code through the Anthropic Messages API and translate local-model tool calls. If a hosted usage limit interrupts your coding session, the keep going command can resume that conversation with a local model.

Features

  • Runs local coding models with Apple MLX on Macs and llama.cpp on Linux and Windows.
  • Connects to Claude Code through the Anthropic Messages API and streams model responses.
  • Converts Qwen, Gemma, Llama, and related model tool calls into the tool format Claude Code expects.
  • Repairs malformed or incomplete tool calls, including multi-call replies and mismatched tool names.
  • Reuses prompt-cache prefixes across turns to reduce repeated processing in longer sessions.
  • Resumes a recent Claude Code conversation with keep going on a local model or an optional OpenRouter model.
  • Includes a separate Native Engine agent with file, shell, search, and edit operations.
  • Offers optional voice, browser, phone, remote-access, session-management, and failover integrations.

Use Cases

  • Resume a coding conversation on a local model after a hosted Claude Code usage limit stops the session.
  • Investigate a failing test, edit the affected files, and rerun the test with code prompts processed locally.
  • Read code, fix small bugs, and run focused commands on an 8 GB or 16 GB Apple Silicon Mac.
  • Trace dependencies across several files and make coordinated edits with a larger model on a high-memory Mac.
  • Inspect a UI screenshot and update the corresponding frontend code with a vision-capable local model.
  • Use the optional browser agent to test interactions on a website during a local-model coding session.

How Claude Code Local Works

Claude Code sends Anthropic Messages API requests to the local server, normally at http://localhost:4000 on a Mac. The server forwards prompts to an MLX model and converts the response into Claude Code-compatible text, streaming events, and tool_use messages. The portable Linux and Windows runtime uses llama.cpp for inference and shares the project’s request and tool-call translation logic.

Local coding models generate tool calls in several XML and JSON formats. Claude Code Local parses these variations, repairs malformed arguments, and preserves multiple tool calls in a single response. Claude Code handles file edits, shell commands, permissions, and project instructions after receiving the translated calls.

The MLX server reuses prompt prefixes between turns and trims its cache to the current conversation. Tool-call retries use temporary cache state, preserving the context that the next request will reuse.

How to Use Claude Code Local

Install on macOS

On an Apple Silicon Mac, install a current Claude Code CLI and run the Claude Code Local installer. The setup process selects a model based on unified memory, downloads its weights, installs the MLX dependencies, and creates a Claude Local.command Desktop launcher.

curl -fsSL https://claude.ai/install.sh | bash
curl -fsSL https://raw.githubusercontent.com/nicedreamzapp/claude-code-local/main/install.sh | bash

You can inspect the repository and run its setup script directly:

git clone https://github.com/nicedreamzapp/claude-code-local
cd claude-code-local
bash setup.sh

For a fresh local session, double-click Claude Local.command. The installer keeps the ordinary claude command available for your existing hosted Claude Code setup.

Install on Linux or Windows

Linux and Windows installations use the portable llama.cpp backend. The installer detects NVIDIA, AMD/Vulkan, or CPU hardware, installs a pinned llama.cpp build, and selects a supported vision model according to available memory.

Linux:

curl -fsSL https://raw.githubusercontent.com/nicedreamzapp/claude-code-local/main/install.sh | bash
claude-local

Windows (PowerShell):

irm https://raw.githubusercontent.com/nicedreamzapp/claude-code-local/main/install.ps1 | iex

Check the Installation with Doctor

Run Doctor from the repository and check the local model server, model files, Claude Code CLI, Python, and any installed integrations. Use --fix on macOS or Linux, or -Fix on Windows, for supported service and symlink repairs.

macOS or Linux:

bash scripts/doctor.sh

Windows (PowerShell):

powershell -ExecutionPolicy Bypass -File scripts\doctor.ps1

Continue a Session with keep going

On a Mac, setup installs the keep going shell command. If a hosted usage limit interrupts Claude Code, type exit inside the Claude Code session. After you return to your shell in the same project directory, run:

keep going

keep going finds the latest Claude Code conversation for that directory and offers a local model to continue it. It can also present free OpenRouter models if an OpenRouter API key has been configured.

Local inference requires no Anthropic model API key. Choosing OpenRouter sends the selected conversation to the cloud provider.

Choose a Model for Your Mac

The current Mac installer selects these starting models according to unified memory:

Unified MemoryInstaller Model
8 GB (under 16 GB)Qwen 3.5 2B, 8-bit; 16K context
16–31 GBQwen 3.5 4B, bf16; 16K context
32–63 GBGemma 4 12B, 4-bit
64–95 GBGemma 4 31B, 4-bit
96 GB or moreQwen 3.8 27B, 8-bit

Run the Native Engine

Native Engine is the project’s own terminal coding agent, separate from Claude Code. It loads an MLX model in the agent process and uses a compact, stable system prompt to reuse its KV cache through longer sessions. The agent handles Bash, Read, Write, Edit, Glob, and Grep operations and is available through the bundled (Native Engine) launchers.

From the repository directory, run:

AGENT_MODEL=lmstudio-community/Qwen3-Coder-30B-A3B-Instruct-MLX-8bit \
AGENT_DIALECT=native \
python3 agent/agent.py

AGENT_DIALECT=native uses the selected model’s native tool-call template. AGENT_DIALECT=prompted uses the prompt-defined XML format. The agent can also connect to a local Anthropic-protocol server using AGENT_BACKEND=http.

Optional Integrations

Claude Code Local can be used on its own for terminal coding. The installer can also offer separate companion projects that add browser control, voice interaction, remote sessions, and automatic failover.

  • NarrateClaude transcribes speech locally and reads Claude Code replies aloud on supported desktops.
  • browser-agent drives a real browser session for web-based tasks.
  • Moonstone gathers Claude Code sessions from multiple machines into one window.
  • FiaOS provides a remote screen and terminal in a browser.
  • claude-screen-to-phone supports iPhone control through iMessage on macOS.
  • claude-failover switches compatible background agents to local inference when a hosted limit is reached.

On macOS, install selected add-ons by passing their names to the installer. For example:

curl -fsSL https://raw.githubusercontent.com/nicedreamzapp/claude-code-local/main/install.sh | bash -s -- --with voice,browser,phone

Windows has its own add-on menu, including voice, browser, Moonstone, remote access, and the Trinidad Head terminal.

Privacy and Local Usage Costs

With a locally hosted model, prompts and inference run on the computer, and the backend does not charge per token. Model downloads require disk space, and inference uses the machine’s RAM or GPU memory and electricity.

The local launchers disable Claude Code’s nonessential background network requests, automatic updates, official marketplace auto-installation, and background tasks. Once the required models are downloaded, local-model inference can run offline with no Anthropic model API subscription.

Agent-12 Model Benchmarks

These are the project’s published model runs on an M5 Max with 128 GB of unified memory, using the Agent-12 harness.

Model (MLX)Agent-12 TasksHard-Suite Time
Qwen 3.8 27B, 8-bit (DFlash 2)12/12 easy; 7/8 hard401 seconds
Qwen3.6-35B-A3B, 8-bit12/12 easy; 8/8 hard125 seconds
Qwen3-Coder-30B-A3B, 8-bit12/12 easy; 7/8 hard392 seconds
Gemma 4 31B, 4-bit11/12 easy; 8/8 hard348 seconds
DeepSeek V4 Flash, 2-bit12/12 easy; 8/8 hard551 seconds

Claude Code Route vs Native Engine

The Claude Code route retains Claude Code’s project instructions, permission controls, commands, and MCP servers on your operating systems. Native Engine runs separately from Claude Code, normally loading an MLX model directly on Apple Silicon. It uses a short fixed prompt and direct cache management, and can also connect to a local Anthropic-compatible server through its HTTP backend.

AreaClaude Code RouteNative Engine
InterfaceClaude Code terminalIncluded terminal agent
ToolingClaude Code tools and MCPBash, Read, Write, Edit, Glob, Grep
Prompt and cacheClaude Code harness with local cache reuseCompact prompt and native cache control
First-token latencyDepends on model and conversation0.36 s (Gemma 4 31B, 4.5K context)
UseExisting Claude Code projectsFocused local agent sessions

Alternatives and Related Resources

Pros

  • Free, MIT-licensed backend with no per-token charge for local inference.
  • Works with Claude Code on macOS, Linux, and Windows.
  • Keeps Claude Code’s coding tools, project instructions, and MCP workflows.
  • Provides a practical 8 GB and 16 GB Mac starting configuration.
  • Supports resuming a Claude Code conversation after a hosted usage limit.

Cons

  • The smaller 8 GB and 16 GB configurations use 16K context windows, which restrict longer coding sessions.
  • Running larger coding models requires higher-memory hardware and substantial model downloads.
  • Using an OpenRouter model for session continuation sends that conversation to an external provider.

Changelog

  • October 31, 2026 (v0.7.0): Added installer tiers for 8 GB and 16 GB Macs, cross-platform Doctor checks, and additional small-model tool-call parsing fixes.
  • October 29, 2026 (v0.6.0): Introduced installer-managed companion integrations for voice, browser access, remote sessions, and related tools.
  • October 29, 2026 (v0.5.0): Added Linux and Windows support through a portable llama.cpp backend.
  • October 25, 2026 (v0.4.1): Fixed a command-injection risk in the optional usage-limit handoff hook’s Terminal fallback.
  • October 15, 2026 (v0.4.0): Fixed dropped parallel tool calls, model-specific tool argument parsing, image payload handling, streaming, and retry state; introduced keep going.
  • August 22, 2026 (v0.3.0): Published the Agent-12 leaderboard and model benchmark results.
  • August 5, 2026 (v0.2.0): Fixed cross-session prompt-cache contamination, improved launchers, and expanded model/tool-call compatibility.
  • May 8, 2026 (v0.1.0): Added offline-oriented launcher settings and small-Mac support alongside early streaming and tool-call fixes.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest & top AI tools sent directly to your email.

Subscribe now to explore the latest & top AI tools and resources, all in one convenient newsletter. No spam, we promise!