ollama/docs/api
ParthSareen f760ae1fdd api: add Anthropic Messages API compatibility layer
Add middleware to support the Anthropic Messages API format at /v1/messages.
This enables tools like Claude Code to work with Ollama models through the
Anthropic API interface.

Features:
- Request/response transformation between Anthropic and internal formats
- Streaming support with SSE events (message_start, content_block_delta, etc.)
- Tool calling support (tool_use and tool_result content blocks)
- Thinking/extended thinking block support
- Image content block support (base64)
- System prompt handling
- Multi-turn conversation support
- Proper stop_reason mapping (end_turn, max_tokens, tool_use)
- Error responses in Anthropic format

New files:
- anthropic/anthropic.go: Types and transformation functions
- middleware/anthropic.go: Request/response middleware
2026-01-05 19:19:34 -08:00
..
anthropic-compatibility.mdx api: add Anthropic Messages API compatibility layer 2026-01-05 19:19:34 -08:00
authentication.mdx docs: add docs for docs.ollama.com (#12805) 2025-10-28 13:18:48 -07:00
errors.mdx docs: add docs for docs.ollama.com (#12805) 2025-10-28 13:18:48 -07:00
introduction.mdx docs: rename api-reference.md back to api.md since redirect stopped working (#13056) 2025-11-11 15:53:06 -08:00
openai-compatibility.mdx docs: add version note for /v1/responses API (#13596) 2026-01-03 01:58:20 -05:00
streaming.mdx docs: add docs for docs.ollama.com (#12805) 2025-10-28 13:18:48 -07:00
usage.mdx docs: add docs for docs.ollama.com (#12805) 2025-10-28 13:18:48 -07:00