How to Track Claude API and Claude Code Costs
Short answer: in Claude Code, run /usage. Its Session block estimates what the current session has cost at list price. Put the cost.total_cost_usd field in your status line to keep that number on screen. For the actual bill, open the Console Usage page at platform.claude.com/usage, and set a ceiling under Settings > Billing > Spend limits.
TL;DR
- Built in: the
/usageSession block (for API users, with aPrompt cache (main)line; Pro and Max subscribers see plan usage bars instead), the status line cost field, the Console Usage page, and the auto-created “Claude Code” workspace with its Console dashboard. - Across sessions: FavTray shows today’s, 7-day and 30-day Claude Code cost with a per-model split, one click from your Mac menu bar. It reads your local logs and is free. ccusage does the same in the terminal.
- Caps: a Console spend limit below your tier cap, workspace spend limits with threshold alerts, and
--max-budget-usdfor scripted runs. - On Pro and Max the dollar figure is only an API-equivalent estimate. Your plan’s usage limit is what actually stops you.
This guide covers where each number comes from, what Claude’s token and cache pricing means for Claude Code, and how to set a limit that doesn’t cut you off halfway through a task. For ways to lower the bill, see how to reduce Claude Code token usage. For subscription prices, see Claude Code pricing: Pro vs Max vs API.
Where can you see what Claude Code and the Claude API cost?
Anthropic gives you four places to check spend, and local log readers add a fifth. Each answers a different question:
| Source | What it shows | Use it for |
|---|---|---|
/usage Session block | This session’s estimated cost at list price, tokens by model, prompt-cache hit rate | Deciding mid-task on an API key |
Status line cost.total_cost_usd | The same session estimate, always on screen | Keeping the number in view |
| Console Usage page | Token and request charts by model, cache rate, rate-limit headroom | The authoritative bill |
| ”Claude Code” workspace and Console dashboard | Claude Code usage kept apart from your other API work; spend and accepted lines per member | Teams on Console billing |
| Local log readers (FavTray, ccusage) | Daily, weekly and 30-day totals across every session on your machine | Running totals and trends |
What does the /usage command show?
The Session block at the top of /usage shows the current session’s token counts by model, split into input, output, cache read and cache write, with a dollar total. According to Anthropic’s Claude Code costs documentation, Claude Code computes that figure locally from token counts at list price, unless an administrator has set contracted rates through the modelPricing managed setting. It’s an estimate. Anthropic points to the Console Usage page for authoritative billing.
After the first response, the block adds a Prompt cache (main) line with the request count, the share of input tokens served from cache, cache misses, and whether the cache is still warm. The totals reset when /clear starts a new session.
The Session block is meant for API users. Pro and Max subscribers see plan usage bars, activity stats and a usage breakdown on the same screen, because their session cost isn’t what they’re billed.
How do you keep Claude Code’s cost in the status line?
Claude Code passes session data as JSON to your status line script on stdin. The cost.total_cost_usd field holds the same list-price estimate as /usage (status line docs). Save this as ~/.claude/statusline.sh and make it executable with chmod +x ~/.claude/statusline.sh. It needs jq.
#!/bin/bash
input=$(cat)
MODEL=$(echo "$input" | jq -r '.model.display_name')
COST=$(echo "$input" | jq -r '.cost.total_cost_usd // 0')
printf '[%s] $%.2f\n' "$MODEL" "$COST"
Then point ~/.claude/settings.json at it:
{
"statusLine": {
"type": "command",
"command": "~/.claude/statusline.sh"
}
}
Or run /statusline show the model and session cost and Claude Code writes the script for you.
What does the Claude Console show?
The Usage page charts tokens and requests, shows your cache rate, and has rate-limit charts (rate limits docs). This is your bill.
When someone in your organization first signs in to Claude Code with a Console account, Anthropic creates a workspace called “Claude Code”. It keeps Claude Code traffic separate from your other API workloads, and you can’t create API keys in it yourself (workspaces docs). The Console Claude Code dashboard shows spend and accepted lines of code per member.
The Console tells you what you’ve been billed. /usage, the status line or a local log reader tells you what the task in front of you is costing.
How can you track Claude Code costs across sessions on your Mac?
/usage covers one session and resets on /clear. For totals across sessions and days, read the logs Claude Code already writes: every request is recorded as JSONL under ~/.claude/projects, with the model and its input, output, cache-read and cache-write token counts.
FavTray’s AI Usage tracker reads those logs, along with $CLAUDE_CONFIG_DIR/projects, ~/.config/claude/projects and Codex’s ~/.codex/sessions, and prices every request by model at list price, cache reads and writes included. Here is what it shows:
- In the menu bar popover: an AI spend panel with today’s cost and the last seven days, by day or by model.
- In the AI Usage window: today, the last 7 days, the last 30 days, your average day and your peak day, plus a daily chart split by model.
- An honest floor: when a log contains a model that FavTray’s bundled price table doesn’t know yet, the 30-day figure is marked “Partial” with the number of unpriced tokens instead of guessing.
AI Usage is free on every plan with no daily limit. The setting is Track cost from local logs in AI Usage settings, and it’s on by default. The logs are read and priced on your Mac, and no FavTray server stores your usage.
If you’d rather stay in the terminal, ccusage is an open-source (MIT) CLI that reads the same local data. Run npx ccusage@latest daily for a per-day table. weekly, monthly and session slice the data differently, blocks tracks Claude Code’s 5-hour windows, and statusline feeds a status bar. It supports Codex and many other agent CLIs too, and prices usage from LiteLLM’s pricing data.
What does Claude Code actually cost per day?
Anthropic’s own numbers are the best benchmark. Across enterprise deployments, the average is about $13 per developer per active day and $150-250 per developer per month, and 90% of users stay below $30 per active day (Claude Code costs, checked 30 September 2026).
Here’s what pushes a session above that, from the same documentation:
- Long context. Claude Code sends the full conversation with every request, and each round of tool use is another request. With prompt caching, it re-reads that history at the cached token rate, so a one-line question late in a long session still pays for the whole conversation.
- Cache misses. Your first message after the cache lifetime has passed reprocesses the full context. On an API key, the lifetime is five minutes by default.
- Parallel work. Subagents send their own requests. Agent teams use roughly 7x the tokens of a standard session when teammates run in plan mode.
- Model and thinking. Opus left as the default costs more than Sonnet for routine work, and thinking tokens are billed as output.
The fixes (/clear between tasks, /model for simple work, tighter prompts) are covered in how to reduce Claude Code token usage.
How does Claude API token pricing work?
Claude charges per million tokens (MTok), with separate rates for input, output and prompt-cache reads. Output costs five times as much as input on every current model. Prices checked 30 September 2026 on Anthropic’s pricing page:
| Model | Input | Output | Cache read |
|---|---|---|---|
| Fable 5.1 | $10 / MTok | $50 / MTok | $0.25 / MTok (2.5% of input) |
| Opus 5.5 | $4 / MTok | $20 / MTok | $0.20 / MTok (5% of input) |
| Sonnet 5.5 | $2 / MTok | $10 / MTok | $0.20 / MTok (10% of input) |
| Haiku 4.5 | $1 / MTok | $5 / MTok | $0.10 / MTok (10% of input) |
Writing to the cache costs 1.25x the input price for the 5-minute cache and 2x for the 1-hour cache. The Batch API takes 50% off input and output.
Cache reads matter most for Claude Code, because most of a long session’s input is history read back from the cache. Anthropic’s own sample /usage output shows 1.2k input tokens, 5.3k output tokens, 940k cache-read tokens and 50k cache-write tokens for one session.
An illustration, not a measurement: resending a 200,000-token context on Sonnet 5.5 costs $0.40 at the full input price and $0.04 as a cache read. On Opus 5.5 it’s $0.80 uncached, but still $0.04 cached, because Opus 5.5’s cache reads cost the same per token as Sonnet 5.5’s.
How much text is a token? On the current tokenizer, introduced with Claude Opus 4.7, 1M tokens is roughly 555,000 words. Older models fit about 750,000 words in the same space (models overview). Anthropic says the newer tokenizer produces about 30% more tokens for the same text. For a comparison with other providers, see Claude vs. OpenAI pricing.
Do Pro and Max subscribers pay what the cost figure shows?
No. On Pro and Max, Claude Code usage is part of the subscription, so any dollar figure, whether from a status line, ccusage or FavTray, is only what those tokens would cost at API list price. It’s still useful for comparing your plan with pay-as-you-go, but what actually limits you is the plan’s 5-hour and weekly allowance. To watch that, see how Claude’s usage limits and resets work and how to see Claude Code usage limits on Mac.
How do you set a spending limit on Claude?
Where you set a limit depends on how you’re billed. Each option below is taken from Anthropic’s rate limits, workspaces, CLI reference and costs documentation, checked 30 September 2026.
1. Organization spend limit (Console billing). Go to Settings > Billing, find Spend limits, and click Adjust limit (or Set limit). Your limit can’t be higher than your tier’s monthly cap:
| Usage tier | Monthly spend cap |
|---|---|
| Start | $500 |
| Build | $1,000 |
| Scale | $200,000 |
| Custom | None (arranged with your account team) |
2. Know which error you’ve hit. The two ceilings fail in different ways, which matters if you script against the API:
- Your own limit: requests return HTTP 400
invalid_request_error, with a message starting “You have reached your specified API usage limits”. Raise or remove the limit to continue. - The tier cap: requests return HTTP 429
rate_limit_errorwitherror_code: enforced_spend_limit_reachedand noretry-afterheader. Retries, including the SDKs’ automatic ones, fail until 00:00 UTC on the 1st of next month, unless you move up a tier. Don’t retry in a loop.
3. Workspace spend limits. Under Settings > Workspaces, each workspace has a Spend limits tab. There you can cap its monthly spend and set alerts for when spending reaches certain thresholds. You can’t set limits on the Default workspace. The Claude Code workspace is the only one that supports per-user monthly spend limits, and Claude Code requests over its limit can get a 429 that carries a retry-after header.
4. Scripted Claude Code runs. --max-budget-usd stops a print-mode run once it reaches a dollar amount, and subagent spend counts toward it:
claude -p --max-budget-usd 5.00 "fix the failing test in src/auth"
5. Pro and Max usage credits. If you turn on usage credits to keep working past your plan limit, set a monthly spend limit in the Usage credits section of claude.ai Settings > Usage. Running /usage-credits in Claude Code opens the same page. When you reach the limit, Claude Code offers to raise or remove it without leaving the CLI.
Why pair a hard cap with a running total?
A cap that trips mid-task stops Claude with the job half done. The files it read and the plan it built are still in the conversation, but by the time you raise the limit or wait out the month, the prompt cache has usually expired. Your first request back then reprocesses the whole context at the full input price. So set the hard ceiling as a backstop above where you expect to land, turn on workspace threshold alerts, and keep a running total where you’ll see it, so you make the call before the cap does.
To turn a monthly budget into a daily line to watch, divide it by your working days. Example arithmetic, assuming 20 working days, not a recommendation:
| Monthly budget | Daily line (÷ 20) |
|---|---|
| $100 | $5 |
| $250 | $12.50 |
| $500 (Start tier cap) | $25 |
| $1,000 (Build tier cap) | $50 |
For comparison, Anthropic’s enterprise average of about $13 per active day falls between the second and third rows.
How do session, daily and 30-day totals help you manage spend?
Each timescale answers a different question:
- Session (
/usage, status line): is this task worth what it’s costing? If the number climbs fast,/clearand restate the task, switch to a cheaper model with/model, or narrow the prompt to specific files. - Today (FavTray’s Today figure,
ccusage daily): are you above the daily line you set from the table above? One heavy day is normal. A run of them is a pattern worth looking at. - 7 and 30 days (FavTray,
ccusage weeklyandmonthly): where will the month land? Compare your 30-day total with your Console limit. If you’re closing in on it, raise the limit on purpose or ease off, rather than let the cap decide mid-task. Your peak day tells you which day’s sessions to look at first. - By model: FavTray splits each day’s cost by model. If Opus or Fable accounts for most of it on routine work, remember that Sonnet 5.5’s input and output rates are half of Opus 5.5’s and a fifth of Fable 5.1’s.
How can teams track Claude Code spend?
On Console billing, admins get the Claude Code workspace, its spend limits, and the Console dashboard of spend and accepted lines per member. The Claude Code Analytics API returns the same daily per-user metrics programmatically with an Admin API key. OpenTelemetry export works on every setup, including Amazon Bedrock, Google Cloud and Microsoft Foundry. Anthropic describes it as the only option that streams per-user token and cost metrics into your own observability stack in near real time. If your team also pays for OpenAI, Cursor or Copilot, see how to track total AI spending across tools.
How do you start tracking Claude costs today?
- Run
/usagein your current Claude Code session to see its estimated cost and cache hit rate. - Add the status line script above so the session cost stays on screen.
- In the Console, set a spend limit under Settings > Billing, and add a spend limit with threshold alerts on the Claude Code workspace.
- For daily and 30-day totals with a per-model split, download FavTray and open AI Usage, or run
npx ccusage@latest daily.
FavTray’s AI Usage is free. The rest of the app comes with a one-time Lifetime licence (see pricing). For a wider look at monitoring tools, see our roundup of AI usage tracking tools. Once you can see the spend, reducing Claude Code token usage is the next step.
Frequently Asked Questions
How do I check how much I've spent on Claude?
For the authoritative API bill, open the Usage page in the Claude Console at platform.claude.com/usage. Inside Claude Code, run /usage: its Session block estimates the current session's cost at list price, and the status line can show the same figure through the cost.total_cost_usd field. For a running total across sessions and days, read Claude Code's local logs with a tool such as FavTray (Mac menu bar, free) or ccusage (terminal).
How much does Claude Code cost per day?
Anthropic's figures from enterprise deployments put the average at about $13 per developer per active day and $150-250 per developer per month, with 90% of users staying below $30 per active day (Claude Code costs documentation, checked 30 September 2026). Long sessions that are never cleared, Opus left as the default model, and parallel agents push individual days higher.
How do I set a spending limit on the Claude API?
In the Claude Console, go to Settings > Billing and use Spend limits to set a monthly limit below your tier's cap (Start $500, Build $1,000, Scale $200,000; Custom has none). When you reach your own limit, requests return HTTP 400 invalid_request_error. When you reach the tier cap, they return HTTP 429 rate_limit_error with the error code enforced_spend_limit_reached until 00:00 UTC on the 1st. Workspaces, including the Claude Code workspace, can have their own spend limits and threshold alerts.
Do Pro and Max subscribers pay the cost that /usage shows?
No. On Pro and Max, Claude Code usage is included in the subscription, so a dollar figure is only what the same tokens would cost at API list price. The real constraint is the plan's 5-hour and weekly usage limit. You only pay per use if you turn on usage credits, which have their own monthly spend limit in claude.ai Settings > Usage.
How does prompt caching change what Claude Code costs?
Claude Code resends the whole conversation with every request, and prompt caching bills most of that repeated history at the cache-read rate: 10% of the base input price, 5% on Opus 5.5 and 2.5% on Fable 5.1. A cache miss, such as the first message after the cache lifetime expires (five minutes by default on an API key), reprocesses the full context at the normal input price plus a cache-write premium.
Does FavTray send my usage data to the cloud?
No FavTray server stores your usage. FavTray reads Claude Code's log files in ~/.claude/projects on your Mac and calculates costs on-device. Plan-limit readings, such as your 5-hour and weekly percentages, come from Anthropic's own API.
Is Claude Code pricing different from the Claude API?
With Console (API) billing, Claude Code is charged at the same per-token rates as direct API calls. It tends to use more tokens than a chat because each turn carries file contents, tool results and the conversation so far. Pro, Max, Team and Enterprise plans work differently: usage draws from a plan allowance instead of being billed per token.