Back to the catalog

claude-token-stats

Track token usage and cost for every Claude Code session. Automatically captures input tokens, output tokens, cache usage, and calculates re

Open source Open in the app JSON README (API)

About

Track token usage and cost for every Claude Code session. Automatically captures input tokens, output tokens, cache usage, and calculates real cost per prompt using model-specific pricing (Opus, Sonnet, Haiku). Shows running totals and per-model breakdown. Includes a native macOS menu bar app with a live dashboard.

Details

Kind
Plugins
Topic
No topic detected
Publisher
sabahkemalcansu
Origin
marketplace
Category
ferramentas
Last push
2026-05-11T18:11:44Z
Repository state
ativo
Language
Python
Added
2026-08-30 01:48:58
Updated
2026-08-30 01:48:58
Origin id
sabahkemalcansu/claude-token-stats/claude-token-stats

README

# Claude Token Stats

Track token usage and cost for every Claude Code session. Native macOS menu bar app with real-time stats.

![Claude Token Stats](screenshot.png)

## Features

- **Per-prompt breakdown** — input, output, cache read tokens + cost
- **Multi-model pricing** — Opus, Sonnet, Haiku automatically detected
- **Running totals** — cumulative tokens, cost, average per prompt
- **By-model breakdown** — see which model costs what
- **Native macOS menu bar** — always visible, opens dashboard on click
- **Claude Code plugin** — `/claude-token-stats:show` in chat

## Installation

### 1. Clone the repo

```bash
git clone https://github.com/sabahkemalcansu/claude-token-stats.git
cd claude-token-stats
```

### 2. Install

```bash
bash install.sh
```

This will:
- Create a Python virtual environment
- Install dependencies (`rumps`, `customtkinter`)
- Register the Stop hook in Claude Code
- Initialize the stats file

### 3. Start the menu bar app

```bash
bash autostart.sh
```

The `◉` icon appears in your menu bar. Click → **Open Dashboard**.

### 4. Install the Claude Code plugin (optional)

```bash
claude --plugin-dir ./plugin
```

Then use `/claude-token-stats:show` in any Claude Code session.

## Pricing

| Model | Input | Output | Cache Read |
|-------|-------|--------|------------|
| claude-opus-4 | $15/MTok | $75/MTok | $1.50/MTok |
| claude-sonnet-4 | $3/MTok | $15/MTok | $0.30/MTok |
| claude-haiku-4 | $0.80/MTok | $4/MTok | $0.08/MTok |

## Data

Stats are stored at:
```
~/Library/Application Support/ClaudeTokenStats/stats.json
```

## Uninstall

```bash
launchctl unload ~/Library/LaunchAgents/com.claudetokenstats.menubar.plist
rm -rf ~/Library/Application\ Support/ClaudeTokenStats
```

Remove the hook from `~/.claude/settings.json` manually.

## License

MIT

More