Limit an API key’s models

A project API key can call every model its project allows. Switch models off to narrow one key, for example a key that only needs a small model.

Before you start

You need a project API key. See Create an API key.

Set allowed models

The list only offers what the project allows. With every model switched on, the key follows its project, including models the project allows later.

  1. In your project, open Settings > API keys.
  2. Open the ⋯ menu on your key's row.
  3. Click Set allowed models.
  4. Turn off the switch for Claude Opus 5.
  5. Click Save.
  6. Open the ⋯ menu on your key's row.
  7. Click Set allowed models. You should now see the switch for Claude Opus 5 off, and a call to anthropic/claude-opus-5 with the key answers 403 key-model-denied.

Troubleshooting

If a call answers key-model-denied, "Model "anthropic/claude-opus-5" is not on this API key's model list.", the model is switched off for the key. Call one of the models the message lists, or turn the model's switch back on.

If you see "These limits are saved but not enforced yet.", the API serving your project keeps your list but doesn't refuse calls to other models yet.

If you see "Only project keys carry rate and model limits. This is an account key.", the key reaches more than one project. Create a key for the one project and limit that.

If you see "Switch on at least one model", turn one on. To let the key call every model the project allows, turn them all on.

Next steps