Skip to main content
A
Docs

Access control

Control who can call which models through the Gateway with virtual keys, tokens from your identity provider, and Gateway roles.

Two ways to call the Gateway

MethodUse it for
Virtual keyApplications and teams. The key sets the providers, models, budget and rate limit.
Token from your identity providerPeople and services that sign in through your identity provider

Virtual keys

The Gateway issues each virtual key. A virtual key is not a provider key. It never goes to a provider.

Send the virtual key in the x-anar-vk header:

x-anar-vk: <virtual-key>

When your deployment uses Gateway roles, the Authorization header carries your role credential. It does not carry the virtual key.

Create a virtual key

  1. Open Virtual Keys in the Gateway console.
  2. Select Create.
  3. Enter a name and a description.
  4. Attach the providers and models that the key can use. A key with no providers attached cannot call any provider, unless you select "allow all providers".
  5. Optional: attach the key to a team or a customer.
  6. Optional: set a budget and a rate limit.
  7. Save. Copy the key value and give it to the key holder through a secure channel.

Turn a key off

Open the key and turn it off. The Gateway refuses each request with that key with 403.

Tokens from your identity provider

The Gateway can check JSON Web Tokens from your identity provider. Anar sets this up during deployment with these values from you:

ValueMeaning
Issuer addressThe OpenID Connect issuer. The Gateway reads its discovery document.
Key set addressUse this when the issuer has no discovery document.
AudienceThe audience that your identity provider puts in tokens for the Gateway
Required scopesScopes that each token must have
Role claimThe claim that holds the Gateway role. The default is role.
Subject claimThe claim that holds the user identity. The default is sub.

The Gateway refuses a token with the wrong signature, issuer, audience or expiry time. The Gateway removes identity headers that the caller sends.

Gateway roles

RolePermissions
adminCall models. Read and change the configuration. Read logs. Manage keys and budgets.
developerCall models. Read the configuration and logs.
viewerRead the configuration and logs.
auditorRead logs.

Each request to the administration API needs a role that allows it. The Gateway refuses other requests with 403. Anar can add custom roles to the configuration for you.

Secure by default

The Gateway does not start when its administration API has no authentication. Anar configures the authentication during deployment.