The OpenAPI document
Fetch the whole thing, unauthenticated:Authentication
Most endpoints take a project API key:Authorization: Bearer sk-lw-... works too. Some families need an organization API key instead, because they carry signing secrets and organization-wide data: webhook endpoints, gateway spend, and everything that provisions the organization itself, from the organization profile and its members through roles and role bindings. Create either kind under Settings > API Keys.
Two surfaces authenticate differently again. The SCIM 2.0 endpoints take a SCIM bearer token, because the caller is your identity provider. Creating organizations on a self-hosted instance takes the instance administrator credential, because it runs before any organization exists.
The AI Gateway’s own inference endpoints (/v1/chat/completions and friends) authenticate with a virtual key rather than an API key, and live on the gateway host.
Conventions
- Request and response fields are
lower_snake_case. - Money is an integer number of nano-USD (billionths of a dollar), with a decimal string rendered from it for display. The integer is the source of truth: sum integers, round once.
- Timestamps are ISO 8601, except spend and event filters, which take epoch milliseconds.
- List endpoints are cursor-paged: follow
next_cursoruntil it comes backnull. A full page does not mean there is more, and a short page does not mean there is not. - Errors carry a stable
error.codeto branch on. See Errors.