AI Gateway Setup
Connect OpenAI, Anthropic, OpenRouter or AWS Bedrock to the ZopNight AI Gateway. Lists the exact key type or AWS access each provider needs, and how your developers point their tools at the gateway.
The AI Gateway sits between your developers and your AI providers. You connect a provider once. Your developers then use a ZopNight virtual key instead of the provider key. Each virtual key has its own budget and list of allowed models, and every request shows up in AI spend reports.
Before you start
| Need | Detail |
|---|---|
| A ZopNight Admin | Only Admins connect providers and manage models. Editors create virtual keys. |
| A provider account | OpenAI, Anthropic, OpenRouter, or an AWS account with Bedrock. |
| For Bedrock: a connected AWS account | Connected under Cloud Accounts. A read-only connection also needs the AI Gateway permissions. |
| Outbound HTTPS for your developers | Their tools call https://api.zop.dev/ai-gateway. Nothing calls into your network. |
Access to grant
OpenAI, Anthropic and OpenRouter
Each provider needs one API key. Before saving it, ZopNight makes one read call with the key, and rejects a key the provider refuses.
| Provider | Key to create | Minimum access |
|---|---|---|
| OpenAI | A project API key | All, or Restricted with the two permissions below |
| Anthropic | A standard API key | A normal key from the Claude Console |
| OpenRouter | A standard API key | A normal key |
For an OpenAI Restricted key, turn on these two, as named in OpenAI's permission list:
- List models: Read. Without it the key is rejected when you connect.
- Model capabilities: Request. This is what lets the gateway call chat completions.
For Anthropic, use a normal API key. An Admin key (sk-ant-admin…) is for the
Admin API, not for calling
models.
The connect check calls:
- OpenAI:
GET /v1/models - Anthropic:
GET /v1/models(List Models) - OpenRouter:
GET /api/v1/key(Get current key)
The key is stored encrypted. It is never shown again in ZopNight or sent to your developers.
AWS Bedrock
Bedrock needs no key. ZopNight calls it with your connected AWS account's credentials: the ZopNight role (short-lived credentials, refreshed before they expire) or, for a connection made with access keys, that IAM user's keys.
| IAM action | Why | Granted on |
|---|---|---|
bedrock:ListFoundationModels | Find usable models | Every connection |
bedrock:ListInferenceProfiles | Find cross-region IDs | Every connection |
bedrock:GetFoundationModelAvailability | Hide models AWS will not serve the account (optional: without it every model is listed) | Every connection (also in AWS ReadOnlyAccess) |
bedrock:InvokeModel | Call a model | Read and write only |
bedrock:InvokeModelWithResponseStream | Stream a response | Read and write only |
aws-marketplace:Subscribe, aws-marketplace:Unsubscribe, aws-marketplace:ViewSubscriptions | Enable a third-party model on first use | Read and write only |
The list actions and GetFoundationModelAvailability are in the ZopNight role's read policy. The
rest are in its write policy. The Marketplace actions are the ones AWS lists as model access prerequisites. AWS can only narrow
aws-marketplace:Subscribe by Marketplace product ID, one per model, so the role grants it
unscoped. If your security review needs it scoped, add an aws-marketplace:ProductId condition
for the models you use. AWS needs these actions only the first time a model is used in an account.
You can attach them, use each model once, then remove them.
Action names are from Actions, resources, and condition keys for Amazon Bedrock.
Connections made with access keys
ZopNight cannot change an IAM user's permissions. Attach this policy to the user whose keys you
connected. Manage models uses the List actions to find your models. Skip that statement if
the user already has them, for example through ReadOnlyAccess.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "BedrockDiscover",
"Effect": "Allow",
"Action": ["bedrock:ListFoundationModels", "bedrock:ListInferenceProfiles", "bedrock:GetFoundationModelAvailability"],
"Resource": "*"
},
{
"Sid": "BedrockInvoke",
"Effect": "Allow",
"Action": ["bedrock:InvokeModel", "bedrock:InvokeModelWithResponseStream"],
"Resource": "*"
},
{
"Sid": "BedrockModelAccess",
"Effect": "Allow",
"Action": [
"aws-marketplace:Subscribe",
"aws-marketplace:Unsubscribe",
"aws-marketplace:ViewSubscriptions"
],
"Resource": "*"
}
]
}You can also skip the Marketplace actions. Have someone with Marketplace rights enable each
third-party model once by invoking it from the Bedrock console. For Anthropic models, also complete
the First Time Use form. After that, the user's keys need only the bedrock: actions.
You also need the models available in your AWS account. See Access Amazon Bedrock foundation models:
- Amazon Nova models work as soon as Bedrock is available in your account.
- Anthropic Claude models need the one-time First Time Use form first. The first call to a third-party model also starts an AWS Marketplace subscription, which the ZopNight role creates for you on read-and-write connections.
- ZopNight registers each default model under an ID AWS offers in your region: a regional
profile such as
us.,eu.,apac.orin.when there is one, otherwiseglobal.. Models you add under Manage models can be any ID AWS lists for your region.global.ones need access to the model in every Region of the profile. If a Service Control Policy blocks some of those Regions, requests fail.
Set it up
Connect a provider
Open Settings → Integrations → AI Providers and click Connect on the provider tile. Enter the API key. For Bedrock, pick the AWS account and the Region instead. Click Connect. ZopNight checks the key and adds a default set of models. The toast says how many were added. If the tile shows Connected · no models, the models could not be added and the toast says why. Fix the cause, then choose Add default models from the tile menu.
Add or remove models (optional)
For OpenRouter and Bedrock, open the tile menu and choose Manage models. Add a model by picking it from the list or entering its ID.
Create a virtual key
Open AI Estate → Inference Keys and click Create virtual key. Give it a name, the models it may use, and a budget. The key is shown once. Copy it. Rotating a key issues a new secret. The new key keeps the old key's spend and its daily, weekly or monthly reset.
Point your tools at the gateway
Use the gateway address and the virtual key in place of the provider's. The key screen shows ready-made snippets for Claude Code, the OpenAI SDK and cURL.
export ANTHROPIC_BASE_URL=https://api.zop.dev/ai-gateway
export ANTHROPIC_AUTH_TOKEN=<your virtual key>
export ANTHROPIC_MODEL=<a model name from the key>
export ANTHROPIC_DEFAULT_HAIKU_MODEL=<a Haiku model name from the key, else the same model name>
claudefrom openai import OpenAI
client = OpenAI(base_url="https://api.zop.dev/ai-gateway", api_key="<your virtual key>")Usage appears under AI Estate → AI Usage; spend under Costs → Reports → AI Spend.
Cap spend across the organization
- AI Estate → Inference Keys → Org budget ceiling sets one hard cap on all virtual keys combined.
- Only admins can set or remove it.
- Once the total is spent, the gateway refuses requests until the period resets.
- Period is monthly, weekly, daily, or No reset for a lifetime cap.
- Per-key budgets still apply within the ceiling.
- Remove ceiling is in the same drawer and asks you to confirm.
Disconnect and remove access
Settings → Integrations → AI Providers → Disconnect removes the provider, its models, and the stored key or AWS credentials from ZopNight.
- Virtual keys stay, but requests to the removed models fail.
- ZopNight does not revoke anything at the provider. Delete the API key in the provider's console.
- For Bedrock, the short-lived AWS credentials expire within an hour. For a connection made with access keys, deactivate the key in IAM.
Troubleshooting
| Problem | Cause and fix |
|---|---|
<provider> rejected this API key, e.g. OpenAI rejected this API key | For an OpenAI Restricted key, turn on List models. For Anthropic, use a normal API key. |
| Bedrock requests return access denied | The AWS connection is read-only, its stack predates the streaming permission, or the access-key user lacks the policy above. |
| Claude on Bedrock works once, then is denied (Marketplace) | Complete the First Time Use form. Then update the ZopNight stack, or attach the policy above to the access-key user, so the Marketplace subscription can be created. |
| The Bedrock tile shows Connected · no models | The default models could not be added. The toast names the cause. Fix it, then choose Add default models from the tile menu. |
| Connect is greyed out | Connecting needs permission to create cloud accounts and AI models (the Admin role has both), and the console must not be in read-only mode. |
| Add default models is greyed out | It needs permission to create AI models, and the console must not be in read-only mode. |