Reference

HTTP API reference

Four families on one address. Two of them are implemented because they are what every client is already written against; the third is implemented in its own conventions so a client can be pointed here by changing a URL; the fourth has no counterpart anywhere and is the point.

The four families

OpenAI SSE · /v1/chat/completions Anthropic /v1/messages Ollama NDJSON · ns durations llamay /v1/contexts · no counterpart one scheduler, one model set, one prefix cache A route that exists but cannot be served refuses by name rather than answering 404 — a 404 sends the caller looking for another server.
Both mainstream API families are implemented because those are the two every client already speaks. Ollama's is implemented in its conventions, not translated into OpenAI's.

OpenAI-compatible

RouteNotes
POST /v1/chat/completionsStreaming with "stream": true, as server-sent events. tools, tool_choice and response_format are all constrained rather than suggested. Tools.
POST /v1/completionsPlain completion.
POST /v1/embeddingsNeeds -embed, or an encoder as -m. Supports the base64 encoding_format the official client asks for by default.
GET /v1/modelsEvery model this server could load, across llamay's store and Ollama's — the same set /api/tags reports. This is what a client populating a model picker reads.
POST /v1/rerankNeeds -rerank. Also at /rerank and /rerank/v1/rerank.

Anthropic-compatible

RouteNotes
POST /v1/messagesThe Messages API shape, including tool_use blocks.

Ollama-compatible

Implemented in Ollama's own shapes — newline-delimited JSON rather than server-sent events, streaming on by default, durations in nanoseconds — so a client written against it works unchanged.

RouteNotes
POST /api/generate · /api/chatGeneration. format carrying a schema is enforced.
GET /api/tags · POST /api/showWhat exists, and what one model is.
GET /api/ps · /api/versionWhat is resident, and which build this is.
POST /api/pullTakes {"model": "<source>"} in any form llamay pull accepts, and streams progress in the shape Ollama's clients render. {"stream": false} collapses it to one object. A pulled model is nameable immediately.
POST /api/copy · DELETE /api/deleteWrites to the store. All three write routes are off under -pull=false.
POST /api/embed · /api/embeddingsEncoders.
Three routes are refused, by name, with the reason in the body
  • POST /api/push — publishing to a registry is a different trust decision from fetching from one.
  • POST /api/create and POST /api/blobs/{digest} — a Modelfile parser is a separate product from an inference engine, and half of one would misread files rather than refuse them.

llamay's own

RouteNotes
POST /v1/contextsCreate a context, optionally prefilled from prompt or messages. Answers {"id","tokens","pages"}.
GET /v1/contextsList them.
POST /v1/contexts/{id}/fork?n=Fork n ways, sharing pages.
GET /v1/contexts/{id}/snapshotDownload it.
POST /v1/contexts/restoreRestore one. Refuses a different model, a bad CRC, a truncated file, and a declared length beyond sixteen million positions — each by its own sentinel.
DELETE /v1/contexts/{id}Release it.

Health, stats and metrics

RouteNotes
GET /healthz{"status":"ok","model":…,"id":…} — identity, not just liveness, and the same three fields whether the server is holding a decoder, an encoder or a cross-encoder. model is a name a request can carry, not the display string inside the file. The one route an API key is not required on, because the thing reading it is usually a container probe with no way to carry a secret.
GET /v1/statsThe scheduler's counters as JSON.
GET /metricsPrometheus.

llamay's extensions

Namespaced, so a client that does not know them is unaffected. They may be set on any generation request in any of the three families.

{
  "messages": [...],
  "llamay_session": "ctx_3",
  "llamay_format": "json",
  "llamay_schema": { ... },
  "llamay_lexicon": true,
  "llamay_retain_prefix": true
}
FieldEffect
llamay_sessionGenerate inside a named context rather than a fresh one.
llamay_format: "json"Any valid JSON. The weaker guarantee.
llamay_schemaThe full schema constraint, same machinery as response_format.
llamay_lexiconConstrain decoding to a word list.
llamay_retain_prefixKeep this prompt's prefix in the radix tree after the request ends.

Responses report llamay_cached_prompt_tokens alongside the usual usage — the number that says whether the prefix cache is earning its memory.

Authentication and errors