Claude API Budget Alerts Per Project: A Setup Guide
If you're running multiple projects, clients, or teams on a single Claude API account, you've probably hit the same wall: Anthropic's console gives you account-level spend, not a per-project breakdown, and there's no built-in way to say "alert me when project X crosses €50 this month." This is a common pain point once a team goes beyond one prototype and starts running several apps or internal tools against the same Claude access.
The short answer is that per-project budget alerts aren't a native Anthropic feature — you have to build the boundary yourself, either by isolating keys per project and monitoring them separately, or by using a layer in front of the API that already tracks usage per key. Below is a practical way to do both, from the manual approach to a lighter-weight setup using scoped API keys.
Why per-project alerts don't exist out of the box
Anthropic's console shows aggregate usage and cost across your organization. Workspaces help separate resources logically, but alerting is still coarse — you get overall spend visibility, not a webhook that fires when a specific project's Claude spend crosses a threshold. If you're billing clients per project, allocating a shared budget across teams, or just trying to catch a runaway script before it burns through your monthly cap, you need something more granular.
There are two practical ways to get there:
- Isolate usage at the source — give every project its own API key (or workspace), then pull usage data per key and alert on it yourself.
- Use a proxy layer with per-key usage metadata — issue application keys per project through a gateway sitting in front of Claude, and read cost/usage directly from that layer instead of reconstructing it from raw token counts.
Option 1: Manual tracking with separate keys
The baseline setup is simple: one Anthropic API key (or workspace) per project, and a script that pulls usage on a schedule.
# pseudocode - pull usage for a given key/workspace and compare to budget
USAGE=$(curl -s "https://api.anthropic.com/v1/usage?workspace_id=$WORKSPACE_ID" \
-H "x-api-key: $ANTHROPIC_API_KEY")
SPEND=$(echo "$USAGE" | jq '.total_cost')
if (( $(echo "$SPEND > $BUDGET_LIMIT" | bc -l) )); then
curl -X POST "$SLACK_WEBHOOK_URL" \
-d "{\"text\": \"Project $PROJECT_NAME has spent \$${SPEND}, over budget of \$${BUDGET_LIMIT}\"}"
fi
This works, but you own the token-to-cost math, the cron job, the retry logic, and the alerting integration. It's fine for one or two projects. It gets tedious fast once you have five projects, three clients, and a mix of Sonnet and Opus calls with different pricing.
Option 2: Scoped keys with built-in usage metadata
A cleaner pattern is to put a thin API layer between your apps and Claude, where each project gets its own application key, and that layer already tracks usage per key. This is exactly the model SubToAPI (https://subtoapi.app) uses: you turn your existing Claude access into an HTTPS API, issue a separate sub_live_... key per project or client, and every request through that key carries usage metadata you can read back.
Instead of reconstructing spend from raw Claude usage logs, you query usage by key:
const res = await fetch("https://api.subtoapi.app/v1/usage", {
headers: {
"Authorization": `Bearer ${process.env.SUBTOAPI_KEY}`
}
});
const data = await res.json();
// data includes per-key request counts and token usage you can
// map to your own per-project budget thresholds
Because each project has its own key, the "per-project" boundary already exists at the request level — you're not filtering a shared log after the fact. That makes threshold logic straightforward:
const projects = [
{ key: "sub_live_proj_a", budget: 50 },
{ key: "sub_live_proj_b", budget: 120 },
];
for (const project of projects) {
const usage = await getUsage(project.key);
if (usage.estimatedCost > project.budget) {
await notifySlack(`${project.key} is over its €${project.budget} budget`);
}
}
Run that on a schedule (cron, a scheduled Lambda, whatever you already use) and you have per-project budget alerts without touching Anthropic's raw usage API or writing your own cost model for every model version. The keys, streaming responses, and tool use all go through the same SubToAPI setup described in /docs/quickstart, so adding this doesn't require a separate integration — it's the same key you're already using for requests.
Structuring projects for clean alerts
Regardless of which approach you pick, a few habits make budget alerts actually reliable:
- One key per project, not per environment. Mixing staging and production traffic on the same key makes budget numbers meaningless.
- Name keys after the thing you bill, not the thing you build. If you invoice per client, key per client — not per microservice.
- Set alerts at 50%, 80%, and 100% of budget rather than a single threshold. A single alert at 100% means you find out after the damage is done.
- Separate "alert" from "cutoff." Alerts should be advisory; if you need a hard stop, revoke or rotate the key programmatically once the threshold is hit, rather than relying on someone reading a Slack message.
Where a gateway helps beyond alerts
Once you've split usage per project, the same key-per-project structure pays off elsewhere: you can hand a key to a contractor without giving them your main Anthropic credentials, rotate access when a project ends, and get consistent usage metadata regardless of which Claude model the project calls. SubToAPI's plans (Solo, Team, Scale, see /pricing) are built around this multi-key, multi-seat model rather than a single shared credential, which is what makes per-project budgeting workable in the first place. If you want to see the request/response shape before wiring up alerts, /docs/messages and /docs/streaming cover the core API surface.
Questions
Does Anthropic's API support budget alerts per project natively? No. The console shows account-level spend and workspaces group resources, but there's no built-in alert that fires per project or per key when a threshold is crossed. You need to build this yourself or use a layer that tracks usage per key.
What's the fastest way to get per-project budget tracking without writing a full billing system? Issue a separate API key per project, pull usage per key on a schedule, and compare it against a stored budget value. Using a gateway that already exposes usage metadata per key (like SubToAPI's application keys) removes the need to reconstruct cost from raw token logs.
Can I set a hard spending cap instead of just an alert? Yes, but it requires action beyond notification — once a key crosses its limit, revoke or rotate it programmatically so no further requests go through on that key. Treat the alert as the trigger and the key rotation as the enforcement step.