claude-usage

Solid

Report ground-truth Claude token consumption and estimated cost by parsing JSONL session files directly. Use when checking API spend, auditing token usage by project/session/model, generating daily/weekly/monthly cost reports, or diagnosing ccusage undercounting. Includes subagent files that ccusage ignores.

AI & Automation 41 stars 3 forks Updated yesterday MIT

Install

View on GitHub

Quality Score: 84/100

Stars 20%
54
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Claude Usage Ground-truth token usage and cost reporting for Claude Code sessions. Parses JSONL files directly—parent sessions and subagent sidechains—to produce accurate numbers. ## Why This Exists ccusage (v18+, the standard community tool with 10.6k stars) **undercounts output tokens by 77-94%** for heavy users: | Source | Output Tokens | Notes | |--------|-------------|-------| | Raw JSONL (all files) | 1,076,691 | Ground truth | | Raw JSONL (date-filtered) | 412,987 | Properly filtered | | ccusage --timezone UTC | 93,960 | 77% undercount | | ccusage default | 62,375 | 94% undercount | Three compounding bugs: 1. **Ignores subagent files** at `{session-uuid}/subagents/{agent-id}.jsonl`—132 files missed on a typical day with Agent Teams 2. **Timezone confusion** between UTC entry timestamps and local time filtering 3. **Drops entries** in parent files—even at UTC, reports only 23% of actual tokens This script reads every JSONL file to produce correct totals. --- ## Usage ```bash # Today's usage (default) python3 ~/.claude/skills/claude-usage/scripts/claude_usage.py # Last 7 days, broken down by day python3 ~/.claude/skills/claude-usage/scripts/claude_usage.py --since 7d # Weekly breakdown for the past month python3 ~/.claude/skills/claude-usage/scripts/claude_usage.py --by week --since 30d # Per-model breakdown python3 ~/.claude/skills/claude-usage/scripts/claude_usage.py --by model --since 7d # Per-session with human-readable summaries python3 ~/.claude/skil...

Details

Author
tdimino
Repository
tdimino/claude-code-minoan
Created
7 months ago
Last Updated
yesterday
Language
Python
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category