What does a million tokens cost me?
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.
- Hardware share
- 4.76
- Electricity
- 0.63
- Per million tokens
- 5.38
The API is cheaper at this level of use. More hours per day or a faster model moves the line. Same currency as your inputs.
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 tokensTokenA chunk of text, usually part of a word. Models read and write in tokens.Read more written in an hour, then multiply by a million.
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,000What 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?.
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? before deciding on cost alone.
Go deeperThat's enough
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 runtimeRuntimeThe software that loads a model file and runs it.Read more, 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? explains batching.