Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>EcoCode — AI Carbon TrackerNew to Visual Studio Code? Get it now.
EcoCode — AI Carbon Tracker

EcoCode — AI Carbon Tracker

Swastik Maiti

|
4 installs
| (1) | Free
Track the real-world environmental cost of your AI coding tools. Shows water, CO₂ and energy consumed by Claude and Codex — updated live as you code.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

EcoCode — AI Carbon Tracker

Know the real-world cost of your AI coding tools. EcoCode tracks token usage from Claude and OpenAI Codex and converts it into water consumed, CO₂ emitted, and energy used — updated live as you code.

Features

  • Live tracking — polls Claude and Codex session logs every 5 seconds
  • Session vs All-time — see today's impact or your cumulative footprint
  • Household equivalents — water supply, electricity, and CO₂ footprint in relatable units
  • Zero setup — reads local log files directly, no API keys, no accounts, no data leaves your machine
  • Works with Claude Code and OpenAI Codex — both CLI and VS Code chat sessions

How it works

EcoCode reads session logs written by your AI tools:

Tool Log location
Claude Code / Claude VS Code ~/.claude/projects/**/*.jsonl
OpenAI Codex CLI / Codex VS Code ~/.codex/sessions/**/**/*.jsonl (YYYY/MM/DD/rollout-*.jsonl)

Token counts are parsed from these files and converted to environmental metrics using the formulas below.

Usage

Open the Command Palette (Cmd+Shift+P / Ctrl+Shift+P) and run:

EcoCode: Show Dashboard

The status bar also shows a live water and CO₂ counter at all times.

Environmental model

These are estimates, not measured values. Anthropic and OpenAI do not publish per-token energy figures. All constants are sourced from peer-reviewed research; real figures vary by model size, data center efficiency, and electricity grid.

Token counting

counted_tokens = input_tokens + output_tokens

Following the standard methodology of Luccioni et al. (2023) and Samsi et al. (2023):

Token type Claude Codex Counted?
New prompt input input_tokens input_tokens − cached_input_tokens ✅
Generated output output_tokens output_tokens ✅
Chain-of-thought reasoning — reasoning_output_tokens ✅ (folded into output)
Cache reads cache_read_input_tokens cached_input_tokens ❌ reused memory, not reprocessed
Cache writes cache_creation_input_tokens not reported ❌ not standard in research papers

Cache reads are excluded because counting them inflates totals by 40–100× in long sessions (the same cached system prompt is re-read on every turn but processed only once). Note: Claude reports cache reads as a separate field, while Codex's input_tokens includes cached tokens — so for Codex the cached portion is subtracted out. Codex token data lives in event_msg → token_count → info.total_token_usage / info.last_token_usage.

Energy

energy_kWh = (counted_tokens / 1,000) × 0.002 kWh

Default: 0.002 kWh per 1,000 tokens

  • Luccioni et al. (2023) "Power Hungry Processing: Watts Driving the Cost of AI Deployment?" measured 0.001–0.005 kWh/1K tokens across models of varying size; mid-range frontier models (Claude Sonnet scale) land around 0.002 kWh/1K. (arxiv:2311.16863)
  • Samsi et al. (2023) "From Words to Watts" reported 0.0014–0.0025 kWh/1K tokens for 7B–70B parameter models under realistic inference loads. (arxiv:2310.03003)
  • Faiz et al. (2025) "How Hungry is AI? Benchmarking Energy, Water, and Carbon Footprint of LLM Inference" confirmed the 0.001–0.003 kWh/1K range for frontier model inference. (arxiv:2505.09598)

CO₂

co2_grams = energy_kWh × 233 g/kWh

Default: 233 g CO₂ per kWh

The IEA 2023 global average grid carbon intensity is 233 g CO₂/kWh. Cloud providers purchase renewable energy certificates that lower their reported intensity, but these do not eliminate physical grid emissions. The global average is the conservative, methodology-safe choice.

  • IEA (2023) Electricity 2024 — Analysis and Forecast. (iea.org)
  • For a region-specific value, see electricitymap.org.

Water

water_mL = energy_kWh × 1,900 mL/kWh

Default: 1,900 mL (1.9 L) per kWh

Data centers consume water both for direct cooling (on-site WUE) and indirectly through thermoelectric power generation (off-site). The combined figure is used here:

  • Li et al. (2023) "Making AI Less Thirsty: Uncovering and Addressing the Secret Water Footprint of AI Models" measured on-site WUE of 1.4–1.8 L/kWh across major US data centers, with an off-site cost of ~0.1–0.5 L/kWh, yielding a combined ~1.9 L/kWh. (arxiv:2304.03271)
  • Strubell et al. (2019) "Energy and Policy Considerations for Deep Learning in NLP" established the baseline methodology for AI resource cost accounting. (arxiv:1906.02629)

Summary

Metric Formula Default Source
Energy tokens / 1K × 0.002 0.002 kWh / 1K tokens Luccioni et al. 2023; Samsi et al. 2023
CO₂ energy_kWh × 233 233 g / kWh IEA 2023 global grid average
Water energy_kWh × 1,900 1,900 mL / kWh Li et al. 2023

All three constants are adjustable in VS Code settings under EcoCode.

Privacy

EcoCode is entirely local. It reads files already on your machine. No data is sent anywhere, ever.

Requirements

  • VS Code 1.90+
  • Claude Code (~/.claude/) and/or OpenAI Codex (~/.codex/) installed and used at least once

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft