Back to guides

AI API Budget Planning

The Dumb Spending-Limit Mistake That Lets One Bug Drain Your AI API Budget

We read the current billing docs for OpenAI, Anthropic and Google side by side. The limit you set is often an email, not a stop. Here is what each provider really does when you hit the number, which error comes back, and how far past the cap you can still get billed.

Quick answer

As of November 2, 2026: an OpenAI monthly spend limit only sends alerts unless you turn on Enforce a hard limit, then requests fail with a 429 (project_spend_limit_exceeded or organization_spend_limit_exceeded). Anthropic pauses the whole organization at its tier cap ($500 Start, $1,000 Build, $200,000 Scale) with a 429 that has no retry-after header, and a limit you set yourself returns HTTP 400. Gemini pauses every project on the billing account at the tier cap ($250 Tier 1, $2,000 Tier 2), returns HTTP 402 when prepaid credit hits $0, and warns that billing lags about 10 minutes, so agents and batch jobs can run past the cap. None of the three stops spend instantly.

9 min read - Published Nov 2, 2026 - Updated Nov 2, 2026

The limit you set is probably an email

Here is a scene that plays out more often than anyone admits. You open the OpenAI dashboard, type $50 into the monthly spend limit, hit save, and go to bed feeling responsible. That night a background job gets stuck in a loop. By morning there is a polite alert in your inbox and the meter is still running.

Nothing broke. That is how the setting works. On OpenAI, a monthly spend limit only sends alerts unless you also turn on a separate switch called Enforce a hard limit. Most people never see the switch, because the number field looks like it is the limit.

I read the current billing docs for OpenAI, Anthropic and Google side by side on November 2, 2026. Each one does something different at the cap, returns a different error, and lets a different amount slip past. If you only remember one table from this post, make it the next one.

OpenAI vs Claude vs Gemini: what happens at the cap

OpenAIAnthropic (Claude)Google (Gemini)
Cap you set yourselfMonthly spend limit per organization or projectMonthly limit for the organization or a workspace (not the Default Workspace)Monthly spend cap per project (experimental)
Does it stop traffic by default?No. Alerts only, until you turn on Enforce a hard limitYesYes, with up to ~10 minutes of billing lag
Error you get429 project_spend_limit_exceeded or organization_spend_limit_exceeded400 invalid_request_error: “You have reached your specified API usage limits”Requests rejected; forum users report a 429 saying the billing account exceeded its monthly spending cap
Cap the provider sets for youOpenAI-approved usage limit by tier (429 organization_usage_limit_exceeded)Tier cap: $500 Start, $1,000 Build, $200,000 ScaleTier cap: $250 Tier 1, $2,000 Tier 2, $20,000 to $100,000+ Tier 3
When the provider cap hitsRequests fail until the limit is raised or the month resetsWhole organization paused until 00:00 UTC on the 1st. 429 rate_limit_error, error_code enforced_spend_limit_reached, no retry-afterEvery project on the billing account paused until the 1st
Out of prepaid credit429 credit_balance_exhaustedNot stated on the rate-limits page402 Payment Required for every key on the billing account
Overshoot warning in the docs“Recorded spend can slightly exceed” the limitNot statedAbout 10 minutes of lag; batch jobs and agents can overshoot

Sources: the OpenAI spend limits guide, Anthropic's Claude rate limits page and Google's Gemini API billing page. All three change often. If a number here ever disagrees with the provider page, the provider page wins.

The one-line version

OpenAI trusts you to flip a switch. Anthropic stops you, but with an error that looks like an ordinary rate limit. Google stops you late, and when it does, it stops every project on the account at once.

Mistake 1: leaving the OpenAI limit as an alert

This is the cheapest fix in the whole post, and it takes about a minute. Go to Organization limits (or the project's limits), select Edit spend limit, enter the monthly number, turn on Enforce a hard limit, and save. Do it for the organization and again for each project that runs unattended code.

Keep a spend alert below the hard limit as well. Alerts keep working after you add the hard limit, so an alert at 50% and 80% gives you time to look before traffic stops.

One more thing people miss: OpenAI also gives your organization its own approved monthly usage limit based on your tier. That is a separate ceiling with its own error code, organization_usage_limit_exceeded. If you see that one, your own limit is not the problem; you need to ask OpenAI for a higher approved limit.

Mistake 2: retrying a spend cap like a rate limit

This one is sneaky. When an Anthropic organization hits its tier cap, the API returns HTTP 429 with error type rate_limit_error. That is the exact error type you get for a normal per-minute rate limit. The difference is buried in error.details.error_code, which says enforced_spend_limit_reached, and in the missing retry-after header.

Most retry code only looks at the status code. So it sees 429, waits, retries, sees 429 again, and keeps going until it gives up. Anthropic says plainly that retrying, including the SDK's automatic retries, fails until access resumes, which can be weeks away if you hit the cap on the 9th.

Your retry logic should treat these as stop signals, not slow-down signals. A minimal check on the raw HTTP response looks like this:

SPEND_STOP_CODES = {
    # OpenAI
    "project_spend_limit_exceeded",
    "organization_spend_limit_exceeded",
    "organization_usage_limit_exceeded",
    "credit_balance_exhausted",
    # Anthropic tier cap
    "enforced_spend_limit_reached",
}

def is_spend_stop(status: int, body: dict) -> bool:
    err = body.get("error") or {}
    code = err.get("code") or (err.get("details") or {}).get("error_code")
    if code in SPEND_STOP_CODES:
        return True
    # Anthropic: a limit you set yourself comes back as HTTP 400
    if status == 400 and str(err.get("message", "")).startswith("You have reached your specified"):
        return True
    # Gemini Prepay: credit balance hit $0
    return status == 402

# In your retry loop: if is_spend_stop(...), stop retrying and page a human.

Google's billing page does not spell out the error for a spending cap. Developers on Google's forum report a 429 whose message says the billing account exceeded its monthly spending cap. If you run Gemini in production, match on that message, and check it against a real response before you trust it.

Retries cost money even when they work. If you have never priced them, the retry and fallback cost breakdown shows how a 10% retry rate quietly adds to a monthly bill.

Mistake 3: one cap that takes down every app you own

Caps protect your wallet by stopping traffic. The catch is what else they stop.

  • Gemini: the tier cap is counted across every project linked to the billing account. When the total hits $250 on Tier 1, your side project, your staging app and your paying customers' app all pause together until the 1st. The same goes for a $0 Prepay balance: every key on the billing account stops at once.
  • Anthropic: the tier cap applies to the whole organization. A runaway eval script in one workspace can use up the month for production in another, unless each workspace has its own lower limit.
  • OpenAI: an organization hard limit blocks every project. A project hard limit only blocks that project, which is usually what you want for anything experimental.

The fix is the same idea everywhere: give risky work its own fence. Put experiments, evals and batch jobs in their own OpenAI project or Anthropic workspace with a small hard limit, so they hit their wall long before production hits the shared one.

On Gemini that is harder, because the tier cap lives on the billing account. A separate billing account isolates the risk but starts its own tier history from scratch, which means a low cap of its own. Decide which hurts more for you: a smaller ceiling for experiments, or the chance of an experiment pausing production.

Mistake 4: keeping production keys in the Claude Default Workspace

Anthropic does not let you set a spend limit on the Default Workspace. If you never created another workspace, every key you have lives there, and the only thing standing between a bug and your card is the organization-wide limit.

Create one workspace per app or environment, move keys into them, and set each workspace's monthly limit lower than the organization's. Workspace limits cannot be higher than the organization limit anyway, so the organization number becomes your true worst case.

If you use Claude Code against the API, note that its workspace limits are checked separately and can return a 429 that does carry a retry-after header. That is the one case where waiting makes sense.

Mistake 5: trusting the cap to be instant

None of the three providers promises an instant stop. OpenAI says recorded spend can slightly exceed the limit while the limit state propagates. Google is more specific: billing data can lag around 10 minutes, and batch completions and agent sessions can run past a project cap.

Do the math for your own worst loop. Say a broken agent spends $3 a minute. Ten minutes of lag is about $30 past the cap. That is an illustration, not a measurement, but the point holds: the faster your heaviest job can spend, the lower you should set the cap below what you can actually afford.

To get your own per-minute number, price one heavy request in the AI API cost calculator and multiply by how many requests that job can fire per minute. It takes a few seconds and it is the number that tells you how much a 10-minute lag can cost.

A 15-minute setup that beats what most teams have

If you do nothing else this week, do this list. It costs nothing and it closes the holes above.

ProviderDo thisWhere
OpenAISet an organization limit with Enforce a hard limit on. Add a smaller hard limit to each project that runs unattended. Add alerts at 50% and 80%.Organization limits, then each project's limits
AnthropicCreate a workspace per app or environment. Move keys out of Default. Set a monthly spend limit on each workspace and an organization limit on the Billing page.Claude Console: Workspaces, Billing
GoogleSet a monthly spend cap on each project. Turn on auto-reload with a monthly auto-charge limit so a $0 balance does not pause everything.AI Studio: Spend page, Billing page
Your codeTreat spend-limit errors as stop signals, alert a person, and log which project or workspace hit the wall.Retry wrapper

Two Gemini details worth knowing while you are in there. Prepaid credits expire after 12 months and are not refundable, so buy what you will use. And if your Google Cloud billing account was opened after March 2, 2026, the $300 welcome credit does not pay for Gemini API usage, so it will not cushion an overrun.

What a provider cap will never do for you

Provider caps work on organizations, projects and workspaces. They know nothing about your customers. If one free-plan user scripts your chatbot, the cap will happily let them burn the whole month, and then shut everyone else out.

Per-customer and per-feature limits have to live in your app: tag every call, keep a running total, and check it before the next call. The guide to AI API budget limits walks through soft alerts, hard caps and per-customer quotas, and AI API cost tracking covers how to tag usage so you can see who spent what.

Know your cap number in two minutes.

Enter users, requests and the models you run. The planner shows a normal month and a bad month, so you can set the hard limit just above the bad one.

Open the Free Budget Planner

FAQ

Does the OpenAI API spending limit stop requests?

Only if you turn on Enforce a hard limit when you set it. Without that toggle, the monthly spend limit sends alerts and API traffic keeps running. With it on, requests return a 429 with project_spend_limit_exceeded or organization_spend_limit_exceeded. Enforcement is not instantaneous, so recorded spend can land slightly above the limit.

OpenAI spend limits guide

What does enforced_spend_limit_reached mean on the Claude API?

Your Anthropic organization reached its usage tier's monthly spend cap. Requests return HTTP 429 with error type rate_limit_error and error.details.error_code enforced_spend_limit_reached, without a retry-after header. Retrying will keep failing until 00:00 UTC on the first of next month, unless you move to a higher tier.

Claude API rate limits

Can I set a spend limit on the Anthropic default workspace?

No. Anthropic does not allow spend limits on the Default Workspace. If production keys live there, only the organization-wide limit protects them. Create a separate workspace for each app or environment and set a lower limit on each one.

Claude API rate limits

Does the Gemini API spend cap stop charges immediately?

No. Google labels project spend caps experimental and says billing data can lag about 10 minutes, so batch jobs and agent sessions can overshoot the cap. The billing account tier cap pauses service for every linked project once it is reached, until the first of the next month.

Gemini API billing

Why do my Gemini API calls return 402?

On the Prepay plan, a 402 Payment Required means the billing account's prepaid credit balance reached $0. Every API key in every project on that billing account stops at the same time until you add credits. Auto-reload prevents this, and the monthly auto-charge limit caps how much auto-reload can spend.

Gemini API billing

Should my code retry a spend limit error?

No. A spend cap error will not clear in a few seconds, and on Claude it even uses the same error type as a normal rate limit. Check the error code, stop retrying, and alert a person. Retrying burns time, fills logs and, on providers that bill partial work, can add cost before the block takes effect.

Is a provider spending limit enough for per-customer budgets?

No. Provider caps work at the organization, project or workspace level. To stop one customer or one feature from eating the month, you need your own usage ledger and a check before each call. Use the provider cap as the last line, not the only one.

Find your cap number before your provider does.

Price one real request, multiply by traffic, then set the hard limit a little above a bad month instead of guessing.

Work Out My Monthly Cap (Free)