Skip to content

Create a new module for manual impact estimations #188

Open

Description

@samuelrince

Description

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.

Having intermediate results of the methodology can also be very useful for EcoLogits Calculator and Boavizta/e-footprint to better explain the impact modeling.

Activity

  1. Lunik commented on Nov 21, 2025

    @Lunik

    Is using the llm_impacts method from ecologits.tracers.utils useful in your use case ?
    You can use it directly like :

    from ecologits.tracers.utils import llm_impacts
    
    impacts = llm_impacts(
         provider="openai",
         model_name="gpt-5-mini",
         output_token_count=12782,
         request_latency=3,
         electricity_mix_zone="FRA",
    )
  2. samuelrince commented on Nov 21, 2025

    @samuelrince
    MemberAuthor

    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:

    1. 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.
    2. 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:

    from ecologits.tracers.utils import llm_impacts
    
    OPENAI_GPT5_MINI_TPS = 50  # from openrouter.ai
    
    output_tokens = 12782
    
    impacts = 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,
    )
  3. gturri commented on Mar 24, 2026

    @gturri

    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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions