You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Create a new module for manual impact estimations #188
We have seen many projects that only rely on the implemented methodology and ignore the tracing features of the package. This is the case for the EcoLogits Calculator and other external projects like betagouv/ComparIA or Boavizta/e-footprint. Currently using the methodology without the tracing features is complex and not officially supported nor documented.
Solution
We can create a new module within EcoLogits dedicated to impact estimations. These estimations will be based on the same inputs and generate similar outputs. The API design is key to make sure that the developer experience is as simple as possible but also flexible enough to allow custom configuration and internal methodological changes.
Hi @Lunik, yes for now you can use this function! But, in v1.0 it will probably no longer work, and you will need to migrate to this future "estimations" module that we will create.
As this method is not really well documented, two caveats:
It is better to estimate the request_latency using an average token throughput for the target model and provider. This is what we do in EcoLogits Calculator and will bring it to the estimations module later.
The electricity_mix_zone is for the data center, not the user location. So for OpenAI, it will likely be the USA. I'd recommend you keep the value at None and use our default config for providers.
So with your example it becomes:
fromecologits.tracers.utilsimportllm_impactsOPENAI_GPT5_MINI_TPS=50# from openrouter.aioutput_tokens=12782impacts=llm_impacts(
provider="openai",
model_name="gpt-5-mini",
output_token_count=output_tokens,
request_latency=output_tokens/OPENAI_GPT5_MINI_TPS,
electricity_mix_zone=None,
)
Upvoting this feature request: here my use case: coding agents (eg: copilot integrated in the IDE) make it possible to get the total number of tokens used, but (AFAIK) it's not possible to wrap each call with the ecologits sdk.
So having a way to convert the overall agent usage to CO2 (in order to be able to come up with some API with feature similar to Ecologit Calculator) would be great!
Activity
Lunik commentedon Nov 21, 2025
Is using the
llm_impactsmethod fromecologits.tracers.utilsuseful in your use case ?You can use it directly like :
samuelrince commentedon Nov 21, 2025
Hi @Lunik, yes for now you can use this function! But, in v1.0 it will probably no longer work, and you will need to migrate to this future "estimations" module that we will create.
As this method is not really well documented, two caveats:
request_latencyusing an average token throughput for the target model and provider. This is what we do in EcoLogits Calculator and will bring it to the estimations module later.electricity_mix_zoneis for the data center, not the user location. So for OpenAI, it will likely be the USA. I'd recommend you keep the value atNoneand use our default config for providers.So with your example it becomes:
gturri commentedon Mar 24, 2026
Hi,
Upvoting this feature request: here my use case: coding agents (eg: copilot integrated in the IDE) make it possible to get the total number of tokens used, but (AFAIK) it's not possible to wrap each call with the ecologits sdk.
So having a way to convert the overall agent usage to CO2 (in order to be able to come up with some API with feature similar to Ecologit Calculator) would be great!