Authentication
Connecting to Gate takes two things: the base URL you point your client at, and a Gate API key. From there you can let Gate serve the model for you, or route through your own provider key. The same key works for both.
Base URL
Point your app, SDK, or agent at Gate instead of at your provider:
https://gateway.constellationgate.aiOpenAI-compatible clients use the /v1 suffix (https://gateway.constellationgate.ai/v1), the same as they would with OpenAI. Anthropic-style clients keep the bare host and target /v1/messages.
API keys
Create an API key in the dashboard under API keys to get started. Gate keys start with sk-gw-. Each key is scoped to a single user. The value is shown only once at creation, so store it somewhere secure like a secrets manager.
Pay through Gate
Using Gate as your model provider is as simple as pointing your client at the base URL and putting your Gate key in the Authorization header. Gate routes each request to an upstream provider and runs its security, audit, and caching on top. Requests are billed pay-as-you-go against your Gate balance.
Authorization: Bearer sk-gw-...content-type: application/json| Header | Required | Notes |
|---|---|---|
Authorization: Bearer sk-gw-... | Yes | Your Gate key. |
X-Gate-Provider | No | Lock your model to specific provider. Otherwise, your request will be routed to the lowest cost and/or fastest provider that supports your chosen model. |
For Anthropic-shaped requests (/v1/messages), you do not need to send the anthropic-version header. Gate does not require it, and on managed routing it supplies the version header each provider expects — for Anthropic Direct accounts that is anthropic-version: 2023-06-01, set by Gate and used in place of any value you send. Sending it does no harm.
Use your own provider keys
Gate can also sit in front of a provider you already call, as a passthrough proxy. This works with any provider that speaks the OpenAI-compatible (/v1/chat/completions) or Anthropic Messages (/v1/messages) format. Keep your request as it is, swap your provider’s base URL for Gate’s base URL, and add two headers: X-Gate-Upstream-Url (your provider’s original base URL) and X-Gate-Api-Key (your Gate key). Your existing Authorization header still goes to the provider, which authenticates and bills you directly. Gate adds its security, audit, and rate limiting in between.
Authorization: Bearer <your-upstream-key>X-Gate-Api-Key: sk-gw-...X-Gate-Upstream-Url: https://openrouter.ai/apicontent-type: application/json| Header | Required | Notes |
|---|---|---|
Authorization: Bearer <upstream-key> | Yes | Your provider (e.g. OpenAI, OpenRouter, or Anthropic) authorization key. |
X-Gate-Api-Key: sk-gw-... | Yes | Your Gate API key. |
X-Gate-Upstream-Url | Yes | The provider’s base URL, without the path your client already sends (see below). |
The upstream URL and the request path
Gate appends your request’s full path — including the /v1 your client adds — to
X-Gate-Upstream-Url. So set the header to the provider’s base without that suffix,
otherwise the path doubles (.../api/v1 + /v1/chat/completions →
.../api/v1/v1/chat/completions) and the provider returns a 404.
| Provider | X-Gate-Upstream-Url | Your client sends | Gate forwards to |
|---|---|---|---|
| OpenAI | https://api.openai.com | /v1/chat/completions | api.openai.com/v1/chat/completions |
| OpenRouter | https://openrouter.ai/api | /v1/chat/completions | openrouter.ai/api/v1/chat/completions |
| Anthropic | https://api.anthropic.com | /v1/messages | api.anthropic.com/v1/messages |
The same Gate API key works for either Pay through Gate or using your own keys.