Concepts
Rate limits & quota
Rate limits, quota, and handling 429
The platform limits on two layers: rate (RPM/TPM) and balance quota, computed per API key / organization / tier.
Rate limits
| Dimension | Meaning |
|---|---|
| RPM | requests per minute |
| TPM | tokens per minute |
| Concurrency | in-flight requests |
Allowances depend on your tier and model; higher tiers get more. Response headers carry current usage and limits:
| Header | Meaning |
|---|---|
x-ratelimit-limit-requests | RPM cap |
x-ratelimit-limit-tokens | TPM cap |
x-ratelimit-remaining-requests | requests left this minute |
x-ratelimit-remaining-tokens | tokens left this minute |
retry-after | suggested wait (seconds) on 429 |
Quota (balance)
Every successful call is billed in real time per Billing. Insufficient balance returns 402 insufficient_quota — top up or upgrade.
Handling 429
# read retry-after / exponential backoff
import time
for i in range(5):
r = call()
if r.status_code != 429:
break
time.sleep(int(r.headers.get("retry-after", 2 ** i)))Recommendation: do concurrency control (token bucket / semaphore) + exponential backoff on the client to avoid maxing out RPM.