Claude API Spend Tracking Per Project: A Setup Guide
If you're running multiple products, clients, or internal teams on Claude, you've probably hit the same wall: Anthropic's console gives you one bill for the whole account, not a breakdown by project. Figuring out "how much did the chatbot feature cost us last month" versus "how much did the internal tool cost" takes manual digging unless you set up tracking yourself.
The short answer: you track Claude API spend per project by separating usage at the request level — either with distinct API keys per project, request metadata you log yourself, or a proxy layer that tags and aggregates usage for you. There's no single Anthropic dashboard toggle for this today, so the method you pick depends on how many projects you're juggling and how much engineering time you want to spend maintaining it.
Why per-project cost visibility matters
Token costs scale with usage, and usage scales unevenly across projects. A support bot that handles 50,000 conversations a month behaves very differently, cost-wise, than an internal tool used by five people. Without per-project breakdowns you end up:
- Pricing client work incorrectly because you don't know the real API cost behind a feature
- Missing runaway usage on one project because it's buried in the aggregate bill
- Struggling to justify budget requests because you can't show which project needs more headroom
Getting this right early saves a lot of spreadsheet archaeology later.
Method 1: Separate API keys per project
The most common approach is also the simplest: generate a distinct key for each project and treat key-level usage as project-level usage. This works well when:
- Each project is a clearly separated codebase or service
- You don't need sub-breakdowns within a project (e.g., per customer)
- You're comfortable managing multiple keys in your secrets manager
The downside with raw Anthropic keys is that you still need to pull usage data yourself and reconcile it against the single consolidated invoice — there's no native per-key spend dashboard.
Method 2: Log usage metadata yourself
If you want finer granularity than "one key per project," you log token usage at the application layer and tag each request with a project ID, customer ID, or feature flag.
async function callClaude(prompt, projectId) {
const start = Date.now();
const response = await fetch("https://api.anthropic.com/v1/messages", {
method: "POST",
headers: {
"x-api-key": process.env.ANTHROPIC_API_KEY,
"anthropic-version": "2023-06-01",
"content-type": "application/json"
},
body: JSON.stringify({
model: "claude-3-5-sonnet-20241022",
max_tokens: 1024,
messages: [{ role: "user", content: prompt }]
})
});
const data = await response.json();
// write this to your own usage table
await logUsage({
projectId,
inputTokens: data.usage.input_tokens,
outputTokens: data.usage.output_tokens,
model: data.model,
latencyMs: Date.now() - start
});
return data;
}
This gives you exact per-project numbers, but you're on the hook for building and maintaining the logging table, the cost math per model, and any dashboard on top of it.
Method 3: Use a gateway that tags and aggregates usage for you
The middle ground — and the one that scales best past two or three projects — is routing Claude traffic through a layer that issues separate application keys per project and surfaces usage per key automatically.
This is exactly what SubToAPI does. You connect your existing Claude access once, then issue application keys (sub_live_...) per project, client, or environment. Every request made with a key returns usage metadata, and the dashboard aggregates that into per-key spend over time — so "project A cost this much this month" is a number you can see, not one you have to compute.
curl https://api.subtoapi.app/v1/messages \
-H "Authorization: Bearer $SUBTOAPI_KEY" \
-H "content-type: application/json" \
-d '{
"model": "claude-3-5-sonnet-20241022",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Summarize this ticket."}]
}'
Issue a different sub_live_... key for each project, keep the keys in each project's own environment config, and the per-project breakdown falls out of normal usage — no separate logging pipeline required. If you're already doing this with multiple teammates, team seats let you keep billing and access consolidated while usage stays split by key. The quickstart covers key setup, and the messages docs cover the request/response shape including the usage fields.
Practical tagging conventions
Whichever method you pick, a few habits make the numbers actually useful:
- Name keys/projects consistently.
sub_live_clientA_prodis more useful six months from now thansub_live_key3. - Separate environments. Don't mix staging traffic into production project totals — use distinct keys or metadata for each.
- Reconcile monthly, not daily. Token costs fluctuate request to request; monthly totals are more stable for budgeting.
- Track by feature, not just by project, if a project has multiple Claude-powered features. A single project key can still have per-feature metadata logged in your own system if you need that extra layer.
- Set a review cadence. Even lightweight tracking is only useful if someone actually looks at the breakdown monthly and acts on anomalies.
Choosing the right level of effort
If you have one or two projects and don't expect that to grow, separate keys plus a manual monthly export are enough. If you're managing client work, multiple internal teams, or a product with several Claude-powered features, build or adopt a layer that gives you per-key usage without custom logging — it pays for itself the first time you need to explain a cost spike to a client or a finance team.
Questions
Does Anthropic's console show spend broken down by project? No. The console shows account-level usage and billing. Per-project breakdowns require separate keys, your own request logging, or a gateway that tracks usage per key.
What's the fastest way to start tracking spend per project today? Create a separate API key per project immediately — even without a dashboard, you can filter usage logs by key and get a rough breakdown within a billing cycle.
Can I track spend per project without building my own logging system? Yes — issue separate application keys per project through SubToAPI and use the dashboard's per-key usage data instead of building a logging pipeline from scratch.