Chat API
Read this page as MarkdownIn this section: Rate limits
Rate limits
See the Chat API rate limits and the response headers your client can use to handle 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, one account | 4 | The account, across every grant it holds |
| Turns at once, everyone | 2, up to 4 during a zero-downtime deploy | The whole service, shared across callers |
| Spend in a rolling 24 hours | An allowance sized well above a person's day | The account, across every grant it holds |
Token refreshes do not reset the count. All personal API keys on an account share one count, so adding a key does not add an allowance. Today the service-wide ceiling of 2 is the one that binds: a second grant or a second key does not add turns at once. The per-account ceiling applies if the service-wide one is raised. Other callers can trigger the shared global limit; all three concurrency refusals say “concurrency limited” and request a two-second wait.
The daily allowance is counted per account, so authorizing a second client does not widen it, and the person's own web chat spends from the same allowance. The allowance caps spending from a compromised credential; normal use stays well below it, and clients that reach it are almost always looping. It is a rolling 24-hour window, so capacity returns as earlier spend ages out of it. The Retry-After on its refusal is an hour. It is a hint: capacity comes back as earlier spend ages out.
GET /v1/models has its own per-minute window, equal in size to the completions window and counted on the same grant. Listing models does not use the budget for turns. It carries no x-ratelimit-* headers, so this page is the only place that ceiling is written down.
Headers on every response
Every /v1/chat/completions response includes these headers on successes, streams, and 429s:
x-ratelimit-limit-requests: 30
x-ratelimit-remaining-requests: 27
x-ratelimit-reset-requests: 41sThese use OpenAI's header names, so OpenAI SDKs can read them without Miles-specific code. The remaining value excludes the current call. The reset value gives the seconds until the oldest request in the 60-second window ages out and frees a slot, or 0s when the window is empty.
An account whose monthly budget governs it also gets two more:
x-miles-budget-percent-used: 42
x-miles-budget-reset-date: 2026-10-14percent-used is an integer from 0 to 100, rounded down. reset-date is the Pacific date when the budget period turns over. For accounts without a monthly budget, both headers are omitted. Their absence means no budget applies; a value of 0 means the budget applies. Miles sends none of these headers before identifying the caller, so a 401 includes none. Neither does /v1/models, which has its own window and would otherwise report the wrong one under OpenAI's header names.
Over a ceiling
A 429 response uses the OpenAI error envelope and includes a Retry-After header. Four conditions share this status and require different handling. Read the message to tell them apart:
type | Message starts | What to do |
|---|---|---|
rate_limit_exceeded | rate limited, retry after Ns | Wait Retry-After seconds; the per-minute window is full. On /v1/models this is that endpoint's own window |
rate_limit_exceeded | concurrency limited, retry after 2s | Reduce parallelism; another turn on this grant, on another grant of the same account, or on the service, is still running |
rate_limit_exceeded | You've reached today's usage limit | Wait Retry-After, which is an hour here. The account's daily spend allowance is full until earlier spend ages out of the rolling 24 hours. This is not the per-minute window and will not clear in a minute, so a client that retries on the usual 429 backoff will keep failing |
insufficient_quota | You've used this month's budget. It resets on …, or a trial-budget message during a Membership trial | This month's budget is spent. Retry-After is the seconds until the reset date. It can be days, so do not retry on the usual 429 schedule |
Two of those four are rate_limit_exceeded on a window measured in seconds and one is rate_limit_exceeded on a window measured in hours, so a client that branches on the code alone will retry the daily ceiling far too fast. Branch on Retry-After.
See the errors page for the full code table.