Claude Code spending limit: how to cap what it costs, on an API key, a plan or a team
Dmitriy Solodukha · Updated · 5 min read
Checked against Caprock v0.199.0
Set a Claude Code spending limit: --max-budget-usd for one run, Console workspace limits, usage-credit limits on Pro and Max, team caps, and a daily cap.
It depends on how you pay. On an API key, set a monthly spend limit on the workspace in the Claude Console; for one headless run, claude -p --max-budget-usd 5 "…" stops at an estimated $5. On Pro and Max the plan's 5-hour and weekly limits are the cap, and if you turned on usage credits, their monthly limit is set in Settings → Usage. Team and Enterprise owners set limits for the organization, a seat tier or a member.
Caprock prices every Claude Code turn as it is written, per day and per repository, and can pause the sessions it started when a day's spend reaches the cap you set. Free and open source, the cap included.
Which limit applies to you
| How you pay | The cap | Where you set it |
|---|---|---|
| One headless run | --max-budget-usd, estimated dollars | the command line |
| API key | a monthly limit per workspace | Console → Settings → Spend limits |
| API, the Claude Code workspace | a monthly limit per user | Console → Settings → Spend limits |
| Pro or Max | the 5-hour and weekly limits; usage credits' monthly limit | claude.ai Settings → Usage |
| Team, seat-based Enterprise | a monthly usage-credit limit for the org, a seat tier or a member | Organization settings → Usage |
| Bedrock, Vertex or Foundry through the Claude apps gateway | daily, weekly or monthly per developer | the gateway's admin API |
| Bedrock, Vertex or Foundry directly | your cloud's budgets | your cloud console |
Cap one run: --max-budget-usd
--max-budget-usd stops a claude -p run once its estimated API spend reaches the amount:
- 1
claude -p --max-budget-usd 5.00 "fix the failing test in src/api"
- Print mode only. An interactive session has no such flag.
- An estimate, not the bill. The cap is checked against Claude Code's own estimate, and Anthropic's docs say spend can pass it: leave headroom.
- Subagents count. At the cap, starting a subagent fails with
Budget limit reachedand running background subagents stop. - A resumed run starts at zero. With
--continueor--resume, earlier runs' totals do not count.
--max-turns caps the number of turns the same way, also in print mode only.
On an API key: workspace spend limits
In the Claude Console, each workspace can have a monthly spend limit (Settings → Spend limits → Workspace limits), and an email alert at an amount you choose if Anthropic bills you directly. The organization's own limits always apply on top.
- The Claude Code workspace. Claude Code creates one when people sign in with the Console, and it is the only workspace with per-user monthly limits: each developer gets a key there.
- The Default Workspace can have a limit too, but Anthropic's page says it might not count or stop some usage, including Claude Code signed in on the Default Workspace. Put Claude Code in its own workspace.
On Pro and Max: plan limits and usage credits
A paid plan has no dollar cap to set, because the plan's 5-hour and weekly limits are the cap: at either one Claude Code stops until it resets (a reply in progress may finish). Switching /model does not reset them.
Usage credits let you keep working past the limit and bill it:
- Turn them on in Settings → Usage;
/usage-creditsopens the page from Claude Code. - Set the cap with Adjust limit, a monthly spend limit, or Set to unlimited. Once you reach it, usage credits stop until the next billing period or until you adjust the limit.
- Turn them off at any time, and the plan's limits are the cap again.
How the windows work and when they reset: Claude Code usage limits.
Team and Enterprise
The seat's allowance is the default ceiling. Owners and Primary Owners set monthly usage-credit limits in Organization settings → Usage: for the whole organization, per seat tier (Standard or Premium, on seat-based Enterprise) or per member where available. A member's limit replaces a group's; the organization's still applies. The limit is checked before each request, so a member can go slightly over. Usage-based Enterprise plans do not use usage credits, so these limits do not apply there. The team view of the same question, with allocation and reporting: FinOps for coding agents.
Through a gateway on Bedrock, Vertex or Foundry
The Claude apps gateway, which you host, caps each developer per day, week or month, for a user, an identity-provider group or the organization (a per-seat default, not a shared pool). Over the cap, requests get 429 billing_error until it resets at the UTC boundary or an admin raises it. Claude Code warns at 75% and 95% and shows a Spend limit bar in /usage.
See what you have spent: /usage
/usage (/cost and /stats are aliases) shows the session's estimated cost at list price, its durations and usage by model; on a plan, the usage bars and a usage-credits row. It is one session on one machine: for a day, a week or a repository you need a tool that reads every session — the options are compared in Claude Code usage monitors.
What none of them cap: a day on your machine
Each limit above has a scope that leaves a gap. The Console's is monthly, the plan's is counted in usage, not dollars, and --max-budget-usd covers one run. Only the gateway caps a day, and only if you run one in your cloud. A laptop running several sessions all afternoon has no daily ceiling of its own.
What Caprock adds: a daily cap on the machine
Caprock, a free, open-source desktop app for macOS, Windows and Linux, prices every Claude Code, Codex and OpenCode turn at list price as it is written, per day and per repository. Its daily spend cap is a free setting:
- Checked after every priced turn, not on a timer.
- Pauses, never kills. At the cap it pauses the sessions Caprock started; resuming them continues where they were. Sessions you started in your own terminal are never touched.
- Once a day, and it fails open: if spend cannot be read, nothing is paused.
- A suggested figure: twice your median day, offered as a click, never filled in for you.
Caprock can also pause the Claude Code sessions it started at a share of the 5-hour or weekly window you choose (50% to 99%) and resume them after the reset, and alerts you at 90%. Every figure is an estimate at list price, not your bill. How the cap behaved on a month of one developer's sessions: Cap the loop, not the work.
Which to use
--max-budget-usd— scripts and CI runs ofclaude -p.- Workspace limits — anyone on an API key; per-user limits for a team on the API.
- Usage-credit limits — Pro, Max, Team and Enterprise once credits are on.
- Caprock's daily cap — several sessions a day on your own machine, and a ceiling you want per day rather than per month.
Questions people ask
- Can I set a spending limit in Claude Code?
- Not in its settings file. For one headless run, claude -p --max-budget-usd caps the estimated spend. On an API key the limit is a monthly workspace spend limit in the Claude Console; on a paid plan it is the plan's own limits, plus a monthly limit on usage credits if you turned them on.
- Does --max-budget-usd work in interactive Claude Code?
- No. It works in print mode (claude -p) only, checks a client-side estimate, and spend can pass it, so leave headroom.
- What happens when I hit my Claude Pro or Max limit?
- Claude Code stops at the plan's 5-hour or weekly limit until it resets, unless you turned on usage credits, which bill past the limit up to the monthly spend limit you set.
- How do I limit Claude Code spend for my team?
- On Team and seat-based Enterprise, owners set monthly usage-credit limits for the organization, a seat tier or a member in Organization settings, Usage. On an API organization, use the Claude Code workspace's per-user monthly limits in the Console.
- How do I see what Claude Code has cost so far?
- Run /usage (/cost is an alias): the session's estimated cost at list price, its durations and usage by model, and on a plan the usage bars.
Sources
- Claude Code docs — CLI reference: --max-budget-usd, --max-turns, read 27 November 2026
- Claude Code docs — Manage costs effectively: workspace limits, usage credits, /usage, read 27 November 2026
- Claude Platform docs — Workspaces: workspace spend limits, the Claude Code workspace, read 27 November 2026
- Claude Code docs — Claude apps gateway spend limits, read 27 November 2026
- Claude Help Center — Manage usage credits for paid Claude plans, read 27 November 2026
- Claude Help Center — Using Claude Code with your Pro or Max plan, read 27 November 2026
- Claude Help Center — Manage usage credits for Team and seat-based Enterprise plans, read 27 November 2026
- Claude Code docs — Commands: /usage, /cost, /usage-credits, read 27 November 2026
- Caprock CHANGELOG — 0.39.0 daily spend cap, 0.52.3 sessions Caprock started only
- Caprock contracts — the daily cap's rules (.ai/03-contracts.md)
Try it
The record of every coding agent you run, the sessions it did not start included. Free, open source; nothing leaves your machine.
Caprock is a desktop app: it installs on your computer, not your phone.
Or email yourself the link:
macOS, Windows and Linux. Your phone pairs with it by QR code. Install options →
Notarized by Apple. One file for Apple silicon and Intel, macOS 13 or later.
Windows 10 22H2 or later, x64. Windows may ask once whether to run it: click More info, then Run anyway.
Paste it into Claude Code, Codex or any coding agent.
See what it says ▾
Install the Caprock desktop app for me. It is open source (Apache-2.0), a local app for my coding agents: https://github.com/dspv/caprock What the install does and how to remove it: https://github.com/dspv/caprock/blob/master/docs/install-agent.md Run the install script for my system: https://caprock.dev/mac.sh, /win.ps1 or /linux.sh. Read it before you run it if you like. Leave my Claude Code settings alone; the app asks me itself. Tell me when it's open.
Or run it yourself:
Paste in Terminal: it installs Caprock and opens it.Or with Homebrew: brew install --cask dspv/tap/caprock-app
Or run it yourself:
Paste in PowerShell: it installs Caprock for you and opens it.
Or run it yourself:
Paste in a terminal: it installs Caprock for you, no sudo. Or download the AppImage