wattmark
v0.1.1
Published
Measure the energy footprint of your Claude Code sessions
Downloads
293
Maintainers
Readme
wattmark
Measure the energy and carbon footprint of your Claude Code sessions — all processing local.
wattmark reads your local Claude Code session logs, estimates how much energy
and CO₂ your AI usage represents, and renders it as an interactive terminal
dashboard or a shareable card.
Quick start
Zero install — just run it:
npx wattmarkOr install permanently:
npm install -g wattmarkCommands
| Command | Description |
| --- | --- |
| wattmark | Launch the interactive TUI dashboard (default). |
| wattmark summary | Print a shareable card to stdout, no TUI. |
| wattmark config | Interactively update grid intensity, default model, and GitHub handle. |
| wattmark export | Write an SVG card to ~/Desktop/wattmark-card.svg. |
Inside the TUI: q quit · r refresh · s export card · ←→ navigate weeks · ? methodology.
Methodology
Read this before quoting a number. The token counts are exact (read straight from your logs). The energy and carbon figures are estimates — and deliberately imprecise ones. Treat the relative signals (trends over time, model mix, week-over-week change) as the trustworthy output, and the absolute Wh / CO₂ totals as order-of-magnitude.
Each assistant turn in your Claude Code logs records token usage. wattmark
multiplies those token counts by per-token energy coefficients (in watt-hours),
matched to the model tier:
| Tier | output | fresh input | cache read | | --- | --- | --- | --- | | haiku | 0.0001 | 0.00002 | 0.000002 | | sonnet | 0.0006 | 0.00012 | 0.000012 | | opus | 0.0015 | 0.00030 | 0.000030 |
Cache-creation tokens use the fresh-input coefficient (cache writes are a prefill pass); cache-read tokens use the much cheaper cache-read coefficient.
energy_Wh = output·c_out + input·c_in + cacheCreate·c_in + cacheRead·c_cacheRead
carbon_g = (energy_Wh / 1000) · grid_g_per_kWhWhere the coefficients come from (not invented):
- Output (decode) tokens are anchored to Epoch AI's measured ~0.0006 Wh/output-token for a GPT-4o-class (~100B active-parameter) model; haiku and opus scale within Epoch's observed 0.0001–0.002 Wh/token band.
- Fresh input (prefill) tokens ≈ 0.2× output. Prefill is compute-bound and far more energy-efficient per token than memory-bandwidth-bound decode.
- Cache-read tokens ≈ 0.1× input, following Anthropic's own published pricing ratio (input : cache-write : cache-read = 1 : 1.25 : 0.1) as a citable proxy for relative cost.
The big caveat: for heavy Claude Code usage, cache-read tokens vastly outnumber every other kind, so the cache-read term usually dominates the estimate — and it's also the least certain coefficient (Anthropic's price covers cache memory, not just compute energy, so it likely overstates the true energy). This is exactly why nothing is reported as a single number.
Why a range? True per-token energy is unknowable from logs alone — it
depends on hardware, datacenter efficiency (PUE), and especially request
batching (one GPU serving many concurrent requests divides its power across all
of them). Every figure is shown as low – high, where low = mid × 0.2 and
high = mid × 4.0.
output_tokens in Claude Code logs already includes extended
thinking/reasoning tokens, so reasoning is counted without any extra parsing.
Grid intensity defaults to 400 g CO₂/kWh (US average is ≈ 386 g/kWh per EPA
eGRID) and is configurable via wattmark config.
Sources:
- Epoch AI — How much energy does ChatGPT use? https://epoch.ai/gradient-updates/how-much-energy-does-chatgpt-use
- Anthropic — prompt caching pricing ratios https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
- EPA eGRID — US grid carbon intensity https://www.epa.gov/egrid
Privacy
All processing is local. wattmark reads ~/.claude/projects/ on your
machine and writes its config and parse cache to ~/.wattmark/. Nothing leaves
your computer unless you explicitly run wattmark login (leaderboard sharing —
coming soon, not yet active).
License
MIT
