Errors
Refusal statuses the live gateway sends. A status that is not in that file is not listed here.
JSON refusals are {"error":{"code":"...","message":"..."}} when a message is set. Some codes have no message. Auth for the bearer and POST /v1/account/anonymous is on Auth. This page does not name a public host.
Stream is not these HTTP statuses
POST /v1/chat/completions with stream true checks JSON, model, and messages first. Those failures are HTTP 400. If those checks pass, the handler sends HTTP 200 and Content-Type: text/event-stream before chat_stream runs. Later refusals are data: lines. They do not change the HTTP status. One line is data: {"error":{"code":"..."}} and, when a message is passed, a message field. The SSE codes are listed after the HTTP statuses.
400
| Code | When | Body |
|---|---|---|
bad_json |
A POST body is present and is not JSON. An empty body is {} and is not this error. |
{"error":{"code":"bad_json"}} |
| first word of the exception | POST /v1/webhooks/{processor} when the UI API object is mounted and receive raises WebhookError or ProcessorError. The code is the first whitespace-separated word of the exception text. This page does not name those words. |
code as above, message the exception text |
| PackError code | POST /v1/credits/purchase with a non-empty pack_id, when checkout raises PackError. The code string is the exception's code. It is not hardcoded in the handler. |
{"error":{"code":"<PackError.code>"}} |
bad_events |
POST /v1/meter/ingest when events is not a list. |
message events array required |
bad_tier |
POST /v1/founding/purchase when tier is not paid or verified. The default tier is paid. |
message paid | verified |
missing_model |
POST /v1/chat/completions after a valid bearer, when model is missing or empty. |
message model parameter is required |
missing_messages |
Same route, when messages is missing or not a list. Checked only after model is present. |
message messages array is required |
A chat POST with no valid bearer is 401 before missing_model or missing_messages.
401
Code bad_key. Message unknown or revoked key. Sent when a route that requires the bearer has no key, a key that does not start with Bearer , an unknown key, or a revoked key. The same object is returned by chat if the account is gone. On a stream that already sent HTTP 200, the same object is an SSE line, not HTTP 401. Which routes require the header is on Auth.
402
Non-pool JSON chat only. The model id does not contain / and does not end with :free. The account is not the free zero-credit path (plan free and credits_face_usd at or below 0). reserve returns false. Code insufficient_credits. Message reserve failed — the breaker denies before it spends. Meter headers are still attached.
The free zero-credit path does not use this status. It uses 429 quota_exhausted. A pool model does not use this HTTP status in this file. Its JSON error code reserve_denied uses the same message; the HTTP status on that path is the dispatch result code, which this file returns unchanged. The pool stream, already HTTP 200, uses an SSE code 402 with no message when reserve returns false. That SSE code is not HTTP 402.
403
| Code | When | Body |
|---|---|---|
turnstile_verification_failed |
POST /v1/account/create or POST /v1/founding/purchase, only when CF-Turnstile-Token or JSON turnstile_token is present, the Cloudflare module is loaded, and verification returns false. Anonymous is not in this list. No token skips the check. |
code only |
bad_setup_key |
POST /v1/account/create when the UI API object is mounted and setup_key does not match. Anonymous does not check setup_key. |
code only |
404
| Code | When | Body |
|---|---|---|
model_not_found |
GET /v1/models/{id} after a valid bearer, when that id has no detail row. |
message is model , the Python repr of the id, then not found |
event_not_found |
GET /v1/logs/{id} when the UI API object is mounted, the bearer is valid, and that event_id is not in the account's last 1000 meter events. |
code only |
not_found |
An unknown GET, with or without a bearer. An unknown POST only after the bearer is valid. A route that is skipped because the UI API object is not mounted also lands here. | code only |
429
| Code | When | Body |
|---|---|---|
rate_limit_exceeded_key |
Non-stream chat, before its own account check. The same key string has reached 60 requests in 60 seconds. Response header Retry-After is 60. |
message Rate limit exceeded (60 requests/minute). Please back off. |
rate_limit_exceeded_ip |
Same call, when the client IP has reached 120 requests in 60 seconds. The message text still says 60 requests/minute. Retry-After is 60. The IP is Cloudflare CF-Connecting-IP when that module is loaded, otherwise the first X-Forwarded-For hop, otherwise the socket address. |
same message |
key_cap_exhausted |
Non-pool JSON chat, when daily_cap_usd is set and today's key usage is at least that cap. The anonymous key stores 1.0, so the rendered amount is $1.00. |
message Key-specific daily cap of $ plus the cap with two decimal places, plus reached. |
quota_exhausted |
Non-pool JSON chat, plan free and credits at or below 0, when today's free use has reached free_tier.daily_face_usd (default 1.50). |
message You've used today's free capacity. $10 keeps you running tonight. Also resets_at (next UTC midnight) and founding_offer /founding |
The handler already returned 401 for a bad key, so this HTTP 429 is for a key that passed account_for_key. A stream does not send HTTP 429. Its rate-limit SSE message is Rate limit exceeded with no Retry-After header. Pool JSON chat does not use key_cap_exhausted or quota_exhausted. See the pool section.
500
POST /v1/account/anonymous when opening the account raises. That includes the cap not being stored. Code anonymous_failed. No message.
502
| Code | When | Body |
|---|---|---|
upstream_failed |
Pool JSON chat, when dispatch_chat raises. This is separate from a dispatch result that itself carries upstream_failed. |
message request refused |
rail_error |
Non-pool JSON chat, when the rail runsync raises. A reserve already held is settled at 0 first. |
message is the exception text |
processor_error |
Pack checkout, POST /v1/credits/purchase, or POST /v1/founding/purchase, when ProcessorError is raised. |
message is the exception text |
503
| Code | When | Body |
|---|---|---|
no_supply |
Non-pool JSON chat, when the id is not a usable registry entry. Exact id is tried first, then a case-insensitive substring match in either direction. A registry row is unusable when its rail is not openrouter, vertex, gemini, or google, and it has no endpoint. |
message is model , the Python repr of the id, then not in the registry |
no_processor |
Pack checkout when the Stripe adapter is missing. Also POST /v1/credits/purchase without a pack_id, when PayPal was not both requested and configured and Stripe is missing. PayPal is used only when processor is paypal and a PayPal adapter exists. Otherwise Stripe is tried. Founding purchase does not send this code. |
message payment processor unavailable |
Pool JSON chat keeps a dispatch status of 503. If that error is no_supply and the lease stored a supply code, the error code becomes that supply code before the message is chosen. The non-pool stream SSE code is no_supply with message model , the Python repr, then not in registry (no word "the"). That line is not HTTP 503.
Pool JSON messages
A model id that contains /, or ends with :free in any case, uses the pool. If the dispatch code is 200 and the error is empty, the body is the upstream payload with api_key, authorization, and Authorization removed. Otherwise the HTTP status is that dispatch code, except the 503 no_supply rewrite above, which changes the error code and not the status. The error body is {"error":{"code":"<error or upstream_failed>","message":"..."}}. That status number can match a section above while the error code is the pool code, not the code in that section. This file does not list a status number that it does not itself write. Messages defined in this file:
| Error code | Message |
|---|---|
free_lane_unconfigured | free lane has no key |
paid_lane_unconfigured | paid lane has no key |
reserve_denied | reserve failed — the breaker denies before it spends |
lane_saturated | lane saturated |
cap | daily cap reached |
catalog_unknown | model price is unknown |
| any other error | request refused |
The anonymous key has daily_cap_usd set, so the pool cap check runs. If the activity store is missing, that check fails closed. This file does not assign the HTTP number for that result; it returns the dispatch code and, when the error is cap, the message daily cap reached.
SSE error codes
These are error.code strings inside an HTTP 200 stream. A code that looks like a number is still a string, not the HTTP status.
| SSE code | Message | When |
|---|---|---|
rate_limit_exceeded_key or rate_limit_exceeded_ip | Rate limit exceeded | chat_stream limiter, same windows as HTTP 429 |
bad_key | unknown or revoked key | chat_stream account check failed |
no_supply | model + repr + not in registry | non-pool stream, no usable registry entry |
quota_exhausted | none; founding_offer is /founding | non-pool stream, free zero-credit quota spent |
insufficient_credits | none | non-pool stream, reserve returned false |
stream_error | exception text | non-pool stream, rail stream raised. A held reserve is settled at 0 |
cap | none | pool stream, daily cap check failed |
503 | the charge or supply code | pool stream, price refused or no lease. free_lane_unconfigured is passed through as that message. Any other supply code is that code. A missing supply code becomes no_supply |
429 | lane_saturated | pool stream, the lane is saturated, the retry lease raises, or a later upstream 429 |
402 | none | pool stream, reserve returned false |
upstream_failed | none | pool stream, transport failure, a non-429 upstream status, or a failed read before any chunk was sent |
Integer 0
pack_purchase_response returns the integer 0 and {} when pack_id is missing or not a non-empty string. POST /v1/credits/purchase calls that helper only when pack_id is a non-empty string, so the handler does not send 0 on that path. The helper itself does return 0. It is not a named refusal in the handler.