Hosted vs self-hosted LLMs: a calculator that tells the truth
Most cost comparisons leave out electricity, amortization, and the data sovereignty cost of egress. A live calculator that puts all of them on one page so you can find your actual break-even point.
Every team running production AI eventually arrives at the same question: “At what point does it actually make sense to stop paying OpenAI and buy our own GPU?”
The honest answer is it depends, but most people asking the question want a number, not a non-answer. So I built the calculator I wished existed. It estimates monthly cost across five deployment options — OpenAI GPT-4o, Anthropic Claude (Opus and Sonnet), Cloudflare Workers AI, and self-hosting an H100 — using publicly listed prices, realistic hardware amortization, and electricity costs that actually reflect where you are running the machine.
Move the sliders. Find your break-even point.
Illustrative, based on publicly listed prices as of May 2026. Your actual costs depend on negotiated rates, hardware availability, electricity contracts, and operational overhead. Use this to find the right order of magnitude, not a quote.
What the calculator is actually computing
Five deployment options, each costed honestly. Here is what is under the hood, because a calculator that hides its math is not really a calculator \u2014 it is a lookup table you cannot argue with.
Hosted models (OpenAI, Anthropic, Cloudflare)
Hosted is the easy case. Each provider publishes a price per million input tokens and a separate price per million output tokens. The math is:
monthly_cost = (input_tokens * in_rate + output_tokens * out_rate) / 1,000,000The numbers used:
Self-hosting: where most calculators lie
This is where most cost comparisons go wrong. They either pretend electricity is free, or amortization is instant, or operational complexity does not exist. Here is the model used in the calculator:
Hardware amortization: An H100 SXM costs roughly $30,000 at street prices in 2026, and you should plan for three years of useful life before you replace it with whatever comes after Blackwell or Rubin. That works out to about $830 per month, just to own the card. Add networking, server chassis, and storage and you are closer to $1,000/month per H100 socket fully loaded.
Power: An H100 draws around 700 watts under sustained inference load. Running 24/7 that is roughly 500 kWh per month. At Nairobi prices ($0.22/kWh) that is $110/month in electricity. At Frankfurt prices ($0.40/kWh, industrial) it is $200. At Mumbai ($0.09/kWh) it is $45. The same machine costs more than twice as much to power in some places as in others.
Throughput: A single H100 running Llama 3.1 70B with FP8 quantization sustains roughly 2,000 tokens per second under realistic batched inference. That is around 5 billion tokens per month at 100% utilization. Real utilization is closer to 60% \u2014 nobody is sending you traffic at 4am.
Effective cost per million tokens: ($1,000 amortization + electricity) divided by (5 billion tokens \u00d7 60% utilization) = roughly $0.40 per million tokens at Nairobi electricity prices, with no distinction between input and output. This is the number that ends up on the calculator.
The implication: self-hosting has a high floor (you pay the $1,000+ amortization every month whether you use the GPU or not) but a very low marginal cost above that floor. Hosted providers have a zero floor but a higher marginal cost. Where the lines cross is your break-even point.
What the chart is showing you
The break-even chart in the calculator plots monthly cost (vertical axis, log scale) against monthly token volume (horizontal axis, log scale) for all five options. Look for where the lines cross:
The shape is the same in every scenario: hosted prices are flat lines (you pay per token, so the line goes through the origin). Self-hosted is a diagonal that starts high (the amortization floor) and then approaches a much lower slope (the marginal cost of running the GPU you already paid for).
For low volume, hosted always wins because you do not pay the amortization floor.
For high volume with sustained load, self-hosted always wins because the marginal cost is so much lower than any hosted price.
The interesting question is where exactly the crossover happens, and the calculator answers that for your specific inputs.
What the calculator deliberately ignores
There are real costs that do not show up in dollars-per-token, and any honest comparison should name them:
Operational overhead. A self-hosted GPU requires someone who can debug a CUDA driver issue at 11pm on a Sunday. Hosted providers absorb that cost. If you are a five-person startup, the engineering time to keep a fleet of GPUs alive may dwarf the cost savings on tokens.
Latency. Self-hosted gives you sub-100ms first-token latency in the same data center. Hosted APIs from Nairobi to a US East endpoint are 200-300ms minimum just on the network. For real-time chat this matters; for batch processing it does not.
Data sovereignty. When a Kenyan bank sends a customer query through OpenAI, that data leaves the country, gets logged in California, and comes back. For some workloads this is fine. For others it is the deciding factor regardless of cost. The calculator does not put a price on this, but a finance team building an agentic workflow on customer PII has to.
Reliability. Hosted providers have multi-region failover that you do not have to think about. A single self-hosted H100 in one data center is a single point of failure until you build the redundancy yourself.
Quality. Claude Opus and GPT-4o still outperform Llama 3.1 70B on hard reasoning tasks. The calculator treats them as substitutes; in practice they are not always. The right comparison is “what is the cheapest model that meets my quality bar” \u2014 and the answer is workload-dependent.
If you remove all of the above from the calculation, self-hosting wins more dramatically than the calculator shows. If you include them honestly, hosted wins for more workloads than first appearances suggest. The truth is somewhere in between, and it is somewhere different for every team.
Three numbers worth remembering
If you take three rough rules of thumb away from playing with the calculator, these are the ones I would pick:
Under 10 million tokens per month, do not self-host. The amortization floor will eat you alive. Cloudflare Workers AI or a hosted API is correct.
Between 50 and 200 million tokens per month is where it gets interesting. This is where most enterprise agent deployments end up, and where the cost gap between hosted and self-hosted starts to matter enough to justify the operational complexity. This is also where Cloudflare Workers AI looks remarkably good \u2014 cheap per-token rates with no operational overhead.
Above a billion tokens per month with sustained load, self-hosting is almost always the right answer financially. The question is whether you have the team to run it.
Why this matters beyond the spreadsheet
Every enterprise running production AI is on a journey from “we use ChatGPT” to “we have a private inference stack” to “we have governance over the stack.” The economics of that journey are the topic of this post, but the geography of it is where things get specifically interesting for African deployments.
A bank in Nairobi paying $0.22/kWh and processing customer queries in Swahili has different economics than a Berlin fintech paying $0.40/kWh and processing them in German, which has different economics from a US insurer paying $0.10/kWh and processing them in English. The hardware costs the same. The electricity does not. The data sovereignty rules do not. The model quality on the language does not.
What this means in practice: the right deployment for an African enterprise is rarely the same as what a US case study recommends. Cape Town gets to self-host cheaply. Lagos has to plan around grid reliability. Nairobi has the labor cost of operating the cluster going for it but the electricity going against. The calculator above is a starting point for that conversation, not a finishing one.
What I would build next
A follow-up calculator that adds the latency cost to the picture \u2014 routing a request from Nairobi to OpenAI vs Cloudflare’s Nairobi edge vs an on-prem H100 in the same building, with realistic round-trip numbers from public BGP data. The dollar per token is half the story; the milliseconds per token is the other half.
Comments
Replies use GitHub Discussions. You'll need a GitHub account to post.