Skip to content

Chat completions

POST /v1/chat/completions speaks the OpenAI Chat Completions shape. Point an OpenAI-compatible client at https://gw.lunaroute.com/v1 with your lr_ key.

Terminal window
curl https://gw.lunaroute.com/v1/chat/completions \
-H "LUNAROUTE-API-KEY: $LUNAROUTE_API_KEY" \
-H "content-type: application/json" \
-d '{
"model": "glm-5.3",
"messages": [{"role": "user", "content": "hello"}],
"stream": true
}'

The legacy POST /v1/completions endpoint is also available.

  • Background model variant — use the -background form of the model id, e.g. glm-5.3-background, for work that can wait. See Lanes & scheduling.
  • Project attribution — send LUNAROUTE-PROJECT-ID.
  • BYOK passthrough — a non-lr_ Authorization / x-api-key value is forwarded to the upstream provider, so you can route through your own key.

Set "stream": true to receive server-sent events. The response model is the public model id you requested, not the internal upstream name.