An OpenAI HTTP 429 can require a billing change rather than a retry. Inspect error.code before treating it as a rate limit. The broader error.type can still say insufficient_quota when the code identifies a more specific credit, spend, or usage restriction.
Match the code to the control that stopped traffic
Billing-related codes in OpenAI's documentation, read October 15, 2026
credit_balance_exhaustedMeaning. The organization has no prepaid credits remaining.
Action. Check the intended organization's billing account and add credits if authorized.
organization_spend_limit_exceededMeaning. The organization reached an enforced hard spend limit.
Action. Review usage and the organization limit. An authorized owner can raise or remove that limit, or wait for the next monthly cycle.
project_spend_limit_exceededMeaning. The billed project reached its enforced hard spend limit.
Action. Review that project's usage and limit. Changing an unrelated project's budget does not fix this request.
organization_usage_limit_exceededMeaning. The organization reached its OpenAI-assigned usage limit.
Action. Request a higher approved usage limit. This is separate from a hard spend limit you configure yourself.
If the response only supplies insufficient_quota, inspect the dashboard, organization, project, and request ID rather than guessing which control is responsible. An exhausted balance and a project cap can require different people to resolve them. Record the structured code and request ID in your incident log; omit credentials and request contents.
A spend alert is different from an enforced limit
OpenAI's current spend-limits guide distinguishes notification thresholds from hard limits. A spend alert sends a notification while traffic continues. Turning on Enforce a hard limit makes affected requests fail after tracked spend reaches the configured amount. Both organization and project limits can apply.
Hard-limit enforcement is not instantaneous. OpenAI warns that recorded spend can slightly exceed the configured amount while the state propagates. A hard limit is an interruption control, not a guarantee that every in-flight operation stops at an exact dollar boundary. Use your own admission controls when a workload needs a tighter operational budget.
Stop the retry loop without breaking unknown errors
The following Python function classifies a decoded HTTP error object. It does not call OpenAI, change billing, sleep, or retry. Its billing branches take precedence over a generic rate-limit type. Unknown responses return inspect, so an unfamiliar 429 does not silently start an automatic loop.
"""Classify a decoded HTTP error; this does not send or retry a request."""
BILLING_CODES = {
"credit_balance_exhausted",
"organization_spend_limit_exceeded",
"project_spend_limit_exceeded",
"organization_usage_limit_exceeded",
"insufficient_quota",
}
def error_action(status, body):
error = body.get("error") if isinstance(body, dict) else None
error = error if isinstance(error, dict) else {}
code, kind = error.get("code"), error.get("type")
if isinstance(code, str) and code in BILLING_CODES:
return "billing_review"
if kind == "insufficient_quota":
return "billing_review"
if status == 429 and (code in ("rate_limit_exceeded", "slow_down")
or (code in (None, "") and kind == "rate_limit_error")):
return "bounded_retry"
if status == 503 and code == "server_is_overloaded":
return "bounded_retry"
return "inspect" # Unknown 429s must not start an automatic retry loop.
Verification boundary: the classifier is covered by local tests using constructed error objects, including malformed bodies and every billing code above. These objects are test fixtures, not captured provider responses. Provider error envelopes and an actual account's billing state were not exercised with credentials.
The official Python SDK can retry eligible requests automatically. If you implement application-level classification and retries, account for that behavior or disable SDK retries with OpenAI(max_retries=0). Otherwise an outer attempt can contain additional hidden attempts. A retryable classification still needs a bounded policy, a time budget, and a safely repeatable operation; see the rate-limit guide.
Restore service deliberately
- Confirm which organization and project the deployed credential bills. Compare production configuration with the account whose dashboard you are inspecting.
- Read the exact code, then inspect the matching credit balance, hard limit, or approved usage limit. Do not raise every control at once.
- Have an authorized owner make the intended change. OpenAI says a raised or removed spend limit takes effect after the update propagates; it does not promise an immediate result.
- Run a deliberately bounded verification request through your normal deployment process when spending is authorized. Keep failed and successful request IDs so an intermittent recovery is visible.
- Review the cause of the spend before replaying a backlog. Resuming an unbounded queue can exhaust the new allowance again.
Changing to a cheaper model can reduce future cost, but it does not replenish credits or remove an existing limit. Use the source-linked calculator to estimate a proposed workload, then test its output quality separately. Do not infer equivalent task cost from a per-token discount alone.