Skip to content
AI GatewayAI Gateway Manual

Issuing and managing Gateway Keys

Issue your own Gateway Key in a project, set it in a client, and revoke a key you no longer use.

A gateway key identifies who sent a request to AI Gateway. Each key belongs to one project and one user: the Gateway Keys page lists only your own keys, and a project administrator can list and revoke other users’ keys from the administration screen. Anyone who holds the secret can send requests as you, so treat it like a password.

  • The project you open must show Gateway Keys in the top menu (GNB). The menu appears only when you may manage your own keys in that project. If it is missing, ask a project administrator for the permission.
  • Check that the project already allows the models, MCP servers and toolsets you want to use. A key never reaches beyond the project that issued it.

The top menu places Gateway Keys here.

Interactive demo · Project menu
Loading interactive demo…

Open the project and select Gateway Keys in the top menu. On the Gateway Keys page, use Issue key in the top right to open the Issue gateway key dialog.

FieldDescription
Key nameA name for the key. Required, up to 128 characters. Name it after where it is used, for example cursor-laptop.
Expiry date (optional)The key expires after this moment. Enter it in your browser’s local time; a time in the past is rejected. Leave it blank for a key that never expires.

If the expiry cannot be read as a date and time, the form shows an error beside the field. Correct it or clear the field before submitting again.

The demo below is the whole flow: Issue key on the page, the dialog, the one-time secret and the copy. Press Play and the steps run in order; closing the dialog adds the new key to the bottom of the list, which the console lists by creation date. The demo runs locally and issues no real key.

Interactive demo · Issuing a gateway key
Loading interactive demo…

After you press Issue key, the dialog switches to One-time secret. Its title is the key name you just chose, and the key itself is shown below it.

Press Copy secret to copy the key. The button changes to Copied. After you close this view with Close, the key is gone for good; only the Preview column in the list remains.

The key starts with agw_.

The list shows only the keys you issued in this project.

ColumnMeaning
Key nameThe name you gave the key.
PreviewThe first 12 characters of the key. Use it to tell keys with the same name apart.
CreatedThe day you issued the key.
ExpiresThe expiry date, or Never when the key has none.
Last usedWhen this key last authenticated successfully, or Not used yet. Updates can lag by up to 5 minutes.
StatusActive or Expired.
ActionsThe Revoke action for that key.

A key past its expiry date turns Expired and stops authenticating. Expired keys stay in the list, so revoke them if you want the list clean.

Put the key into the client that uses it. The examples in this manual read it from the AI_GATEWAY_API_KEY environment variable.

Terminal window
export AI_GATEWAY_API_KEY='<your Gateway Key>'

If a client can only read the key from a settings file, keep that file out of Git.

If a key leaks or is no longer used, press Revoke on its row. In Revoke this gateway key?, select Revoke key. The dialog warns that this deletes the key immediately and that existing clients using this preview will stop authenticating. Revoking cannot be undone.

The key disappears from the list, and clients that authenticated with it receive Authentication failed. (401). Issue a new key and update the client.

  • You may hold at most 10 active keys per project at a time. Expired keys do not count. Issuing beyond that fails, so revoke keys you no longer use first.
  • A key belongs to the project and the user that issued it. To use another project’s models or MCP servers, issue a key in that project.
  • A key is a secret. Never put the value itself in source code, a repository, or a shared screenshot.
  • A key stops authenticating when the account is deactivated or the permission is removed from the project.
SymptomWhat to check
Authentication failed. (401)The value starts with agw_, Status is Active, and the client runs in the environment where you set the key. Revoked and expired keys get this error.
Models, MCP servers or toolsets are missingThe key was issued in the right project, and that project allows the models and tools you want.
Gateway Keys shows “Gateway keys could not be loaded”Select Try again. Check that you can manage your own keys in that project.

For errors raised by an MCP client, see Troubleshooting MCP.