Ollama and Claude
Claude Messages transport for ollama and ollama-local connections.
Use an Ollama model from Claude Code or an Anthropic SDK through DurinDoor. You need a local Ollama connection, a DurinDoor key, and an Ollama model that supports the tasks you plan to run.
Connect Ollama
- Start Ollama and confirm
http://localhost:11434/api/tagslists your installed model. - On Providers, add an Ollama Local connection. Set its host URL if Ollama runs on another host or port.
- Find the
ollama-local/<model>ID inGET /v1/models. - Configure Claude Code to call DurinDoor, or use an Anthropic SDK with base URL
http://localhost:20128.
Claude Code uses ANTHROPIC_BASE_URL=http://localhost:20128/v1. Keep the Ollama host on the provider connection, rather than putting port 11434 in the client settings.
Send a test
Replace llama3.2 with an installed model ID:
curl http://localhost:20128/v1/messages \
-H "Authorization: Bearer YOUR_DURINDOOR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "ollama-local/llama3.2",
"max_tokens": 64,
"messages": [{"role": "user", "content": "Say hello."}]
}'A successful response contains Anthropic message content. Confirm the request on Usage. Then test tools and streaming if your client needs them.
Transport limits
Anthropic-format requests use Ollama's /v1/messages transport. Other client formats use /api/chat. DurinDoor preserves native Claude block order, removes unsupported cache_control, and converts remote images to base64. Guarded image fetches reject private, loopback, and link-local destinations.
Streaming stays Anthropic SSE. A stream that ends before message_stop is treated as truncated rather than successful.
Existing ollama cloud connections use https://ollama.com/v1/messages and Bearer authentication. The cloud provider is hidden from new connection creation. Local Ollama does not require a key; a saved key is sent as Bearer.
Troubleshoot
If Docker cannot reach Ollama, use a host gateway or compose service name instead of container localhost. Store a host origin on the connection to avoid duplicate upstream paths. If curl works but Claude Code fails, inspect its settings and shell for a stale Anthropic token. A successful short reply does not prove tools or a larger context work on that model.