Rate limits
Limits protect every account from runaway clients, including your own.
Requests per minute
Each key has its own limit on requests per minute, set when you create it. New keys start at
120 per minute. Requests are counted in a rolling one minute window,
separately for each scope: chat (which includes listing models), search, uploads, job checks, reading billing, and starting
purchases. A request counts once its key has been checked, so one that fails later still counts; a request refused with
429 rate_limited does not count.
Monthly token cap
A key can also carry a monthly token cap. Before each chat request, the tokens the key used this calendar month (UTC)
plus the request's max_tokens (zero when you leave it out) must fit under the cap; otherwise the request returns
429 rate_limited. The check runs before the request, so it does not stop a response that is already being
generated. Streamed requests do not report token counts yet, so they do not count toward the cap. Leave the cap empty for
no monthly limit.
Size limits
max_tokenscan be at most 4,096.- Uploads can be up to 25 MB.
- Search queries can be up to 8,000 characters, with up to 50 results.
Handling 429
Responses do not carry rate limit headers yet. When you get a 429, wait and retry with exponential backoff,
and spread steady traffic across several keys only when each belongs to a separate service.
