DEV Community

Cover image for How much water does Claude Code use? I built a CLI to measure it
Beau Sterling
Beau Sterling

Posted on

How much water does Claude Code use? I built a CLI to measure it

My AI coding agents used about 47.8 litres of water in September. That's roughly eight toilet flushes, and it's an estimate with a wide range. Here's how I got the number, and the open-source CLI I built to track it live.

GitHub logo beausterling / drip-ai-water-usage

How much water is your AI agent drinking? Live water-usage meter for Claude Code & Codex CLI β€” status line, split-pane meter, research-backed estimates.

drip πŸ’§

How much water is your AI agent drinking? drip estimates the water used by terminal AI agents (Claude Code and Codex CLI) and shows it live in your status line, a split-pane meter, or a full breakdown page, with every number traced back to published research.

Opus 5.5 β”‚ my-project β”‚ β–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘ 48% β”‚ πŸ’§ 412 mL (1.7 glasses) Β· today 3.1 L
  • Real token counts. drip reads your agent's local logs, so the token counts aren't guesses.
  • Research-backed coefficients. Low, mid and high estimates, each with its source cited.
  • Private. Everything is local: no accounts, no telemetry, and nothing leaves your machine.
  • No dependencies. Python 3.11+ standard library only.

Install

git clone https://github.com/beausterling/drip-ai-water-usage.git ~/.drip
~/.drip/bin/drip install
Enter fullscreen mode Exit fullscreen mode

install plays a short intro, imports your existing Claude Code and Codex history, puts drip on your PATH (via ~/.local/bin), and turns on the Claude Code status line…

Why water?

Every Claude Code or Codex request runs on GPUs in a data center. Water gets used twice:

  1. On site: evaporative cooling. Data centers report this as WUE (litres per kWh).
  2. Off site: the power plants that generate the electricity also consume water (EWIF, litres per kWh generated).

The second one is usually bigger. In drip's mid estimate it's about 88% of the total.

The formula

water (mL) = tokens Γ— energy per token (Wh) Γ— water per kWh (L/kWh)
water per kWh = WUE / PUE  +  EWIF
Enter fullscreen mode Exit fullscreen mode
  • Tokens are exact. drip reads the logs your agent already writes: ~/.claude/projects/**/*.jsonl for Claude Code and ~/.codex/sessions/** for Codex CLI. It counts input, output, cache-read and cache-write tokens separately and dedupes by message id.
  • Energy per token comes from measured inference energy (ML.ENERGY, Microsoft's study in Joule, Google's disclosure). Output tokens cost far more than input, and cache reads are a small fraction of input. Models are scaled by list price, the only public proxy for how expensive a model is to serve.
  • Water per kWh comes from Lawrence Berkeley National Lab's 2024 US data center report and Li et al., Making AI Less Thirsty (CACM 2025). Mid estimate: about 3.6 L/kWh including generation, about 0.4 L/kWh on site only.

How accurate is it?

Token counts: exact. Water: maybe 3–5Γ— off in either direction, and the low-to-high span is 10–30Γ—, because no provider publishes energy per token. So drip shows a range everywhere instead of a falsely precise number. It's good for trends ("I used 3Γ— more this week") and bad for exact litres.

The biggest unknown is cache reads. They're most of an agent's tokens, and nobody knows exactly what they cost.

What it looks like

In Claude Code, a segment in the status line:

Opus 5.5 β”‚ my-project β”‚ β–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘ 48% β”‚ πŸ’§ 412 mL (1.7 glasses) Β· today 3.1 L
Enter fullscreen mode Exit fullscreen mode

For Codex or any other agent, drip run codex opens a split pane with a live meter (a little ASCII bottle that fills up) in Ghostty, Warp, iTerm2, tmux or macOS Terminal.

drip open shows a breakdown page: per model, per token type, the uncertainty range, 30 days of history, every coefficient linked to its source, and a share card.

drip breakdown page

Install

git clone https://github.com/beausterling/drip-ai-water-usage.git ~/.drip
~/.drip/bin/drip install
Enter fullscreen mode Exit fullscreen mode

Python 3.11+, standard library only, nothing leaves your machine. MIT licensed.

What I'd love help with

If you have better data on per-token inference energy, especially for cache reads, open an issue. The coefficients live in one TOML file, and since drip stores tokens rather than water, updating them re-prices your whole history.

Top comments (0)