API compatibility - 10 documented limits
Ollama API compatibility
Ollama documents an OpenAI-compatible API at http://localhost:11434/v1/ (chat/completions, completions, responses, embeddings and models). Its Anthropic-compatible base URL, the value for ANTHROPIC_BASE_URL, is http://localhost:11434. The docs list 10 limitations: 6 for the OpenAI-compatible layer and 4 for the Anthropic-compatible layer.
Verified against Ollama's own documentation. Not documented means the docs read that day do not say; it never means No.
Compare every provider in the API compatibility matrix.
OpenAI-compatible API
Supportedhttp://localhost:11434/v1/- Endpoints
- chat/completions
- completions
- responses
- embeddings
- models
- Auth
- Local: API key required by the client but ignored by Ollama (docs use 'ollama'). Cloud: OLLAMA_API_KEY.
- Regional and alternate URLs
- Local
http:// localhost:11434/ v1/ - Cloud
https:// ollama. com/ v1
- Local
- Notes
- Ollama supports a subset of the OpenAI API. Responses API (added in v0.13.3) is stateless only. Direct cloud access at https://ollama.com/v1 needs no local install; the cloud API does not support stateful Responses or custom/freeform tool-call replay.
From the docs
Connect OpenAI clients to Ollama. Ollama supports a subset of the OpenAI API.
Anthropic-compatible API
Supportedhttp://localhost:11434- Auth
- Local: ANTHROPIC_AUTH_TOKEN=ollama (required but ignored). Cloud: Authorization: Bearer $OLLAMA_API_KEY (x-api-key alone not accepted).
- Regional and alternate URLs
- Local
http:// localhost:11434 - Cloud
https:// ollama. com
- Local
- Notes
- Ollama supports a subset of the Anthropic Messages API at /v1/messages. The cloud base URL https://ollama.com is derived from the documented request URL https://ollama.com/v1/messages, not stated as a base URL.
From the docs
export ANTHROPIC_AUTH_TOKEN=ollama # required but ignored export ANTHROPIC_BASE_URL=http://localhost:11434
Documented limitations
Parameters, content types and features Ollama's docs say its compatibility layers ignore, reject or change, each with the line it comes from. A layer with nothing listed may still differ in ways the docs do not spell out.
OpenAI-compatible layer6
logprobs not supported (chat and completions)
[ ] Logprobs
docs.ollama.com/api/openai-compatibility chat: tool_choice, logit_bias, user, n not supported
[ ]
tool_choice[ ]logit_bias[ ]user[ ]ndocs.ollama.com/api/openai-compatibility chat: image URLs not supported (base64 only)
[x] Base64 encoded image [ ] Image URL
docs.ollama.com/api/openai-compatibility completions: best_of, echo unsupported; prompt string only
[ ]
best_of[ ]echo...promptcurrently only accepts a stringdocs.ollama.com/api/openai-compatibility responses: stateless only (no previous_response_id, conversation, truncation)
Only the non-stateful flavor is supported (i.e., there is no
previous_response_idorconversationsupport).docs.ollama.com/api/openai-compatibility no way to set context size via OpenAI API (use a Modelfile num_ctx)
The OpenAI API does not have a way of setting the context size for a model.
docs.ollama.com/api/openai-compatibility
Anthropic-compatible layer4
count_tokens, tool_choice, metadata, prompt caching, batches, citations, PDF documents, streamed error events not supported
The following Anthropic API features are not currently supported:
/v1/messages/count_tokens...tool_choice...metadata... Prompt caching ... Batches API ... Citations ... PDF support ... Server-sent errorsdocs.ollama.com/api/anthropic-compatibility image URLs not supported (base64 only)
Image content | Base64 images supported; URL images not supported
docs.ollama.com/api/anthropic-compatibility thinking budget_tokens accepted but not enforced
Extended thinking | Basic support;
budget_tokensaccepted but not enforceddocs.ollama.com/api/anthropic-compatibility token counts approximate
Token counts are approximations based on the underlying model's tokenizer
docs.ollama.com/api/anthropic-compatibility
Example from Ollama's docs
Copied verbatim from the provider's documentation, placeholders included.
from openai import OpenAI
client = OpenAI(
base_url='http://localhost:11434/v1/',
api_key='ollama', # required but ignored
)
chat_completion = client.chat.completions.create(
messages=[
{
'role': 'user',
'content': 'Say this is a test',
}
],
model='gpt-oss:20b',
)More on Ollama
Newsletter
Know when a provider changes its API
One email per week. New models, new endpoints and the compatibility changes that break a base URL, and what they mean for your stack.