Deriving dollars per million tokens from hardware specs, why utilization dominates every other term, and how to decide between an API and self-hosting with actual arithmetic.
Same hardware, same model, same code:
U = 90% → $0.14 / 1M tokens
U = 60% → $0.21
U = 40% → $0.31
U = 20% → $0.63
A 4.5× cost swing, entirely from how full the GPUs are.
For comparison, a heroic kernel optimisation might
buy you 15%.
Speculative decoding (a small model drafts several tokens; the big model checks them in one pass)
2–3× latency at low batch
Costs throughput at high batch, where rejected drafts waste compute the batch could have used
Larger batch
More throughput
Worse TTFT
GQA / smaller KV
More concurrency → bigger batch
Model architecture choice
Smaller model
Proportionally cheaper
Quality, and it's a real quality drop
Reserved capacity
40–70% off hourly
Commitment risk
Most of these are covered elsewhere. The one worth flagging here: routing to the smallest model that can do the job is frequently the largest single cost lever in a product, and it's a product decision rather than an infrastructure one.
MODEL ROUTING
classify the request (cheaply — a small model or a
classifier costs ~1% of the frontier model)
├── simple → small model (~20× cheaper)
├── medium → mid model (~5× cheaper)
└── hard → frontier model
If 70% of traffic is simple, a well-tuned router can
cut total cost by more than half at essentially
unchanged output quality.
The risk to manage: misrouting a hard request to a small
model produces a bad answer. Route conservatively and
measure the escalation rate.
Routing, budgets and attribution usually live together in an LLM gateway in front of every model call.
The decision that gets made on vibes and should be made on arithmetic.
The arithmetic says what practitioners find: most teams should use an API. Self-hosting becomes correct when at least one of these holds:
Volume is genuinely large — above roughly 500M output tokens/day sustained.
Data cannot leave your infrastructure — regulatory or contractual, not preference.
You need a custom or fine-tuned model that no API serves.
Latency requires colocation with your other services.
You already have GPUs for training, and inference can backfill idle capacity. Those GPUs are paid for whether or not they're busy, so the extra cost of serving on them is close to zero. This is the most commonly overlooked case.
The costs that get left out of self-hosting estimates: on-call for a GPU fleet, capacity planning with quarter-long lead times, model upgrade work, and the opportunity cost of the engineers doing it. The $30k/month engineering line above is not padding.
Once you're spending meaningfully, you need to know on what — and default logging won't tell you.
Per request, record: tenant / customer ID model and version input tokens (cached and uncached, separately) output tokens feature / endpoint derived cost Aggregate by all of them. What you're looking for: · the top 1% of users by cost — often 40%+ of the bill · features whose cost per active user exceeds revenue · retry storms and agent loops burning tokens invisibly · prompts that grew over time without anyone noticing
Reasoning models move cost to the output side. A model that thinks before answering can generate 5,000–50,000 hidden reasoning tokens on a hard question, billed as output — the most expensive token type — and served by the bandwidth-bound decode phase. Most such models expose a reasoning-effort or thinking-budget setting: use a low budget for routine traffic and a high one only where accuracy pays for it, and track reasoning tokens as their own line in cost attribution. Serving reasoning models covers the infrastructure side.
If you resell, the unit economics have to be worked out per user, not per token.
$20/month subscription. Cost $0.28/1M output tokens,
$0.05/1M input.
A typical user: 60 conversations/month, 8 turns each,
~2,500 input and ~400 output tokens per turn.
input: 60 × 8 × 2,500 = 1.2M → $0.06
output: 60 × 8 × 400 = 192K → $0.05
total ≈ $0.11/month → 99% gross margin ✓
A power user: 50× that volume
total ≈ $5.50/month → 72% margin ✓ still fine
An agent user: 20 tool calls per task, 40 tasks/month,
average 60,000 tokens per task
2.4M tokens × mixed rate ≈ $8-15/month → thin or negative
→ Flat-rate pricing works for chat and breaks for agents.
This is why agentic products meter, cap, or price by
usage while chat products don't have to.
Node price per hour ÷ (3,600 × sustained tokens/s × utilisation). A $22/hour node at 48,800 tokens/s is ~$0.13 per million output tokens at full load, ~$0.28 at 45%.
Why does utilisation dominate cost?Show answer
It swings cost 2–4× (90% → $0.14, 20% → $0.63), far more than a heroic 15% kernel win. Levers: batch lanes, multi-tenancy, follow-the-sun traffic, right-sized replicas.
Why are input and cached tokens cheaper?Show answer
Prefill is compute-bound and batches at high intensity (~4–8× more tokens/s than decode); cached input skips prefill entirely.
What is model routing, and its risk?Show answer
A cheap classifier sends simple requests to small models and hard ones to the frontier model — cutting cost by more than half when most traffic is simple. Misrouting gives bad answers, so route conservatively and watch escalations.
Where is the API-versus-self-host break-even?Show answer
With ~$46K/month fixed (node plus 1.5 engineers) and $2.72 saved per million tokens: ~17 billion output tokens a month, ~500M a day — a large product.
When is self-hosting right despite the arithmetic?Show answer
Genuinely huge volume, data that can't leave your infrastructure, a custom model no API serves, colocation for latency, or idle training GPUs that inference can backfill.
What should cost attribution record?Show answer
Per request: tenant, model and version, cached and uncached input, output (and reasoning) tokens, feature and cost — to find the top 1% of users, unprofitable features and runaway loops.
Why do agents and reasoning models break flat pricing?Show answer
Agents re-send growing context each step (300,000+ tokens per task versus 2,500 per chat message) and reasoning models emit thousands of hidden output tokens. Meter, cap or budget them.