Chat completions
POST /v1/chat/completions — a fully OpenAI-compatible endpoint with streaming, tools, and JSON mode.
POST ${GATEWAY_URL}/v1/chat/completions is the core endpoint. It supports tool calls, JSON mode, and both streaming and non-streaming responses — the same surface as OpenAI's chat completions API.
Streaming Reliability
- SSE streams emit
: keepalivecomments every 15 seconds during upstream silence, so long-lived connections don't get killed by idle timeouts. - If your client disconnects, the gateway aborts the upstream provider request and finalizes billing for the tokens received so far — you're never charged for tokens you never got.
- Connection resume via
Last-Event-IDisn't supported in v1. Open a new request with a freshrequest_idinstead.
Tip:
If you stream to a browser or a flaky mobile connection, keep your own reconnect logic simple: on disconnect, just retry the whole request. The keepalive comments mean a hung connection is rare, not something you need to work around.
Error responses follow the gateway's shared error contract — see Errors for the full list of status codes.