ollama/ollama
REST endpoints
Every route registered by Server.GenerateRoutes in server/routes.go, grouped by family.
Liveness and version
| Method | Path | Handler | Purpose |
|---|---|---|---|
GET/HEAD |
/ |
inline | "Ollama is running". |
GET/HEAD |
/api/version |
inline | {"version": "..."} from version/. |
GET |
/api/status |
Server.StatusHandler |
High-level daemon status. |
Native API
| Method | Path | Handler | Purpose |
|---|---|---|---|
POST |
/api/pull |
Server.PullHandler |
Pull a model from the registry. NDJSON progress. |
POST |
/api/push |
Server.PushHandler |
Push a model. |
GET/HEAD |
/api/tags |
Server.ListHandler |
List local models. |
POST |
/api/show |
Server.ShowHandler |
Show model metadata, template, capabilities. |
DELETE |
/api/delete |
Server.DeleteHandler |
Delete a local model. |
POST |
/api/me |
Server.WhoamiHandler |
Cloud "who am I". |
POST |
/api/signout |
Server.SignoutHandler |
Remove the local key from the cloud account. |
DELETE |
/api/user/keys/:encodedKey |
Server.SignoutHandler |
Same, addressed by encoded key. |
POST |
/api/create |
Server.CreateHandler |
Create a model from a Modelfile. |
POST |
/api/blobs/:digest |
Server.CreateBlobHandler |
Upload a blob (used during create). |
HEAD |
/api/blobs/:digest |
Server.HeadBlobHandler |
Check if a blob exists locally. |
POST |
/api/copy |
Server.CopyHandler |
Copy a model under a new name. |
GET |
/api/ps |
Server.PsHandler |
Loaded runners. |
POST |
/api/generate |
Server.GenerateHandler |
Single-prompt completion (NDJSON). Wrapped by request logging. |
POST |
/api/chat |
Server.ChatHandler |
Multi-message chat (NDJSON). Wrapped by request logging. |
POST |
/api/embed |
Server.EmbedHandler |
Vector embeddings. |
POST |
/api/embeddings |
Server.EmbeddingsHandler |
Legacy embeddings shape. |
Experimental
| Method | Path | Handler | Purpose |
|---|---|---|---|
POST |
/api/experimental/web_search |
Server.WebSearchExperimentalHandler |
Cloud-backed web search. |
POST |
/api/experimental/web_fetch |
Server.WebFetchExperimentalHandler |
Cloud-backed URL fetch. |
GET |
/api/experimental/model-recommendations |
Server.ModelRecommendationsExperimentalHandler |
Cached recommendations for the launcher. |
OpenAI-compatible
| Method | Path | Middleware (in order) | Final handler |
|---|---|---|---|
POST |
/v1/chat/completions |
withInferenceRequestLogging, cloudPassthroughMiddleware, middleware.ChatMiddleware |
ChatHandler |
POST |
/v1/completions |
withInferenceRequestLogging, cloudPassthroughMiddleware, middleware.CompletionsMiddleware |
GenerateHandler |
POST |
/v1/embeddings |
cloudPassthroughMiddleware, middleware.EmbeddingsMiddleware |
EmbedHandler |
GET |
/v1/models |
middleware.ListMiddleware |
ListHandler |
GET |
/v1/models/:model |
cloudModelPathPassthroughMiddleware, middleware.RetrieveMiddleware |
ShowHandler |
POST |
/v1/responses |
withInferenceRequestLogging, cloudPassthroughMiddleware, middleware.ResponsesMiddleware |
ChatHandler |
POST |
/v1/images/generations |
cloudPassthroughMiddleware, middleware.ImageGenerationsMiddleware |
GenerateHandler |
POST |
/v1/images/edits |
cloudPassthroughMiddleware, middleware.ImageEditsMiddleware |
GenerateHandler |
POST |
/v1/audio/transcriptions |
middleware.TranscriptionMiddleware |
ChatHandler |
Anthropic-compatible
| Method | Path | Middleware | Handler |
|---|---|---|---|
POST |
/v1/messages |
withInferenceRequestLogging, cloudPassthroughMiddleware, middleware.AnthropicMessagesMiddleware |
ChatHandler |
Behavior notes
- Inference handlers wrapped with
withInferenceRequestLoggingare captured to the on-disk request log (configured viaOLLAMA_INFERENCE_LOG_DIR). - Cloud passthrough runs before compat middleware. Cloud-only models bypass local handlers entirely with their original request body.
- Streaming endpoints emit NDJSON for native routes (
/api/...) and SSE for OpenAI-compatible routes whenstream: trueis set. Authorizationis signed by the local SSH key for any request the daemon forwards to the cloud (see auth).
Reference docs
| Source | Where |
|---|---|
| User-facing API reference | docs/api.md |
| OpenAPI spec | docs/openapi.yaml |
| Go client types | api/types.go |
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.