# Cap what an API key spends

A project [API key](/docs/authentication.md) can call as often as its project allows. A rate limit sets how many model calls one key may make a minute, for example a key that serves a public form. Other API and MCP calls don't count. What a key may spend a month is its budget: see [Set spend limits](/docs/account/spend-limits.md).

## Before you start

You need a project API key. See [Create an API key](/docs/authentication/api-keys.md).

## Set a rate limit

**Studio**

1. In your project, open **Settings** > **API keys**.
2. Open the **⋯** menu on your key's row.
3. Click **Set rate limits**.
4. Enter 30 as the **Requests per minute**.
5. Click **Save**. You should now see **Rate limit saved**.
6. Open the **⋯** menu on your key's row.
7. Click **Set rate limits**. You should now see 30 as the **Requests per minute**.

## Troubleshooting

**If a call answers `key-rate-limited`**, "This API key is limited to 30 requests per minute. Retry in 60 s.", the key has made its model calls for this minute. Wait the seconds in the `Retry-After` header, or raise the **Requests per minute**.

**If the 31st call in a minute still answers `200`** right after you save, the limit isn't applied yet. Send the calls again a few minutes later.

**If several calls at once answer `503`** "AI provider spend check is temporarily unavailable", the gateway couldn't check spend for them. They still count toward the minute's limit, so send them again once the minute is over.

**If you see "These limits are saved but not enforced yet."**, the API serving your project keeps the limit but doesn't refuse calls over it yet.

## Next steps

* [Set spend limits](/docs/account/spend-limits.md)
* [Revoke access](/docs/authentication/revoke-access.md)
