# Replace API key inference limits

```http
PUT /api-keys/{id}/limits
```

Replace API key limits. Requires project.api\_keys.manage.

## Parameters

| Name | In   | Required | Description |
| ---- | ---- | -------- | ----------- |
| `id` | path | Yes      |             |

## Request body

| Field                 | Type         | Required | Description                                                                                                                                                                                                                                                                                                                                                                         |
| --------------------- | ------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `allowed_models`      | array,null   |          | Allowed catalog model IDs from `GET /ai/models`. Aliases are normalized to `<vendor>/<model>`, and duplicates are removed. Retired models return `422` with a replacement; unknown models return `400`. Null or omitted means no model restriction. A model excluded by project policy can be stored, but is excluded from `effective_allowed_models` and rejected at request time. |
| `requests_per_minute` | integer,null |          | Inference requests this key may make per minute. Null or omitted: no rate limit.                                                                                                                                                                                                                                                                                                    |

## Responses

| Status | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 200    | The key’s limits as they now stand. All limits are replaced; omitted limits are removed. `allowed_models` stores canonical catalog IDs; models the project policy excludes are stored but left out of `effective_allowed_models` and rejected at request time, so key limits cannot broaden the policy. The gateway applies stored limits only when `enforced` is true. Requires a signed-in administrator or owner with `project.api_keys.manage`; API keys, service accounts, and agent runs are rejected. The change is audited. |
| 400    | Bad request                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 401    | Unauthorized                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| 403    | Forbidden                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| 404    | Not found                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| 500    | Server error                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
