Try Bifrost Enterprise free for 14 days. Request access

Best AI Gateway to Monitor Claude Code Token Usage

An AI gateway monitors Claude Code token usage by logging tokens and cost for every request and tagging each one to a developer or team. This guide shows how Bifrost tracks usage, exports metrics to Prometheus and OpenTelemetry, and enforces budgets.

Best AI Gateway to Monitor Claude Code Token Usage

TL;DR

  • Claude Code's /usage command shows token usage for one session on one machine; it cannot attribute spend across a team or block a request when a budget runs out.
  • An AI gateway in front of Claude Code logs input, output, and cache tokens plus computed cost for every request, tagged to a developer or team.
  • Bifrost tags every Claude Code request with a virtual key, exports Prometheus metrics and OpenTelemetry traces, and enforces hierarchical budgets.
  • Bifrost adds 11 microseconds of overhead per request at 5,000 requests per second, so monitoring does not slow interactive sessions.
  • Connecting Claude Code takes two environment variables: ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN set to a Bifrost virtual key.

The best AI gateway to monitor Claude Code token usage is Bifrost. Get per-request cost attribution, per-team budgets, Prometheus metrics, and OTel tracing.

Claude Code spend averages around $13 per developer per active day and $150 to $250 per developer per month across enterprise deployments, according to Anthropic's Claude Code cost documentation, and agent teams running in plan mode use approximately 7x more tokens than standard sessions. Most engineering teams have no centralized visibility into which models, developers, or sessions drive that consumption. Bifrost, the open-source AI gateway by Maxim AI, is the best AI gateway to monitor Claude Code token usage. Built in Go and available on GitHub under Apache 2.0, Bifrost sits between Claude Code and any LLM provider and captures per-request token counts, per-virtual-key cost attribution, and full session traces with 11 microseconds of overhead at 5,000 requests per second.

Why Claude Code Token Usage Demands Centralized Monitoring

Claude Code token consumption is unpredictable at team scale because the same product can be invoked in radically different ways. A focused bug fix may use 20,000 tokens. A multi-file refactor with subagents can use millions. Claude Code sends the full conversation with every request, so token usage climbs as a session grows even when each new prompt is short.

Without monitoring at the gateway layer, engineering leaders cannot answer basic questions:

  • Which teams or developers account for the majority of monthly Claude Code spend?
  • How much of that spend is on Opus versus Sonnet versus Haiku?
  • Which sessions are burning tokens through autocompact loops or runaway subagent fan-out?
  • Are projected budgets being breached, and by which cost center?

Claude Code's built-in /usage command shows token usage for the current session, and the Claude Console reports spend per member with workspace-level spend limits. Neither enforces a per-developer or per-team budget at request time, and neither covers Claude traffic served through Amazon Bedrock or Google Vertex AI in the same view. That is the job of an AI gateway placed in front of Claude Code, where every request is logged, costed, and attributed before it ever reaches Anthropic. The Bifrost AI gateway is built for this role.

How to Check Claude Code Token Usage

Claude Code token usage can be checked in four places: the /usage command, the Claude Console, Claude Code's OpenTelemetry export, and an AI gateway on the request path. Each answers a different question, and only the gateway combines team attribution with budget enforcement across every provider.

Where to check What it shows Team attribution Enforces budgets
/usage command Session tokens by model, cache reads and writes, estimated cost No, one machine No
Claude Console usage page Spend per member and workspace for API-billed usage Yes, Anthropic API only Workspace spend limits
Claude Code OpenTelemetry export claude_code.token.usage and claude_code.cost.usage metrics per user and session Yes, if every machine is configured No
Bifrost AI gateway Tokens, cost, latency, model, and provider per request, per virtual key Yes, any provider Yes, hierarchical

For anyone asking how to check Claude token usage on a single machine, the /usage session block is the fastest answer: it lists input, output, cache read, and cache write tokens per model with a cost estimate at list price. Claude Code's OpenTelemetry monitoring goes further by exporting token and cost metrics, but every developer machine has to set CLAUDE_CODE_ENABLE_TELEMETRY=1 and point at a collector. The answer to how to track Claude token usage across a whole team is different: a gateway such as Bifrost acts as a Claude token usage tracker that works centrally with no per-machine setup beyond the base URL, which is why platform teams choose it to govern Claude Code token usage per team.

What an AI Gateway Should Track for Claude Code Token Usage

An AI gateway used to monitor Claude Code token usage should capture tokens, cost, attribution, and model mix for every request, then export that data to the tools engineering already uses. The gateway should capture and expose the following data points at request granularity:

A Claude Code request passes virtual key authentication and a budget check, reaches the provider, and its tokens and cost are logged asynchronously and exported as metrics

Figure 1: Cost is computed at request time from synced pricing, and logging runs off the request path.

  • Per-request token counts: input tokens, output tokens, and cache reads or writes for every Claude Code call
  • Per-request cost: dollar amount computed against current Anthropic, Bedrock, Vertex, or Azure pricing
  • Per-user and per-team attribution: which developer, team, or business unit issued the request
  • Model breakdown: how much spend goes to Opus, Sonnet, and Haiku separately
  • Session and trace correlation: full session view across multi-turn Claude Code interactions
  • Budget enforcement: ability to block requests when a team or developer exceeds an allocation
  • Standards-based export: Prometheus, OpenTelemetry, and Datadog integration so the data lives where the rest of engineering monitoring lives

A gateway that captures only aggregate totals does not solve the team-scale problem. The gateway has to attribute spend down to the individual key or developer, and it has to make that data extractable into existing observability platforms. The Bifrost governance model is built around exactly this pattern: virtual keys as the unit of attribution, hierarchical budgets as the unit of enforcement, and standards-based export as the unit of integration.

Bifrost: The Best AI Gateway to Monitor Claude Code Token Usage

Bifrost is the best AI gateway to monitor Claude Code token usage because it logs every request with tokens and computed cost, attributes it to a virtual key, exports it to Prometheus and OpenTelemetry, and enforces budgets on the same path. The Bifrost gateway is built around four monitoring capabilities that map directly to the requirements above.

Claude Code sessions from three developers route through Bifrost to Anthropic, AWS Bedrock, or Vertex AI, and Bifrost exports token and cost data to Prometheus and OpenTelemetry

Figure 2: Token and cost data is captured on the request path, so no developer machine needs its own telemetry setup.

Per-request cost and token attribution. Bifrost logs every Claude Code request with input tokens, output tokens, latency, model, provider, status, and computed cost. The pricing catalog is automatically synced from a remote datasheet every 24 hours, and custom pricing overrides let teams reflect negotiated Anthropic, AWS Bedrock, or Vertex rates. Cost is computed at request time, not in a nightly batch.

Per-team and per-developer visibility through virtual keys. Virtual keys are the primary governance entity in Bifrost. Each developer or team gets a virtual key that Claude Code uses as its ANTHROPIC_AUTH_TOKEN, and every request is automatically tagged with that key. Dashboards, metrics, and exports filter by virtual key, team, or customer, producing a clear answer to who spent what.

Native Prometheus metrics and OpenTelemetry tracing. Bifrost exposes a /metrics endpoint that Prometheus can scrape or push to a Push Gateway for multi-node clusters. Request-level metrics carry virtual key, team, and customer labels, and bifrost_stream_inter_token_latency_seconds tracks streaming speed, which answers how many Claude Code tokens per second each provider delivers. The same data also flows through OpenTelemetry as span-level traces, exportable to Grafana, New Relic, Honeycomb, or any OTLP-compatible backend. Metrics collection runs asynchronously with no impact on Claude Code request latency.

Real-time built-in dashboard. As a Claude Code usage monitor, Bifrost ships with a built-in dashboard at http://localhost:8080 whose request logs show token usage, cost, model breakdown, and latency, filterable by virtual key, token range, cost range, and time window. No external tools are required to see who consumed what. The same dashboard supports per-team filtering for engineering leads who need a weekly review without setting up Grafana.

For teams that already run Grafana, New Relic, or Honeycomb, the OTel observability plugin pushes traces directly into each platform, and Bifrost Enterprise adds a native Datadog connector for APM traces and LLM Observability.

How Bifrost Connects to Claude Code

Connecting Claude Code to Bifrost takes one virtual key and two environment variables, after which every request is monitored with no change to how developers work. The Claude Code integration requires changing two environment variables in Claude Code's settings.json and creating a virtual key in Bifrost.

Claude Code reads ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN from settings.json, sends requests to the Bifrost anthropic endpoint with a virtual key, and Bifrost forwards them to the provider

Figure 3: The virtual key replaces the Anthropic login, so attribution starts with the first request.

"env": {
  "ANTHROPIC_BASE_URL": "http://localhost:8080/anthropic",
  "ANTHROPIC_AUTH_TOKEN": "your-bifrost-virtual-key"
}

After this change, every Claude Code request routes through Bifrost transparently. Developers continue using Claude Code exactly as before, with no workflow changes. The open-source Bifrost gateway translates between the Anthropic API format and any target provider, including AWS Bedrock, Google Vertex AI, Azure, OpenAI, Groq, and Mistral, so platform teams can route Claude Code to whichever provider holds the contract or fits the cost model. The ANTHROPIC_AUTH_TOKEN method does not require an Anthropic account login at all; the virtual key handles authentication and billing routing on its own.

Once routing is in place, monitoring is automatic. No additional SDK, instrumentation, or code change in Claude Code is needed. Claude Code also sends an x-claude-code-session-id header on every request, which keeps a session on the same provider key and prompt cache. The Claude Code resource page covers team rollout patterns.

Budget Enforcement and Active Cost Control

Visibility without enforcement leaves cost overruns to discover after the fact. Bifrost moves from passive monitoring to active control through hierarchical budgets attached to virtual keys, teams, and customers. Each level enforces independently.

A Claude Code request passes the developer virtual key budget, the team budget, and the customer budget before the provider call, and any exhausted level blocks it

Figure 4: A runaway session hits the developer limit first, long before it can drain the team or organization budget; Enterprise alerting can warn before any limit is reached.

  • Per-developer daily limits prevent a single runaway session from burning the team budget
  • Per-team monthly budgets keep cost predictable at the engineering manager level
  • Organization-wide caps give finance and platform leads a hard ceiling

When a budget is exhausted, Bifrost blocks further requests automatically. Calendar-aligned reset durations (1d, 1w, 1M, 1Q, 1Y) align with billing cycles, and Bifrost Enterprise alerting notifies Slack, Microsoft Teams, PagerDuty, or a webhook when a budget crosses a threshold. Rate limits on tokens per hour and requests per minute add another layer of protection against accidental burst spend, especially for subagent-heavy and agent-team Claude Code workflows that run several parallel sessions. The guide to Claude Code usage limits explains how these gateway limits interact with Anthropic's own plan limits.

For platform teams, the governance resource covers the full virtual-key, RBAC, and SSO model. For deeper monitoring patterns, the MCP gateway resource walks through how Code Mode and tool filtering further reduce Claude Code token consumption.

How Bifrost Compares to Alternative Monitoring Approaches

Engineering teams evaluating how to monitor Claude Code token usage typically consider five options, and they differ mainly in whether they can attribute spend across a team and stop a request before a budget is exceeded.

Claude Code's built-in /usage command: Useful for individual developers checking their own session. It cannot aggregate across users, attribute to teams, enforce budgets, or feed Prometheus.

Anthropic Console organizational view: Adds workspace-level cost tracking, workspace spend limits, and per-user breakdowns when developers are on API billing. Its limits apply per workspace rather than per developer or team, and it only reflects spend from Anthropic-hosted models, not Bedrock, Vertex, or Azure deployments of Claude.

Claude Code OpenTelemetry export: Streams per-user token and cost metrics from each developer's machine into an existing collector, including a Prometheus exporter. It reports usage but does not enforce budgets, and coverage depends on every machine carrying the telemetry settings.

LiteLLM proxy: A Python-based gateway that supports routing to multiple providers including Anthropic, with virtual keys, per-key budgets, and centralized cost monitoring. Anthropic's own documentation notes that the project is unaffiliated with Anthropic and has not been audited for security, and a March 2026 PyPI supply-chain compromise affected published LiteLLM packages. Teams comparing options can review Bifrost as a drop-in LiteLLM alternative for the complete feature delta.

The Bifrost AI gateway: Provides the most comprehensive monitoring stack for Claude Code token usage: per-request cost, virtual key attribution, hierarchical budgets, Prometheus and OTel export, a built-in dashboard, and an enterprise Datadog connector. Bifrost adds only 11 microseconds of overhead at 5,000 requests per second in published benchmarks, so the monitoring layer does not slow down interactive Claude Code sessions. The Go-based architecture handles governance enforcement, cost logging, and observability export concurrently without impacting request latency. For a wider field of options, the roundup of LLM gateways for monitoring Claude Code token spend compares more products on the same criteria.

Frequently Asked Questions

How do I check Claude Code token usage?

Run /usage inside Claude Code to see the current session's input, output, and cache tokens per model with an estimated cost. For usage across a team, check the Claude Console for API-billed workspaces, enable Claude Code's OpenTelemetry export, or route Claude Code through an AI gateway such as Bifrost, which logs tokens and cost for every request by virtual key.

What is the best Claude token usage monitor for teams?

The best Claude token usage monitor for teams sits on the request path, which a local Claude token monitor such as /usage cannot do, attributes every request to a developer or team, and enforces budgets. Bifrost does all three for Claude Code, exports metrics to Prometheus and OpenTelemetry, and covers Claude served through Anthropic, Bedrock, Vertex AI, or Azure in one view.

How much does Claude Code cost per developer?

Anthropic reports an average of around $13 per developer per active day and $150 to $250 per developer per month across enterprise deployments, with costs below $30 per active day for 90% of users. Actual spend depends on model choice, codebase size, session length, and use of subagents or agent teams.

Can I build a Claude Code token usage dashboard?

Yes. Bifrost includes a built-in dashboard with token, cost, and latency analytics filterable by virtual key, and it exposes a Prometheus /metrics endpoint with bifrost_input_tokens_total, bifrost_output_tokens_total, and bifrost_cost_total labeled by virtual key and team. Those metrics feed a Grafana dashboard or a weekly Claude Code token usage report with no custom instrumentation, and the Prometheus integration guide lists every label.

How do I track Claude Code tokens per second?

Bifrost records bifrost_stream_inter_token_latency_seconds and bifrost_stream_first_token_latency_seconds for every streamed Claude Code response, labeled by provider and model. Tokens per second is the inverse of inter-token latency, which lets teams compare how fast Anthropic, Bedrock, and Vertex AI serve the same Claude model.

Does monitoring through a gateway require changes to Claude Code?

No. Claude Code only needs ANTHROPIC_BASE_URL pointed at Bifrost and ANTHROPIC_AUTH_TOKEN set to a virtual key in settings.json. Developers keep using Claude Code the same way, and every request is logged, costed, and attributed automatically.

Getting Started with Bifrost for Claude Code Token Monitoring

Engineering organizations running Claude Code at team scale need an AI gateway that monitors token usage at request granularity, attributes spend to virtual keys, enforces hierarchical budgets, and exports data to existing observability platforms. Bifrost delivers all four in a single open-source binary that deploys with zero configuration. Teams that also want to cut consumption, not just measure it, can pair monitoring with the tactics in how to reduce Claude Code token costs, and the pillar guide to the best AI gateway for Claude Code covers routing and governance beyond monitoring.

For regulated industries and enterprise teams that need air-gapped deployment, VPC isolation, SSO integration with Okta or Entra, or RBAC for finance and platform teams, Bifrost Enterprise adds clustering, secret management with HashiCorp Vault, AWS Secrets Manager, or GCP Secret Manager, audit logs of administrative activity, and adaptive load balancing on top of the open-source core.

To see how Bifrost can centralize Claude Code token usage monitoring for your engineering organization, book a demo with the Bifrost team.