Skip to navigation

Claude Code Usage Tracking: /usage, APIs and Team Telemetry

In short: Claude Code exposes session usage, while the Usage and Cost API provides historical API data. Know the latency and granularity before building alerts.

Published 18 min read
On this page

Direct answer

Use /usage for Claude Code session metrics and plan bars. Use team admin controls for spend limits. For historical API usage and cost, the Usage and Cost API typically has data within five minutes of request completion, but cost buckets are daily and the API is legacy.

Do not build a real-time alert on a delayed daily aggregate. Separate immediate session checks, administrative controls and historical reconciliation. Record model, workspace, inference geography and time window, and remember that Priority Tier costs are excluded from the cost endpoint.

Official: these boundaries come from Anthropic’s cost, usage API and rate-limit documentation. Unknown: the supplied evidence does not establish one universal alert threshold or a real-time Claude Code telemetry stream for every account.

Why usage data needs a decision deadline

A usage number is only useful when it arrives in time for a decision. A developer may need to know whether a session is approaching a limit now. Finance owners may need yesterday’s reconciled cost. Those questions require different surfaces.

Claude Code’s /usage view supports session-level awareness. Team administrators can configure spend limits through admin settings or workspaces. The historical Usage and Cost API serves a different purpose: reviewing API activity after requests complete.

Confusing those surfaces creates bad alerts. A daily cost bucket can confirm a trend but cannot reliably stop a runaway request in the current minute. A session bar can guide a developer but does not replace transaction-level billing evidence.

The 429 diagnosis guide shows why error mechanics matter. Standard and ramp limits can return retry-after; a monthly spend-cap 429 has no such header and pauses usage until the next month at 00:00 UTC. An alert should understand the limit it is watching.

The cost per verified change framework adds the missing engineering denominator. Consumption is an input. Accepted, verified work is the outcome that makes the number meaningful.

Usage telemetry evidence map connecting session view, team admin, historical API and cost buckets
Evidence map from Anthropic’s cost and Usage and Cost API documentation, checked 2026-11-27. The surfaces differ in purpose, latency and granularity.

Start with the local session view

Official: Claude Code documents /usage for session metrics and plan bars. Use it as the immediate surface for a developer who needs to understand current session consumption and plan status.

The view is useful, but it is not a complete accounting system. It does not replace invoice records, API cost exports or a team reconciliation process. Treat it as operational awareness.

A practical session check happens before a large task and at a clean stopping point. If the remaining allowance looks uncertain, choose work that can pause safely rather than starting an unbounded loop.

The task budgets versus hard stops guide explains why a token budget is not a cap. Task budgets count thinking, tool calls, tool results and output, but remain advisory. A session meter and an enforcement control solve different problems.

Local use Good question Boundary
Before a large task Is there enough session allowance? Displayed usage may not be transaction detail
During a long loop Is consumption growing unexpectedly? Meter does not prove accepted work
At a checkpoint Should the task pause or narrow? Human must define the checkpoint
After a stop What state needs preservation? Usage alone cannot reconstruct the task

Keep a checkpoint outside the conversation. The context-portable migration guide explains how to preserve prompts, hooks and task state. A usage interruption should not erase the engineering context.

Team controls are administrative, not analytical

Official: teams can set spend limits through admin settings or workspaces. This makes the control useful for governance, but it does not answer every usage question.

A spend limit is a boundary. It does not explain which project consumed the allowance, whether a retry caused a spike or whether the resulting change was accepted. Pair it with reports and task evidence.

Team seats also have a specific meaning. Official: each seat is assigned to one named individual, credentials cannot be shared, unused usage cannot be transferred, and new seats or upgrades are prorated and charged immediately. Seat accounting should not be treated as a pool of anonymous usage.

The team seat management policy is the source for those rules. A dashboard that divides total spend by seat count may be informative, but it does not change the named-user model.

Team question Control or evidence
Who has access? Named seat assignment
What boundary applies? Admin or workspace spend limit
What was consumed? Usage and cost records
Which work was accepted? Repository and verification evidence
What changed mid-period? Seat, upgrade and recharge records

The billing-dispute evidence packet applies the same separation. Subscription charges, usage credits, recharges, API usage and refunds belong in different categories.

Understand the historical Usage and Cost API

Official: the API provides historical API usage and cost data, typically within five minutes of request completion. Reported buckets can span 1 minute, 1 hour or 1 day. Cost data is daily.

This difference matters. A one-minute usage bucket does not imply one-minute cost precision. Building an alert that compares both as if they share the same resolution creates false confidence.

The API is legacy. Official: new integrations should use the Analytics API. Existing reporting stacks explain why this article still covers the legacy endpoint.

Filters include model, workspace and inference geography. Use them deliberately. A workspace filter can isolate a team or environment; a model filter can show whether one family dominates usage; geography can matter when reviewing where inference occurred.

API dimension Documented behavior Reporting consequence
Availability Typically within five minutes after completion Not a real-time stream
Usage buckets 1m, 1h or 1d Choose resolution for the question
Cost buckets Daily Avoid minute-level cost claims
Filters Model, workspace, inference geography State filters with every report
Priority Tier cost Excluded from cost endpoint Reconcile separately
Lifecycle Legacy Prefer Analytics API for new work

The Usage and Cost API documentation is the primary source. Record the query window and retrieval time so a reviewer knows what could have been present when the report ran.

Usage workflow moving from session checks and team controls to delayed historical usage and daily cost reconciliation
Editorial workflow from Anthropic’s documented telemetry boundaries. Historical API data can lag completion and cost granularity is daily.

Latency changes what an alert can promise

Suppose a request completes and a report runs immediately. The historical API may not yet contain the usage. A second report after the typical five-minute window may show it. This sequence is a Derived expectation from the documented lag, not a guaranteed maximum.

Do not encode “five minutes” as an absolute service-level promise. The documentation says typically. A robust reconciliation job should record missing intervals and retry on a schedule rather than declaring the data final at one timestamp.

A dashboard should display two times: the period being measured and the time the data was retrieved. Without both, a daily total can look current when it is only partial.

The usage and billing console guide is useful for understanding account-level controls in a gateway context. It does not change Anthropic’s historical API latency or bucket rules.

Alert need Suitable surface Unsuitable shortcut
Immediate session awareness /usage Daily cost export
Administrative boundary Team spend limit Assuming a report enforces a cap
Historical usage trend Usage API bucket Calling the API real-time
Daily cost review Cost data plus reconciliation Inferring cost from session bars alone
Incident reconstruction Request and account evidence One final balance screenshot

The proof-of-work packet supplies the engineering side of an incident record. Consumption explains usage; changed files and checks explain value.

Build a reconciliation view before an alert

A reliable report begins with categories. Separate subscription charges, usage credits, recharges, API usage, incident windows and refunds. This is a reconciliation method, not an official Anthropic feature.

Start with a time window and a consistent time zone. Then record the filters used for each query. If one report covers all models and another only a workspace, placing them side by side without labels invites a false comparison.

Normalize units carefully. Token counts, request counts and currency are different measures. Keep them in separate columns and avoid combining them into a single “usage score” unless the method is documented.

The refund policy adds another category. Refunds are generally restricted, with regional and payment-method exceptions. A credit or refund can change the apparent balance without representing new model activity.

Reconciliation field Why to keep it
Period and time zone Defines the comparison window
Retrieval timestamp Shows how complete the data could be
Model filter Prevents partial reports from looking total
Workspace filter Separates environments or teams
Inference geography Preserves a documented query dimension
Usage buckets Explains trend resolution
Daily cost Keeps currency at documented granularity
Excluded categories Makes Priority Tier and other gaps visible

The billing-dispute evidence packet provides a fuller worksheet. Do not declare a charge erroneous without transaction evidence.

Design alerts around decisions

An alert should name the action it requests. “Usage is high” is weak. “Review today’s workspace usage before starting another batch” gives the recipient a decision and a deadline.

Use session awareness for immediate behavior. Historical trends support planning. Administrative limits set boundaries. No single alert needs to perform all three jobs.

A simple design has three levels. An informational trend notes unusual growth. A warning asks the owner to review current work. A critical event requires action, such as pausing a batch or checking an account state.

Level Trigger shape Expected action
Informational Historical trend changes Review planning assumptions
Warning Session or workspace consumption needs attention Narrow or pause upcoming work
Critical Documented limit or spend boundary is reached Stop new work and inspect account state

The thresholds are team choices. The fact pack provides no universal warning percentage. Select them from observed workload and tolerance, then record the rationale.

Avoid alerting on a partial daily bucket as if it were final. Compare equivalent periods, label incomplete data and allow late-arriving records to revise the previous result.

The cost per verified change framework helps set a useful threshold. A rise in tokens may be acceptable when verified output rises with it. A rise without accepted changes deserves investigation.

Keep Priority Tier visible as a gap

Official: Priority Tier costs are excluded from the Usage and Cost API cost endpoint. A report built only from that endpoint can therefore understate the relevant cost if Priority Tier activity is present.

Do not silently fill the gap with an estimate. Mark it as excluded and reconcile the missing category through the appropriate billing evidence. If the account does not use Priority Tier, record that condition rather than assuming it for every reader.

The same discipline applies to subscription usage. An API cost report does not become a complete subscription invoice because it contains model names and token counts. Different charging mechanisms need separate records.

Cost category Where to look Common mistake
API usage cost Historical cost data Treating daily totals as immediate
Priority Tier cost Separate billing evidence Assuming the cost endpoint includes it
Subscription charge Plan and payment records Converting plan price into token price
Usage credits Account transaction records Calling credits API consumption
Refund Refund and payment records Netting it against usage without a trail

The refund and support policy guide explains why region, payment method and dispute status matter. Usage reporting should preserve those categories rather than flatten them into one balance.

Telemetry tradeoff diagram comparing immediate session awareness with delayed daily cost detail and excluded categories
Editorial tradeoff map from official usage documentation. Faster surfaces support immediate decisions, while historical detail supports reconciliation but arrives later.

Rate limits are not the same as usage totals

A low displayed usage number does not prove that a request cannot be rate-limited. Official: standard limits use a token bucket that replenishes continuously. Spend limits and rate limits are separate controls.

A token bucket can restrict a burst even when a longer-term usage total appears modest. That is why a dashboard should not treat every 429 as evidence that the monthly or daily allowance is exhausted.

Community: issue #29579 reports a Max account showing 16 percent usage while requests immediately returned a rate-limit error. It remained open without maintainer confirmation or a fix version. The report is a useful diagnostic case, not proof of a universal accounting defect.

The 429 decision tree uses the error type, retry-after header and account state to separate token-bucket, spend-cap and ramp-limit cases.

Signal What it can indicate What it cannot prove alone
High session usage Current consumption is growing Exact future cost
Daily cost increase Historical spend changed Which request caused it
429 error A limit or policy blocked access One universal limit type
retry-after Documented retry timing for some limits That every 429 has a retry time
Low shown usage Displayed allowance remains That no burst or spend control applies

Capture the account state at the time of the error. A screenshot taken later may show a different window or replenished bucket. The billing-dispute evidence packet explains why timestamps matter.

A small alerting design that respects the data

Begin with a daily reconciliation job. Query a completed window, record retrieval time and filters, and store the result with an explicit completeness note. Re-run the previous window after the documented lag when late data may matter.

Next, add a trend review. Compare equivalent periods rather than a partial current day with a full previous day. Segment by model and workspace when those dimensions explain the workload.

Then add an operational check. Before a large agent run, ask the developer to inspect /usage and choose a bounded task. The check is procedural because the supplied sources do not describe a universal event stream for every Claude Code session.

Finally, configure administrative spend limits where the team needs a boundary. Document who can change them and who receives the alert. A limit without an owner is just a setting.

Step Implementation Evidence to retain
Daily pull Completed historical window Query, filters and retrieval time
Late-data pass Recheck prior window Revised totals and reason
Trend review Equivalent-period comparison Model and workspace breakdown
Pre-run check /usage plus task scope Checkpoint and planned bound
Boundary control Admin spend limit Owner and change record

This design is an editorial recommendation, not an official Anthropic architecture. Its purpose is to match each surface to a decision it can actually support.

Assign an owner to each alert and write down the expected response. If a warning arrives but nobody knows whether to pause a batch, narrow a query or contact an administrator, the alert adds noise. Review the rules after a real incident and remove any trigger that never changed a decision.

Keep the raw query results with the alert record. A screenshot of a dashboard can omit filters, retrieval time and excluded categories. The stored result lets a later reviewer reproduce what the alert actually saw.

The official Usage and Cost API documentation is the source for the API mechanics. The cost calculator can help model an external test budget, but it does not reconcile an Anthropic invoice.

Treat reports as evidence, not omniscience

A dashboard can be precise and still incomplete. A daily cost number may exclude Priority Tier. A usage bucket may arrive after the request. A session bar may not name the project that consumed the allowance.

Show those boundaries in the report itself. Use labels such as “data retrieved at,” “daily cost,” “Priority Tier excluded” and “partial window.” Precision without scope creates false confidence.

The verification proof packet provides a useful model. Every claim should point to an artifact, and every artifact should have a scope and timestamp.

When a number conflicts with a user’s expectation, investigate before accusing. Compare filters, windows, time zones, late data and excluded categories. The billing-dispute evidence packet keeps that investigation grounded in transactions.

A concrete win is a report that helps a team pause the right work before a boundary. The concrete loss is that historical detail cannot make an immediate decision by itself. Good telemetry design states both.

Connect usage to request design

Usage reports become more useful when they sit beside the engineering choices that shape a request. A token total says what happened. It does not explain whether a broad repository read, a verbose tool result or repeated discovery produced the load.

Start with cache state. The idle-session cache-miss analysis separates expired entries, changed prefixes and fresh input. If a resumed request costs more, record the idle interval and prefix change beside the usage data. That turns an unexplained spike into a testable event.

Next, record context scope. The long-context prefill benchmark separates input volume, first-token wait, decode and tool time. A large prompt may consume input before a visible change exists, while a slow local command may dominate elapsed time without extra model tokens.

Tool output belongs in the same record. The MCP output truncation guide recommends explicit status, decisive errors and artifact locations. A compact result can reduce repeated context, but only if the full evidence remains available for verification.

Usage driver Evidence to attach Decision it supports
Cache state TTL, prefix diff and input split Explain a resumed-request change
Context scope Retrieved files and input tokens Narrow the next discovery step
Tool output Result schema and artifact path Reduce noise without hiding failure
Subagent work Task brief and returned report Avoid duplicated discovery

Parallel work needs its own annotation. The subagent duplicate-work analysis explains that isolated agents can rediscover the same facts. Record what each agent examined and what the parent reused. Without that handoff, total usage can rise while the returned reports repeat one another.

Compaction is another state change worth marking. The compaction cost worksheet models the summary pass, new prefix and resumed work. A usage report that spans compaction should note the event rather than attributing the whole period to one unchanged session.

None of these annotations guarantees a lower bill. They make the number explainable. A team can then decide whether to stabilize a prefix, narrow retrieval, compact tool output or stop a duplicate task. The prompt-caching economics guide supplies the rate math, while local measurements supply the actual reuse pattern.

The honest loss

/usage, team controls and the historical API are useful together. They cover immediate awareness, administrative boundaries and after-the-fact reconciliation. Separating them prevents a delayed report from being mistaken for a live enforcement system.

The loss is latency and incomplete scope. Cost data is daily, Priority Tier costs are excluded from the cost endpoint, and the legacy API should not be the foundation for a new real-time integration. Subscription and API charges also need separate treatment.

The supplied evidence does not provide a universal alert threshold, a complete real-time Claude Code event schema or a guaranteed five-minute maximum. Future updates should revisit the Analytics API guidance and publish a repeatable reconciliation fixture with query windows, filters and late-data behavior.

Do not claim that every surprising bill is wrong or every low-usage 429 is a bug. Build the evidence packet first.

Alerting control checklist covering decision deadlines, query scope, late data, exclusions and named owners
Editorial alerting checklist based on the documented API lag, bucket sizes and exclusions. Thresholds remain team choices, not official universal values.
Verdict that session awareness, team controls and delayed historical reconciliation serve different decisions
Editorial verdict from official usage documentation. No single surface is complete, immediate and transaction-level at once.

Practical response: measure an OpenAI-format test lane

If you want to compare usage reporting across an agent stack, start with a bounded synthetic workload. One AI API Key provides 46 live free model IDs for OpenAI-format agents such as OpenCode, Cline or Cursor. The quickstart uses https://api.oneaiapikey.com/v1, and the pricing page explains prepaid billing.

Those free IDs are OpenAI-format only and do not work in Claude Code. The documented Claude Code route uses the Anthropic Messages format, but all four Claude IDs were unavailable on 2026-11-27. Use an OpenAI-format client for the active free lane. The API format comparison explains the boundary.

The free lane shares 100 requests and 5,000,000 tokens per day per account, resets at 05:30 IST or 00:00 UTC, and allows one request in flight per key. The model catalogue shows availability, and the cost calculator can estimate a separate test budget.

Use a disposable key with expiry and a narrow allowlist from the API reference. Review the privacy and retention policy, then create the account through sign-up. Record request counts, token usage, retrieval times and accepted changes. The comparison measures the entire gateway and agent stack, not a universal model price or a substitute for Anthropic’s billing records.

FAQ

Is /usage the same as the Usage and Cost API?

No. /usage supports Claude Code session metrics and plan bars. The API provides historical API usage and cost data.

Is the Usage and Cost API real-time?

No. Data is typically available within five minutes of request completion, and cost buckets are daily. The API is also legacy.

Can usage buckets be one minute while cost is daily?

Yes. The documented usage resolutions are 1m, 1h and 1d, while cost data is daily.

Does the cost endpoint include Priority Tier costs?

No. Priority Tier costs are excluded and need separate reconciliation.

Can a 429 prove that displayed usage is wrong?

No. Rate limits, spend caps and ramp limits are different controls. Capture the error type, headers and account state before drawing a conclusion.

More Claude Code troubleshooting

Sources

More in Blog

Try it

One API key for GPT, Grok, DeepSeek, Kimi, GLM, MiniMax, Qwen, Step, Beam, Nemotron, ERNIE, Hunyuan, Gemma, Laguna, LFM, LongCat, Llama, Solar, Jais, Mistral, K2 and Roleplay.

One AI API Key speaks the OpenAI and Anthropic formats, so you change the base URL and the key, not your code. Credit packs start at $10, and every model has a published per-token rate.

New accounts$10 credit on sign-up
  • 100requests
    per day
  • 3Mtokens
    per day
  • 47free
    models
  • $0per
    token
  • No card
  • No end date
Claim $10 credit →