How Many Tokens Per Kilowatt-Hour? A Reproducible Approach to Estimating LLM Inference Costs
This article outlines a reproducible methodology for estimating LLM inference costs, focusing on energy consumption, hardware depreciation, and GPU utilization. It provides formulas to calculate the number of tokens generated per kilowatt-hour and the cost per million mixed tokens, allowing readers to input their own benchmark data for accurate cost analysis.
1. Definitions and Scope
All parameters used in this article are illustrative assumptions. They do not represent the actual performance of any specific product and should not be used as a basis for quotations. Readers can substitute their own stress-testing data into the provided formulas to derive their own results.
Token definitions are as follows:
- Input Tokens: Also known as prefill tokens, referring to the portion of the user prompt processed by the model. This part can be computed in parallel and is fast.
- Output Tokens: Also known as decode tokens, referring to the portion generated by the model one by one. This must be output sequentially and is slower.
- Mixed Tokens: The sum of input and output tokens. This article defaults to an input-to-output ratio of 3:1, meaning input accounts for 75% and output for 25%.
The cost scope includes only the hardware depreciation, electricity, and O&M costs of a single accelerator card. It does not account for human resources, software R&D, network egress, redundancy, profit, or taxes. Therefore, the results presented here represent a cost floor.
2. From Energy Consumption to Token Count
2.1 Basic Assumptions
- Effective power per card: 900 W. This is the wall power, which already includes the Power Usage Effectiveness (PUE) and the allocated overhead for network and CPU. Do not multiply by PUE again during calculation to avoid double counting.
- Decode throughput: A stable output of approximately 1000 tokens per second per card. This value must come from stress testing and meet target latency requirements; peak values cannot be substituted. A conservative range is 500 to 3000 tokens/s.
- Prefill throughput: Processing approximately 10000 input tokens per second per card.
- Input-to-output ratio: 3:1.
- Electricity price: Estimated at $0.1/kWh for industrial electricity.
2.2 Energy Consumption per Output Token
Unit energy consumption is calculated by dividing power by throughput. A power of 900 W equals 900 joules per second. At a throughput of 1000 tokens/s, each output token consumes 0.9 joules. Since 1 kilowatt-hour equals 3.6×10⁶ joules, the number of output tokens generated per kilowatt-hour is:
Output Tokens per kWh = 3.6×10⁶ ÷ (Power ÷ Decode Throughput)
Holding power constant at 900 W, the comparison for three different throughput rates is shown below.
Table 1: Output Tokens Only (Excluding Prefill)
| Decode Throughput (token/s) | Energy per Token (J) | Output Tokens per kWh |
|---|---|---|
| 500 | 1.8 | ~2 million |
| 1000 | 0.9 | ~4 million |
| 3000 | 0.3 | ~12 million |
When power remains unchanged, doubling the throughput approximately doubles the number of tokens generated per kilowatt-hour. This table calculates only output tokens and cannot be directly used for pricing.
2.3 Energy Consumption per Mixed Token
Actual billing typically includes both input and output, so a 3:1 weighting must be applied. The approach is to first calculate the time a mixed token occupies the card, then multiply it by the power.
- Prefill single-token time: 1 ÷ 10000 = 0.0001 s, Energy = 900 × 0.0001 = 0.09 J
- Decode single-token time: 1 ÷ 1000 = 0.001 s, Energy = 900 × 0.001 = 0.9 J
- Mixed-token time: 0.75 × 0.0001 + 0.25 × 0.001 = 0.000325 s
- Mixed-token energy: 900 × 0.000325 = 0.2925 J
Converted to tokens per kWh: 3.6×10⁶ ÷ 0.2925 ≈ 12.3 million mixed tokens.
This result is based on the assumption that prefill and decode are executed serially on the same card, each occupying a portion of time. If the scheduler allows the two to overlap, actual throughput will be higher and energy consumption lower. When switching to a different framework or card model, stress testing must be conducted again.
3. Depreciation and Utilization
3.1 Cost Formula
The procurement cost of the card is amortized over its depreciation months to each calendar hour, then divided by the utilization rate to obtain the cost per effective running hour.
Hourly Cost = (Electricity Price × Power ÷ 1000) + (Card Price ÷ (Depreciation Months × 730 × Utilization))
Here, 730 represents the average number of hours in a month. Utilization is defined as the ratio of effective running hours calculated at stable throughput to calendar hours. You cannot directly use the occupancy rate displayed by the GPU, as the displayed value may include time without actual output.
Cost per 1M Tokens = Hourly Cost ÷ (Mixed Token Throughput × 3600) × 10⁶
Assume a card price of $30,000 (illustrative), a depreciation period of 36 months, and a utilization rate of 0.6.
- Hourly electricity cost: 0.1 × 0.9 = $0.09
- Hourly depreciation: 30000 ÷ (36 × 730 × 0.6) ≈ $1.903
- Total hourly cost: ~$1.993
- Mixed tokens per hour: 3077 × 3600 ≈ 11.08 million
- Cost per 1 million mixed tokens: ~$0.18
3.2 The Impact of Utilization
Utilization is the most sensitive variable. The table below keeps all other parameters constant and only changes the utilization rate.
Table 2: Impact of Utilization on Cost per 1M Mixed Tokens (Card Price $30,000, 36-Month Depreciation)
| Utilization | Hourly Depreciation (USD) | Cost per 1M Mixed Tokens (USD) |
|---|---|---|
| 0.3 | 3.806 | ~0.35 |
| 0.6 | 1.903 | ~0.18 |
| 0.9 | 1.268 | ~0.12 |
As utilization increases from 0.3 to 0.9, the cost per 1M tokens drops by about two-thirds. The primary variable in self-hosted costs is utilization.
In this example, electricity accounts for only about 4.5% of the total. Electricity price is rarely the main variable unless your price is significantly higher than $0.1/kWh or the card’s power consumption is well above 900 W.
4. Reproducible Calculation Parameters
4.1 Parameter Table
Table 3: Script Parameters
| Parameter | Meaning | Example Value | Data Source |
|---|---|---|---|
| power_w | Wall power (W) | 900 | Power meter or data center PDU, incl. PUE |
| decode_tps | Stable decode throughput (token/s) | 1000 | Benchmarking, meets target latency |
| prefill_tps | Stable prefill throughput (token/s) | 10000 | Benchmarking |
| ratio | Input:Output | 3.0 | Real-world traffic statistics |
| price_kwh | Electricity price (per kWh) | 0.1 | Utility bill, unit consistent with card price |
| card_price | Single card purchase price | 30000 | Procurement contract or quote, illustrative value |
