Pick one engine to load the model, then connect one harness to give it files, tools, and an agent loop. The model stays on your Mac; the two apps talk over a local HTTP endpoint.
STEP 1 / SERVE THE MODEL
Choose an inference engine.
All three can expose a local API. Ollama minimizes setup, llama.cpp exposes the most knobs, and LM Studio adds a visual model manager.
01
LEAST SETUP
Ollama
Import a downloaded GGUF with a Modelfile, or pull an existing Ollama model. Its launch command can configure supported coding harnesses for you.
Modelfile
FROM ./models/your-model.gguf
PARAMETER num_ctx 65536
Claude Code can target llama.cpp's Anthropic-compatible endpoint, but that path is less complete and less documented than Ollama or LM Studio. Use it as an experiment, not the default.
THE AGENT LAYER
Connect your coding harness.
Start the engine first. Then give the harness the matching base URL and the exact model identifier exposed by that engine.
MINIMAL, EXTENSIBLE
Pi
Add any OpenAI-compatible local server in ~/.pi/agent/models.json, start Pi, then choose the model with /model.
Ollama has the shortest setup. LM Studio exposes the Anthropic endpoint Claude Code expects. Use a large context window for tool definitions and project files.
Ollama · recommended
curl -fsSL https://claude.ai/install.sh | bash
ollama launch claude --model local-model
LM Studio · direct
export ANTHROPIC_BASE_URL=http://localhost:1234
export ANTHROPIC_AUTH_TOKEN=lmstudio
export CLAUDE_CODE_ATTRIBUTION_HEADER=0
claude --model local-model
llama.cpp · experimental
export ANTHROPIC_BASE_URL=http://localhost:8080
export ANTHROPIC_AUTH_TOKEN=llama.cpp
export ANTHROPIC_API_KEY=""
claude --model local-model
The GGUF file is only the starting point. Context, the KV cache, tool definitions, and the harness itself all need memory. A model that barely fits may slow down or fail once an agent scans a repo.
Start at 32K context; move to 64K when the working set remains comfortable.
Prefer a smaller, higher-quality quant over a model that leaves no headroom.
Coding needs a compatible chat template and reliable tool calling—not just a high benchmark score.