claude-carbon 1.5.0 โ 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -11
- package/package.json +11 -3
package/README.md
CHANGED
|
@@ -6,10 +6,18 @@
|
|
|
6
6
|
[](https://www.npmjs.com/package/claude-carbon)
|
|
7
7
|
[](https://github.com/gwittebolle/claude-carbon/actions/workflows/ci.yml)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
claude-carbon is an open source Claude Code plugin that tracks the carbon footprint of your sessions: a live CO2 estimate in the status line, computed locally from your token usage, next to the session cost.
|
|
10
10
|
|
|
11
11
|

|
|
12
12
|
|
|
13
|
+
## What claude-carbon does
|
|
14
|
+
|
|
15
|
+
- Adds a live CO2 estimate to the Claude Code status line, next to the session cost
|
|
16
|
+
- Persists each session to a local SQLite database, so history survives the 30-day transcript purge
|
|
17
|
+
- Backfills historical data from existing `~/.claude` transcripts
|
|
18
|
+
- Slash commands: `/carbon-report` (text), `/carbon-card` (PNG), `/carbon-pr` (footprint of a pull request)
|
|
19
|
+
- A README badge with your all-time total, and a public methodology with every factor sourced
|
|
20
|
+
|
|
13
21
|
**1. Install (or update):**
|
|
14
22
|
|
|
15
23
|
macOS, Linux, WSL:
|
|
@@ -35,7 +43,7 @@ Same command to install and to update to the latest version (all three run the s
|
|
|
35
43
|
**2. Restart Claude Code.** Your CO2 appears in the status line:
|
|
36
44
|
|
|
37
45
|
```
|
|
38
|
-
claude-carbon โฅ main | ๐ข Opus
|
|
46
|
+
claude-carbon โฅ main | ๐ข Opus 5 โโโโโโโโโโ 35% | $0.50 ยท 65g COโ | Use 24% โป13:00
|
|
39
47
|
```
|
|
40
48
|
|
|
41
49
|
Segments, left to right: project + git branch, model + context window %, session cost + CO2, 5h block usage % + reset time. A ๐ฅ prefix appears when the sustained burn rate would overshoot 100% of the limit by the end of the 5h block (after a 15 min grace window, only once usage reaches 15%).
|
|
@@ -55,13 +63,6 @@ Accurate on every plan, including Max 20x.
|
|
|
55
63
|
- `/carbon-card` - generate shareable PNG report cards (requires `playwright-core`, see [Dependencies](#dependencies))
|
|
56
64
|
- `/carbon-update` - update to the latest version and re-price history (see [Updating](#updating))
|
|
57
65
|
|
|
58
|
-
## What it does
|
|
59
|
-
|
|
60
|
-
- Adds a live CO2 estimate to the Claude Code status line, next to the session cost
|
|
61
|
-
- Persists each session to a local SQLite database
|
|
62
|
-
- Backfills historical data from existing `~/.claude` transcripts
|
|
63
|
-
- Two slash commands: `/carbon-report` (text) and `/carbon-card` (PNG)
|
|
64
|
-
|
|
65
66
|
## Example report
|
|
66
67
|
|
|
67
68
|
<p align="center">
|
|
@@ -74,6 +75,12 @@ OneDrive-redirected one is honoured) and the folder opens in your file manager,
|
|
|
74
75
|
card selected on macOS. `CLAUDE_CARBON_EXPORT_DIR` picks another folder;
|
|
75
76
|
`CLAUDE_CARBON_NO_OPEN=1` skips the opening.
|
|
76
77
|
|
|
78
|
+
From the 1st to the 10th of each month the status line ends with `๐ August wrapped ยท /carbon-card`:
|
|
79
|
+
the month just closed has its bar on the card, under the running total. Generating a card
|
|
80
|
+
clears it for the month; it goes quiet on its own after the 10th. `CLAUDE_CARBON_CARD_NUDGE_UNTIL_DAY`
|
|
81
|
+
moves the cut-off, `CLAUDE_CARBON_NO_CARD_NUDGE=1` removes the nudge. Nothing is posted anywhere:
|
|
82
|
+
sharing stays a human decision.
|
|
83
|
+
|
|
77
84
|
<details>
|
|
78
85
|
<summary>Advanced options (CLI)</summary>
|
|
79
86
|
|
|
@@ -195,7 +202,7 @@ Turning it off is the default: nothing is posted unless you run it. `--dry-run`
|
|
|
195
202
|
|
|
196
203
|
## How it works
|
|
197
204
|
|
|
198
|
-

|
|
199
206
|
|
|
200
207
|
**Three data paths, two levels of accuracy:**
|
|
201
208
|
|
|
@@ -289,7 +296,8 @@ Factors from [Jegham et al. 2025](https://arxiv.org/abs/2505.09598), an arXiv pr
|
|
|
289
296
|
|
|
290
297
|
- Sonnet factors are a 3-point least-squares fit to the three Claude 3.7 Sonnet per-query energies estimated in Jegham et al. v6 (0.950 / 2.989 / 5.671 Wh), giving a ~21:1 output:input ratio. The value is consistent with [EcoLogits](https://ecologits.ai): its independent estimate for Sonnet brackets the same range (a wide band, so this is a consistency check, not proof). Fable, Opus and Haiku are extrapolated (no public data from Anthropic on per-model energy consumption); Opus = 2x Sonnet matches both the current EcoLogits Opus 4.5+ parameter ratio and the Anthropic price ratio (honest band 2x-5x).
|
|
291
298
|
- Sessions run on non-Anthropic models (e.g. local models behind `ANTHROPIC_BASE_URL`) are stored with their raw tokens but zero cost/CO2 and excluded from reports - a datacenter factor doesn't apply to them. Add patterns to `exclude_models` in `data/factors.json` to exclude more models by name.
|
|
292
|
-
- Cache read tokens are counted at a reduced factor (default 0.08 of an input token, set in `data/factors.json`). A cached token skips
|
|
299
|
+
- Cache read tokens are counted at a reduced factor (default 0.08 of an input token, set in `data/factors.json`). A cached token skips most of the prefill compute; the factor is the residual. This is an engineering estimate derived from the literature, not Anthropic's 0.1x billing ratio. The decode-phase re-read of the cache grows with context length x generated tokens and is not modelled yet; every session stores that product (`output_context_sum`) so a calibrated term can be applied to history later. See [METHODOLOGY.md](METHODOLOGY.md).
|
|
300
|
+
- Reviewed against the April-September 2026 literature (measurement papers, provider disclosures, the Watershed framework) with a sensitivity run on 30 days of real transcripts: no factor moved, the displayed figure is more likely low than high, next review March 2027. See [Where the estimate stands](METHODOLOGY.md#where-the-estimate-stands-september-2026).
|
|
293
301
|
- Carbon intensity uses the AWS region grid (location-based, 0.287 kgCO2e/kWh), not real-time grid data. This sits at the low end of the location-based range; the US national average is ~380 g/kWh.
|
|
294
302
|
- Anthropic does not publish Scope 1, 2, or 3 emissions. These estimates are independent and based on academic research, not provider data.
|
|
295
303
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-carbon",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Track the carbon footprint of your Claude Code sessions",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"diagram": "node docs/render-diagram.mjs",
|
|
@@ -21,12 +21,20 @@
|
|
|
21
21
|
"author": "Gaetan Wittebolle (https://github.com/gwittebolle)",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"keywords": [
|
|
24
|
+
"claude-carbon",
|
|
24
25
|
"carbon-footprint",
|
|
26
|
+
"carbon-emissions",
|
|
27
|
+
"co2",
|
|
28
|
+
"co2-tracker",
|
|
25
29
|
"sustainability",
|
|
30
|
+
"green-it",
|
|
31
|
+
"green-ai",
|
|
26
32
|
"claude-code",
|
|
33
|
+
"claude-code-plugin",
|
|
27
34
|
"claude",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
35
|
+
"anthropic",
|
|
36
|
+
"statusline",
|
|
37
|
+
"llm"
|
|
30
38
|
],
|
|
31
39
|
"engines": {
|
|
32
40
|
"node": ">=18"
|