GET /v1/limits reports the whole picture in one call.
Your own keys have no money ceiling
We set no request allowance and no monthly cap. You hold no balance to draw down. See pricing and billing. One ceiling applies. Your organization runs a fixed number of flex races at a time. Past that number we run the request on the standard tier. You lose the discount, not the answer. The report calls that numberown_keys.flex_race_slots.
What Managed Keys can run out of
A risk review can pause managed requests on top of those four. It returns
account_under_review. Your own key routes keep working.
Four more limits cover every organization. Three count requests a minute from one organization, from one key, and from one IP address. The fourth counts failed authentication attempts from one IP address. We also refuse a body over 50,000,000 bytes as request_too_large.
The report names each per-minute limit with its window and its scope. It leaves the number out, because Cloudflare counts each one in every location it runs in and one number wouldn’t be a budget you could plan against. Back off for the seconds in Retry-After instead.
Two response headers report your spend
An own-keys response carries them once its routes resolve, and a managed response carries them from the balance hold on. Three responses have neither header: one we turned away earlier, the model catalog, and a managed request whose balance we couldn’t read. We leave the headers off rather than guess.
We read both as we admitted this request. The number covers what you had left before this request settled its own cost.
A negative number means we turn away every managed request. Adding money repairs a negative balance. A negative daily remainder recovers at the next UTC midnight or with a raised ceiling, never with a top-up.
Read these headers on traffic you already send. Polling the endpoint before every request costs a round trip and tells you no more than the header did.
The limits endpoint
GET /v1/limits takes your FlexInference key. It reports the ceilings your organization runs under. It reads the records that admit your requests, so it never claims room we’d turn away. We never cache the answer.
The last three fields say why your concurrency number and your daily ceiling read as they do. An exempt organization has no ceiling to explain, so all three read
null.
A paused balance reports the pause in place of a number. No positive figure can then read as permission to send.
These numbers hold at as_of and promise nothing about your next request. Another request moves them, and so does a settlement, a top-up, or a refund.
A missing or wrong key returns 401 with invalid_api_key. When we can’t read one of these records, the endpoint returns 503 with limits_unavailable. It refuses rather than hand you a cached figure, which could claim room your next request wouldn’t get. Requests keep working either way.
Cost inside a stream
A response you didn’t stream reports its cost twice, in thex-flexinference-cost header and the usage.cost block. A streamed response can’t use the header, because we send headers before the answer exists and we don’t know the cost then.
Send include_cost: true to move the cost inside the stream.
usage.routing block sits beside it and names the route that ran the request.
/v1/chat/completions makes the usage frame itself opt-in at OpenAI. Send "stream_options": {"include_usage": true} as well. Without it the cost has no frame to go in.
A managed request reports what the provider charged us. An own-keys request reports the provider’s list price at the tier that ran it. A request we can’t price reports no cost at all. Read a missing block as nothing to report, not as zero.
Two routing headers come on every response either way. They are x-flexinference-served-provider and x-flexinference-routing-reason. A streaming caller who skips include_cost still sees which route ran the request and why. See reading the outcome.
include_cost never reaches the provider. We remove it from the body before we forward the request.