← Blog AI Cost Management

How to Track Your Claude API Costs: A Developer's Guide

By Akash Rajagopal ·

How to Track Your Claude API Costs: A Developer’s Guide

If you use Claude for coding, writing, or analysis, your API bill is probably higher than you think. Anthropic’s usage-based pricing means costs scale with how much you use — and most developers have no visibility into what each session actually costs until the monthly invoice arrives.

This guide covers everything you need to know about tracking Claude API costs: what Anthropic gives you out of the box, where the gaps are, and how to get real-time local monitoring with tools like FavTray.

Why does tracking Claude API costs matter?

Claude API costs can quietly escalate to hundreds of dollars per month without deliberate monitoring. According to a 2025 Andreessen Horowitz survey, 58% of developers underestimated their monthly AI API spending by more than 30% (a16z, “The State of AI in Enterprise,” 2025). The usage-based pricing model means a single heavy coding session can cost more than an entire week of light use.

The core problem is unpredictability. Unlike fixed-price subscriptions, API costs depend on token volume — and token volume depends on context window size, conversation length, and how many iterations you need. A 10-minute Claude Code session that touches a large codebase might use 200K tokens, costing $3-5 in a single interaction.

Developers who track costs in real time consistently spend 25-40% less than those who only check monthly invoices. The reason is behavioral: when you can see the cost accumulating during a session, you naturally make smarter decisions about when to use expensive models versus cheaper alternatives.

What does Anthropic’s billing dashboard show you?

Anthropic’s console at console.anthropic.com provides a monthly billing overview showing total spend, token counts by model, and daily aggregates. It updates roughly every few hours rather than in real time, and it does not break costs down by session, project, or task.

The dashboard gives you three main data points: total tokens consumed (split by input and output), total cost for the billing period, and a daily bar chart. This is useful for month-end accounting but nearly useless for real-time decision-making. If you’re in the middle of a coding session and want to know whether this particular refactoring task has already cost $8, the Anthropic dashboard can’t tell you.

There’s also no alerting system built in beyond a hard spending cap. You either set a maximum monthly limit (and get cut off when you hit it) or you don’t — there’s no “warn me at 80%” option native to the platform.

For teams, the dashboard shows aggregate usage but doesn’t break down spending by individual developer or project. This makes cost attribution nearly impossible without external tooling.

How can you track Claude costs locally on your Mac?

FavTray reads the local log files that Claude stores in ~/.claude/ on your Mac, calculates token costs using current API pricing, and displays running totals directly in your macOS menu bar. No data ever leaves your machine.

Here’s how the local tracking pipeline works. When you use Claude Code or the Claude API through a local client, conversation logs are written to ~/.claude/ in JSON format. These logs contain token counts for each request and response. FavTray monitors these files in real time, applies the current per-token pricing for each model, and maintains running session, daily, and weekly totals.

The key advantage of local tracking is immediacy and granularity. You see costs update as they happen — not hours later on a web dashboard. And because FavTray processes the raw log data, it can show you breakdowns that Anthropic’s dashboard never will:

  • Per-session costs: How much did this specific coding session cost?
  • Per-model splits: How much went to Claude 3.5 Sonnet versus Claude 3 Opus?
  • Time-of-day patterns: When do you spend the most?

The ~/.claude/ directory structure contains JSON files with conversation metadata including model used, input tokens, output tokens, and timestamps. FavTray parses these without modifying them — it’s read-only access to data already on your disk.

How do per-session, daily, and weekly views help manage spending?

Per-session tracking shows you the cost of your current working task so you can decide in real time whether to continue, switch models, or take a different approach. Daily totals reveal spending patterns, and weekly aggregates help you stay within monthly budgets.

Per-session view is the most actionable. When you’re refactoring a complex module and the session cost hits $12, you can make an informed choice: is this refactoring worth continuing at this rate, or should you switch to a cheaper model for the remaining work? Without per-session visibility, you’d never know until the monthly bill arrived.

Daily totals expose patterns you can optimize around. Many developers discover that their first session of the day is the most expensive because they’re loading large codebases into context. After seeing this data in FavTray, you might decide to start with a focused task using a smaller context window.

Weekly spending with trend lines lets you project your monthly bill mid-month. If you’re averaging $45/week and your budget is $150/month, you know by week two whether you need to adjust.

How do you set effective budget alerts?

Set your daily alert at your monthly budget divided by working days (typically 20-22), and set your weekly alert at 25% of your monthly budget. FavTray triggers macOS notifications when you cross these thresholds, giving you time to adjust before costs compound.

The most effective alert strategy uses three tiers:

  1. Soft daily alert at 70% of your daily target — a gentle reminder to be cost-conscious for the rest of the day
  2. Hard daily alert at 100% of your daily target — time to switch to cheaper models or stop API use
  3. Weekly trend alert when your weekly pace exceeds your monthly budget trajectory

For example, if your monthly Claude budget is $200, your daily target is roughly $10 (assuming 20 working days). Set soft alerts at $7 and hard alerts at $10. Your weekly alert would fire at $50.

The critical thing about alerts is timing. Getting notified at $10 when you’ve already committed to a $15 session is less useful than getting notified at $7 while you can still change course. FavTray’s approach of showing real-time costs in the menu bar means you often catch high-spend sessions before any alert fires — the ambient visibility alone changes behavior.

What are typical Claude Code cost patterns?

Most Claude Code users see a bimodal spending pattern: many small sessions under $1 for quick questions and completions, and occasional large sessions of $5-20 for complex refactoring, debugging, or code generation tasks. The large sessions account for roughly 70% of total spend.

Here’s a breakdown of typical Claude Code costs by task type:

Task TypeAvg. TokensApprox. CostFrequency
Quick question / completion2K-8K$0.05-0.3015-25/day
Code review / explanation10K-30K$0.30-1.003-5/day
Feature implementation30K-100K$1.00-4.001-3/day
Large refactoring session100K-300K$4.00-15.001-2/week
Debugging complex issue50K-200K$2.00-10.002-4/week

The pattern most developers don’t realize until they start tracking: it’s not the quantity of interactions that drives cost, it’s the context window size of the expensive sessions. A single debugging session where you paste in 3,000 lines of code and iterate 8 times can cost more than an entire day of quick questions.

FavTray makes this visible by breaking costs down per-session so you can see exactly which work patterns are most expensive. Developers who track this data typically find one or two recurring task types that account for the majority of their spend — and once identified, those are the tasks worth optimizing.

How does Claude’s token pricing actually work?

Claude uses per-token pricing with separate rates for input tokens (what you send) and output tokens (what Claude generates). As of early 2026, Claude 3.5 Sonnet charges $3 per million input tokens and $15 per million output tokens. Claude 3 Opus charges $15/$75 per million tokens respectively.

Understanding the input/output split matters because they’re priced very differently. Output tokens on Sonnet cost 5x more than input tokens. This means a session where Claude generates long responses (code generation, detailed explanations) costs significantly more per token than a session where you send long prompts but get short answers.

Current Claude model pricing (early 2026):

ModelInput (per 1M tokens)Output (per 1M tokens)
Claude 3.5 Sonnet$3.00$15.00
Claude 3.5 Haiku$0.80$4.00
Claude 3 Opus$15.00$75.00
Claude 4 Sonnet$3.00$15.00

One million tokens is roughly 750,000 words — but in practice, code is less token-efficient than prose due to special characters and formatting. A 1,000-line Python file might use 8,000-12,000 tokens depending on complexity.

For a practical reference on how these costs compare to other providers, see our Claude vs. OpenAI pricing comparison. And if you’re looking at the full landscape of tools to monitor these costs, check out our roundup of AI usage tracking tools.

How can you get started tracking Claude costs today?

Install FavTray from favtray.com, enable the AI Usage Tracker in settings, and your Claude costs will appear in your macOS menu bar within seconds. No configuration needed — it automatically finds and reads your ~/.claude/ logs.

The setup is intentionally minimal:

  1. Download FavTray and drag it to Applications
  2. Launch it — it appears in your menu bar
  3. Open settings and enable AI Usage Tracker
  4. Your Claude costs appear immediately if you have existing logs

From there, you can configure daily and weekly budget alerts, choose which cost view to show in the menu bar (session, daily, or weekly), and start building a picture of your actual spending patterns.

The first week of tracking is usually the most eye-opening. Most developers discover their actual Claude spending is 30-50% higher than they estimated. But with visibility comes control — and that’s the entire point.

For strategies on reducing the costs you’ll discover, read our guide on reducing AI API costs by 40%. And if you want to set effective budgets without disrupting your workflow, see how to set AI spending limits without killing productivity.

Frequently Asked Questions

How do I check how much I've spent on Claude?

You can check Claude spending through Anthropic's billing dashboard at console.anthropic.com, which shows monthly totals. For real-time per-session tracking, tools like FavTray read local Claude log files on your Mac and display costs in your menu bar as they accumulate.

What is the average daily cost of using Claude API for coding?

Most developers using Claude Code for active coding spend between $3 and $10 per day, with the median around $6. Heavy refactoring sessions with large context windows can push costs to $15-20 in a single day, which is why real-time cost tracking matters.

Does FavTray send my usage data to the cloud?

No. FavTray is 100% local. It reads Claude log files stored in ~/.claude/ on your Mac, calculates costs on-device, and never transmits any data to external servers. Your usage patterns, code context, and spending data stay entirely on your machine.

How do I set spending limits on Claude API?

Anthropic lets you set monthly spend limits in the console billing settings. For more granular control, FavTray lets you set daily and weekly budget alerts that notify you before you hit a threshold, so you can adjust your usage mid-session rather than getting cut off.

Is Claude Code pricing different from the Claude API?

Claude Code uses the same underlying API pricing as direct API calls — you pay per input and output token at the same rates. The difference is that Claude Code sessions tend to use more tokens due to system prompts, tool use context, and iterative code generation loops.

FavTray is coming soon

Join the waitlist and we'll notify you when we launch.

No spam. Unsubscribe anytime.