Agent Upstart

Cool things people are building with agents — and practical help getting the most out of them.

Playbooks · Coding tasks

Stop an agent running up a bill

Written October 28, 2026 · Edited November 8, 2026

For a solo builder × API spending caps × the OpenAI and Anthropic consoles, ending with a hard limit that stops traffic, an alert that warns before it, and one container per experiment so a runaway job can only spend its own budget.

Before you start

You need an API account on at least one vendor, and the permission to change its settings: on OpenAI, an organization or project owner; on Anthropic, access to the Console billing settings. The distinction that decides whether any of this works is the difference between an alert and a limit. On OpenAI, a spend alert sends a notification and traffic continues; a hard spend limit makes requests fail with a 429 error once tracked spend reaches the amount. The two controls live in the same place and look alike, and the alert on its own stops nothing. On Anthropic, the same split exists in different clothes: your usage tier carries a monthly spend cap you did not choose, and below it you can set your own limit, which stops traffic with a different error.

Know your tier cap before you set your own number. Anthropic's rate limits page lists the monthly spend cap for each tier: $500 on Start, $1,000 on Build, $200,000 on Scale, and none on Custom. Your own limit cannot exceed your tier's cap. OpenAI separately assigns an approved monthly usage limit based on usage tier; that limit is separate from the spend limits you configure, and it has its own error code when reached. A runaway job meets whichever ceiling is lowest first, so set your own number below all of them.

One honest caveat: enforcement is not instant on either vendor. OpenAI's guide states that recorded spend can slightly exceed the configured amount while the limit state propagates. Anthropic's tier cap pauses usage until 00:00 UTC on the first day of the next month. A hard limit is a ceiling with a small lag, not a wall: the certain stop is a prepaid balance at $0 with auto-reload off, and this playbook uses both.

What "done" looks like

At the end of one sitting you have a hard limit set at the organization level and on the project or workspace doing the work, an alert set below the limit, auto-reload off or capped on any prepaid balance, and each experiment in its own project or workspace with its own key. You have also seen the usage page move after a small job, so you know where to look when a job goes quiet.

Steps

  1. Find your tier cap and your current spend. On Anthropic, open the Rate limits page in the Console to see your tier and its cap, and the Billing page to see spend so far this month. On OpenAI, open Organization limits and the usage page. Write both numbers down: the cap you did not choose, and the spend already incurred. A limit set without knowing current spend is a guess, and a guess set above spend already incurred does nothing until next month.
  2. Set the hard limit on OpenAI, with the switch on. On the Organization limits page, in Spend, select Edit spend limit, enter a monthly spend limit, and turn on Enforce a hard limit before saving. Without that switch, the number is only an alert. Do the same on the project that will run the job: a project hard limit applies only to traffic billed to that project, and reaching it returns a 429 with the project_spend_limit_exceeded code, while the organization limit returns organization_spend_limit_exceeded. Set the project limit lower than the organization limit, so one project cannot spend the whole organization's budget.
  3. Set your own limit on Anthropic, below the tier cap. In the Console, go to the Billing page, open the Spend limits section, and set a limit below your tier's cap. When usage reaches a limit you set, requests return HTTP 400 with the message starting "You have reached your specified API usage limits." That 400 is easy to mistake for an ordinary error, so note it now: a 429 with no retry-after header and the code enforced_spend_limit_reached means the tier cap; a 400 with that message means your own limit. The fix for the first is a tier increase or waiting for the 1st; the fix for the second is raising or removing the limit you set.
  4. Give each experiment its own container and key. On OpenAI, a project; on Anthropic, a workspace you created — spend limits cannot be set on the Default workspace, so a key living there answers only to the organization-wide limit. Set a spend limit on each workspace, sized at two to three times that experiment's normal month. One key per container: if a key leaks or a job runs away, you revoke one key and the other work keeps running, and the usage page shows exactly which container spent the money.
  5. Set an alert below the limit, and turn auto-reload off. Add a spend alert at about half your normal month, so unusual use reaches you while there is still time to act. On a prepaid OpenAI balance, turn auto-reload off, or set a low monthly reload cap: with auto-reload on and uncapped, a runaway job refills the balance as fast as it spends it, and the hard limit's small enforcement lag is the only thing standing between the job and the card. With auto-reload off, the worst case is roughly the credit bought plus the lag.
  6. Run a small job and watch the usage page move. Send one real request from the new key, then open the usage page and confirm the spend appears under the right project or workspace. This is the step that catches the two silent failures: a key living in the Default container, and a limit set on the wrong project. If the spend appears under the wrong container, move the key before running anything larger.
  7. Write down what each failure looks like, where you will see it. Keep a short note with the job: the 429 codes for the limits you set, the 400 message for a self-set Anthropic limit, and the usage page address. When a job goes quiet mid-month, the note tells you in one look whether a limit fired or the code broke. A limit that fires without anyone recognizing it gets raised in a panic and reopens the tap for whatever caused the spike — including a leaked key, which is revoked first, before any limit is raised.

Check the agent's work

What can go wrong

Limits

Related playbooks

Sources

Sources: OpenAI spend limits guide, Anthropic rate limits, Managing projects in the API platform — OpenAI help article, Claude Platform on AWS — Anthropic docs.

Back to: Coding playbooks hub · Also: Pick the cheapest model for the job · Token cost calculator