Yes. Claude Code sends its requests to the address in the ANTHROPIC_BASE_URL environment variable, and three Mac runners now answer in Anthropic's Messages API format, so a model on your own machine can sit behind it. With Ollama, run ollama launch claude, or set the variable to your local Ollama address. With LM Studio 0.4.1 or newer, start its server and point the same variable at it. llama.cpp's server also serves /v1/messages, and tool use needs its jinja chat templates, on by default. What answers is then the model you loaded, not Claude, so the result is only as capable as that model: Ollama asks for a context window of 64k or more for local models, and LM Studio recommends at least 25K tokens. This page repeats each runner's own instructions and quotes no speed or quality figure, because we have not measured Claude Code on a local model.
| Runner | How to point Claude Code at it | What its documentation asks for |
|---|---|---|
| Ollama | ollama launch claude, or the two variables below | A model that supports tools, with a context window of 64k or more for local models |
| LM Studio | lms server start --port 1234, then the two variables below | Version 0.4.1 or newer, for its Anthropic compatible endpoint; at least 25K tokens of context to start |
| llama.cpp | Start llama-server with a model; its server answers /v1/messages | Tool use requires the --jinja option, which its README lists as enabled by default |
Ollama and LM Studio both publish the same pair of variables. The key is a placeholder the runner ignores, and only the address changes.
# Ollama, default address
export ANTHROPIC_BASE_URL=http://localhost:11434
export ANTHROPIC_AUTH_TOKEN=ollama
claude --model qwen3-coder
# LM Studio, default address
export ANTHROPIC_BASE_URL=http://localhost:1234
export ANTHROPIC_AUTH_TOKEN=lmstudio
claude --model openai/gpt-oss-20b
Those model names are the ones each runner's own page uses in its example. After you set a variable, run /status inside Claude Code to see which address it is using; Ollama's page says Claude's settings files can override a shell variable.
Pick the largest model your memory can hold with room for a long context. The which LLM can my Mac run page gives the sizing rule, best local LLM for coding on a Mac lists coding models by memory, and Ollama models scores the Ollama library.
Grux AI (MIT) does not need any of this to use a local model: it talks to Ollama directly, with no base address to set, and acts on your mail, calendar and files. The two also work together: Grux writes work orders for Claude Code when you want to change the app itself. See Claude Code Mac app for the official app and where Grux fits.
| Claim | Source |
|---|---|
Ollama connects Claude Code through its Messages API support; ollama launch claude; 64k or more context for local models | Ollama documentation, Claude Code |
| The two variables and the subset of the Messages API Ollama supports | Ollama documentation, API compatibility |
| LM Studio 0.4.1 serves /v1/messages; the setup; at least 25K tokens of context | LM Studio blog, Use your LM Studio models in Claude Code |
| llama.cpp's server serves /v1/messages, and tool use requires --jinja | llama.cpp server README |
| Claude Code sends requests to the address in ANTHROPIC_BASE_URL | Claude Code documentation, LLM gateway |
All five were read on 18 November 2026. These tools change quickly, so check the runner's page for the current model names before you copy a command.
ollama launch claude. Ollama's documentation describes it as launching Claude Code with Ollama, and asks for a context window of 64k or more for local models.