Claude Code with Anthropic API compatibility
Ollama announced that versions v0.14.0 and later are compatible with the Anthropic Messages API, making it possible to use tools such as Claude Code with open-source models. The compatibility allows Claude Code, described as Anthropic's agentic coding tool that runs in the terminal, to work with any Ollama model.
Users can run Claude Code with local models on their machine or connect to cloud models through ollama.com. Setup involves configuring the environment variables ANTHROPIC_AUTH_TOKEN=ollama and ANTHROPIC_BASE_URL=http://localhost:11434, then running Claude Code with a chosen model, for example claude --model gpt-oss:20b locally or claude --model glm-4.7:cloud for a cloud model.
Ollama recommends running a model with at least 32K tokens of context length, noting that its cloud models always run at their full context length. Recommended models for coding use cases include gpt-oss:20b and qwen3-coder locally, and glm-4.7:cloud and minimax-m2.1:cloud in the cloud.
Existing applications using the Anthropic SDK can connect to Ollama by changing the base URL, with the API key required but ignored. Supported features listed include messages and multi-turn conversations, streaming, system prompts, tool calling or function calling, extended thinking, and vision for image input.
The announcement is dated January 16, 2026. Further setup instructions and configuration options are available in the Claude Code guide, and a complete list of supported features is in the Anthropic compatibility documentation.
Based on reporting from the original publisher. Visit the source for full context and later updates.
Publisher excerpt
Ollama is now compatible with the Anthropic Messages API, making it possible to use tools like Claude Code with open models.