Ollama v0.14.0: Anthropic API Compatibility and Claude Code Support

Ollama v0.14.0 and later versions introduce compatibility with the Anthropic Messages API, allowing users to run Anthropic's agentic coding tool, Claude Code, with open-source models. This update enables developers to leverage local models on their own machines or cloud-hosted models via ollama.com using tools designed for the Anthropic ecosystem.

Integration of Claude Code with Ollama

Claude Code is a terminal-based agentic coding tool developed by Anthropic. By implementing Anthropic API support, Ollama now allows Claude Code to interface with any Ollama model.

Configuration and Setup

To use Claude Code with Ollama, users must install the tool via the provided installation scripts for macOS, Linux, WSL, or Windows (PowerShell/CMD) and configure the following environment variables to redirect requests to the local Ollama instance:

  • ANTHROPIC_AUTH_TOKEN=ollama
  • ANTHROPIC_BASE_URL=http://localhost:11434

Once configured, the tool can be launched with a specific model, such as claude --model gpt-oss:20b for local use or claude --model glm-4.7:cloud for cloud-hosted models.

Context Length Requirements

Ollama recommends using models with a context length of at least 32K tokens for coding tasks. While Ollama's cloud models operate at their full context length by default, local users may need to adjust their context length settings according to Ollama's documentation.

Recommended Models for Coding

Ollama identifies specific models as suitable for use with Claude Code depending on the deployment method:

  • Local Models: gpt-oss:20b and qwen3-coder.
  • Cloud Models: glm-4.7:cloud and minimax-m2.1:cloud.

Anthropic SDK Compatibility

Beyond Claude Code, any existing application utilizing the Anthropic SDK (Python or JavaScript) can now connect to Ollama by updating the base_url to http://localhost:11434 and providing ollama as the API key (which is required by the SDK but ignored by Ollama).

Tool Calling Support

Ollama's compatibility layer supports tool calling (function calling), allowing models to interact with external systems. This is achieved by passing a tools array within the messages.create call, defining the tool's name, description, and input schema.

Supported API Features

Ollama v0.14.0 provides support for several key features of the Anthropic Messages API, including:

  • Multi-turn conversations and messages
  • Streaming responses
  • System prompts
  • Tool and function calling
  • Extended thinking
  • Vision (image input)

Sources

Related

  • Dispatch
  • Dispatch
  • Dispatch
  • Project
  • Dispatch