The whole surface in one table
Ollama's HTTP API is a small REST surface — under ten endpoints you'll touch. Streaming is on by default. All durations in responses are in nanoseconds. There is no authentication; the daemon binds to localhost by default, which is the security boundary.
| Method | Endpoint | Purpose |
|---|---|---|
| POST | /api/chat | Conversational (messages array). Use this for almost everything. |
| POST | /api/generate | Raw completion (single prompt). FIM / autocomplete shape. |
| GET | /api/tags | List installed models. |
| POST | /api/show | Show model details. |
| POST | /api/pull | Download a model (streams progress). |
| DELETE | /api/delete | Remove a model. |
| POST | /api/embed | Generate embeddings. |
| GET | /api/ps | List currently loaded models. |
| GET | /api/version | Daemon version. |
Two defaults that bite people
- Streaming is on. If you send
{"model": "...", "messages": [...]}without"stream": false, you get NDJSON back, not a single JSON object. People crash JSON parsers on this constantly. - Durations are nanoseconds.
total_duration: 1234567890is 1.23 seconds, not 1234 seconds. Always divide by1e9before logging.
OpenAI-compatible endpoint
Ollama also exposes an OpenAI-compatible surface at /v1/chat/completions for drop-in compatibility with the OpenAI Python / TypeScript SDKs. Behavior is mostly compatible but not exact — see the serving track later. For native Ollama features (NDJSON streaming, structured outputs via format, the embed endpoint), use /api/....