OpenAI APIRunbook 0/4 done
insufficient_quota

OpenAI API Error insufficient_quota: You exceeded your current quota

Critical✕ Not retryable · fix the payloadHTTP 429 Too Many RequestsAI Provider
TL;DR · 10-second read

Same 429 status as a rate limit, but the cause is billing: the project has no credit left or hit its monthly budget. Retrying never helps; add credits or raise the budget.

Identify: does your log match?

What you see · exact log / response
openai.RateLimitError: Error code: 429 - {'error': {'message': 'You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.', 'type': 'insufficient_quota', 'param': None, 'code': 'insufficient_quota'}}
  1. High

    Prepaid credits used up

    Pay-as-you-go accounts stop serving requests when the credit balance reaches zero, unless auto-recharge is on.

  2. Medium

    Project or org budget reached

    A monthly budget set on the project or organization blocks further usage until it is raised or the month resets.

  3. Medium

    Key belongs to a different project

    The key comes from a project with no billing attached, while the dashboard you checked shows another project.

Fix

Don’t retry quota errors

✕ Broken · TypeScript
catch (e) {
  if (e.status === 429) return retryWithBackoff(req); // loops forever on insufficient_quota
}
✓ Fixed · TypeScript
import OpenAI from "openai";

catch (e) {
  if (e instanceof OpenAI.RateLimitError && e.code === "insufficient_quota") {
    alertBilling(e);            // page a human; retrying cannot fix billing
    throw e;
  }
  if (e instanceof OpenAI.RateLimitError) return retryWithBackoff(req);
  throw e;
}

Both errors arrive as RateLimitError with status 429. The code field is the only reliable way to tell a billing stop from a temporary limit.

Verify: reproduce it on purpose

Reproduce locally · bash
$ # Use a key from a project with no credit balance
curl -s https://api.openai.com/v1/chat/completions \
  -H "Authorization: Bearer $OPENAI_KEY_UNFUNDED_PROJECT" -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"hi"}]}' | jq .error.code

Run it against a dev environment to trigger insufficient_quota on purpose and test your error handler.

Prevent

  • Turn on auto-recharge for production projects.
  • Set a budget alert below the hard limit so you hear about it before requests fail.
  • Alert on code, not status: insufficient_quota is a billing incident, rate_limit_exceeded is a capacity one.

FAQ

I just added credits, why does it still fail?

Check that the API key belongs to the project you funded; new keys and balance updates can take a few minutes to apply.

Is ChatGPT Plus the same as API credit?

No. ChatGPT subscriptions and API billing are separate; the API needs its own credit balance.

Related errors

Last verified 2026-10-22 · Source: OpenAI error-code guide + SDK exception classes · Official docs ↗ · ~33,100 searches/mo