Claude Code usage

Cccost

Instrument Claude Code to track actual token usage and cost

Install

Install
npm install -g @mariozechner/cccost

Found in the project README. Check it for setup steps after installing.

From source
git clone https://github.com/badlogic/cccost.git

From the README

cccost - Claude Code Cost Tracker

Track token usage and costs for your Claude Code sessions in real-time.

Problem
Claude Code does not show cost for users of the Pro and Max plan when using the /cost command. API users enjoy that privilege. Except that /cost has a bug (CC 1.0.83). And if you wrote a fancy statusline script and think you can just parse the session transcript to get token usage and cost, think again. The transcript does not contain all requests Claude Code issues to the Anthropic servers.

What Claude Code Cost Tracker does
Claude Code cost track is a minimally invasive tool. Instead of running Claude Code directly, run your session via cccost. All arguments you pass will be forwarded to Claude Code verbatim:

cccost spawns Claude Code and injects this code. It hooks the NodeJS fetch() function and intercepts all API requests to Anthropic's servers. It then writes a file ~/.claude/projects/mangled-current-working-dir/sessionid.usage.json and keeps updating it with every new request. As opoosed to Claude Code's /cost slash command, this also accurately tracks cost and token usage when resuming sessions.

The file contains total input/output/cache read/cache write statistics per model, the usage stats for the last request made with each model, and the total cost. E.g.:

You can use that to write accurate statusline scripts that display e.g. context usage or cost for the current session. Simply read the .usage.json file for the current session to get the statistics.

The GitHub repository includes an example statusline.js.

Installation

Usage

Simply start Claude Code via cccost instead of claude:

Options
- --ccc-verbose: cccost will output debug logging during the session

Development

License

MIT

Author

Mario Zechner
Read the full README on GitHub

Details

Language
TypeScript
Last updated
18 August 2025

FAQ

What is Cccost?

Instrument Claude Code to track actual token usage and cost It is a usage for Claude Code, from badlogic/cccost on GitHub.

How do I install Cccost?

Run npm install -g @mariozechner/cccost, then follow the setup in the README.

Is Cccost popular?

badlogic/cccost has 26 GitHub stars and 0 forks, and is included in 1 curated Claude Code list. It was last updated on 18 August 2025.

More usage & cost trackers

Browse the most popular Claude Code mods, all usage & cost trackers, or the skills and MCP server directories.