Back to Vibe Coder Toolkit
Intelligence
Cost Attribution
Know what each feature costs
npx promptreports-cli costsGroups AI costs by model, git commit, or provider. Shows unit economics and cost anomalies.
costs answers three questions: which models are you paying the most for? which git commits cost the most AI tokens to produce? which providers account for your spend? Groups costs across your entire stack (Claude Code + all providers) and shows per-unit breakdowns. Use --by commit to see your cost-per-PR.
On this page
Prerequisites
- Session files in ~/.claude/projects/
- Git repo (for --by commit)
- Env vars for providers (for --by feature)
Flags & Options
| Flag | Description | Default |
|---|---|---|
| --days N | Lookback | 7 |
| --by <group> | Group by: model | commit | feature | model |
| --json | JSON output | — |
Examples
By model
npx promptreports-cli costs --by modelOpus vs Sonnet vs Haiku spend.
By commit
npx promptreports-cli costs --by commit --days 30Cost of every commit last month.
By feature
npx promptreports-cli costs --by featureWhich providers dominate your spend?
Output
Table grouped by selected dimension + totals (Claude Code + Providers = Grand Total).
Cost by Model
Model Cost Turns Unit Cost %
claude-opus-4 $3.45 12 $0.29 45%
claude-sonnet-4 $2.10 18 $0.12 27%
claude-haiku-4.5 $0.68 34 $0.020 9%
gpt-4o-mini $1.42 23 $0.062 19%
──────────────────────────────────────────────────────
Total Claude Code: $7.65 (5 sessions, 7d)
Total Providers: $12.45 (5 services, 7d)
Total Burn Rate: $20.10 / 7d
$86.14 / month (projected)What it reads and writes
Reads
- ~/.claude/projects/**/*.jsonl
- .env.local
- git log
Writes
Nothing (read-only)
API calls
- Provider APIs (same as providers)
- Git log for commit grouping
Free vs Pro usage
Free tier
- Identify your most expensive model — usually Opus
- Spot cost-per-commit outliers for retro
- Share breakdown with CFO or manager
Pro tier
Upgrade- Tag sessions with feature labels → cost per feature
- Attribute costs to specific team members (who's burning the most Opus?)
- Alert when any single commit exceeds cost threshold
- Export to QuickBooks / Stripe Revenue categories
Pro tips
- --by commit reveals the real cost of large refactors
- If Opus is 70%+ of cost, run `models` to find downgrade candidates
- Unit Cost (cost per turn) is the key efficiency metric