The kind of key failure an HTTP answer is, or null when the answer is not
the key's fault (a bad request, a missing model, a server error, a 403 for
a disallowed model or region).
401: auth. 403: auth only for an envelope type authentication_error
(Anthropic), a code invalid_api_key (OpenAI), or a message starting
"Invalid authorization token" (Requesty's answer to a bad key, read 17 Oct
2026). A permission_error or insufficient_permissions is a denial of a
resource the key may not use (a model, a feature, a region), not a revoked
key, and leaves the key in rotation.
402: billing. 429: billing when the envelope's type or code is
insufficient_quota (OpenAI bills that way) or Anthropic's details.error_code
is enforced_spend_limit_reached (the tier's monthly spend cap, no
Retry-After, until the next month), else quota. 456: quota.
400: billing for Anthropic's credit-balance envelope (type
invalid_request_error, a message starting "Your credit balance is too
low") and for a spend limit the operator set on the organization or a
workspace (the same type, a message starting "You have reached your
specified API usage limits" or "... specified workspace API usage limits"); auth for Google's invalid-key envelope (a details entry with
reason API_KEY_INVALID, or the message "API key not valid", which the
Gemini API answers with HTTP 400, read 17 Oct 2026); every other 400 is
null.
A body that is not JSON classifies by status alone.
The kind of key failure an HTTP answer is, or null when the answer is not the key's fault (a bad request, a missing model, a server error, a 403 for a disallowed model or region).
auth. 403:authonly for an envelope typeauthentication_error(Anthropic), a codeinvalid_api_key(OpenAI), or a message starting "Invalid authorization token" (Requesty's answer to a bad key, read 17 Oct 2026). Apermission_errororinsufficient_permissionsis a denial of a resource the key may not use (a model, a feature, a region), not a revoked key, and leaves the key in rotation.billing. 429:billingwhen the envelope's type or code isinsufficient_quota(OpenAI bills that way) or Anthropic'sdetails.error_codeisenforced_spend_limit_reached(the tier's monthly spend cap, no Retry-After, until the next month), elsequota. 456:quota.billingfor Anthropic's credit-balance envelope (typeinvalid_request_error, a message starting "Your credit balance is too low") and for a spend limit the operator set on the organization or a workspace (the same type, a message starting "You have reached your specified API usage limits" or "... specified workspace API usage limits");authfor Google's invalid-key envelope (adetailsentry with reasonAPI_KEY_INVALID, or the message "API key not valid", which the Gemini API answers with HTTP 400, read 17 Oct 2026); every other 400 is null.