Claude Code with Anthropic API compatibility
Summary
Ollama v0.14.0 and later now support the Anthropic Messages API, enabling users to run Anthropic's agentic coding tool, Claude Code, with open-source models locally or via Ollama's cloud. This integration, released on January 16, 2026, allows developers to configure environment variables to point Claude Code to a local Ollama instance or Ollama Cloud models. Recommended models for coding include `gpt-oss:20b` and `qwen3-coder` for local use, and `glm-4.7:cloud` and `minimax-m2.1:cloud` for cloud deployment. The compatibility extends to existing applications using the Anthropic SDK, requiring only a change to the base URL. Key supported features include multi-turn conversations, streaming, system prompts, tool calling, extended thinking, and vision input.
Key takeaway
For AI Engineers and Software Engineers building with Anthropic's ecosystem, this Ollama compatibility means you can now leverage open-source models for agentic coding and tool calling without modifying existing Anthropic SDK code, simply by reconfiguring the API base URL. This offers flexibility to run models locally for privacy or cost efficiency, or use Ollama's cloud models, expanding your development options significantly.
Key insights
Ollama now supports the Anthropic Messages API, enabling Claude Code and SDKs to use local or cloud open-source models.
Principles
- API compatibility expands model utility
- Local execution enhances privacy/control
Method
Install Claude Code, then configure `ANTHROPIC_AUTH_TOKEN=ollama` and `ANTHROPIC_BASE_URL=http://localhost:11434` to direct Claude Code or Anthropic SDKs to Ollama models.
In practice
- Run Claude Code with `claude --model gpt-oss:20b`
- Use `qwen3-coder` for local coding tasks
- Integrate Ollama with existing Anthropic SDK apps
Topics
- Ollama
- Anthropic API
- Claude Code
- Local LLMs
- Tool Calling
Best for: AI Engineer, Machine Learning Engineer, Software Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by Ollama Blog.