AI & Agents

How to Track Claude Code Usage, Costs, and Token Limits

The average Claude Code deployment costs $13 per developer per active day, but that number swings wildly based on model selection, context size, and how many sessions run in parallel. This guide walks through every tool Anthropic provides to track those costs, from the /usage command in your terminal to team analytics dashboards, OpenTelemetry pipelines, and workspace spend caps. You will also learn practical techniques to cut token consumption without sacrificing productivity.

Fast.io Editorial Team 13 min read
Tracking usage starts with visibility into every session and token.

What Claude Code Actually Costs

Across enterprise deployments, the average Claude Code cost is roughly $13 per developer per active day and $150 to $250 per developer per month, with 90% of users staying below $30 per active day. Those figures come directly from Anthropic's cost management documentation, not from third-party estimates. The variance is large because costs depend on three things: which model you run, how big your codebase context is, and whether you run multiple instances or automation.

Claude Code charges by API token consumption. If you are on a Pro ($20/month) or Max (from $100/month) subscription, usage is bundled into your plan with rate limits rather than per-token billing. The Max plan offers 5x or 20x the usage of Pro, depending on the tier you choose. Team plans run $20 to $100 per seat per month, with premium seats getting 5x more usage than standard seats. Enterprise pricing is custom.

For API users paying per token, costs scale with context window size. Every message you send includes your system prompt, conversation history, tool definitions, and file contents Claude has read. A session that has read 15 files and accumulated a long conversation history sends far more tokens per request than a fresh session with a single targeted prompt.

The distinction between subscription and API billing matters for how you read the /usage screen. Subscribers see plan usage bars and activity stats. API users see dollar estimates computed from token counts. Both groups benefit from the same monitoring and optimization tools.

Helpful references: Fast.io Workspaces, Fast.io Collaboration, and Fast.io AI.

How to Check Your Current Usage

The fast way to see where your tokens are going is the /usage command. Type it in any Claude Code session, whether you are in the terminal CLI or the VS Code extension.

The Session block at the top shows your current session stats:

Total cost:            $0.55
Total duration (API):  6m 19.7s
Total duration (wall): 6h 33m 10.2s
Total code changes:    0 lines added, 0 lines removed

That dollar figure is an estimate computed locally from token counts and published per-token rates. It may differ from your actual bill. For authoritative billing numbers, check the Usage page in the Claude Console at platform.claude.com/usage.

On Pro, Max, Team, or Enterprise plans, /usage also breaks down what counts against your plan limits. It attributes recent usage to skills, subagents, plugins, and individual MCP servers, each shown as a percentage of the total. Press d to see the last 24 hours or w to switch to the last 7 days. The numbers come from local session history on your current machine, so usage from other devices or claude.ai sessions is not included.

In the VS Code extension (v2.1.174 or later), the same breakdown appears in the Account & Usage dialog with a Day/Week toggle. This gives you the same visibility without leaving your editor.

Continuous monitoring with the status line

If you want to see token usage without running a command, configure the Claude Code status line to display context window usage continuously. This is especially useful during long sessions where context can grow without you noticing. Run /config and look for the status line settings, or add context-window-usage to your status line configuration.

Background token usage

Claude Code uses a small number of tokens in the background even when you are not actively prompting. Conversation summarization for the claude --resume feature and some internal commands like /usage itself generate API requests. This background consumption is typically under $0.04 per session.

AI-powered audit and summary interface showing usage analytics

Setting Spending Limits and Budget Controls

Anthropic provides different budget controls depending on whether you pay per token through the API or use a subscription plan.

API workspace spend limits

If your team uses the Claude API, admins can set workspace spend limits in the Claude Console at platform.claude.com. When you first authenticate Claude Code with your Console account, a workspace called "Claude Code" is automatically created. This workspace provides centralized cost tracking for all Claude Code usage in your organization. You cannot create API keys for this workspace because it exists exclusively for Claude Code authentication and usage tracking.

Admins can view cost and usage reporting in the Console and set caps on total workspace spend. For organizations with custom rate limits, Claude Code traffic in this workspace counts toward your organization's overall API rate limits. You can set a workspace rate limit on the workspace's Limits page to cap Claude Code's share and protect other production workloads from being starved.

Subscription spend limits

On Pro and Max plans, run the /usage-credits command to set a monthly spend limit on usage credits. If you hit the limit while credits are still available, Claude Code prompts you to raise or remove it so you can keep working. Changing the limit requires billing access on the account.

Rate limit recommendations by team size

When rolling out Claude Code to a team, Anthropic recommends these per-user Token Per Minute (TPM) allocations:

  • 1 to 5 users: 200k to 300k TPM per user
  • 5 to 20 users: 100k to 150k TPM per user
  • 20 to 50 users: 50k to 75k TPM per user
  • 50 to 100 users: 25k to 35k TPM per user
  • 100 to 500 users: 15k to 20k TPM per user
  • 500+ users: 10k to 15k TPM per user

The per-user allocation decreases as team size grows because fewer users tend to be active simultaneously in larger organizations. These limits apply at the organization level, not per individual, so one developer can temporarily burst above their calculated share when teammates are idle.

Fastio features

Keep your agent outputs in one place

Fast.io gives every agent workspace storage with built-in semantic search and an MCP server. Stop regenerating files across sessions. Starts with a 14-day free trial.

Team Analytics and Usage Dashboards

Claude Code offers two analytics dashboards depending on your plan type. Both track adoption and usage, but they surface different metrics.

Team and Enterprise dashboard

Navigate to claude.ai/analytics/claude-code. Admins and Owners see:

  • Usage metrics: lines of code accepted, suggestion accept rate, daily active users, and session counts
  • Contribution metrics: PRs and lines of code shipped with Claude Code assistance, powered by a GitHub integration
  • Leaderboard: top 10 contributors ranked by Claude Code usage, with CSV export for all users
  • Adoption chart: daily active users and sessions over time

Contribution metrics require installing the Claude GitHub app on your organization's GitHub account and enabling analytics in the admin settings. Once connected, the system analyzes merged pull requests to determine which code was written during a Claude Code session. PRs with at least one assisted line get a claude-code-assisted label in GitHub automatically.

The attribution is conservative. Only code where there is high confidence in Claude Code's involvement gets counted. Code substantially rewritten by developers (more than 20% different) is not attributed to Claude Code. Lock files, generated code, build artifacts, and lines over 1,000 characters are excluded from analysis.

API customer dashboard

API customers access analytics at platform.claude.com/claude-code. The Console dashboard shows:

  • Lines of code accepted and suggestion accept rate
  • Activity: daily active users and sessions on a chart
  • Spend: daily API costs in dollars alongside user count
  • Team insights table: per-user spend and accepted lines for the current month

The spend figures in the Console are estimates for analytics purposes. For actual costs, check your billing page.

Querying attribution data programmatically

If you want to pull Claude Code contribution data into your own reporting, search GitHub for PRs labeled claude-code-assisted. This label is applied automatically when contribution metrics are enabled, giving you a stable query target for custom dashboards or engineering velocity reports.

AI agent collaboration and sharing interface

Enterprise Monitoring with OpenTelemetry

For organizations that need to pipe Claude Code metrics into their existing observability stack, Anthropic supports OpenTelemetry (OTel) export. This lets you send metrics, logs, and traces to Datadog, Grafana, New Relic, or any OTel-compatible backend.

The setup is environment-variable driven:

export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=otlp
export OTEL_LOGS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer your-token"

Metrics export at 60-second intervals by default, and logs export every 5 seconds. You can shorten these intervals during setup for debugging, but reset them for production use to avoid unnecessary overhead.

OTel export gives you per-user token counts and cost estimates that the built-in analytics dashboards do not surface as granularly. This is particularly useful for organizations running Claude Code through Bedrock, Vertex, or Foundry, where Claude Code does not send metrics from your cloud by default. Several large enterprises have reported using LiteLLM as an open-source proxy to track spend by API key in these environments.

What gets exported

The telemetry pipeline exports:

  • Metrics: time-series data covering token usage, latency, and operational stats
  • Logs/Events: structured events for tool invocations, session lifecycle, and errors
  • Traces (beta): distributed traces via the OpenTelemetry traces protocol

Operational telemetry does not include your code or file paths. It covers latency, reliability, and usage patterns only.

Practical Ways to Reduce Token Costs

Token costs scale with context size. Every message Claude processes includes your system prompt, conversation history, tool definitions, and every file it has read in the session. Here are the most effective ways to shrink that context.

Clear between tasks

Run /clear when switching to unrelated work. Stale context from a previous task wastes tokens on every subsequent message. Use /rename before clearing so you can find the session later with /resume.

Pick the right model for the job

Sonnet handles most coding tasks well and costs less than Opus. Reserve Opus for complex architectural decisions or multi-step reasoning. Use /model to switch mid-session. For subagent tasks that do not need deep reasoning, specify model: haiku in your subagent configuration.

Move specialized instructions out of CLAUDE.md

Your CLAUDE.md file loads into context at the start of every session. If it contains detailed instructions for specific workflows like PR reviews or database migrations, those tokens are present even when you are doing unrelated work. Move specialized instructions into skills that load on demand only when invoked. Aim to keep CLAUDE.md under 200 lines.

Delegate verbose operations to subagents

Running tests, fetching documentation, or processing log files can balloon your context. Delegate these to subagents so the verbose output stays in the subagent's context and only a summary returns to your main conversation.

Use hooks to preprocess data Instead of having Claude read a 10,000-line log file to find errors, write a PreToolUse hook that greps for ERROR and returns only matching lines. This can reduce context from tens of thousands of tokens to hundreds. The hook runs before Claude sees the data, so you save tokens at the source.

Write specific prompts

"Improve this codebase" triggers broad file scanning across your entire project. "Add input validation to the login function in auth.ts" lets Claude work with minimal file reads. The more specific your request, the fewer tokens Claude spends exploring.

Use plan mode for complex tasks

Press Shift+Tab to enter plan mode before implementation. Claude explores the codebase and proposes an approach for your approval before writing code. This prevents expensive re-work when the initial direction is wrong, which is one of the biggest sources of wasted tokens.

Manage agent team costs

Agent teams spawn multiple Claude Code instances, each with its own context window. Token usage scales roughly proportionally with team size. Use Sonnet for teammates, keep teams small, and shut down teammates when their work is done. Agent teams use approximately 7x more tokens than standard sessions when teammates run in plan mode.

Storing agent outputs for collaboration

When your Claude Code sessions produce files, reports, or code artifacts that need to be shared with teammates or other agents, a persistent workspace prevents duplication. Rather than regenerating the same analysis in separate sessions, store outputs once and reference them. Fast.io provides shared workspaces where agents and humans collaborate on the same files, with Intelligence Mode for semantic search and an MCP server that any Claude Code session can connect to, and every org starts with a 14-day free trial. This means one agent's output becomes immediately available to the rest of the team, whether they are working through the API, the CLI, or the web UI, without re-running expensive token-heavy operations.

Frequently Asked Questions

How much does Claude Code cost?

Claude Code is included in Pro ($20/month), Max (from $100/month), Team ($20-$100/seat/month), and Enterprise plans. API users pay per token based on the model they select. Anthropic reports that the average enterprise deployment costs about $13 per developer per active day, or $150 to $250 per developer per month.

How do I check my Claude Code usage?

Type /usage in any Claude Code session to see token counts, estimated costs, and a breakdown by skills, subagents, and MCP servers. Press d for daily or w for weekly views. In VS Code, open the Account & Usage dialog for the same data. For authoritative billing, visit the Usage page in the Claude Console at platform.claude.com/usage.

Can I set spending limits on Claude Code?

Yes. API users can set workspace spend limits in the Claude Console. Subscription users on Pro and Max plans can run /usage-credits to set a monthly spend limit on usage credits. Admins can also set per-workspace rate limits to cap Claude Code's share of the organization's overall API rate limits.

How do I track Claude Code costs for my team?

Team and Enterprise plans have an analytics dashboard at claude.ai/analytics/claude-code showing usage metrics, contribution metrics, and a leaderboard. API customers see spend tracking and per-user cost breakdowns at platform.claude.com/claude-code. For deeper monitoring, enable OpenTelemetry export to pipe metrics into Datadog, Grafana, or any OTel-compatible backend.

What is the difference between /usage and the analytics dashboard?

The /usage command shows your individual session stats computed from local data on your current machine. The analytics dashboard aggregates usage across your entire team or organization, including contribution metrics from GitHub. Use /usage for personal cost awareness and the dashboard for organizational reporting.

Does Claude Code use tokens when I am not actively prompting?

Yes, but minimally. Background processes like conversation summarization for the resume feature and some internal commands generate small API requests. This typically costs under $0.04 per session.

How can I reduce Claude Code costs without losing productivity?

The biggest wins come from clearing context between unrelated tasks with /clear, using Sonnet instead of Opus for routine work, moving specialized CLAUDE.md instructions into on-demand skills, delegating verbose operations to subagents, and writing specific prompts that minimize file scanning.

Related Resources

Fastio features

Keep your agent outputs in one place

Fast.io gives every agent workspace storage with built-in semantic search and an MCP server. Stop regenerating files across sessions. Starts with a 14-day free trial.