Purpose
cc-cost is a command-line tool for analyzing the cost of Claude Code sessions. It parses the session transcript JSONL files generated by Claude Code, helping users understand the cost breakdown of each session and pinpoint the causes of cost anomalies.
Main capabilities
- Report the cost of each session.
- Report the prompt-cache hit rate.
- Report the tool call distribution (per-tool spend).
- List the most expensive turns (top expensive turns).
- Through
--diagnoseprovide actionable optimization suggestions.
Usage
This tool is a single-file Python CLI, requires Python 3.9+, and has no other dependencies. The specific installation and run commands are not yet given in the provided materials and need to be referenced from the project repository documentation.
Applicable scenarios
- Debugging cost anomaly issues such as "why did this session cost 40 dollars".
- Checking whether the cache hit rate is low (for example, long static context not marked with cache_control).
- Discovering a large number of redundant tool calls (each call re-pays the prompt cost).
- Identifying long output explanations actively generated by the model.
Limitations
The materials do not provide the specific installation commands, usage examples, supported platform scope, billing model, or pricing information; these contents are not yet provided.