From ccusage-analyzer
Analyze Claude Code token usage and costs via ccusage CLI, providing actionable insights on spending patterns and optimization opportunities.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ccusage-analyzer:analyze-usageThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Analyze Claude Code token usage and costs via ccusage CLI, providing actionable insights on spending patterns and optimization opportunities.
Analyze Claude Code token usage and costs via ccusage CLI, providing actionable insights on spending patterns and optimization opportunities.
--monthly — Show monthly aggregated report (default: daily)--session — Show session-level breakdown--since YYYYMMDD — Start date filter (e.g., --since 20260301)--until YYYYMMDD — End date filter (e.g., --until 20260310)--breakdown — Include per-model cost breakdownParse $ARGUMENTS to determine:
daily (default), monthly (if --monthly), or session (if --session)--since and --until values if present--breakdown is specifiedBuild and run the appropriate ccusage command:
# Base command pattern
npx ccusage <report-type> --json [--since YYYYMMDD] [--until YYYYMMDD]
npx ccusage daily --jsonnpx ccusage monthly --jsonnpx ccusage session --json--since / --until flags if date filters were specifiedIf the command fails, inform the user that ccusage may not be installed and suggest running npm install -g ccusage or using npx ccusage directly.
Parse the JSON output and compute:
--breakdown): cost and token usage per modelFormat the analysis as markdown with the following structure:
## Usage Report ({report-type}: {date-range})
### Summary
| Metric | Value |
|--------|-------|
| Total Cost | $X.XX |
| Total Tokens | X,XXX,XXX |
| Cache Hit Rate | XX.X% |
| Peak Day/Month | YYYY-MM-DD ($X.XX) |
| Average Cost/Day | $X.XX |
### Breakdown
| Date | Input Tokens | Output Tokens | Cache Read | Cost |
|------|-------------|---------------|------------|------|
| ... | ... | ... | ... | $X.XX |
### Model Breakdown (if --breakdown)
| Model | Input Tokens | Output Tokens | Cost | Share |
|-------|-------------|---------------|------|-------|
| ... | ... | ... | $X.XX | XX% |
### Insights
- {Trend observations: increasing/decreasing/stable}
- {Spike alerts if any periods exceed 2x average}
- {Cache efficiency assessment}
- {Optimization recommendations}
Provide actionable insights based on the data:
npx ccusage is not available, inform the user and suggest installationnpm install -g ccusage or use via npx)npx claudepluginhub b4tchkn/claude-code-plugins --plugin ccusage-analyzerDisplays real token usage and estimated savings for current Claude Code session from session logs—no AI estimation. Invoke via `/genshijin-stats` for session stats, `--all` lifetime totals, `--share` summaries, or `--since` periods.
Analyzes Claude Code token usage and cost trends over daily/weekly/monthly periods, computes metrics like averages, peak days, trend direction, and monthly projections, with per-project filtering.
Displays per-session token usage breakdown for Claude Code. Supports custom date ranges via `/token-usage N`.