ai-burn
v0.4.1
Published
π₯ COβ, water and money burned by your AI coding tools (Claude Code, Gemini CLI, Codex, Cursor, OpenCode). One command, fully local.
Maintainers
Readme
π₯ ai-burn
What did your AI actually burn?
The COβ, water and money your AI coding tools quietly torched β in one command, fully local, nothing uploaded.
npx ai-burn π₯ ai-burn β what your AI burned (all time)
9.82 kg COβe Β· 49.1 L of water Β· $709.55 at API prices
π Daily Commuter
ββββββββββββββββββββββ 15% to π Diesel Hauler (20 kg)
That's likeβ¦
π 58 km in a petrol car
π 3.9 cheeseburgers
π 545 party balloons of pure COβ
π§ 295 cmΒ² of Arctic sea ice, gone
β¦and your machines drank
β 1.64k espresso shots, evaporated
π₯€ 98 half-litre bottles
π 0.000000000055% of Lake Geneva
By tool
β³οΈ Claude Code ββββββββββββ 8 kg 81% $664.00
π OpenCode ββββββββββββ 1.73 kg 18% $40.75
π Codex CLI ββββββββββββ 56.1 g 1% $2.79
π±οΈ Cursor ββββββββββββ 28.3 g 0% $1.77 β
β Gemini CLI ββββββββββββ 4.31 g 0% $0.24
β‘ 20 kWh π€ 1.02B tokens π
23.9 g/day π₯ peak day: 1.91 kg (Jun 6)
π top model: claude-opus-4-8 (43%)
Rough estimates β run with --json for raw numbers, README for methodology.Everything runs locally: it reads the session history your AI tools already keep on disk, counts your tokens, and converts them to energy, emissions, water and money. Nothing is uploaded anywhere β ai-burn never makes a network request. The output is information, plain and simple: what you do with it is up to you.
π«π· Parle aussi franΓ§ais β
--lang fr(auto-detected from your locale).
π Website Β· π¬ Methodology Β· π Privacy Β· β Star this repo
Supported tools
| Tool | Where it reads | Token counts |
| --- | --- | --- |
| β³οΈ Claude Code | ~/.claude/projects/**/*.jsonl | exact (per API turn) |
| β Gemini CLI | ~/.gemini/tmp/*/chats/*.json | exact |
| π Codex CLI | ~/.codex/sessions/**/*.jsonl | exact |
| π±οΈ Cursor | β¦/Cursor/User/globalStorage/state.vscdb | exact tokens, model unknown (β) |
| π OpenCode | ~/.local/share/opencode/opencode.db | exact (+ its own cost figures) |
Cursor and OpenCode are SQLite databases, so those two need the sqlite3 CLI
on your PATH (preinstalled on macOS; apt/dnf install sqlite3 elsewhere).
Missing tools are silently skipped. Using something we don't read yet? PRs
welcome β a source is ~60 lines in src/sources/.
Options
| Flag | Effect |
| -------------- | --------------------------------------------------- |
| --days <n> | Only count the last n days |
| --tools <ids>| Subset of claude,gemini,codex,cursor,opencode |
| --lang <code>| Report language: en, fr (default: your locale) |
| --json | Machine-readable output (always English keys) |
| --no-color | Plain text (NO_COLOR also respected) |
| -y, --yes | Skip the confirmation prompt |
Privacy & safety
- Asks first. Before reading anything, ai-burn asks for a Y/n
confirmation in your terminal (skip with
--yes; non-interactive runs proceed, since there is no one to ask). - Fully local. No network access at all β zero HTTP requests, no
telemetry, no analytics, nothing phones home. The only runtime dependency
is Node's standard library (plus the
sqlite3CLI for two of the sources). - Never touches credentials. The tool databases it reads also contain
auth tokens (e.g. OpenCode's
accounttable). The queries here only read chat/usage rows β never auth tables, neverauth.json, never key files. - No content leaves the math. Your prompts and code are never parsed for meaning, stored, or displayed β only token counts, models and timestamps.
Methodology (a.k.a. how wrong is this?)
Vendors publish almost no per-token energy figures, so this is an estimate, triangulated from public LLM-inference studies (Epoch AI's GPT-4o estimate, Google's Gemini per-prompt disclosure, Mistral's Large 2 lifecycle report):
- Tokens are read per API turn from each tool's local history and deduped across resumed/forked/checkpointed sessions.
- Energy: each model gets a Wh-per-million-tokens rate by tier (frontier β Opus/Fable-class: 1200 Wh/M output; standard β Sonnet/GPT-5/ Gemini-Pro-class: 500; light β Haiku/Flash/mini-class: 100). Input tokens count at 1/10 of the output rate (prefill is much cheaper), cache reads at 1/100, cache writes like input. Datacenter overhead (PUE) of 1.2 applies.
- Carbon: 0.4 kg COβe per kWh (world-average grid mix).
- Water: 2.0 L per kWh β on-site evaporative cooling (~1.1 L/kWh, Google's fleet WUE) plus water consumed generating the electricity (~0.9 L/kWh). See Making AI Less Thirsty (Li et al., 2023).
- Money: retail pay-as-you-go API list prices per model
(
src/pricing.js), with cache reads at ~0.1Γ and cache writes at ~1.25Γ the input price β i.e. what your usage would cost if you weren't on a subscription. OpenCode records its own per-message cost; we trust it when present.
Real numbers depend on hardware, batching, datacenter location, grid mix and
the phase of the vendor's pricing moon β expect the truth to be within a
factor of a few, in either direction. All constants live in
src/co2.js and src/pricing.js; PRs with
better-sourced numbers are welcome.
License
MIT β made by ThΓ©ophile J-R.
