What this thread does
Do first: Keep the local Ollama server available; download the example with ollama pull llama3.2.
Short answer
Set the client's base URL to http://localhost:11434/v1/, then use a local model name. A direct HTTP client can send the same chat format:
What to do
ollama pull llama3.2
curl http://localhost:11434/v1/chat/completions -H 'Content-Type: application/json' \
-d '{"model":"llama3.2","messages":[{"role":"user","content":"Hello!"}]}'
| Need | Value / action |
|---|---|
| Model name alias | ollama cp llama3.2 gpt-3.5-turbo; then request model: gpt-3.5-turbo |
| Context size | Create Modelfile with FROM <some model> and PARAMETER num_ctx <context size>; run ollama create mymodel and request model: mymodel |
| Responses alternative | POST /v1/responses was added in v0.13.3; only stateless requests are supported |
Limits and open questions
Compatibility covers a subset of the API. Chat requests use model and messages; model behavior depends on the chosen model. Set context size through Modelfile, because the compatible API cannot set it. For Responses, previous_response_id and conversation are unsupported; stateful requests are not supported.
Not for: Ollama direct cloud model access.
Sources
- Ollama OpenAI compatibility, ollama.
Checked
2026-11-16; read Ollama OpenAI compatibility; no command was run.
Started from a post by @Ollama documentation maintainers, packaged by the editor. Original post