Updated November 2026.
Cost per token is what it costs to process or generate one token, usually quoted per million tokens. With an API, you read it off the price list. With a model you host, you work it out: the hourly cost of the serving setup divided by the useful tokens it produces in that hour. The second calculation is where teams find out that GPU price per hour is the wrong thing to compare.
Both versions matter because they answer different questions. API pricing tells you what a call costs. Self-hosted math tells you whether renting GPUs would be cheaper than calling an API at your volume. NVIDIA’s tokenomics material frames the same idea: judge infrastructure by how many tokens it delivers per dollar, not by hardware specs.
Calculating cost per token for an API
APIs bill input and output tokens at different rates, so the blended number depends on your mix. Take a model priced at $1 per million input tokens and $4 per million output tokens (hypothetical prices). A request with 500 input tokens and 1,000 output tokens costs:
- Input: 500 ÷ 1,000,000 × $1 = $0.0005
- Output: 1,000 ÷ 1,000,000 × $4 = $0.004
- Total: $0.0045 for 1,500 tokens
That is a blended $3.00 per million tokens. If your outputs are longer than your inputs, the blend moves toward the output price, so measure your real ratio instead of quoting the list price. Always check the provider’s current price page, because prices change often. For current figures, see our guides to Azure OpenAI pricing and OpenAI Codex pricing.
Calculating cost per token for self-hosted models
The formula is: cost per million tokens = hourly serving cost ÷ useful tokens per hour × 1,000,000.
Suppose a serving node costs $4 an hour all in (GPU rental, CPU, orchestration, monitoring) and produces 2 million useful tokens an hour. Cost is $4 ÷ 2,000,000 × 1,000,000 = $2 per million tokens. If utilization halves, because traffic is uneven and the GPU idles half the time, the same node produces 1 million tokens an hour and the cost doubles to $4 per million.
“Useful” matters. Count tokens your application actually serves to users, not peak benchmark throughput.
What moves the number
Utilization is the biggest lever. An idle GPU bills the same as a busy one, so uneven traffic inflates cost per token. Batching requests raises throughput on the same hardware. Quantization and mixture-of-experts models reduce compute per token. The serving stack matters too: an optimized engine such as vLLM or TensorRT-LLM can serve far more tokens per GPU than a naive setup, though the gain depends on model and workload. Trimming prompts reduces tokens at the source, and no price negotiation beats not sending the tokens.
Why cost per token beats cost per GPU hour
A GPU hour is an input. A token is an output you can tie to revenue or user value. Two teams on identical hardware can have costs per token several times apart, based on batching and utilization alone. If you track only the hourly rate, you miss that.
Pair it with a business-level metric. A support bot’s real unit is cost per resolved ticket, which includes retries and failures. FinOps for AI and how to reduce OpenAI API cost show how to connect the two, and cost per customer covers the customer-level view.
Questions people ask
Is output more expensive than input?
On most commercial APIs, yes. Output tokens are priced several times higher than input tokens, so long answers cost more than long prompts.
When does self-hosting beat an API?
When your traffic is steady enough to keep GPUs busy and your engineers can run the stack. At low or spiky volume, an API usually wins, because you pay nothing when idle.

Pingback: Cost Per Customer: How to Calculate Cloud Cost to Serve
Pingback: Cursor Pricing 2026: X Subscription Plans and Costs
Pingback: Cursor Cost Management: Limits, Alerts and Seat Control