Docs
Browse documentation

Docs / Reference

Server API reference

Routes, request fields, streaming frames, errors, context clamps, and operational health data.

Endpoints

MethodRoutePurpose
POST/v1/chat/completionsChat completions with streaming and tools.
POST/v1/completionsLegacy single-string text completion.
GET/v1/modelsThe resident model card.
GET/v1/models/{id}One model card, or model_not_found.
GET/health, /v1/health, /healthzRuntime, model, session, tool, and integrity status.
GET/Service name, version, model id, and endpoint list.
OPTIONSany routeCORS preflight when --cors is enabled.

Chat-completion fields

FieldBehavior
modelAccepted for client compatibility. One model is resident, and the response uses the configured served id.
messagesRequired, non-empty. system, developer, user, assistant, and tool roles. Text content only.
tools / tool_choiceOpenAI function schemas and auto, none, required, or a named function.
functions / function_callLegacy fields are accepted and converted to the current tools form.
temperature0 through 2. Explicit values override server profiles.
top_p0 through 1.
repetition_penaltyExtension from 0.01 through 2. A value of 1 disables it.
max_tokens / max_completion_tokensPositive integer, clamped to server and model context limits.
stopString or up to four strings, enforced server-side and streaming-safe.
nOnly 1 is accepted.
streamBoolean. Uses server-sent events.
stream_options.include_usageAdds a trailing usage chunk with empty choices.

Unsupported fields

The server warns once per process when it sees unsupported sampling fields.

  • presence_penalty, frequency_penalty, top_k, min_p
  • logit_bias, seed, logprobs, top_logprobs
  • response_format and constrained JSON output are not implemented.

Streaming format

Streaming uses real SSE with Content-Type: text/event-stream and chunked transfer. The sequence is role delta, content deltas, an optional indexed tool-calls delta, finish chunk, optional usage chunk, then [DONE].

text
data: {"object":"chat.completion.chunk","choices":[{"delta":{"role":"assistant"}}]}

data: {"object":"chat.completion.chunk","choices":[{"delta":{"content":"Hello"}}]}

data: [DONE]

If generation fails after the stream starts, the server sends an in-band error frame followed by [DONE].

Errors and request limits

Errors use {"error":{"message", "type", "param", "code"}}. Unknown routes return an OpenAI-shaped 404. The request-body limit is 32 MB, and chunked request bodies are rejected.

Client token requests are clamped rather than rejected. The server applies --max-new-ceiling, the model’s 40,960-position window, and the remaining positions after prompt tokenization.

Health data

/health reports the model id and kind, container SHA-256 and path, byte size, package version, device and dtype, backend, native runner and session state, sampler defaults, tool profile, stuck-detector configuration and counters, container header, context, and KV reuse statistics.