# How do I estimate the energy of my AI API calls?

> You can't meter a hosted AI API, but you can estimate energy per call from token counts and model assumptions with EcoLogits, and log it next to cost.

Source: https://greenai.guide/how-do-i/estimate-energy-of-ai-api-calls/  
Updated: 2026-11-19

## In short

You can't meter hardware you don't control, so estimate instead: log input and output tokens per call and use a tool such as EcoLogits, which wraps your AI client and reports estimated energy and emissions per request. Label the figures as estimates, state the method, and replace them with supplier-reported numbers when you can get them.

## Steps

1. Log the model, input tokens and output tokens for every call, tagged with the feature that made it.
2. Wrap your AI client with an estimator such as EcoLogits to get energy and emissions per request.
3. Store the estimate next to latency and cost in your logs or dashboards.
4. Review the heaviest features and prompts at each release.
5. Ask your supplier for measured figures and swap them in when available.

**Estimate from tokens, log it per call, and be clear it is an estimate.** Hosted AI services give you no power
meter, so heavy features and wasteful prompts stay invisible unless you build a number yourself.

## Why tokens?

Energy rises with how much a model reads and writes. Epoch AI's bottom-up estimate puts a typical ChatGPT query at
about 0.3 Wh, rising to about 2.5 Wh with a 10,000-token input and almost 40 Wh with a 100,000-token input. Your
own token logs therefore tell you far more than any headline average.

## Which tool should I use?

CodeCarbon's own guidance draws the line: use CodeCarbon for code running on hardware you manage, and EcoLogits for
calls to remote generative AI services. EcoLogits wraps the client libraries of common AI providers and returns
estimated energy and global-warming impact for each request, based on the model and token counts.

## What should I record with each estimate?

- the model and version, and the tool version used to estimate;
- input and output tokens;
- the feature or workflow that made the call;
- whether the call succeeded, so you can count energy per successful task.

## Common mistakes

- **Treating estimates as measurements.** The model sizes and hardware behind closed models are often assumed.
  Give a range and say so.
- **Ignoring retries and agent loops.** One user request can trigger many calls; see
  [tracking energy per task](/how-do-i/track-ai-energy-per-task/).
- **Never asking the supplier.** See [asking an AI company for its energy figures](/how-do-i/ask-an-ai-company-for-energy-figures/).

More on methods and boundaries in [how to measure AI energy](/practice/measure-ai-energy/).

## Sources

- [EcoLogits documentation](https://ecologits.ai/latest/), EcoLogits (2025)
- [When to use CodeCarbon](https://docs.codecarbon.io/latest/explanation/when-to-use/), CodeCarbon (2025)
- [How much energy does ChatGPT use?](https://epoch.ai/gradient-updates/how-much-energy-does-chatgpt-use), Epoch AI (2025)
