Rate limits
Per key, and the same for each account across its keys.
- 120
- 2M
- 8
The configured defaults, over sliding one-minute windows; yours are in the dashboard under Settings. Defaults may change, and a key can have its own limits. A key with higher limits raises its account’s limits to match.
How tokens are counted#
An admitted request counts its estimated prompt plus its full max_tokens, until it finishes.
Example: a 2,000-token prompt with the default max_tokens counts 10,192 tokens. 2M tokens a minute fit 196 of them, so the limit of 120 requests a minute applies first.
When a request finishes, its count is corrected to the tokens actually used. A request refused with 402 or 403 after it was admitted still counts its estimated prompt. Setting max_tokens close to what you need lets more requests through.
Without it, max_tokens is 8,192. Image requests count as requests and use a slot while in flight, but count no tokens.
When you hit a limit#
- You get 429 rate_limited and a
Retry-Afterheader: the seconds until enough of the window has passed, or 1 for the in-flight limit. - A refused request counts towards nothing and costs nothing.
- Retry after those seconds. Back off further if it repeats.
Models and balance#
GET /v1/models and /v1/credits have their own limit per key: 60 a minute and 4 in flight. They do not count towards the limits above.
Other 429s#
- Requests in progress. One address may have only so many requests in progress. One key, account or address may send only so many request bodies at once, and far fewer large ones. Beyond them: 429 with
Retry-After: 1. - Content check time. An account that sends more text in a minute than the content check reads in that time gets 429 until the minute is over.
- All capacity in use. When every backend for the model is busy, the request waits briefly for a free slot, then gets 429 with
Retry-After: 5. - Invalid keys. After 60 requests with unknown keys from one address in a minute, further requests from that address with keys we have not just seen get 429 until the minute passes. Requests with valid keys already in use keep working.