Practical overview
When it fits
Use Ecologits when your Python application calls a supported generative AI API and you want impact estimates exposed with the response. For local compute, the project points users to CodeCarbon.
Who it is for
- Python developers integrating generative AI provider APIs into applications.
- Teams that want energy and environmental estimates alongside API inference activity.
Documented uses
- Attach estimated energy use and environmental-impact values to supported provider API responses.
- Collect estimates to compare or report impacts across API-based generative AI usage.
Requirements & limits
- The README lists integrations for Anthropic, Cohere, Google GenAI, Hugging Face Hub, Mistral, and OpenAI.
- Provider integration is installed using a provider-specific package extra.
- The project documents estimates, not direct measurements, and the cited README does not describe the estimation methodology.
- The repository specifies the Mozilla Public License 2.0.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Add impact estimates to an OpenAI API call
Install Ecologits, initialize its OpenAI integration, and read estimated energy and emissions from a chat-completions response.
Before you start
- Python environment
- OpenAI client library
- OpenAI API key
Steps
Install Ecologits with the OpenAI integration using the command below.
pip install ecologits[openai]Import
EcoLogitsandOpenAI, then initialize tracking withEcoLogits.init(providers=["openai"]).Create the OpenAI client with an API key and make a chat-completions request.
Read the response impact fields for energy consumption in kWh and greenhouse-gas emissions in kgCO2eq.
Expected outcome
The response exposes estimated energy and greenhouse-gas impact values for the inference.
Guide limitations
- The example covers OpenAI chat completions; consult provider documentation for other integrations.
- The README describes the values as estimates and does not specify their calculation methodology.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 15 October 2026
- Original website title
- mlco2/ecologits · Official homepage title · retained in its source language
Related options
CodeCarbon — The Ecologits README points to CodeCarbon for tracking local compute emissions.
EcoLogits.js — A related project listed in the Ecologits README for environmental-impact estimates in JavaScript and TypeScript.

