Two ways to call the Gateway
| Method | Use it for |
|---|---|
| Virtual key | Applications and teams. The key sets the providers, models, budget and rate limit. |
| Token from your identity provider | People 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
- Open Virtual Keys in the Gateway console.
- Select Create.
- Enter a name and a description.
- 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".
- Optional: attach the key to a team or a customer.
- Optional: set a budget and a rate limit.
- 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:
| Value | Meaning |
|---|---|
| Issuer address | The OpenID Connect issuer. The Gateway reads its discovery document. |
| Key set address | Use this when the issuer has no discovery document. |
| Audience | The audience that your identity provider puts in tokens for the Gateway |
| Required scopes | Scopes that each token must have |
| Role claim | The claim that holds the Gateway role. The default is role. |
| Subject claim | The 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
| Role | Permissions |
|---|---|
admin | Call models. Read and change the configuration. Read logs. Manage keys and budgets. |
developer | Call models. Read the configuration and logs. |
viewer | Read the configuration and logs. |
auditor | Read 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.