Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ai-spend-report

See what your AI coding habit would cost if you paid per token.

Claude Code and OpenAI Codex both run on flat subscriptions right now. This tool reads your local session logs, adds up the tokens by model, and prices them at current API list rates. It answers one question: what would the last month of my usage cost on the API meter?

If you run these tools on a subscription, treat the number as a pay-as-you-go comparison, not a bill.

Quick start

Point your coding agent (Claude Code, Codex, Cursor, etc.) at this repo and say:

Run the analysis in this repo on my usage.

Or run it yourself:

python3 analyze.py            # last 30 days
python3 analyze.py --days 7   # last 7 days

You get a summary in the terminal, a machine-readable usage.json, and a shareable report.html.

What it reads

  • Claude Code~/.claude/projects/**/*.jsonl (per-message usage + model)
  • OpenAI Codex~/.codex/**/rollout-*.jsonl (cumulative token_count events)

Everything runs on your machine. Nothing is uploaded. The generated usage.json and report.html contain your numbers and are gitignored by default.

Pricing

Rates live in pricing.json as per-million-token prices. Update them when providers change pricing. Cache is handled per provider: Claude bills cache writes at 1.25× input and cache reads at 0.10× input; Codex bills cached input at its own cached rate with no separate write charge.

Caveats

  • Codex token counts exclude OpenAI's 2× surcharge on turns over 272K context, so Codex is slightly conservative.
  • Numbers come from one machine. Usage on other machines isn't counted.
  • Models not listed in pricing.json are skipped — add them to include them.

License

MIT. Built at Runpoint.

About

See what your AI coding habit (Claude Code + Codex) would cost at API rates. Runs locally on your session logs.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages