Skip to content
Veil

Rate limits

Per-key limits, headers and how to back off.

Limits are per key. We do not limit by network address, because we do not read it.

LimitDefaultHow it is counted
Requests per minute60A fixed window that starts on each clock minute.
Concurrent requests8Requests in progress for the key, streams included.

The limits that apply to your key are returned by GET /api/account in the limits object.

Headers

HeaderMeaning
x-ratelimit-limitRequests allowed per minute.
x-ratelimit-remainingRequests left in the current minute.
retry-afterSeconds to wait. Sent with 429 and 503.

The two x-ratelimit headers are on successful replies, on 429 and on errors that happen after the limit check (502, 503 and a 400 from the model). Requests refused earlier, such as 401 or 404, do not carry them and do not count against the limit. A 402 is the exception: it counts against the minute but carries no rate limit headers.

When you hit a limit

The reply is 429 rate_limit_error. For the per-minute limit, Retry-After is the number of seconds until the next minute starts. For the concurrency limit it is 1, and a slot frees as soon as one of your requests finishes.

  • Wait for Retry-After before retrying. Requests refused by the per-minute limit still count in the current minute, so retrying early only uses up the next window.
  • Keep a client-side cap on parallel requests at or under the concurrency limit.
  • A 429 costs nothing.
Rate limits | Docs | Veil