Related ToolsClaude CodeClaude

Claudetop Monitors Your Claude Code Spending in Real Time

Claude by Anthropic
Image: Anthropic

A developer who expected a $10 Claude Code bill and got charged $65 built a tool to make sure that never happens again. Claudetop is an open-source status line monitor that shows exactly where your money goes during Claude Code sessions.

The core problem: Claude Code's context compaction (where the system compresses your conversation to fit the context window) can hide up to 80% of actual token usage. You think you've used a modest amount of tokens, but behind the scenes the system has been reading, compressing, and re-reading your files repeatedly. Claudetop makes all of that visible.

What It Actually Shows

The tool runs as a status line inside Claude Code and displays a dense but readable string of metrics:

  • Live cost tracking with hourly burn rate and monthly projections
  • Cache hit ratios, color-coded so you can spot inefficiency at a glance (green above 60%, red below 30%)
  • Cost-per-line-of-code efficiency metric
  • Budget alerts at configurable thresholds ($5, $10, $25)
  • "Spinning" detection that warns you when Claude is burning tokens without producing useful output

A typical readout looks like: Opus 20m | 152.3K in / 45.2K out 38% | $3.47 $5.10/hr ~$174/mo - giving you timestamp, model, token counts, cache usage percentage, current session cost, hourly rate, and what that pace would cost over a month.

The Cache Problem

The cache efficiency feature is particularly useful. When Claude Code reads your files, those reads can be cached so subsequent references cost less (cache reads on Opus 4.6 cost $0.50 per million tokens versus $5.00 for fresh reads - a 10x difference). But context resets force expensive re-reads. Claudetop flags when your cache ratio drops below 20%, which usually means something in your workflow is forcing unnecessary full-context rebuilds.

Installation is a one-line curl command, and the tool is built primarily in shell script with jq and bc as dependencies. It pulls pricing data daily from a centralized repository, so it stays current as Anthropic adjusts rates. There's also a plugin system where you can drop executable scripts into ~/.claude/claudetop.d/ to add custom information to the status line.

For anyone running Claude Code on Anthropic's API pricing (Opus 4.6 at $5/$25 per million input/output tokens), this fills a real gap. The difference between a $3/hour session and a $15/hour session often comes down to cache efficiency and context management - things that are invisible without a tool like this.