2026-11-27 16:22 UTC

Tracarbon offers workload energy and emissions tracking for developers

state: expiredheat: lowuncertainty: mediumrelevance: mediumlocal-inference energy-measurement ai-sustainabilityFlorian Valeye

What is this?

Tracarbon is an Apache-2.0 Python library and command-line tool maintained by Florian Valeye. Its GitHub project describes measuring device energy use during a command or Python workload and estimating associated emissions using electricity carbon-intensity data. It documents support for several Mac, Linux, and Windows readings, cloud-instance datasets, and JSON, Prometheus, and Datadog exporters. A Hacker News post on 3 November 2026 drew attention to the project, but the supplied evidence does not establish a new release: search results show a PyPI listing, while the project’s own cited article dates to 2022. Measurement coverage varies by platform; the project says emissions reflect collected samples and may be unavailable when host carbon data is not collected.

Why it matters

This makes it easier for developers to instrument local model runs and other workloads, and potentially compare their energy use rather than relying only on broad estimates. Exporters and Kubernetes support could help teams monitor workloads over time. The figures are estimates, not a universal or complete accounting: hardware readings differ by platform, and emissions depend on the location and carbon-intensity data used. The project’s availability is meaningful, but the evidence suggests renewed attention to an existing tool rather than a newly announced capability.

Current assessment

The project’s GitHub documentation presents Tracarbon as installable with pip and usable through a CLI or Python API to track workload energy and estimate CO₂ emissions. Documented integrations include Prometheus, Datadog, JSON, and Kubernetes container metrics. Its stated hardware coverage includes Apple Silicon energy readings, Linux Intel/AMD power readings, and NVIDIA GPU readings on Windows; coverage and available host totals are not uniform. Emissions may use an Electricity Maps API key or bundled regional/country data, and the project explicitly says totals reflect collected samples and can be unavailable when host carbon metrics are missing. The supplied evidence supports the tool’s documented features, not independent validation of measurement accuracy or adoption. The 3 November 2026 Hacker News post is a discovery signal; search results also indicate a PyPI listing, and a project-linked introductory article dates to 2022, so do not characterize this as a launch without further release-history evidence.

Measured heat

no measured readings yet — the hourly heat pass fills this in

How the heat travelled

05-15 14:00⭐ origin echo-reconstructedThe original Tracarbon article says: “It was the birth of Tracarbon, lightweight software that will track a device’s energy consumption and
Florian Valeye on blog (echo) · attributed from hn.story.50350000
—
11-03 09:53first on hacker news · published · +39187.9hMeasure the energy and CO2 of local LLMs
fvaleye
—
11-03 09:53amplified on hacker news 👑hn.story.50350000
fvaleye
peak 1 · 0 comments · 104% of case engagement
11-03 10:21our radar first saw it · +39188.4hdiscovery anchor: hn.story.50350000—

Evidence (2) — ⭐ canonical anchor

sourceobjectauthorscorecomments
🟧 hnMeasure the energy and CO2 of local LLMs
Retrieved article excerpt

Open article · Retrieved 2026-11-03T10:23:03.112796+00:00

Tracarbon logo

[Build](https://github.com/fvaleye/tracarbon/actions/workflows/build.yml)
[PyPI](https://pypi.org/project/tracarbon/)
[Documentation](https://fvaleye.github.io/tracarbon/documentation/)
[License](https://github.com/fvaleye/tracarbon/blob/main/LICENSE.txt)

## 📌 Overview

Tracarbon is a Python library and CLI that tracks your device's energy consumption and estimates its carbon emissions.

It detects your device and location automatically. Run it from the command line to collect and export measurements, or use the Python API to add tracking to your application.

Read the [introductory article](https://medium.com/@florian.valeye/tracarbon-track-your-devices-carbon-footprint-fb051fcc9009).

## 📦 Installation

```
# Install Tracarbon
pip install tracarbon
```

```
# Install one or more exporters from the list
pip install 'tracarbon[datadog,prometheus,kubernetes]'
```

## 🔎 Usage

### Command line

```
tracarbon run
```

Measure your machine's energy and carbon while a command runs:

```
tracarbon exec -- python generate.py
```

### Python API

```
from tracarbon import TracarbonBuilder, TracarbonConfiguration

configuration = TracarbonConfiguration() # Your configuration
tracarbon = TracarbonBuilder(configuration=configuration).build()
tracarbon.start()
# Your code
total_co2g = tracarbon.stop() # The CO2 grams emitted while it was running

with tracarbon:
    ...  # Your code

report = tracarbon.report # Get the report
print(report.total_co2g)
```

`total_co2g` is `None` when no host carbon emission metric was collected. The total reflects collected samples.

### Carbon intensity API

For the latest electricity carbon intensity, get an [Electricity Maps API key](https://app.electricitymaps.com/developer-hub/api/reference) and set `TRACARBON_CO2SIGNAL_API_KEY` in your environment or `.env` file, or pass `co2signal_api_key` to `TracarbonConfiguration`.
Without a key, Tracarbon uses bundled data for [supported countries](https://github.com/fvaleye/tracarbon/blob/main/tracarbon/locations/data/co2-emission-intensity.json) and cloud regions.
To use the bundled country data without IP geolocation, choose the country explicitly:

```
TRACARBON_CO2SIGNAL_API_KEY= tracarbon run --country-code-alpha-iso-2 fr
```

See [file and API configuration](https://github.com/fvaleye/tracarbon/blob/main/docs/source/usage.rst#carbon-intensity) for Python examples, refresh intervals, and API failure behavior.

### Prometheus with Kubernetes containers

```
tracarbon run --exporter-name Prometheus --containers
```

See the [Prometheus metric reference](https://github.com/fvaleye/tracarbon/blob/main/docs/source/usage.rst#export-metrics) for metric names, labels, and units.

When running in Kubernetes, deploy Tracarbon per node and set `NODE_NAME` from `spec.nodeName` with the Downward API so container metrics are scoped to the measured node.

### Processes

```
tracarbon run --pid 1234
```

In Python, follow the current process:

```
with TracarbonBuilder().with_processes().build() as tracker:
    run_workload()

print(tracker.report.process_co2g)
```

Each process and its descendants get their share of the host CPU energy and carbon emissions. See [process metrics](https://github.com/fvaleye/tracarbon/blob/main/docs/source/usage.rst#processes).

## 🔌 Supported devices

### Hosts

| Devices | Description |
| --- | --- |
| Mac | ✅ Apple Silicon GPU energy via IOReport (no sudo), plus CPU, memory and Neural Engine energy when available. Excludes display and peripherals. Fallbacks: `powermetrics` (sudo), then `ioreg` system power for the whole machine. |
| Linux | ✅ Intel and AMD power via [RAPL](https://web.eece.maine.edu/~vweaver/projects/rapl/). CPU power is the full package, which can include an integrated GPU. AMD requires kernel 5.11+ (powercap) or `amd_energy` (HWMON). Unreadable RAPL permits GPU-only readings. Host power and emissions remain unknown. |
| Windows | ✅ NVIDIA GPU power via `nvidia-smi`. CPU, memory and host totals are unavailable. |

### Cloud providers

| Cloud Provider | Description |
| --- | --- |
| AWS | ✅ Use the hardware's usage with the EC2 instances carbon emissions datasets of [cloud-carbon-coefficients](https://github.com/cloud-carbon-footprint/ccf-coefficients/blob/main/data/aws-instances.csv). |
| GCP | ✅ Use the hardware's usage with the GCP [instances](https://github.com/cloud-carbon-footprint/ccf-coefficients/blob/b0032d9/data/gcp-instances-latest-2026.csv) and [coefficients](https://github.com/cloud-carbon-footprint/ccf-coefficients/blob/b0032d9/output/coefficients-gcp-use.csv) of [cloud-carbon-coefficients](https://github.com/cloud-carbon-footprint/ccf-coefficients) (Apache-2.0, 2026-04-24), generated by `scripts/generate_gcp_instances.py`. |
| Azure | ✅ Use the hardware's usage with the Azure instances carbon emissions datasets of [cloud-carbon-coefficients](https://github.com/cloud-carbon-footprint/ccf-coefficients/blob/main/data/azure-instances.csv). |

### 🎮 GPU power tracking

| GPU | Description |
| --- | --- |
| NVIDIA | ✅ Supported via `nvidia-smi`. Works on Linux, Windows, and Intel Macs. Supports multiple GPUs. |
| AMD | ✅ Supported via `rocm-smi` or `amd-smi` on Linux. Supports multiple GPUs. |
| Apple Silicon | ✅ Integrated GPU power via IOReport, without sudo. Falls back to `powermetrics` (requires sudo). |
| Intel | ❌ Not yet implemented. |

## 📡 Exporters

| Exporter | Description |
| --- | --- |
| Stdout | Log metrics through the application's Loguru handlers (stderr in the CLI). |
| JSON | Write a JSON array by default, or [JSON Lines](https://jsonlines.org/) with a `.jsonl` path. |
| Prometheus | Expose an HTTP endpoint for Prometheus to scrape. |
| Datadog | Send the metrics to Datadog. |

See [exporter examples](https://github.com/fvaleye/tracarbon/blob/main/docs/source/usage.rst#export-metrics) for JSON files, JSON Lines, and Prometheus scraping.

## 🗺️ Locations

| Location | Description and source |
| --- | --- |
| Worldwide | Get the latest co2g/kwh in near real-time using the CO2Signal or ElectricityMaps APIs. See [here](https://app.electricitymaps.com/developer-hub/api/reference) for available Electricity Maps query modes.  [CO2Signal API](https://www.co2signal.com) or [ElectricityMaps](https://app.electricitymaps.com/developer-hub/api/reference) |
| Supported countries | Latest yearly lifecycle carbon intensity of electricity for 200+ countries in the [bundled dataset](https://github.com/fvaleye/tracarbon/blob/main/tracarbon/locations/data/co2-emission-intensity.json), used without an API key.  [Ember](https://ember-energy.org/data/yearly-electricity-data/) via [Our World in Data](https://ourworldindata.org/grapher/carbon-intensity-electricity), [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) |
| AWS | Static file of the AWS Grid emissions factors.  [cloud-carbon-coefficients](https://github.com/cloud-carbon-footprint/cloud-carbon-coefficients/blob/main/data/grid-emissions-factors-aws.csv) |
| GCP | Static file of the GCP Grid emissions factors (2025 yearly data).  [GoogleCloudPlatform/region-carbon-info](https://github.com/GoogleCloudPlatform/region-carbon-info/blob/main/data/yearly/2025.csv) |
| Azure | Static file of the Azure Grid emissions factors.  [cloud-carbon-coefficients](https://github.com/cloud-carbon-footprint/cloud-carbon-coefficients/blob/main/data/grid-emissions-factors-azure.csv) |

## ⚙️ Configuration

Set the variables below in your environment or a `.env` file. See [configuration details](https://github.com/fvaleye/tracarbon/blob/main/docs/source/usage.rst#configuration).

| Parameter | Description |
| --- | --- |
| `TRACARBON_CO2SIGNAL_API_KEY` | The [Electricity Maps](https://app.electricitymaps.com/developer-hub/api/reference) API key. The variable keeps its CO2Signal name for compatibility. |
| `TRACARBON_CO2SIGNAL_URL` | The carbon intensity endpoint. Defaults to the Electricity Maps `https://api.electricitymaps.com/v4/carbon-intensity/latest`. |
| `TRACARBON_EMISSION_FACTOR_TYPE` | The Electricity Maps emission factor: `lifecycle` (default) or `direct`. |
| `TRACARBON_METRIC_PREFIX_NAME` | Metric name prefix. Defaults to `tracarbon`. |
| `TRACARBON_INTERVAL_IN_SECONDS` | Positive measurement interval in seconds. Defaults to `60`. |
| `TRACARBON_LOG_LEVEL` | Minimum log level for the CLI. Defaults to `INFO`. |
| `TRACARBON_IPINFO_TOKEN` | An optional [ipinfo.io](https://ipinfo.io) API token used for country detection from the IP address, lifting the anonymous rate limit. |
| `TRACARBON_KUBERNETES_NODE_NAME` | The Kubernetes node name used to scope container metrics to the node being measured. Falls back to `NODE_NAME` when unset. |
| `PROMETHEUS_ADDRESS` | The address the Prometheus exporter listens on. Defaults to `::`. |
| `PROMETHEUS_PORT` | The port the Prometheus exporter listens on. Defaults to `8081`. |
| `DATADOG_API_KEY` | The Datadog API key of the Datadog exporter. |
| `DATADOG_APP_KEY` | The Datadog application key of the Datadog exporter. |

## 💻 Development

### Local: using uv

```
make init
make test-unit
```

## 🛡️ Licence

[Apache License 2.0](https://raw.githubusercontent.com/fvaleye/tracarbon/main/LICENSE.txt)

## 📚 Documentation

Read the [documentation](https://fvaleye.github.io/tracarbon/documentation/).

## 📖 Cited in

- 2025-11 [Carbon Emission Quantification of Machine Learning: A Review](https://doi.org/10.1109/TSUSC.2025.3578834)
- 2025-04-25 [A Critical Analysis of Machine Learning Eco-feedback Tools through the Lens of Sustainable HCI](https://doi.org/10.1145/3706598.3713198)
- 2025-04-25 ["Should I choose a smaller model?": Understanding ML Model Selection and Its Impact on Sustainability](https://doi.org/10.1145/3706598.3713240)
- 2024-07-08 [Balancing computational chemistry's potential with its environmental impact](https://doi.org/10.1039/D4GC01745E)
- 2023-06-26 [GREENER principles for environmentally sustainable computational science](https://doi.org/10.1038/s43588-023-00461-y)
- 2023-01-19 [eco2AI: Carbon Emissions Tracking of Machine Learning Models as the First Step Towards Sustainable AI](https://doi.org/10.1134/S1064562422060230)
fvaleye10
🟧 echo.blog ⭐The original Tracarbon article says: “It was the birth of Tracarbon, lightweight software that will track a device’s energy consumption and Florian Valeye——

Interpretation history

Decision trace