Chat API
Read this page as MarkdownIn this section: Rate limits
Rate limits
Requests per minute and turns at once, counted per grant, with the headers every response carries so a client can plan around them.
The ceilings
| Ceiling | Value | Counted per |
|---|---|---|
| Requests per minute | 30 | Grant: one OAuth token family, or all of an account's personal keys together |
| Turns at once | 2 | The same grant |
| Turns at once, everyone | 6, briefly 12 during a deploy | The whole service, shared across callers |
Refreshing a token does not reset its count. Every personal API key on one account shares a single count, so a second key is not a second allowance. The global ceiling is shared, so someone else's traffic can trip it; that refusal says concurrency limited and asks for a two-second wait.
Headers on every response
Every /v1/chat/completions response carries these, on successes, streams and 429s alike:
x-ratelimit-limit-requests: 30
x-ratelimit-remaining-requests: 27
x-ratelimit-reset-requests: 41sThey are spelled the way OpenAI spells them, so an OpenAI SDK reads them with no Miles-specific code. remaining excludes the call being answered. reset is seconds until the window opens again.
An account whose monthly counter governs it also gets two more:
x-miles-quota-limit-month: 200
x-miles-quota-remaining-month: 143They are absent, not zero, on an account with no monthly limit: absent means the counter does not apply, and zero would mean the opposite. Nothing is emitted before the caller is identified, so a 401 and /v1/models carry none of these.
Over a ceiling
A 429 in the OpenAI error envelope with a Retry-After header. Two different conditions share the status and need different handling:
type | Message starts | What to do |
|---|---|---|
rate_limit_exceeded | rate limited, retry after Ns | Wait Retry-After seconds; the per-minute window is full |
rate_limit_exceeded | concurrency limited, retry after 2s | Reduce parallelism; another turn on this grant, or on the service, is still running |
insufficient_quota | usage limit reached | The month's allowance is spent; it does not reset with time in the minute |
The full table of codes is on the errors page.