What does this skill do?

The Token Cost Tracking Skill analyzes Claude Code's local metrics log to provide an accurate breakdown of token spending and consumption. It reads the JSONL file generated by the tracking hook, processes the accumulated snapshots per session, and calculates actual costs using the pre-calculated field in the log, avoiding manual estimates that may become outdated.

Total Expenses and Expenses Per Session
Check how much you've spent in total or during a specific session, with amounts displayed clearly and decimals formatted appropriately.
Breakdown by Model
Get a summary of costs grouped by each model used, sorted from highest to lowest cost.
Comparison by Date
Compare today's spending with yesterday's and review the historical total for all sessions.
Export to CSV
Export token usage and cost data to CSV format for external analysis or reporting.

Usage examples

💰 Total Expenses
How much have I spent in total on Claude Code so far?
🤖 By model
Please give me a breakdown of costs by model for the last 7 days.
📅 Today vs. Yesterday
Compare today's expenses with yesterday's and tell me how many sessions I've had.
📁 Export CSV
Export all my token usage data to a CSV file so I can analyze it in Excel.

Features

Reading a JSONL record Process the costs.jsonl file generated by the Claude Code hook, extracting the latest snapshot per session to prevent duplicate counts.
Estimated costs Use the `estimated_cost_usd` field in the record instead of estimating manually, ensuring accuracy even if model prices change.
Flexible aggregation Group the data by model, session, or date, depending on the user's request.
Smart Amount Format Display amounts less than one dollar with four decimal places and amounts greater than one dollar with two decimal places, for maximum readability.
Cross-platform compatibility It uses Node.js scripts to validate the log and process data, ensuring it works on any operating system.

Frequently asked questions

The log is generated in ~/.claude/metrics/costs.jsonl. It only appears after the first session ends with the stop:cost-tracker hook enabled.
Yes, you need the `stop:cost-tracker` hook enabled in Claude Code. The skill reads the log generated by that hook; it does not recommend installing unreviewed hooks that execute arbitrary code.
Each row in the JSONL is a cumulative snapshot of the session. The skill reduces the data to the last row for each session_id before summing, thereby avoiding counting the same expense multiple times.
Yes. The skill supports exporting usage and cost data to CSV format so you can analyze it in Excel or other tools.
Token Cost Tracking — Expense Control in Claude AI

¿Prefieres escuchar el contenido? Genera la narración de audio con un clic.