Monitor Claude Code Usage and Costs

Monitor Claude Code Usage and Costs

Claude Code usage monitoring comes down to three tools: the /usage command for a quick check, analytics dashboards for teams, and OpenTelemetry for raw numbers you send to your own system. Each one answers a different question, so you rarely need all three.

This guide shows you how to read each one, what the numbers mean, and how to turn on a real metrics feed in under a minute. We read the official usage and cost docs, then ran a real test with the OpenTelemetry console exporter and show its actual output below.

This is Part 8 of 10 in our Advanced Claude Code series, part of our Claude Code tutorials. Last time, we covered prompt caching.

Tested with Claude Code v2.1.312 on October 31, 2026. We tested on macOS; the Windows and Linux steps follow Anthropic’s official instructions.

Quick Summary: Three Ways to Monitor Claude Code

ToolBest forWhat you get
/usageOne person, right nowSession cost, token totals, cache stats and plan usage
Analytics dashboardsTeams on Claude plans or the ConsoleSpend and activity per user, with CSV export
OpenTelemetryAdmins who want raw dataMetrics and events sent to your own collector
Decision ladder showing when to use the usage command, analytics dashboards or OpenTelemetry
Pick the level that matches who you are and how much detail you need

Why Claude Code Usage Monitoring Matters

Claude Code sends your whole conversation with every request. So a long session costs more per message than a fresh one, even when your question is short.

The official costs page gives a rough yardstick. Across enterprise deployments, the average is around $13 per developer per active day and $150 to $250 per developer per month, and 90 percent of users stay under $30 per active day.

Official costs page paragraph with the average daily and monthly cost per developer highlighted in a red box
The docs give a baseline, and tell teams to run a small pilot to find their own

Your numbers will differ. The docs say costs vary with model choice, codebase size and habits like running several instances at once. Measuring beats guessing.

Option 1: Check Your Own Usage With /usage

Type /usage inside Claude Code. The top of the screen is the Session block, which shows the cost and token totals for the current session.

Official docs example of the usage session block with total cost, durations, code changes and usage by model highlighted
The Session block lists cost, time, code changes and tokens by model

According to the docs, Claude Code works out the dollar figure on your machine from token counts at list price. It is an estimate. For authoritative billing, look at the Usage page in the Claude Console.

The totals reset when /clear starts a new session, so the next session starts at $0. Before v2.1.211 they kept adding up across /clear.

A Note for Subscribers

If you are on Pro, Max or Ultra, usage is included in your subscription. The docs say the session cost figure is not relevant for billing in that case. You will see plan usage bars and a breakdown instead.

We chose not to screenshot our own /usage screen, because it lists account details. The screenshots here come from the official docs instead.

Prompt Cache Line

After the first response, the Session block also adds a Prompt cache (main) line. It shows the request count, the share of input tokens served from cache, cache misses, and whether the cache is warm. The docs say it needs v2.1.251 or later and covers the main conversation only, not subagents.

A high cache share is good news, because cached tokens are cheaper. Our prompt caching guide explains why a miss makes the next message cost more.

Plan Usage Breakdown and the Fix Shortcut

On a plan, /usage also shows what counts against your limits. The docs describe three parts:

  • Attribution, which splits recent usage across skills, subagents, plugins and individual MCP servers as percentages.
  • Recommendations, one per row, each with a share of at least 10 percent of your recent usage.
  • Loops, a row for each heavy /loop or other scheduled task (v2.1.242 or later).
Official docs section on plan usage breakdown with the attribution bullet highlighted in a red box
Attribution shows which skills, subagents, plugins and MCP servers used your plan

Press d or w to switch between the last 24 hours and the last 7 days. The figures are approximate and come from local session history, so usage from other devices or claude.ai is not included.

When the footer says something like f to fix 2 of 3, press f (v2.1.305 or later). Claude Code runs any /effort command shown in a row and asks Claude to walk you through the other fixes, showing each change before it makes it. Rows that end in run /compact are left for you to run yourself.

If /usage Fails to Load

Sometimes the plan limits request fails, usually because the endpoint is rate limited. The docs say /usage then shows the last bars it loaded within the past 60 minutes, plus a note saying how old they are. Press r to retry.

A message like “rate limited until 3:14am” means Claude Code cannot fetch your plan limits until then. It does not mean your work with Claude is blocked.

The Token Count Beside the Spinner

While Claude works, the spinner line can end with something like (10m 27s · ↓ 5.5k tokens). That is a live, approximate count of the output the current turn has produced. It leaves out your prompt and history, and it resets at the start of each turn, so it will not match the session totals.

Look at Habits With /insights

The /insights command answers a different question. It writes an HTML report about how you work: what you build, where friction shows up, and tips. The docs say it saves the latest report at ~/.claude/usage-data/report.html and analyzes up to 200 new sessions per run.

Option 2: Team Dashboards and Spend Limits

If you manage a team, the same costs page splits the options by plan. On Team and Enterprise, the spend report in org analytics shows estimated spend per user and per model, with CSV export, updated daily. A separate dashboard shows daily active users and sessions.

You can cap spend by turning on usage credits and setting limits at the organization, group or member level. On the Console, the dashboard shows spend and accepted lines per member, and an Analytics API returns the same daily numbers.

One catch is worth knowing. On Amazon Bedrock, Google Cloud and Microsoft Foundry, Claude Code is billed through your cloud account, and Anthropic’s dashboards do not cover that usage. For per-user numbers there, the docs point to OpenTelemetry, a Claude apps gateway or an LLM gateway.

Option 3: Export Real Metrics With OpenTelemetry

OpenTelemetry (OTel) is a standard way to export metrics. The monitoring page says Claude Code exports metrics as time series, events through the logs protocol, and optional traces in beta.

The quick start uses environment variables. Only CLAUDE_CODE_ENABLE_TELEMETRY=1 is required to switch it on, and you then pick where the data goes.

Official monitoring docs quick start block with the telemetry environment variables highlighted in a red box
The official quick start lists every variable you need for an OTLP setup
VariableWhat it does
CLAUDE_CODE_ENABLE_TELEMETRYTurns telemetry on. Required
OTEL_METRICS_EXPORTERWhere metrics go: otlp, prometheus, console or none
OTEL_LOGS_EXPORTERWhere events go: otlp, console or none
OTEL_METRIC_EXPORT_INTERVALExport interval in milliseconds. The default is 60000
OTEL_EXPORTER_OTLP_ENDPOINTThe collector address, such as http://localhost:4317

Try It Without a Collector: The Console Exporter

You do not need any server to see the data. The docs show a console setup for debugging with a one-second export interval.

Official docs example configuration for console debugging with the three export variables highlighted
Three variables are enough to print metrics straight to your terminal
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=console
export OTEL_METRIC_EXPORT_INTERVAL=1000
claude -p "Reply with the single word hi"

We ran exactly that in a throwaway demo folder. The reply was one word, followed by a block of metrics. Four metrics appeared: a session count, a cost, a token count and an active time.

Terminal output listing four Claude Code metric names with their units
Real console output: session count, cost in USD, tokens and active time in seconds

Next we looked at the values. The cost metric reported 0.108792 USD for that one tiny prompt, about 11 cents. The token metric split into four types: input 2, output 4, cacheRead 0 and cacheCreation 27187.

Terminal output showing the cost value and the four token types with their values
One short prompt wrote 27,187 tokens to the cache, which is where most of the cost came from

This shows something useful. Even a one-word answer carries a large starting context, so a short prompt is not free. Our run is one demo on one day, so treat the exact numbers as an example, not a benchmark.

Another point: the raw console output also contained identity attributes such as a user id and account details. We filtered those out of the screenshots with grep. Treat telemetry output as sensitive before you paste it anywhere.

The Metrics You Get

The docs list eight metrics. Here is what each one counts.

MetricWhat it countsUnit
claude_code.session.countCLI sessions startednone
claude_code.lines_of_code.countLines of code modifiednone
claude_code.pull_request.countPull requests creatednone
claude_code.commit.countGit commits creatednone
claude_code.cost.usageCost of the sessionUSD
claude_code.token.usageTokens usedtokens
claude_code.code_edit_tool.decisionPermission decisions on code editsnone
claude_code.active_time.totalTotal active times

For cost work, the docs suggest breaking claude_code.token.usage down by token type, user, team, model, skill, plugin or agent. They also warn that cost metrics are approximations, so official billing data lives with your API provider.

Send It to a Real Backend

When you are ready, switch the exporter to otlp and set a protocol and endpoint. Claude Code has no default protocol, so the docs say to set OTEL_EXPORTER_OTLP_PROTOCOL to grpc, http/json or http/protobuf.

export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317

To confirm it works, check your backend for claude_code.session.count, which Claude Code emits when a session starts. If nothing arrives, start Claude Code with claude --debug-file <path> and look for lines marked [3P telemetry].

Admins can set these variables for everyone in the managed settings file. The docs also say Claude Code ignores the OTel exporter variables in a repository’s .claude/settings.json, so a project cannot switch telemetry on by itself.

What Stays Private by Default

Prompt text is redacted unless you set OTEL_LOG_USER_PROMPTS=1. Tool details and raw API bodies are also off by default, each behind its own variable. Turn those on only when you have a clear reason and a secure backend.

How to Keep Costs Down Once You Can See Them

Monitoring only helps if you act on it. The costs page lists the habits that matter most:

  • Use /clear between unrelated tasks, since stale context is re-sent with every message.
  • Match the model to the job instead of leaving the biggest one as the default.
  • Disable MCP servers you are not using. Our MCP guide shows how.
  • Use plan mode for complex work, so Claude does not build the wrong thing first.
  • Keep agent teams small, because each teammate has its own context window.

The docs also explain why usage climbs in a long session. Scheduled tasks fire even while the session is idle, and your first message after a long break misses the cache. Our guide to the context window covers how to keep that history small.

Try It Yourself

Run this in a throwaway folder, never a real project. It prints real metrics to your terminal without any collector.

mkdir ~/usage-test
cd ~/usage-test
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=console
export OTEL_METRIC_EXPORT_INTERVAL=1000
claude -p "Reply with the single word hi" > out.txt 2>&1
grep -E 'name: "claude_code|value:' out.txt

Do not paste out.txt anywhere before you read it, because it holds account identifiers. Then open Claude Code normally and run /usage to compare the session view with the metrics.

Common Mistakes

  • Trusting the session cost for billing. The docs call it an estimate, and subscribers should ignore it for billing.
  • Forgetting the protocol. Claude Code has no default OTLP protocol, so an otlp exporter without one will not work.
  • Putting telemetry variables in a repo’s .claude/settings.json. Claude Code ignores them there.
  • Leaving a one-second export interval on in production. The docs say to reset it, and the default is 60 seconds.
  • Pasting raw telemetry into a ticket or chat. It can include user and account identifiers.
  • Expecting the dashboards to cover Bedrock, Vertex or Foundry usage. They do not.

Pro Tips

  • Press w in /usage to see a week at a time, and d to compare it with today.
  • Press f when the footer offers fixes, and read each change before you accept it.
  • Watch the Loops rows. A scheduled task that fires every few minutes sends your full context each time.
  • Run a small pilot first, as the docs advise, before you set team budgets.
  • Our status line guide shows how to keep the session cost visible all day.

Check yourself with /usage, check your team with dashboards, and export the raw numbers with OpenTelemetry.

Cheat Sheet

Cheat sheet card with usage commands and OpenTelemetry quick start variables
Save this card for the next time you need to check usage or set up telemetry

Frequently Asked Questions

How do I check my Claude Code usage?

Type /usage inside a session. It shows the session cost and tokens, and on a plan it adds usage bars and a breakdown by skill, subagent, plugin and MCP server.

How much does Claude Code cost per day?

The docs say the average across enterprise deployments is around $13 per developer per active day. 90 percent of users stay below $30 per active day. Your own cost depends on model, codebase and habits.

Is the cost shown in /usage my real bill?

No. Claude Code computes it locally from token counts at list price, so it is an estimate. Check the Usage page in the Claude Console for authoritative billing.

How do I enable OpenTelemetry in Claude Code?

Set CLAUDE_CODE_ENABLE_TELEMETRY=1, choose an exporter such as OTEL_METRICS_EXPORTER=console, and run claude. For a real collector, also set the protocol and endpoint.

Does Claude Code send my prompts in telemetry?

Not by default. The docs say prompt content is redacted unless you set OTEL_LOG_USER_PROMPTS=1.

Conclusion

Good Claude Code usage monitoring starts small: run /usage to see your session, use the analytics dashboards if you manage a team, and turn on OpenTelemetry when you need raw numbers in your own tools. Our test showed a single one-word prompt costing about 11 cents, mostly from a large cache write, which is a good reminder to clear context between tasks. Treat every dollar figure as an estimate and remember that telemetry output can hold account details. For more background, see our Claude AI overview.

Previous in the series: Part 7: Save Money With Prompt Caching in Claude Code

Next in the series: Part 9: Run Claude Code Safely in a Devcontainer.

Newsletter

New AI tools in your inbox

The best new tools and the AI news that matters, in one short email. Unsubscribe any time.

Free · No spam · Unsubscribe any time

✓ Looks like you’re subscribed

Loading Google’s sign-up form…

Looks like you’re already subscribed

Thanks for reading! New AI tools and the AI news that matters will land in your inbox.

Not subscribed yet? Refresh the page to load the sign-up form.

The sign-up form couldn’t load. If you use an ad or content blocker, allow news.google.com and reload the page.

Free instant check before you pay. Takes a few seconds.

Scroll to Top