Error: 429 You exceeded your current quota, please check your plan and billing details.

Node.js · updated 2026-11-11

Thrown by the openai Node SDK as RateLimitError (its stack prints Error) when the API answers 429. The SDK already retried twice by default (maxRetries 2) before throwing. The message and error.code come from OpenAI's response: a rate limit ("Rate limit reached for requests" or tokens) or a billing problem (the long-standing "You exceeded your current quota" message, credit_balance_exhausted in the current error reference).

Error: 429 You exceeded your current quota, please check your plan and billing details.
    at APIError.generate (node_modules/openai/core/error.mjs:59:20)
    at OpenAI.makeStatusError (node_modules/openai/client.mjs:446:32)
    at OpenAI.makeRequest (node_modules/openai/client.mjs:1014:30)
  status: 429, code: 'insufficient_quota'

Quick fix

Look at error.code and the message before touching retries. Quota or credit errors mean the account is out of money or past its spend limit: add credits or raise the limit, and stop retrying. Rate limit errors mean you are sending too fast: respect the Retry-After header, back off with jitter, and lower concurrency.

  1. Log error.status, error.code and the message for every 429.
  2. Quota, billing or credit codes: add credits or raise the project spend limit in the OpenAI dashboard. Retrying will not help.
  3. Rate limit codes: wait as long as Retry-After says, then retry with exponential backoff and jitter, and cap retries.
  4. Remember the SDK already retried twice; set maxRetries deliberately rather than stacking your own loop on top.
  5. Reduce bursts: queue requests, lower parallelism, batch where you can.
typescript
import OpenAI, { RateLimitError } from 'openai';

const openai = new OpenAI({ maxRetries: 3 }); // the SDK backs off between retries

try {
  return await openai.chat.completions.create({ model, messages });
} catch (err) {
  if (err instanceof RateLimitError && /quota|credit|billing/i.test(`${err.code} ${err.message}`)) {
    // Out of credits or over the spend limit: tell someone, don't retry
    throw new Error('OpenAI account is out of credits', { cause: err });
  }
  throw err;
}
Fix it with your coding agent

Paste this into Claude Code, Cursor or Codex in the project that throws it. The agent reads this guide in plain text and applies the fix that matches your stack.

prompttext
Read https://runheed.com/errors/openai-429-rate-limit-or-quota.md and fix this error in this project.

Why it happens

No credits or spend limit reached

The organization or project has no prepaid credits left or hit its monthly limit. Every request fails until billing changes.

Too many requests at once

A burst of parallel calls (a backfill, a fan-out, a retry storm) passes the per-minute request or token limit.

Retries that make it worse

Your own retry loop on top of the SDK's two retries multiplies traffic during a rate limit.

A key from another project

The key belongs to a project with lower limits or no credits.

Other fixes

  • Alert on quota errors the first time they happen: they stop every AI feature at once and nothing recovers without a billing change.
  • Keep rate-limit retries out of user-facing request paths when you can; queue the work instead.

Same error, other wording

  • RateLimitError: 429 Rate limit reached for requests
  • openai.RateLimitError: Error code: 429 - You exceeded your current quota, please check your plan and billing details.
  • Error code: 429 - credit_balance_exhausted

Let your coding agent catch the next one

Runheed records this error in production with the stack trace, the breadcrumbs before it and, when you set it, the agent session that shipped the code, and serves it to Claude Code, Cursor or any MCP client. With it connected, you can ask:

> Find the OpenAI 429 errors, split them into quota/billing versus rate limits using the error code, fix the retry and concurrency settings for the rate limits, and tell me if the account is out of credits.

Setup for Node.js and Express or Vercel Functions, then have your agent fix and resolve it.

Related errors

More in Network and HTTP

References: OpenAI docs: error codes (429 rate limit vs credit balance, retry guidance), openai-node README: retries (default 2) and errors

Spotted a mistake? Email hello@greatwork.company. About Runheed.