To set a budget for Claude Code, put a hard cap on each user or project, in dollars, tokens, or sessions, and block the request the moment that limit is reached. You do this through a gateway that sits between Claude Code and the model: each developer uses one key, every request is checked against the budget, and once the cap is hit the next request stops. That is the difference between a number you hope people respect and a limit that actually holds.
Claude Code doesn't ship with per-user, per-project dollar budgets you can set from one place across your whole team. So the practical answer to how to set a budget for Claude Code is: run it through a control layer that enforces one. Below is how the pieces work, and how to turn it on.
Soft alert vs hard stop
There are two kinds of "budget", and only one of them protects the bill.
A soft alert emails you when spend crosses a line. It's useful, but it doesn't stop anything. Spend keeps running while the message sits in an inbox, and by the time someone reads it the money is already gone. Most native budget features on the AI platforms are alert-first.
A hard stop blocks the next request the instant the cap is reached. Nothing goes over, because nothing gets through. This is what you want when the point is to never see a surprise invoice.
One detail matters here. When Clawgate blocks a request, it returns a 403 with the limit message, not a 429. Coding agents treat a 429 as a temporary rate limit and quietly retry it, so a 429 both hides the reason and keeps hammering the gateway. A 403 surfaces the actual message to the developer: you've hit your budget. They see why they stopped, instead of watching their tool spin.
The kinds of limits you can set
A good budget isn't one number. It's a small set of caps that fit how your team actually works. With Clawgate you can cap Claude Code spend per user and per project, on a daily or weekly window, measured in dollars, tokens, or sessions.
| Scope | Window | Measured in | What it does |
|---|---|---|---|
| Per user | Daily or weekly | Dollars, tokens, or sessions | A daily spend limit for Claude Code per developer, so no one person can run away with the bill |
| Per project | All-time | Dollars, tokens, or sessions | A total spend cap for a project, checked before the user quotas, so a client engagement can't exceed its number |
The ordering is deliberate. Project budgets are an all-time spend cap that is checked first; if a project has burned through its number, the request stops there before any per-user quota is even considered. That makes a Claude Code budget per developer and a per-project ceiling work together rather than fight each other.
Because every key is tied to a person and a project, the spend lands in the right bucket automatically. You don't tag requests by hand. If you want the full picture of who spent what, that same attribution is what powers usage reporting, which we cover in how to track Claude Code usage per developer.
Alerts before the cap, not after the bill
Hard stops keep you safe, but hitting one mid-task is annoying. That's what configurable alerts are for. Clawgate can email you when spend crosses a threshold you set, 80% of the budget by default. The alert gives you a window to act before the wall: top up the budget, switch that project to a cheaper capable model, or pause and pick it up tomorrow.
So the pattern is: an alert warns you, and the hard stop catches you. You get the heads-up and the guarantee, instead of choosing between them.
How to set it up
Setup takes minutes and doesn't touch anyone's local config beyond one setting.
- Point Claude Code at the gateway. Create a key in the Clawgate console, tie it to a user and a project, and set Claude Code to use that key. No juggling multiple provider keys.
- Set the budget in the dashboard. Choose the scope (user or project), the window (daily or weekly), the unit (dollars, tokens, or sessions), and the number. Set the alert threshold while you're there.
- Let it run. Every request is authenticated, checked against the budget, tied to its user and project, and forwarded to the model. When the cap is reached, the request is blocked with a 403. No servers to operate.
Changing a budget later is a dashboard edit, not a redeploy. You can raise a developer's daily spend limit for a crunch week and drop it back after, without anyone re-configuring their tool.
Cut the tokens, so the budget stretches further
A budget caps what you spend. Prompt compression lowers what each request costs in the first place, so the same cap buys more work. Claude Code resends a large amount of background context on every turn, and you pay full price for it each time. Clawgate's opt-in compression strips up to 92% of those resent tokens on heavy workloads while accuracy holds, and the savings show up in dollars on the dashboard.
The two levers work together. Compression pushes each request's cost down, and the hard cap stops the total from ever running away, so a fixed budget covers noticeably more real work. It's one toggle to turn on. There's a fuller explanation in our write-up on prompt compression for coding agents.
More than a meter
We built Clawgate because no single existing tool did all three of the things a team paying for AI actually needs, so we put them in one place. Budgets are the first: monitor and control spend with hard-stop limits and per-user, per-project attribution. But it also cuts token usage with opt-in prompt compression (up to 92% on heavy agent workloads) plus routing work to cheaper capable models, and it catches abuse and impersonation with content-fingerprint detection that flags a leaked or shared key, or a request whose content doesn't match the project it claims. So a budget cap is the floor, not the whole product. Clawgate started as an internal tool at Virstack that cut our own AI bill by 70% before it became something we sold.
For the wider picture of getting spend under control, see how to control Claude Code costs and how to stop runaway AI costs.
Frequently asked questions
What happens when a Claude Code budget is reached?
With a hard-stop budget, the next request is blocked as soon as the limit is reached, so spend cannot go over. Clawgate returns a 403 with the limit message, which means the developer sees why the request stopped instead of a 429 that coding agents silently retry. Soft alerts do not stop anything on their own; they only notify you while spend keeps running.
Can I set different budgets for different projects?
Yes. In Clawgate each project has its own all-time spend cap, checked before the user quotas, and each user can have daily or weekly caps of their own. So one project can carry a small budget while another carries a larger one, and every key is tied to a person and a project so the spend lands in the right place automatically.
Can I get an alert before I hit the limit?
Yes. Clawgate can email you when spend crosses a threshold you set, 80% of the budget by default. That gives you room to top up, switch to a cheaper model, or pause before the hard cap blocks the next request.
Can budgets be set in dollars instead of tokens?
Yes. You can set a budget in dollars, in tokens, or in session counts, on a daily or weekly window. Dollars are the simplest for a business owner to reason about, since the cap maps straight to the invoice.
Written by Chathuranga K, an engineer at Virstack.
Set a hard budget for Claude Code in minutes
Give each developer a key, set daily or weekly caps per user and per project in dollars, tokens, or sessions, and let the limit block spend before it goes over. No surprise bills.