Skip to main content

Chat completions

POST /v1/chat/completions
Content-Type: application/json
Authorization: Bearer zea-...

Alias: POST /chat/completions. Max body 10 MB. Required field: model (a model group name).

Standard OpenAI fields (messages, stream, …) are forwarded. The gateway strips metadata before sending upstream.

Attribution (optional)

x-zeallm-customer-id: end-user-123
x-zeallm-tags: cost-center-42,experiment-a

Customer fallbacks: x-zeallm-end-user-id, then body user. Tags also merge from the key and metadata.tags. See Headers.

Streaming

Set "stream": true. The gateway forwards SSE and forces stream_options.include_usage: true so the final chunk carries token usage.

Providers

ProviderNotes
OPENAINative OpenAI wire format
AZURE_OPENAINative OpenAI wire format
ANTHROPICTranslated to/from OpenAI format

Response headers

x-zeallm-request-id, x-zeallm-model-group, x-zeallm-provider, optional x-zeallm-fallback-from, and key budget headers when a max budget is set.

Example

curl http://localhost:8080/v1/chat/completions \
-H "Authorization: Bearer YOUR_ZEALLM_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role":"user","content":"Hello from ZeaLLM"}]
}'