Skip to main content

Endpoint

This is the primary gateway endpoint. It accepts an OpenAI-compatible request body, authenticates the caller, enforces your policy, routes to the configured provider, and returns either a complete response or a Server-Sent Events stream.

Authentication

Include an Authorization header with every request. Three schemes are supported:

Request

Content-Type: application/json

Body fields

string
required
The model to use, in "provider/model-name" format.
array
required
Conversation history as an array of message objects. Each object must have:
boolean
default:"false"
When true, the response is delivered as a Server-Sent Events stream. Each event carries an incremental delta. See Streaming response below.
number
Maximum number of tokens to generate in the response.
number
Sampling temperature between 0 and 2. Lower values produce more deterministic output.
object
Structured output configuration. When set, the gateway instructs the model to return valid JSON matching the specified shape.
string
UUID of a saved prompt in your Gatelit dashboard. Links this ad-hoc request to the prompt for log correlation. The prompt’s configuration is not applied — use POST /v1/prompts/:id/run to execute a saved prompt.
array
An ordered list of fallback models to try if the primary model fails. Each entry:

Response headers

These headers are present on every successful response (streaming and non-streaming):
string
A unique ID for this gateway request. Use it to look up the request in the Gatelit dashboard logs.
string
The model that actually handled the request in "provider/model-name" format. May differ from the requested model if a fallback was triggered.
string
The authentication mode used: "signed-token", "oidc", or "service-key".

Non-streaming response

When stream is false (the default), the gateway returns a standard OpenAI-compatible chat completion object.

Streaming response

When stream is true, the gateway returns an SSE stream (Content-Type: text/event-stream). Each line is prefixed with data: and contains a JSON delta chunk:
  • Each chunk carries incremental text in choices[0].delta.content.
  • Token usage appears in the last chunk before [DONE].
  • The stream ends with a bare data: [DONE] line.

Examples


Error responses

All errors return JSON with code, message, and requestId. See the Errors reference for the full list of codes and HTTP statuses.