claude-cost-tracker
Skill14 starsChanged 6 months agoMITView on GitHub
Track your Anthropic API spend by project, model, and task type. Know exactly what each feature costs before it ships. The skill evaluates each prompt type against downgrade criteria: Fully free and open source. Part of the AI Investment Skills Bundle — $29 one-time. → https://jaehyunpark.gumroad.com/l/tcyahy Built after an Opus pipeline ran overnight and cost $12 for something Sonnet would have handled at $2. The downgrade analysis alone pays for itself in the first month.
- Reads credentials
In this repository14 other files it gives its agents.
- llms.txtllms.txt
- commit-roastSkill
- context-budgetSkill
- debug-trailSkill
- env-doctorSkill
- ev-calculatorSkill
- git-standupSkill
- growth-trackerSkill
- investment-briefing-agentSkill
- multi-agent-orchestratorSkill
- news-sentiment-engineSkill
- options-flow-analyzerSkill
- price-monitor-alertSkill
- pr-review-prepSkill
The file
Files
Claude API Cost Tracker
Track your Anthropic API spend by project, model, and task type. Know exactly what each feature costs before it ships.
What it does
- Pulls usage data from Anthropic API billing endpoint
- Breaks down cost by: project, model (Opus/Sonnet/Haiku), date range
- Flags expensive operations (prompts > $0.10 per call)
- Projects monthly spend from current daily burn rate
- Identifies which tasks are best candidates for model downgrade (Opus → Sonnet)
Usage
Check my Claude API costs for this week.
Break down by: model, project tag, daily trend.
Flag any single calls over $0.05.
Project monthly spend at current rate.
Suggest which tasks could switch from Opus to Sonnet without quality loss.Example Output
Claude API Cost Report — Week of May 13, 2026
TOTAL THIS WEEK: $4.23
Opus 4.5: $3.10 (73%) — news analysis pipeline
Sonnet 4.5: $0.89 (21%) — investment briefing
Haiku 4.5: $0.24 (6%) — price monitor checks
DAILY BURN: $0.60/day
MONTHLY PROJECTION: ~$18/month
TOP EXPENSIVE CALLS (this week):
$0.14 — filter.ts:45 — 50-article importance ranking prompt
$0.09 — analyze.ts:88 — per-article deep analysis (x5 articles)
$0.04 — briefing.ts:12 — portfolio summary generation
OPTIMIZATION SUGGESTIONS:
filter.ts ranking prompt: Switch to Sonnet — saves ~$0.06/day ($1.80/month)
Confidence: HIGH — filtering is structured JSON output, not nuanced reasoning
price monitor heartbeat: Already on Haiku — optimalModel Downgrade Analysis
The skill evaluates each prompt type against downgrade criteria:
| Task type | Opus needed? | Recommendation |
| Structured JSON extraction | No | → Sonnet |
| Importance ranking (1-5) | No | → Haiku |
| Nuanced sentiment analysis | Yes | Keep Opus |
| Code generation | Situational | Test Sonnet first |
| Multi-step reasoning chains | Yes | Keep Opus |
Configuration
Track Claude costs:
API key: (reads from ANTHROPIC_API_KEY env)
Date range: last 7 days
Group by: model, then by file/prompt tag
Budget alert: warn if projected monthly > $30
Downgrade candidates: flag any Opus task where Sonnet could substituteRequirements
ANTHROPIC_API_KEYin environment- Anthropic usage API access (available on all paid plans)
Free
Fully free and open source.
Part of the AI Investment Skills Bundle — $29 one-time. → https://jaehyunpark.gumroad.com/l/tcyahy
Author
Built after an Opus pipeline ran overnight and cost $12 for something Sonnet would have handled at $2. The downgrade analysis alone pays for itself in the first month.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

