An administrator can turn the gateway off for the whole workspace with the Enable LLM Gateway switch in Admin
Panel > LLM Gateway. While it is off,
every gateway request is rejected and the gateway scope is hidden from the token picker.
What the gateway provides
- An OpenAI-compatible Chat Completions endpoint.
- An OpenAI Responses endpoint.
- An Anthropic Messages endpoint and token-count endpoint.
- A
GET /modelsendpoint that lists the models your Onyx identity can access.

Before you begin
You need all of the following:- Your workspace is on the Business or Enterprise plan, or on Onyx Cloud.
- An Onyx administrator has configured a language model and made it visible.
- Your Onyx account has access to that model.
- A Personal Access Token (PAT) with the LLM Gateway — Use scope.
New Access Token, or click New token in Settings > LLM Gateway. Under Permissions, choose Limited access and select LLM Gateway — Use. Onyx shows the token only once.A full-access token does not work with the gateway. The gateway accepts only tokens with an explicit scope, and it rejects API keys and browser sessions.
Gateway address
Settings > LLM Gateway shows the Gateway URL for your deployment. For a standard Onyx deployment, it is:/gateway/v1.
Every request uses a Bearer token:
Find an available model
The easiest way to find a model ID is in the Models section of Settings > LLM Gateway. The tab appears only when your plan includes the gateway and at least one model is visible and accessible to your account. The copied value already has the required format:
12/gpt-5-mini means:
12is the Onyx ID for the configured provider.gpt-5-miniis the model name configured for that provider.
model value in your client. Do not replace the provider ID with the provider name.
Only models that are visible and marked for chat appear. There is no fallback to a default model:
an unknown ID returns 404.
You can also list the same IDs from your application:
OpenAI Chat Completions
Point OpenAI-compatible clients at the gateway URL. This example uses the official OpenAI JavaScript SDK.TypeScript
stream: true uses server-sent events.
OpenAI Responses
The gateway also supports the OpenAI Responses API. Use the same base URL and model ID.TypeScript
Gateway responses are stateless. Send the context that a later turn needs;
do not rely on a previous response ID being stored by Onyx.
Anthropic Messages
For Anthropic-compatible clients, send requests to the gateway’smessages endpoint with the same Bearer token and model ID.
POST /messages/count_tokens.
Use with coding agents
Use the gateway with Claude Code or Codex to give coding-agent requests the same model access controls, usage attribution, and token limits as other gateway traffic.Claude Code
Set the gateway’s parent endpoint as the Anthropic base URL, then use a Claude model ID from Settings > LLM Gateway:/v1/messages, which resolves to the gateway’s Anthropic Messages endpoint.
Use a model ID from your own Settings page. Provider IDs differ by deployment.
Codex
Create a Codex profile at~/.codex/onyx.config.toml:
OpenCode
Add the gateway as an OpenAI-compatible provider in your project’sopencode.json:
@ai-sdk/openai-compatible provider uses the gateway’s Chat Completions endpoint.
Usage and limits
Gateway requests use the calling user’s Onyx permissions. If the user loses access to a model, the gateway no longer exposes or accepts that model for the user. Administrators can review token use and estimated model cost in Admin PanelUsage. The Manage spending limits section on the same page sets global, user, or group token limits. Those limits apply before the gateway sends a generation request to a model provider. The token-count endpoint does not generate anything, so it is not metered and not limited.

Native passthrough
Anthropic Messages requests that resolve to an Anthropic provider, and Responses requests that resolve to an OpenAI model, are proxied natively to the provider. Hosted and server tools, extended thinking, and fine-grained streaming pass through unchanged. Chat Completions requests, and requests for other providers, are translated through the OpenAI-compatible path. Self-hosted administrators can turn passthrough off with these environment variables on the API server:ANTHROPIC_GATEWAY_PASSTHROUGH_ENABLED=false: send Anthropic-backed providers through the translation path.OPENAI_GATEWAY_PASSTHROUGH_ENABLED=false: send true-OpenAI models through the translation path.
Common errors
Next steps
Configure language models
Add providers and control which models are visible.
Create a Personal Access Token
Create and manage the token used by your application.