Skip to main content
Use access key configurations to control which providers and models an access key can call. The gateway checks restrictions before it routes a request upstream. That means a request can fail fast if a client asks for a provider or model the key shouldn’t use.

What you’ll need

Allow specific providers

Use provider restrictions when an access key should only call certain providers.
With this configuration, requests can only route to OpenAI or Anthropic.

Allow specific models

Use model restrictions when an access key should only call certain models.
Model entries accept three forms: Use the provider: prefix when you always want to use that provider. Combine model rules with a provider allowlist to block resellers.

Allow providers and models together

Combine provider and model restrictions when you want a key to stay within a small set of approved providers and models.
Requests outside the allowed providers or models are rejected before they reach an upstream provider.

How this works with fallback

Every model in a fallback request must be allowed.
If the primary model is allowed but the fallback model isn’t, the gateway drops the fallback and names it in the Ngrok-AIG-Rejected-Models response header. The request fails only when none of the models you listed are allowed.

Virtual models

Model restrictions apply to the models in a virtual model, not to its name. To let a key use a virtual model, allow the models in it. The gateway skips each model the key can’t use and names it in the Ngrok-AIG-Rejected-Models response header. You can’t add a virtual model name to access.models.allow. The API rejects it with the message 'chat-default' is a virtual model. Add its models to the key instead.

Common patterns

Next steps