pip install codecarbonmlco2 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
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
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.
CodeCarbon
Local compute emissions
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 →
EcoLogits
GenAI API impacts
pip install ecologitsfrom 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
Related tools & integrations
First-party projects from mlco2, plus community-built extensions on our open APIs. Each tool belongs to CodeCarbon or EcoLogits — pick the stack you use.
CodeCarbon tools
EcoLogits tools
Community integrations
Independent projects built on EcoLogits APIs — not official releases, but we're glad they exist.
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.
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
Data Scientist
Amine Saboni
Deep Learning Engineer
Sasha Luccioni
Researcher
Hugging Face
Iñigo Imaz
Software Developer
Luis Blanche
Machine Learning Engineer
Patrick
Software developer
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



EcoLogits




