LLM Token Usage Tracking Dashboard: Build or Buy?
What an LLM token usage tracking dashboard actually does
An LLM token usage tracking dashboard shows, in one place, how many input and output tokens each API key, user, team, or feature is consuming, and translates that into cost. If you're searching for this, you're probably past the "it works in a demo" stage and now dealing with a Claude or OpenAI bill that's hard to attribute — which team burned through the budget, which prompt template is bloated, which customer is heaviest.
The short answer: you need per-request token counts (input, output, and cache-related tokens if you use prompt caching), grouped by a dimension you control (API key, user ID, project), stored somewhere queryable, and visualized with at least daily granularity and cost-per-dimension breakdowns. You can build this yourself on top of the raw API, or use a layer like SubToAPI that returns usage metadata with every response so you don't have to build the plumbing.
The three pieces every usage dashboard needs
Regardless of which model provider you use, a usable tracking setup has three layers:
- Collection — capturing token counts from every single API call, not sampled, not estimated.
- Attribution — tagging each call with who/what caused it (user, team, feature flag, environment).
- Aggregation and display — rolling calls up into daily/weekly/monthly totals, converting tokens to cost, and surfacing anomalies.
Most teams get collection right quickly because the provider's API response includes usage data. Attribution and aggregation are where things get messy — especially once you have more than one API key or more than one app calling the model.
Collection: reading usage from the API response
Anthropic's Messages API returns usage data on every response:
curl https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-sonnet-4-5",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Summarize this ticket."}]
}'
The response includes an usage object with input_tokens and output_tokens. If you stream responses, token counts arrive in the final message_delta event, so your collector needs to handle both streaming and non-streaming paths — a detail that trips up a lot of first attempts.
Attribution: tagging calls before you need the data
The mistake most teams make is adding attribution after they already have a cost problem. By then the historical data is gone. Decide upfront what dimension matters for your business — per-customer, per-feature, per-environment — and pass that through as metadata on every call, even in internal tools and scripts, not just production traffic.
Aggregation: turning raw rows into a dashboard
Once you have tagged usage rows, aggregation is standard analytics work:
SELECT
api_key_label,
date_trunc('day', created_at) AS day,
SUM(input_tokens) AS input_tokens,
SUM(output_tokens) AS output_tokens,
SUM(input_tokens * 0.000003 + output_tokens * 0.000015) AS estimated_cost_usd
FROM llm_usage_log
GROUP BY 1, 2
ORDER BY 2 DESC;
This is where you'd build charts: cost per day, cost per key, token ratio (input vs output), and week-over-week growth. Most teams end up wanting at least a cost-per-key view and a cost-over-time trend before they consider the dashboard "done."
Building it yourself vs using a hosted layer
Building a custom dashboard is reasonable if your usage pattern is simple — one app, one or two API keys, moderate volume. The work is mostly: a logging table, a cron job or event hook to write rows, and a BI tool or small internal app to chart them.
It gets harder once you have:
- Multiple teams or products sharing one Anthropic account and needing separate keys and separate budgets
- A need for per-key rate limits or spend caps, not just visibility after the fact
- Streaming responses where you need to reconstruct final token counts reliably
- Engineers who shouldn't have to touch the raw provider key to get their own usage data
This is the gap SubToAPI fills. It sits between your app and Claude, issues scoped application keys (sub_live_...) per team or project, and returns usage metadata with every response — so the dashboard data is already structured by key instead of something you have to reconstruct from logs. You get streaming, tool use, and usage tracking in one place, with team seats so non-engineers can see spend without touching credentials.
A request through SubToAPI looks like a normal Messages call:
const res = await fetch("https://api.subtoapi.app/v1/messages", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.SUBTOAPI_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "claude-sonnet-4-5",
max_tokens: 1024,
messages: [{ role: "user", content: "Draft a release note." }]
})
});
const data = await res.json();
console.log(data.usage); // input/output token counts per call, tied to this key
Because each key maps to a team or product, the dashboard question — "which part of the business is driving this bill?" — is answered by the key itself, not by a custom attribution scheme you have to maintain. See /docs/messages for the full response shape and /docs/streaming for how usage is reported on streamed calls.
What to check before you commit to a tool
If you're evaluating a hosted usage tracking layer instead of building one, confirm it covers:
- Per-key usage breakdown, not just account-wide totals
- Streaming support with correct final token counts, not estimates
- Tool use token accounting, since tool calls add tokens on both sides of the conversation
- Team-level access so people outside engineering can view spend without API keys
- No lock-in on the request format — if it's a thin layer over Claude, your existing Messages-shaped code should work with a one-line auth and base URL change
You can try this against your own usage with a free trial at /signup, compare plans at /pricing, and get the full request reference at /docs/quickstart.
Questions
Do I need a dashboard if I only use one API key? If usage is low and single-purpose, a simple daily cost query is often enough. A dashboard becomes worth building once you have multiple consumers of the same key or need historical trend data for budgeting.
Does token usage tracking slow down API calls? No. Token counts are returned in the same response as the completion, so tracking is a read of existing data, not an extra request. Logging it adds negligible latency if done asynchronously.
Can I track usage per customer if I'm building a product on top of Claude? Yes — tag each call with a customer or workspace identifier at request time, or issue separate API keys per customer/team through a layer like SubToAPI so usage is segmented automatically rather than reconstructed from logs later.