Analyze Anthropic API usage for cost optimization. Identify batch API candidates, model downtier opportunities, cache optimization, and prompt reduction.
npm install -g @visystems/claude-cost-tracker# Analyze a usage log
claude-cost-tracker analyze usage.jsonl
# Generate optimization report
claude-cost-tracker report usage.jsonl --format json
# Estimate cost for an eval spec
claude-cost-tracker estimate my-eval.eval.yamlJSONL with one record per line:
{"timestamp":"2026-04-01T10:00:00Z","model":"claude-sonnet-4-6","inputTokens":1500,"outputTokens":300,"cacheReadTokens":500}| Model | Input | Output | Cache Read |
|---|---|---|---|
| claude-opus-4-7 | $5/MTok | $25/MTok | $0.50/MTok |
| claude-sonnet-4-6 | $3/MTok | $15/MTok | $0.30/MTok |
| claude-haiku-4-5 | $1/MTok | $5/MTok | $0.10/MTok |
- Batch API — High-volume workloads that could use 50% batch discount
- Model downtier — Expensive models used for simple tasks
- Cache optimization — Low cache hit rates with repeated prompts
- Prompt reduction — Outlier input token counts
Apache 2.0