@einere/ccusage-graph
v1.1.0
Published
CLI tool to visualize ccusage JSON reports as terminal graphs
Maintainers
Readme
ccusage-graph
A CLI tool to visualize ccusage JSON reports as terminal graphs.
Features
- Cost bar chart (daily / weekly / monthly)
- Token usage bar chart (daily / weekly / monthly)
- Cost breakdown by model
- Period summary (total cost, average, peak period, etc.)
- Auto-detects JSON format from top-level key (
daily,weekly,monthly)
Usage
Pipe from ccusage (recommended)
npx ccusage@latest --json | npx @einere/ccusage-graph
npx ccusage@latest weekly --json | npx @einere/ccusage-graph
npx ccusage@latest monthly --json | npx @einere/ccusage-graphFile argument
npx ccusage@latest --json > report.json
npx @einere/ccusage-graph report.jsonRedirect
npx @einere/ccusage-graph < report.jsonOutput Example
Daily
📊 Daily Cost
────────────────────────────────────────────────────────────────────────────────
01-19 $7.34 ████████████████████████████████████████░░░░░░░░
01-25 $4.49 ████████████████████████░░░░░░░░░░░░░░░░░░░░░░░
...
────────────────────────────────────────────────────────────────────────────────
📋 Summary
────────────────────────────────────────────────────────────────────────────────
Period: 2026-01-19 → 2026-02-18 (5 active days)
Total Cost: $12.19
Avg/Day: $2.44
Peak Day: 2026-01-19 ($7.34)
────────────────────────────────────────────────────────────────────────────────Weekly
📊 Weekly Cost
────────────────────────────────────────────────────────────────────────────────
01-18 $7.34 █░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
01-25 $18.69 ███░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
...
────────────────────────────────────────────────────────────────────────────────
📋 Summary
────────────────────────────────────────────────────────────────────────────────
Period: 2026-01-18 → 2026-02-15 (5 active weeks)
Total Cost: $410.83
Avg/Week: $82.17
Peak Week: 2026-02-08 ($230.84)
────────────────────────────────────────────────────────────────────────────────Monthly
📊 Monthly Cost
────────────────────────────────────────────────────────────────────────────────
2026-01 $26.04 ███░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
2026-02 $384.80 ████████████████████████████████████████
────────────────────────────────────────────────────────────────────────────────
📋 Summary
────────────────────────────────────────────────────────────────────────────────
Period: 2026-01 → 2026-02 (2 active months)
Total Cost: $410.83
Avg/Month: $205.42
Peak Month: 2026-02 ($384.80)
────────────────────────────────────────────────────────────────────────────────Input JSON Format
Uses the JSON format generated by ccusage as-is. The tool auto-detects the format from the top-level key.
Daily
{
"daily": [
{
"date": "2026-01-19",
"totalTokens": 10412828,
"totalCost": 7.34,
"modelBreakdowns": [{ "modelName": "claude-opus-4-5-20251101", "cost": 7.11, ... }]
}
],
"totals": { "totalCost": 12.19, "totalTokens": 20300000, ... }
}Weekly
{
"weekly": [
{
"week": "2026-01-18",
"totalTokens": 10412828,
"totalCost": 7.34,
"modelBreakdowns": [{ "modelName": "claude-opus-4-5-20251101", "cost": 7.11, ... }]
}
],
"totals": { "totalCost": 12.19, "totalTokens": 20300000, ... }
}Monthly
{
"monthly": [
{
"month": "2026-01",
"totalTokens": 34720100,
"totalCost": 26.04,
"modelBreakdowns": [{ "modelName": "claude-opus-4-5-20251101", "cost": 25.46, ... }]
}
],
"totals": { "totalCost": 410.83, "totalTokens": 597631053, ... }
}Requirements
- Node.js >= 18
License
MIT
