Genace

Billing hard limit has been reached — OpenAI API billing_hard_limit_reached (HTTP 400)

HTTP 400 billing_hard_limit_reached Do not retry as-is

The exact error

{ "error": { "code": "billing_hard_limit_reached", "message": "Billing hard limit has been reached", "param": null, "type": "invalid_request_error" } }

What it means

The account the key belongs to was refused on billing grounds; nothing is wrong with the image request itself. What makes this error confusing is its shape. In the forum reports it arrives as HTTP 400 with type: invalid_request_error, so the Python SDK raises openai.BadRequestError, the same exception class as a malformed request.

The reports in the OpenAI community forum run from late 2022 to mid 2024 and mostly involve dall-e-2 image calls, but it is not image-specific. In the 2022 thread one user reported a similar error on the GPT-3 API, and another hit it on both DALL·E and GPT-3.5 Turbo. It behaves as an account-level state rather than a per-model one.

No official explanation appears in either thread. Users report several different triggers:

  • Expired free credits. One user found the trial credits on their usage page had already expired; another explained that early free DALL·E credits expired 30 days after being granted.
  • No payment method. One user found they also had to add a payment method in Settings before the API worked, and warned that the DALL·E credits they had bought separately did not work with the API.
  • A configured limit. One user on a paid account had set a $120 hard limit and received emails when the soft and then the hard limit were hit, even though their usage page showed far less.
  • Free-to-paid switch. One user said that after moving from a free to a paid account they had to create a new API key before the error stopped.

Several other users had credits and limits to spare and never found a cause in the thread.

How to confirm it’s this

  • error.code is billing_hard_limit_reached and the HTTP status is 400.
  • Make one cheap call to a non-image endpoint with the same key. If it fails the same way, the problem is the account, not the image request.
  • Check the usage page and billing settings: payment method on file, credit balance, any expired grants, and any spend limits set on the organization or the project.

Fix

  1. Make sure a payment method is on file and the credit balance is positive.
  2. Check spend limits. The current error codes guide says organization spend limits are raised or removed in the organization limit settings, and project spend limits in the project settings.
  3. If you just moved from free or trial credits to paid, try a new API key, as one forum user reported.
  4. If everything looks funded and within limits, contact OpenAI support via help.openai.com, as a forum member suggested in the 2022 thread.

In code, handle every billing code in one place and stop instead of retrying. The error codes guide says to inspect error.code for billing-related errors and notes that the broader error.type can still be insufficient_quota:

const BILLING_CODES = new Set([
  'billing_hard_limit_reached',
  'credit_balance_exhausted',
  'organization_spend_limit_exceeded',
  'project_spend_limit_exceeded',
  'organization_usage_limit_exceeded',
]);

if (BILLING_CODES.has(error?.code) || error?.type === 'insufficient_quota') {
  // Stop this job and alert a human; do not retry.
}

Retry or not

No. The error codes guide is explicit: retrying billing, spend or quota errors won’t restore API access, and you should update the relevant credits or limits before sending another request. The rate limits guide says the same about errors that require you to take action.

For an agent, note the status code. Because this arrives as a 400, a handler that only watches for 429s or RateLimitError will treat it as a bad request and may mislabel the failure. Match on error.code instead.

When it’s not this

OpenAI’s current error codes guide does not list billing_hard_limit_reached. The billing failures it does document are all HTTP 429, each with its own code:

  • credit_balance_exhausted: no prepaid credits remaining.
  • organization_spend_limit_exceeded: the organization hit its enforced monthly spend limit.
  • project_spend_limit_exceeded: one project hit its own limit, while other projects can continue.
  • organization_usage_limit_exceeded: the organization hit its OpenAI-assigned usage limit. The rate limits guide says this is separate from the spend limits you configure.

A plain rate-limit 429 (rate_limit_exceeded) is about throughput and is usually retryable with backoff (the images-per-minute page covers the zero-limit exception). A 403 asking you to verify your organization is an access gate, not a billing state.

Error text last verified against the sources below on .

Where these facts come from