StackSpend

How to Set Spending Limits and Budget Alerts for AI APIs (OpenAI, Claude, Gemini, Bedrock)

GuidesDecember 2, 2026Updated December 2, 2026By 9 min read

The short answer

OpenAI and Anthropic let you set a monthly spend limit that actually stops API requests, at organization level and per project or workspace. AWS, Google Cloud and Azure budgets mainly send alerts; stopping spend there needs an extra automated action. For a small team, set a hard limit on every AI provider that supports one, add alerts at 50% and 80% of it, and keep one combined daily view so a spike shows up before any cap is hit.

Short answer: OpenAI and Anthropic both let you set a monthly spend limit that stops API requests when it is reached, for the whole organization and for individual projects or workspaces. AWS, Google Cloud and Azure budgets are mainly alerts: they tell you about spend, but stopping it needs an extra automated action that you build. A sensible setup for a small team is a hard limit on every AI provider that supports one, alerts well before that limit, and one combined daily view across providers.

This guide is for founders, founding engineers and small platform teams who are about to put an AI feature or agent into production, or who were surprised by last month's bill. It covers what each provider's controls actually do, the order to set them up in, and where a provider's own controls stop being enough. It is written by StackSpend, which sells cross-provider cost monitoring; provider controls are free and should come first either way.

Provider settings change often. Everything below was checked against the linked provider documentation on 2 December 2026. Confirm the details in each console before relying on them.

Spending limits vs budget alerts: the difference that matters

Two kinds of control get called "budgets", and they behave very differently:

  • A hard spending limit stops or rejects requests once tracked spend reaches the amount you set. It protects the bill but can take a production feature offline.
  • A budget alert sends a notification at a threshold. Traffic continues. It protects nothing unless someone reads it and acts.

Both have a delay. Providers say plainly that enforcement is not instantaneous, so recorded spend can end slightly above a hard limit. Plan for some overshoot and set limits below what you can actually afford.

Provider by provider: what you can control

Provider Hard limit that stops requests? Alerts Scope
OpenAI API Yes, if "Enforce a hard limit" is on Yes, email Organization and project
Anthropic (Claude API) Yes Yes, email Organization and workspace
Google Cloud (Gemini on Vertex AI) Only via a spend cap budget where the service supports it, or your own automation Yes, email and Pub/Sub Billing account and project
AWS (Amazon Bedrock) No native cap; budget actions can restrict IAM permissions Yes, email and SNS Account, service, tags
Azure (Azure OpenAI / Foundry) No; budgets do not stop resources Yes, email and action groups Subscription, resource group
Cursor (team plans) Yes, a monthly limit on usage beyond what is included Yes Team, with per-member options depending on plan

OpenAI

OpenAI has monthly spend limits at organization and project level. In Project settings → Limits → Spend, set a monthly spend limit and turn on Enforce a hard limit if you want requests to fail once tracked spend reaches it. Without that switch, the limit only monitors.

What to know:

  • When a project hits its hard limit, affected requests return a 429 error with the code project_spend_limit_exceeded. The organization-level equivalent is organization_spend_limit_exceeded.
  • Creating a project spend limit also creates an alert at 100% of the limit; add earlier thresholds yourself, according to OpenAI's project guide.
  • OpenAI also assigns your organization a monthly usage limit based on its usage tier. That is separate from the limits you configure.
  • Alerts can be created programmatically through the project spend alerts API, which is useful if you create one project per feature or customer.

Practical setup: one project per product feature or agent, a hard limit on each, and alerts at roughly 50% and 80%. Your application should treat project_spend_limit_exceeded as a graceful-degradation case, not a generic retry, because retrying will not succeed until the limit is raised or the month resets.

Anthropic (Claude API)

Anthropic applies a monthly spend cap per usage tier. According to Anthropic's rate limits documentation, the caps are $500 (Start), $1,000 (Build) and $200,000 (Scale); Custom tier limits are agreed with Anthropic. You can set your own lower limit under Spend limits in the Claude Console.

What to know:

  • Reaching the tier cap returns HTTP 429. Reaching a limit you set returns HTTP 400 with an invalid_request_error, and the message says when access resumes. Handle both explicitly.
  • Workspaces can have their own monthly spend limit and email notifications. A workspace limit can only be lower than the organization limit, and organization limits always apply.
  • The default workspace has caveats: some usage, such as Console playground usage, may not be counted or stopped by a default-workspace limit. Put production traffic in named workspaces.
  • The Claude Code workspace is the only workspace that supports per-user monthly spend limits.

Practical setup: a workspace per environment or product area, a spend limit on each production workspace, and email notifications at an amount that gives you a few days of warning at current run-rate.

Google Cloud (Gemini on Vertex AI)

Gemini usage billed through a Google Cloud project is governed by Cloud Billing budgets. Google is explicit that an alerts-only budget does not cap usage or spending. Where the service supports it, you can configure a spend cap budget on a project; otherwise, alerts are all you get by default.

To act on a budget automatically, connect it to Pub/Sub using programmatic notifications. Google publishes a tutorial for disabling billing on a project when costs reach the budget, with a strong warning: it shuts down all services in the project and resources might be irretrievably deleted. Budget data is also estimated and delayed, so it does not guarantee you stay under budget.

Practical setup: keep AI workloads in their own project, put an alerts-only budget with thresholds on it, and only automate disabling billing for sandbox or experiment projects where losing resources is acceptable. If you are still matching Gemini usage to the bill, see Gemini and Vertex token usage from GCP billing.

AWS (Amazon Bedrock)

AWS Budgets alerts on actual or forecast cost. Budget actions can apply IAM or Service Control Policy restrictions, or act on certain resources, when a threshold is exceeded. That is the nearest AWS gets to a cap for Bedrock: for example, attaching a policy that denies Bedrock invoke permissions to the application role.

Pricing, from AWS's pricing page: budget monitoring and notifications are free; the first two action-enabled budgets are free each month, then each additional action-enabled budget costs $0.10 per day; emailed Budgets Reports cost $0.01 per report delivered.

Practical setup: a cost budget filtered to Amazon Bedrock with alerts at 50%, 80% and forecast 100%, plus one action-enabled budget that restricts the Bedrock role at a level you would never want to pass. Test the action in a non-production account first.

Azure (Azure OpenAI / Foundry)

Azure Cost Management budgets send alerts when thresholds are reached; they do not stop resources or consumption. To respond automatically, attach an Azure Monitor action group that triggers your own automation, such as a Logic App or webhook.

Practical setup: scope a budget to the resource group that holds your AI resources, alert at several thresholds, and decide in advance who acts on the alert and what they turn off.

Cursor and other AI coding tools

Coding tools are a growing share of AI spend for small engineering teams. On Cursor team plans, admins can set a monthly limit on usage beyond what seats include, and Cursor's team pricing docs describe when additional usage pauses. Per-member limit options depend on your plan, so check the dashboard for what your team has. For budgeting per developer, see how much to budget for AI coding tools per engineer.

A setup checklist for small teams

You can do this in an afternoon:

  1. List every bill that can grow with usage. Typically one cloud, one or two model APIs, a coding tool and sometimes a data platform.
  2. Separate production from experiments. Projects in OpenAI, workspaces in Anthropic, projects in Google Cloud, accounts or tags in AWS, resource groups in Azure. Limits are only as precise as this split.
  3. Set hard limits where they exist (OpenAI, Anthropic, Cursor), below the amount you could tolerate losing in a bad week.
  4. Add alerts at 50% and 80% of each limit or budget, sent to a shared channel or address rather than one person's inbox.
  5. Handle limit errors in code. Know which status code and error each provider returns, and fail gracefully instead of retrying.
  6. Decide who acts. Name an owner for each provider and write down what they will do when an alert fires.
  7. Review weekly. Compare month-to-date spend with each limit. Raise limits on purpose rather than in the middle of an incident.

Where provider controls stop being enough

Provider limits are worth setting, but they have gaps that show up quickly once you use more than one provider:

  • They are monthly and per provider. A limit tells you when a month's allowance is gone, not that Tuesday's spend was five times Monday's.
  • Alerts arrive in different places. OpenAI and Anthropic email admins, AWS uses email or SNS, Google Cloud uses email or Pub/Sub, and Azure uses action groups. Nobody sees the total.
  • A hard limit is a blunt instrument. Hitting one means a feature goes down. You want to know about a runaway agent or a leaked key well before that.
  • Thresholds go stale. A budget set in January rarely matches the run-rate in June.

That is the gap a cross-provider monitoring layer fills. StackSpend connects to 17 native cost sources plus custom imports, including OpenAI, Anthropic, AWS, Google Cloud, Azure and Cursor. It gives you one place to track cloud and AI spend, real-time anomaly detection that compares reported costs with each provider's historical baseline and flags unusual movement, budgets compared with actuals in forecasts and budgets, and daily reports and alerts in Slack or email. Keep your provider hard limits as the backstop; use a combined view for the early warning.

If you are a small team, the AI cost tracking for small teams page explains the setup in more detail. Plans start at $79/month with a 14-day trial; see pricing.

FAQ

Can I set a hard spending limit on the OpenAI API?

Yes. Set a monthly spend limit at organization or project level and turn on "Enforce a hard limit". Requests then return a 429 error with organization_spend_limit_exceeded or project_spend_limit_exceeded once tracked spend reaches the limit. Enforcement is not instantaneous, so spend can end slightly above it.

How do I set a spend limit for the Claude API?

In the Claude Console, open Spend limits and set a monthly limit for the organization, or select a workspace under Workspace limits and set one there. Your limit cannot exceed your usage tier's cap. When a limit you set is reached, requests return HTTP 400 until the limit is raised or the month resets.

Do AWS, Google Cloud or Azure budgets stop spending?

Not by default. Their budgets alert on actual or forecast cost. AWS budget actions can restrict IAM or Service Control Policy permissions, Google Cloud budgets can trigger your own automation through Pub/Sub (and some services support spend cap budgets), and Azure budgets can trigger action groups. You build and test the response yourself.

What thresholds should a small team use for AI budget alerts?

A common pattern is alerts at 50% and 80% of the monthly limit, plus a forecast alert at 100% where the provider supports forecasts. Set the hard limit itself below the amount you could tolerate losing in a bad week, and review it monthly as usage grows.

How do I control spending by AI agents?

Give each agent or feature its own OpenAI project or Anthropic workspace with its own hard limit, limit which models it can use where the provider allows it, cap output length and retries in code, and watch daily spend for sudden changes. The per-project or per-workspace limit stops a runaway loop from consuming the whole organization's budget.

Know where your cloud and AI spend stands — every day.

Connect providers in minutes. Get 90 days of visibility and start receiving daily cost updates before the invoice lands.

14-day free trial. No credit card required. Plans from $79/month.
How to Set AI API Spending Limits and Alerts — StackSpend