mlco2 open-source ecosystem

Measure the environmental footprint of computing & AI

Two tools, one mission.

Code Carbon is a French non-profit building free, open-source tools for developers and researchers. CodeCarbon for local compute, EcoLogits for GenAI APIs — use both when your stack mixes them.

CodeCarbon

CodeCarbon

Local compute emissions

Track CO₂ from code running on hardware you control — your laptop, workstation, or cloud VM. Measures CPU, GPU, and RAM power, then applies regional grid carbon intensity.

pip install codecarbon
EcoLogits

EcoLogits

GenAI API impacts

Estimate energy and environmental impacts when you call third-party GenAI APIs — OpenAI, Anthropic, Mistral, Google, and more. Attaches impact data to provider SDK responses.

pip install ecologits

How It Works

1

Download package

2

Embed the code

3

Run and track

4

Visualize results

Get started in minutes

Install a package, paste a snippet, run. Both tools side by side — pick Python or CLI/API within each column.

Install
terminal
bash
pip install codecarbon
train.py
python
from codecarbon import EmissionsTracker

tracker = EmissionsTracker()
tracker.start()

# Your code here

emissions = tracker.stop()
print(f"Emissions: {emissions} kg CO₂")

Wrap your script with EmissionsTracker — start, run, stop.

Full docs →
Install
terminal
bash
pip install ecologits
chat.py
python
from ecologits import EcoLogits
from openai import OpenAI

EcoLogits.init(providers=["openai"])
client = OpenAI(api_key="<OPENAI_API_KEY>")

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Tell me a funny joke!"}],
)

print(f"Energy: {response.impacts.energy.value.mean} kWh")
print(f"GHG: {response.impacts.gwp.value.mean} kgCO2eq")

Init once, then read impacts from the SDK response.

Full docs →

What we are

Lightweight, easy-to-use

Python libraries

Open source, free &

community driven

Effective

visual outputs

Get involved

Use the tools, contribute on GitHub, or support the Code Carbon non-profit.

Use it

Track local compute with CodeCarbon, GenAI API calls with EcoLogits — or both if your stack mixes them.

Contribute

Issues, docs, and methodology feedback welcome on GitHub. Most maintenance is volunteer work.

Spread the word

Share the tools with colleagues, at conferences, and in your developer communities.

Join us on Discord →

Maintained by volunteers across the mlco2 ecosystem

CodeCarbon and EcoLogits are built by researchers, engineers, and sustainability practitioners who contribute in their spare time.

Benoît Courty

Benoît Courty

Data Scientist

Amine Saboni

Amine Saboni

Deep Learning Engineer

Sasha Luccioni

Sasha Luccioni

Researcher

Hugging Face

Iñigo Imaz

Iñigo Imaz

Software Developer

Luis Blanche

Luis Blanche

Machine Learning Engineer

Patrick

Patrick

Software developer

Want to contribute?

Join us and help improve the ecosystem.

Supported by sponsors & volunteers

Our tools stay free thanks to organisations that sponsor infrastructure, funding, or expertise. Community volunteers at Code Carbon do the rest.

CodeCarbon

Clever CloudDataForGoodGitHubMozilla

EcoLogits

ResilioTerra CognitaSophtAvanadeTheodoMinistère de la Culture

Historical research partners

BCG GammaCometHaverford CollegeMila