What is the formula to estimate CO2e from LLM API token usage?

    For analysts who have token counts and need the arithmetic spelled out. Factor version soma-ai-ef-2026.11-dataset-v3.1.0. Factors last updated . Location-based grid averages, not renewable contracts. Estimates from published benchmarks.

    Page updated

    Part of the SOMA AI Emission Factors cluster.

    Short answer

    Multiply billed tokens by a factor in kg CO2e per million tokens that already combines electricity (energy per token, server and facility overheads, grid intensity) with a modelled share of embodied hardware, data-centre construction and training. For a mid-size model, SAEF gives 0.00714 kg per million tokens from EU North - Sweden and 0.0261 kg from US East - N. Virginia. These are estimates, not meter readings.

    To run the full method in Python, use pip install saef (PyPI).

    The formula

    Full form
    T_eff  = (T_out + W_in x T_in + W_cache x T_cache) / D
    kg CO2e = T_eff / 1e6 x (E x g + e_hw + e_dc)  +  T_billed / 1e6 x e_train
    
    One-line form
    kg CO2e = T_billed / 1e6 x F        (F = kg_co2e_per_million_tokens_total)
    Variables. Values are the dataset's central settings.
    SymbolMeaningValue
    T_in, T_cache, T_outUncached input, cached input and output tokens billedyour data
    W_inWeight of an uncached input token against an output token0.3
    W_cacheWeight of a cached input token0.05
    DBenchmark-to-billing factor1.339
    EFacility kWh per effective token for the class, including the server uplift 1.5, idle uplift 1.1 and PUE 1.2by class
    gCarbon intensity of the serving grid, kg CO2e per kWhby region
    e_hw, e_dc, e_trainModelled embodied hardware, data-centre construction and amortised trainingby class

    The factors include a modelled embodied hardware, building and training share, so they are higher than an electricity-only figure. The one-line form assumes the dataset's default mix of input and output tokens and takes no cache credit. For a different mix, or to credit cached input, use the full form. Every term is explained on the methodology page.

    Steps

    1. Count billed tokens. Take input, cached input and output tokens from the API usage export or from the usage field in each response.
    2. Convert to effective tokens. Weight input and cached input below output, because reading a prompt costs less energy than generating a reply, then divide by the benchmark-to-billing factor.
    3. Price the electricity. Multiply effective tokens by the facility energy per token of the model class, then by the carbon intensity of the grid that serves it.
    4. Add the modelled share of hardware, building and training. These terms do not depend on the grid. Training is charged on billed tokens, the others on effective tokens.
    5. Or use the published one-line form. Divide billed tokens by one million and multiply by the total kg CO2e per million tokens for the class and region in the SAEF table.

    Worked example

    10 million billed tokens through a mid-size model (class B) at the default input and output mix, served from two regions. Energy is facility kWh. Terms are kg CO2e, as estimates.

    Class B, 10 million billed tokens.
    ItemEU North - SwedenUS East - N. Virginia
    Effective tokens (millions)3.023.02
    Facility energy (kWh)0.7130.713
    Grid (kg CO2e per kWh)0.03840.304
    Electricity0.02740.217
    Embodied hardware0.01010.0101
    Data-centre construction0.004550.00455
    Training, amortised0.02930.0293
    Total0.07140.261
    One-line check, 10 x F0.07140.261

    The grid moves the electricity term by a factor of 7.9, while the other three terms stay the same. The class and the region change the answer far more than rounding does. Download the factors as CSV, cite them by DOI 10.5281/zenodo.20443585, or let the SOMA AI calculator do the arithmetic.

    Common mistakes

    • Multiplying tokens by grid intensity alone. That drops the server and facility overheads and the hardware and training terms.
    • Counting reasoning tokens twice. Billed output already includes them, so add no multiplier to an exact token count.
    • Applying a factor built for chat models to embeddings, speech, image or video usage, which the factors do not cover.

    Keep reading