Claude Code wired to Ollama Anthropic-compatible API, with configurable model.
7.1K
Claude Code wired to Ollama Anthropic-compatible API, with configurable model.
host.docker.internal:11434
sbx run sbx/claude-ollama-kit:latestRun the following command to install sbx on your machine.
brew install docker/tap/sbxwinget install Docker.sbx
ollama launch claude --model gemma4:e4b-it-q4_K_M— but insbx.
A fork of the built-in claude agent that routes all API calls to a local
Ollama instance instead of Anthropic's API. Useful for
offline development, cost-free experimentation, or testing with custom local models.
Prerequisite: Ollama must be running on your host machine at its default port (
localhost:11434) before starting this sandbox.
Linux hosts:
host.docker.internalrequires Docker to be started with--add-host=host.docker.internal:host-gateway. If Ollama is unreachable, verify this flag is set or use your host's LAN/bridge IP in place ofhost.docker.internal.
sbx run --kit "docker.io/sbx/claude-ollama-kit:latest" claude-ollama ~/my-project
Or from a git URL or a local clone of this repo:
sbx run --kit "git+https://github.com/docker/sbx-kits-contrib.git#dir=claude-ollama" claude-ollama ~/my-project
sbx run --kit ./claude-ollama/ claude-ollama ~/my-project
The agent name passed to sbx run (claude-ollama) matches the name: field in
the kit's spec.yaml.
The default model is gemma4:e4b-it-q4_K_M. To use a different model, fork this
kit and change the CLAUDE_OLLAMA_MODEL default in spec.yaml.
claudeInstead of calling api.anthropic.com, a wrapper script replaces the entrypoint:
- entrypoint:
- run: [claude, "--dangerously-skip-permissions"]
+ entrypoint:
+ run: [/home/agent/.local/bin/claude-ollama]
The wrapper script:
ANTHROPIC_BASE_URL to http://host.docker.internal:11434 (Ollama via Docker's host bridge)ANTHROPIC_AUTH_TOKEN — Ollama doesn't require real credentials$CLAUDE_OLLAMA_MODELexec claude "$@" — the real Claude Code CLI takes over from thereReference: ollama/ollama — cmd/launch/claude.go
Network access is restricted to localhost:11434 only; no Anthropic API domains are reachable.
This listing is prepared by Docker. All third-party product names, logos, and trademarks are the property of their respective owners and are used solely for identification. Docker claims no interest in those marks, and no affiliation, sponsorship, or endorsement is implied.