# What does a million tokens cost me?

> Enter hardware price, power draw, electricity price, hours of use and speed to get cost per million tokens. Every assumption is editable.

The answer depends mostly on how many hours a day the machine is actually generating. Fill in your own numbers. The defaults are placeholders, not a recommendation.

*Interactive calculator: cost per million tokens = (hardware per hour + electricity per hour) ÷ tokens per hour × 1,000,000.*

## The formula

Cost per hour is the hardware price spread over the hours you will use it, plus the electricity for one hour. Divide by the tokens written in an hour, then multiply by a million.

```text
hardware per hour = price ÷ (years × 365 × hours per day)
power per hour    = watts ÷ 1000 × price per kWh
cost per million  = (hardware per hour + power per hour) ÷ (tokens per second × 3600) × 1,000,000
```

## What moves the result

Use matters more than anything else. A machine that generates for one hour a day spreads its price over very few tokens. The same machine running agents all day can beat an API by a wide margin.

Speed matters next. A model twice as fast halves the cost per token, because both the hardware share and the power are paid per hour.

That is one more reason a well-sized model beats an oversized one. See [Which size of model do I need?](https://localagi.co/model-classes).

**The catch.** 
This counts output tokens only. APIs also charge for input tokens, often a large share of an agent's bill, while reading prompts at home costs you time but nothing extra. Compare like with like, and read [When is local cheaper than an API?](https://localagi.co/economics) before deciding on cost alone.

## Go deeper

### Costs the calculator leaves out

Your time setting it up and keeping it updated.

Resale value at the end, which lowers the real hardware cost. The machine being busy when you want it for something else. Idle power draw when it is on but not generating.

### Many users at once

With a serving runtime, one machine can write for several people at once at a much higher total speed. Enter the total throughput rather than the single-user speed to see the cost per token for a team. [What changes when many people use one model?](https://localagi.co/one-user-to-many) explains batching.
