How to set AI API spend limits and alerts
AI usage is billed per token, so one loop in an agent can burn a month's budget over a weekend. Both OpenAI and Anthropic give you built-in controls. This guide shows which ones to set and how to check them each week.
Know the difference between an alert and a limit
An alert tells you; a limit stops the work. You want both. OpenAI's documentation describes the two: spend alerts, which send a notification when usage passes a dollar amount you set, and hard spend limits, which stop affected API traffic when tracked spend reaches the limit. Set the alert below the limit so you have time to react.
Neither is a substitute for the other. An alert depends on a person reading it, and a limit can stop legitimate work at the worst moment, so choose the limit with that in mind: high enough for a busy month, low enough that a mistake cannot cost more than you can absorb.
Set the OpenAI controls
OpenAI's production best practices page says to set spend alerts and spend limits on the limits page of your account settings. It also describes a usage dashboard that shows token usage for the current and past billing cycles, with a notification threshold that sends an email, and per-key usage on the Usage page once tracking is enabled. It adds that keys created before December 20, 2023 may not have tracking enabled, so their usage can show as untracked. Use a separate key for each project so spend can be traced to a project.
- Open the limits page in your account settings.
- Set a spend alert at about 50 percent of your monthly budget and another at 80 percent.
- Decide whether to enable a hard spend limit, and at what amount.
- Turn on usage tracking for every key and give each project its own key.
Set the Anthropic controls
Anthropic's documentation describes two kinds of limits: spend limits, a maximum monthly cost for the organization, and rate limits. Each usage tier has a monthly spend cap, and you can set your own lower limit under Spend limits in the Claude Console.
You can also set limits for individual workspaces, which protects other projects from one project's overuse. Know what happens at the edge: when you reach a limit you set, requests return an error until the limit is raised or the month rolls over. Build your application so that failure is handled, not hidden. The Usage page in the Console shows token and request charts.
- Open Spend limits in the Claude Console and set your own monthly limit below your tier's cap.
- Create a workspace for each project or team and set a limit on each.
- Open the Usage page and check which workspace is growing fastest.
- Make sure your code handles the error returned when a limit is reached.
Run a weekly check
A five-minute review each week catches most problems.
Record the numbers in a small spreadsheet: date, provider, spend to date and a one-line note. After a few weeks you will see your normal pace, and anything three times higher will stand out without a tool.
Do a longer review at the end of each month. Compare spend with the budget, list the three largest cost drivers and decide whether any of them should move to a cheaper model or a smaller prompt. Write down one change to try next month.
- Open each provider's usage page and note spend to date for the month.
- Compare it with your budget and with last week's pace.
- Look for a project or key that grew faster than the rest.
- Check that alerts and limits are still set; people change them during testing and forget.
- Remove keys nobody uses.
Decide who gets the alert
An email to a mailbox nobody reads is not an alert. Send it to a shared channel or a named person, and write down who acts and what they do first: stop the job, rotate the key, or raise the limit. Practice the steps once.
Treat usage keys like passwords. Keep them in a secrets manager, never in code or chat messages, and rotate them when someone leaves the team. Prefer a read-only key for anything that only looks at usage.
- First, stop or pause the job that is spending.
- Second, check which key or workspace is responsible.
- Third, rotate the key if you suspect it leaked.
- Fourth, raise a limit only after you know the cause.
Where AI spend tracking fits
AI spend tracking is coming soon. It is planned to combine usage from your AI providers into one view, send alerts to Slack, Teams or email, and offer an optional hard cap in gateway mode. We have not set a date; join the list and we email you at launch.
Sources
Coming soon: AI spend tracking
Watch your team's AI spend and get warned before a surprise bill. A service that tracks how much a small team spends on AI services such as OpenAI and Anthropic, and alerts them before a surprise bill arrives. It is for teams of 3 to 30 who use AI in their products or tools and have no finance person watching it.
Get AI spend tracking first
Join the list and get 25% off your first purchase when it goes on sale. We email you a discount code on launch day. One code per person, for new customers.
One email when it launches (plus the discount code). No other mail, and you can say stop at any time. See our privacy policy.