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)
| Symbol | Meaning | Value |
|---|---|---|
| T_in, T_cache, T_out | Uncached input, cached input and output tokens billed | your data |
| W_in | Weight of an uncached input token against an output token | 0.3 |
| W_cache | Weight of a cached input token | 0.05 |
| D | Benchmark-to-billing factor | 1.339 |
| E | Facility kWh per effective token for the class, including the server uplift 1.5, idle uplift 1.1 and PUE 1.2 | by class |
| g | Carbon intensity of the serving grid, kg CO2e per kWh | by region |
| e_hw, e_dc, e_train | Modelled embodied hardware, data-centre construction and amortised training | by 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
- Count billed tokens. Take input, cached input and output tokens from the API usage export or from the usage field in each response.
- 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.
- 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.
- 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.
- 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.
| Item | EU North - Sweden | US East - N. Virginia |
|---|---|---|
| Effective tokens (millions) | 3.02 | 3.02 |
| Facility energy (kWh) | 0.713 | 0.713 |
| Grid (kg CO2e per kWh) | 0.0384 | 0.304 |
| Electricity | 0.0274 | 0.217 |
| Embodied hardware | 0.0101 | 0.0101 |
| Data-centre construction | 0.00455 | 0.00455 |
| Training, amortised | 0.0293 | 0.0293 |
| Total | 0.0714 | 0.261 |
| One-line check, 10 x F | 0.0714 | 0.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
- How do I calculate the carbon footprint of my company's AI usage? The whole workflow
- How can I track emissions from AI API calls for carbon accounting? The formula as code
- What methodology should a company use to estimate the energy use of generative AI inference?
- SOMA AI Emission Factors. All classes and regions
