Claude Code on Bedrock or Vertex AI: how to cap spend
When Claude Code runs on Amazon Bedrock or Google Cloud, Anthropic's spend limits don't apply: every token is billed to your cloud account. Here's what each cloud can actually stop, how late it acts, and how to get a per-developer cap.
Last reviewed 11 Nov 2026
The short version
- No Anthropic limit here: on Bedrock and Google Cloud, Claude Code is billed per token to your cloud account and the controls are your cloud's budgets (Anthropic's cost docs).
- AWS: Bedrock has no dollar cap. An AWS Budgets budget action can apply an IAM deny policy at a threshold, but budget data updates only up to three times a day.
- Google Cloud: a normal budget only alerts. A spend cap budget on the project and the Agent Platform (Vertex AI) service pauses new usage at 100%, monthly only and not immediately.
- Per developer, checked on every request: a self-hosted Claude apps gateway with spend limits returns
429once a developer passes their cap. - Cheapest saving: pin your models. Unpinned, the
opusalias on both clouds resolves to Opus 5.5 and you pay the Opus rate.
Which control stops what
| Control | Stops requests? | How late |
|---|---|---|
| AWS Budgets alert | No, it notifies | Budget data updates up to 3× a day, typically 8–12 hours apart |
| AWS Budgets action (IAM deny or SCP) | Yes, once it fires (automatically or after you approve) | Same budget data lag; Bedrock keeps serving until then |
| Google Cloud alerts-only budget | No | Billing data is delayed; Google suggests setting the budget below your real limit |
| Google Cloud spend cap budget | Yes, pauses new usage of one service in one project | Faster (estimated costs) but not immediate; overage is billed |
| Claude apps gateway spend limit | Yes, 429 on the developer's next request | Checked per request; spend is a list-price estimate |
--max-budget-usd | Stops one print-mode run | Client-side estimate; see Claude Code spend limit |
1. Amazon Bedrock
Give Claude Code its own account or inference profile
Anthropic's Bedrock setup page recommends a dedicated AWS account for Claude Code to simplify cost tracking and access control. If that's too much, AWS lets you attach tags to an application inference profile to track costs per team or project. Point Claude Code at it with ANTHROPIC_MODEL set to the profile ARN, or map model versions to profile ARNs with the modelOverrides setting, so a developer switching models in /model doesn't bypass the tagged profile. Activate the tag as a cost allocation tag before you build a budget on it.
Add a budget, then a budget action
- In AWS Budgets, create a monthly cost budget filtered to Amazon Bedrock (or to your tag) with alerts at, say, 50%, 80% and 100% of actual spend, plus a forecasted alert.
- On the threshold you treat as the ceiling, add a budget action that applies an IAM policy to the role or user Claude Code runs as. Actions can run automatically or wait for your approval; from the management account you can apply an SCP to another account instead.
{
"Version": "2012-10-17",
"Statement": [{
"Sid": "StopClaudeCodeOverBudget",
"Effect": "Deny",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream",
"bedrock-mantle:CreateInference"
],
"Resource": "*"
}]
}Before you rely on it, know its limits (from the AWS docs, read 11 Nov 2026):
- It's late. AWS says budget information is updated up to three times a day, typically 8–12 hours after the previous update, and you can go past a threshold before AWS notifies you. A runaway agent loop can spend most of a day before the action runs, so set the threshold below your real limit.
- Mantle is separate. If developers use the Mantle endpoint (
CLAUDE_CODE_USE_MANTLE=1), it has its ownbedrock-mantle:IAM actions, so a deny onbedrock:actions alone doesn't block it. That's why the example denies both. - Bedrock API keys. A long-term Bedrock API key (
AWS_BEARER_TOKEN_BEDROCK) creates an IAM user behind the scenes; your deny has to reach that user too. Short-term keys inherit the permissions of the principal that made them (how Bedrock API keys work). - Quotas aren't budgets. Bedrock quotas limit tokens per minute, not dollars. A low quota slows a loop down; it doesn't cap the month.
- Undo it yourself. The deny stays until you remove it, so plan who does that and when.
2. Google Cloud (Agent Platform, formerly Vertex AI)
Use a project just for Claude Code
Anthropic's Google Cloud setup page recommends a dedicated GCP project for Claude Code. It matters more here than on AWS: a spend cap pauses the whole service in the project, so anything else on Agent Platform in that project (your Gemini app, for example) stops too. Claude Code bills the project in ANTHROPIC_VERTEX_PROJECT_ID, even if GOOGLE_CLOUD_PROJECT or your credential file names another one, so check that variable on every machine.
Create a spend cap budget
- Billing → Budgets & alerts → Create budget → choose Spend cap enforcement (not Alerts only).
- Scope: the Claude Code project and the service Gemini Enterprise Agent Platform (formerly Vertex AI),
aiplatform.googleapis.com. - Amount: a bit under your real ceiling. Alerts go to billing admins and project owners at 50%, 80% and 100% and can't be changed.
What Google's spend cap docs say happens (read 11 Nov 2026):
- Above 100% of gross, estimated cost (list price, before savings and credits), new usage of the service in that project is paused for the rest of the month. In-flight requests finish and are billed.
- Enforcement is faster than billing reports but not immediate, and any overage is billed as normal.
- Monthly only, one project and one service per cap. You can't turn an existing alerts-only budget into a spend cap; create a new one.
- After you lift a cap by hand, it won't trigger again that month unless you raise the amount, and services can take up to an hour to come back. Caps reset on the 1st.
- You need
billing.budgets.configureSpendCap(or the project-level equivalent) to set one.
We couldn't find in Google's or Anthropic's docs the exact message Claude Code shows when a spend cap pauses the service. Don't confuse it with 429 RESOURCE_EXHAUSTED, which is a per-minute quota, not your budget. A plain alerts-only budget is still worth having for the rest of the billing account: Google says it “doesn't automatically cap” usage.
3. Per-developer caps: a Claude apps gateway
Cloud budgets see the account or project, not the developer. Anthropic's self-hosted Claude apps gateway sits between Claude Code and Bedrock, Google Cloud or Foundry and enforces spend limits on every request:
- Caps per user, per IdP group or organization-wide, by day, week or month. A group or organization cap is a default each member inherits, not a shared pool.
- Over a cap, the developer gets
429withbilling_errorandx-should-retry: falseuntil the cap resets (00:00 UTC daily, Monday weekly, the 1st monthly) or an admin raises it. - Claude Code warns the developer past 75% and 95% of their cap and shows it in
/usage. - Spend is a USD estimate from token counts at list price (or your pricing overrides), “a circuit breaker rather than an invoice”. Reconcile with your cloud bill.
- If its Postgres store is unreachable, enforcement fails open by default; set
enforcement.fail_closed_on_error: trueif no unmetered spend matters more than uptime.
4. See the spend before the bill
- OpenTelemetry: Anthropic calls OTel export the only option that streams per-user token and cost metrics into your own observability stack as they come in, on any provider.
/usage: a local estimate at list price. If you pay contracted cloud rates, themodelPricingmanaged setting makes the figure match your rates; it's still an estimate.- Usual causes of a surprise: unpinned models running on Opus, long sessions never cleared, and the 1-hour prompt cache TTL (
ENABLE_PROMPT_CACHING_1H), which is billed at a higher rate.
Checklist
- Run
/statuson each machine: the provider line should say Amazon Bedrock or Google Vertex AI, with the account, project and region you expect. - Isolate Claude Code: its own AWS account or tagged inference profile, its own GCP project.
- Pin
ANTHROPIC_DEFAULT_OPUS_MODEL/SONNET/HAIKUor setANTHROPIC_MODELso nobody is on Opus by accident. - AWS: cost budget plus a budget action with an IAM deny that covers
bedrock:andbedrock-mantle:actions. Google Cloud: a spend cap budget on the Claude Code project. - Set every threshold below your real limit, because none of these act at once.
- Need per-developer caps? Run a Claude apps gateway with spend limits.
Also using OpenAI, Anthropic's own API or OpenRouter keys directly? The free AI key limit audit checks whether those limits would stop a runaway loop or a leaked key (no sign-up, no key needed). Related: Claude Code spend limit (all billing paths), runaway AI agent cost.
Where KeyBark fits (and where it doesn't)
Honestly: not here. KeyBark reads cost from OpenAI and Anthropic organizations (with an Admin key) and from OpenRouter keys. It does not read AWS or Google Cloud billing, so it can't see or alert on Claude Code usage on Bedrock or Vertex AI, and it doesn't set or enforce limits anywhere. If part of your team uses the Anthropic API or OpenAI directly, KeyBark can email you when that organization's daily or monthly spend crosses a threshold you set, as a second line of warning next to the cloud controls above.
FAQ
Do Anthropic Console spend limits apply to Claude Code on Bedrock or Vertex AI?
No. Anthropic's Claude Code cost docs say that on Amazon Bedrock, Google Cloud's Agent Platform (formerly Vertex AI) and Microsoft Foundry, Claude Code is billed per token to your cloud account and spend controls live in your cloud provider's billing console. The Console workspace limits, the Claude Code analytics dashboards and the Claude Code Analytics API don't cover that usage.
Can I set a hard spend limit for Claude Code on Amazon Bedrock?
Bedrock has no built-in dollar cap. The closest native option is an AWS Budgets cost budget with a budget action that applies an IAM policy (or an SCP) denying Bedrock invoke actions when a threshold is reached. AWS Budgets data is updated up to three times a day, typically 8 to 12 hours apart, so the action fires after the spend has happened. For a per-developer cap checked on every request, use a Claude apps gateway with spend limits.
Does a Google Cloud budget stop Claude Code on Vertex AI?
An alerts-only budget doesn't: Google says it doesn't cap usage. A spend cap budget does pause new usage of one service in one project once gross estimated costs pass 100% of the amount. Set it on the project Claude Code bills to, for the Agent Platform (formerly Vertex AI) service aiplatform.googleapis.com. It is monthly only, not immediate, in-flight requests finish, and overage is billed as normal.
Is --max-budget-usd enough to cap Claude Code on a cloud provider?
No. --max-budget-usd only applies to print-mode runs (claude -p) and checks a cost estimate on the developer's machine, so spend can pass it and interactive sessions aren't covered. Treat it as a guard for one scripted run and keep a cloud-side budget or a gateway cap as the real ceiling.
Sources (read 11 Nov 2026): Claude Code Manage costs, Claude Code on Amazon Bedrock, Claude Code on Google Cloud's Agent Platform, Claude apps gateway spend limits; AWS Managing your costs with AWS Budgets, Configuring budget actions, inference profiles, Bedrock API keys, Bedrock quotas; Google Cloud spend cap budgets and budgets and alerts. KeyBark is not affiliated with Anthropic, AWS or Google.
KeyBark watches your OpenAI, Anthropic and OpenRouter spend from the server and flags a crossed threshold or spike by email and on your dashboard. Free for one key.