Skip to content
LUNAROUTEDocs

API reference

The API is served from https://gw.lunaroute.com. All endpoints share the same authentication; error envelopes follow the request dialect (see Errors).

Endpoint Shape
POST /v1/chat/completions OpenAI Chat Completions
POST /v1/completions Legacy OpenAI completions
POST /v1/messages Anthropic Messages
POST /v1/messages/count_tokens Anthropic token counting
POST /v1/responses (and /responses) Responses API
POST /v1/embeddings Embeddings
POST /v1/rerank Rerank
POST /v1/audio/transcriptions Audio transcription
POST /v1/audio/preprocess Audio preprocessing
GET /v1/audio/preprocess/capabilities Audio preprocessing
POST /v1/systemone System One (decision models)
POST /v1/images/generations Image generation
POST /v1/images/edits Image editing
POST /v1/images/uploads Image upload
GET /v1/models Model catalog

Embeddings and rerank run in their own concurrency pool, so they never consume priority capacity. Image generation uses the priority pool by default; a background-marked request uses the overflow pool when the organization is entitled to overflow capacity. System One decision requests are admitted against the organization’s inference capacity — there is no dedicated decision pool, so a busy organization gets a 429 with Retry-After rather than an unbounded queue.

Most endpoints return one envelope:

{ "error": { "code": "INVALID_API_KEY", "message": "Invalid or revoked API key" } }

Anthropic-dialect requests (/v1/messages) are not uniform: most errors (including auth failures) return the envelope above, while some Anthropic-shaped errors wrap it as { "type": "error", "error": { … } }. Auth codes are listed on Authentication, and Errors & rate limits covers 429, Retry-After, and retryable 503s.

Some features are operator-gated. When a feature is switched off, its endpoint answers 503 with a <feature>_disabled code rather than disappearing, so the route table is stable. Treat these as “temporarily unavailable”, not “not found”.