# Limits

> Requests per minute, concurrent requests, per-key spend limits, balance reserve and request body size.

| Limit | Value | When exceeded |
| --- | --- | --- |
| Requests per minute per key | 600 | `429 rate_limit_exceeded`, `Retry-After`, `x-ratelimit-*-requests` |
| Requests per minute per account (all keys) | 1 200 | `429 rate_limit_exceeded`, `Retry-After`, `x-ratelimit-*-requests` |
| Requests per minute without a key or with an invalid key | 60 per IP address | `429 rate_limit_exceeded`, `Retry-After` |
| Concurrent requests | Limited per account, across all keys | `429 rate_limit_exceeded`, `Retry-After: 1` |
| Concurrent media requests | Image generations and `POST /v1/videos` with a body over 5 MiB — limited per account and per server | `503 overloaded`, `Retry-After: 5` |
| The model provider's rate limit | Depends on the provider | `429 rate_limit_exceeded`, `Retry-After` when the provider named a pause |
| Key spend limit | Set per key in the cabinet | `403 spend_limit_exceeded` |
| Balance | The free remainder (balance minus the reserve of requests in progress) covers the whole reserve of the new request | `402 insufficient_quota` with the shortfall |
| Request body: text | 25 MiB — `/v1/chat/completions`, `/v1/responses` | `413` |
| Request body: media | 90 MiB — `/v1/images/generations`, `/v1/videos` | `413` |
| Images per request | `n` from 1 to 10 | The value is clamped to the range |
| Choices in `/v1/chat/completions` | `n` from 1 to 8 | The value is clamped to the range |
| Output ceiling | `max_tokens`, `max_completion_tokens`, `max_output_tokens` — at most 131 072 | A larger value is replaced with 131 072 |
| Response without streaming (text) | 10 minutes for the whole response | `504 upstream_timeout`, nothing charged |
| Streamed response | First fragment within 10 minutes, each next one within 5 minutes, the whole stream up to 1 hour | Error event `upstream_timeout`; without a single fragment nothing is charged |

## Requests per minute

Every request to `/v1/*` with a key counts twice: against the key's limit (600
per minute) and against the account's limit (1 200 per minute across all
keys). The window is one minute from the first request, then the counter
starts over. Browser preflight requests (`OPTIONS`) are not counted.

Every response carries the headers of the tightest limit — the one with the
smallest share left:

- `x-ratelimit-limit-requests` — the limit per minute;
- `x-ratelimit-remaining-requests` — requests left in the current window;
- `x-ratelimit-reset-requests` — time until the window resets, as a duration
  string like OpenAI's: `1s`, `42s`, `1m0s`.

Past the limit you get `429 rate_limit_exceeded` with a `Retry-After` header
(whole seconds) and the headers of the limit that refused. A request that got
`429` does not consume the limit: a key that hit its own limit does not eat
the account quota of your other keys. The OpenAI SDK waits for
the `Retry-After` pause and retries on its own.

Requests without a key (including `GET /v1/models`) and with an invalid key
are limited separately: 60 per minute per IP address (for IPv6, per /64 network). Keys that passed the
check within the last 10 minutes are not counted against it: key guessing from
the same address (for example, a shared network behind NAT) and a large burst
of concurrent requests do not block a key that is already working. While the
address limit is exhausted, requests without a key and with keys that have not
passed the check recently get `429` before the key is checked.

## Concurrent requests

The number of requests running at the same time for an account is limited —
across all keys. Once exceeded,
the next request gets `429 rate_limit_exceeded` with a `Retry-After` header —
retry after the indicated pause, when one of the running requests finishes.
Video jobs (`POST /v1/videos`) are not subject to this limit.

Heavy media requests — image generations (`POST /v1/images/generations`) and
video jobs (`POST /v1/videos`) with a body over 5 MiB — are limited
separately: a few at a time per account and an overall ceiling per server.
Beyond it the gateway answers `503 overloaded` with `Retry-After: 5`; the
request is rejected before it reaches the provider and nothing is charged.
Retry after the pause.

If the model's provider hits its rate limit, the gateway also responds `429`;
`Retry-After` is present when the provider named a pause (1 to 60 seconds).

## Spend limit and balance reserve

- A key can have a spend limit: once reached, new requests on that key get
  `403 spend_limit_exceeded` while your other keys keep working.
- While a request runs, its estimated reserve is held on your balance and in
  the key's limit: for text — the input estimate
  plus the output ceiling times `n`; for images — the price times `n`; for
  audio — the cost of the characters to narrate, the estimated duration of the
  input file (speech to text, voice changer) or the duration ceiling (music,
  sound effects); for video — the price of the video for the requested length
  until the job finishes (see [Video](https://llmbox.cc/en/docs/videos)). The
  output ceiling is `max_tokens` plus a reasoning reserve (4 096 tokens:
  reasoning models generate beyond `max_tokens`), or 4 096 tokens if
  `max_tokens` is not set.
- Without `max_tokens`, a response longer than 4 096 tokens may cost more than
  the reserve — the charge may then exceed the free remainder. The same can
  happen if the model ignored `max_tokens`.
- A request is admitted only if the free remainder covers its whole reserve.
  Otherwise it gets `402` (or `403` for the key's limit), and the message names
  the reserve and the amount missing: lower `max_tokens`, top up, or, if the
  remainder is held by requests in progress, retry once they finish.
- The reserve is based on the output ceiling, not on the actual answer. So with
  a small balance, requests with a large `max_tokens` on expensive models may
  get `402` before the balance reaches zero: for example, `max_tokens: 64000`
  at an output price of $15 per 1M tokens reserves $1.02 for the output alone
  (64 000 plus the 4 096-token reasoning reserve).
  Set `max_tokens` to the length you actually expect, or top up in advance.

More on charges in [Balance and pricing](https://llmbox.cc/en/docs/pricing).

## Long responses

A text request without streaming (`stream` unset or `false`) waits for the
whole response for at most 10 minutes. Past that the gateway answers
`504 upstream_timeout` and charges nothing; the request is not retried:
generation may have started. Request reasoning models and long answers with `stream: true`: a
stream waits up to 10 minutes for the first piece, up to 5 minutes between
pieces, and lasts up to an hour in total.

## Request body size

25 MiB for text endpoints and 90 MiB for images and video — the ceiling for
base64 media attachments. Anything larger gets `413`. The body is JSON with
the `Content-Type: application/json` header; without it — `415`. Pass large
references as links rather than `data:` URLs when the model supports it.

With a zero balance a generation request gets `402` before its body is read —
there is no point uploading a large body without funds on the account.
