What it costs
how many tokens per month before self-hosting an llm is cheaper than the claude api
Reproduction script · claude-vs-hetzner-breakeven.mjs · updated 2026-08-24
Every "self-hosting pays off past X tokens" claim you can find online quotes one number and hides the two assumptions that decide it: which model tier, and what mix of input versus output tokens the workload actually runs. Change either one and the number moves by more than 2x. Below is the arithmetic with both assumptions exposed, run against a real fixed-cost box and Anthropic's current published API pricing, so you can plug in your own ratio instead of trusting ours.
The number
For a Claude Sonnet 5 workload with a 3:1 input-to-output token ratio, a common shape for a RAG or tool-calling agent that reads more context than it writes, the breakeven point against one Hetzner GEX44 dedicated GPU server (RTX 4000 SFF Ada, 20 GB VRAM, EUR184/month, roughly $215/month at the current ECB EUR/USD reference rate) lands at approximately 53.8 million tokens per month. Below that volume, calling the Claude API is cheaper than running and maintaining that box. Above it, the fixed monthly cost of the server wins on token cost alone.
That single number is the least useful part of this page. Move to Claude Haiku 4.5 at the same 3:1 ratio and the breakeven jumps to roughly 107.6 million tokens per month, because Haiku's per-token price is a fraction of Sonnet's. Move to Claude Opus 5 and it drops to roughly 21.5 million, because Opus costs 2.5x what Sonnet costs on both input and output. And holding the model fixed at Sonnet 5 but changing the ratio from a 1:1 chat-style exchange to a 10:1 context-heavy agent run moves the breakeven from 35.9 million to 78.9 million tokens per month, a 2.2x swing from the ratio alone. Anyone quoting you a single breakeven figure without naming the model tier and the ratio is quoting a number they made up, not one they computed.
Method
The comparison holds one variable fixed on each side. On the self-hosted side, a Hetzner GEX44 dedicated GPU server: EUR184/month, published on Hetzner's own GPU server matrix, capable of running an open model up to roughly 32B parameters at 4-bit quantisation with headroom for the OS and inference server. That EUR figure converts to USD at the ECB's published reference rate (1.1699 on 2026-08-21) to sit next to Anthropic's USD-denominated API pricing, giving a fixed monthly cost of approximately $215.26.
On the API side, Anthropic publishes per-million-token pricing separately for input and output tokens, and the two differ by 5x on every current model tier: $1 input / $5 output for Haiku 4.5, $2 input / $10 output for Sonnet 5, $5 input / $25 output for Opus 5. Because a real request mixes both, the comparison needs a blended price per million tokens, computed as (ratio * inputPrice + outputPrice) / (ratio + 1) where the ratio is input tokens per output token. A 1:1 ratio is a short back-and-forth chat. A 3:1 ratio is a moderate RAG lookup: some retrieved context, a focused answer. A 10:1 ratio is a heavy agent turn: a long system prompt, several tool definitions, retrieved documents, and a comparatively short final answer or tool call.
The breakeven volume in millions of tokens per month is then the fixed monthly cost divided by the blended price per million tokens. This is pure division on public numbers: no traffic sample, no customer data, and no simulation of anything probabilistic. The entire calculation runs in the artifact linked on this page and reproduces byte-for-byte on any machine with Node installed, which is also why it is a fairer basis for a claim than a vendor's marketing page: you can re-run it with your own ratio and your own exchange rate the day you read this.
Raw data
Hetzner GEX44: EUR184/mo -> $215.26/mo (EUR/USD 1.1699, ECB 2026-08-21)
model | input$/MTok | output$/MTok | R=1:1 | R=3:1 | R=10:1
-------------|-------------|--------------|--------|--------|--------
Haiku 4.5 | 1.00 | 5.00 | 71.8M | 107.6M | 157.9M
Sonnet 5 | 2.00 | 10.00 | 35.9M | 53.8M | 78.9M
Opus 5 | 5.00 | 25.00 | 14.4M | 21.5M | 31.6M
Read a cell as: at that model tier and that input:output ratio, this many million tokens per month (input plus output combined) is where a single Hetzner GEX44 stops being the more expensive option. The three model rows do not move independently: Opus 5's breakeven is exactly 2.5x lower than Sonnet 5's at every ratio, because Anthropic prices Opus at exactly 2.5x Sonnet on both input and output. If your usage tracker reports total tokens without splitting input from output, assume something between the 3:1 and 10:1 columns for a typical agent workload; assume the 1:1 column only for short conversational exchanges with little retrieved context.
What these numbers do not say
This is a token-cost breakeven, not a total-cost-of-ownership comparison, and treating it as the latter will produce a bad decision. A GEX44 running a 32B open model at 4-bit quantisation is not a drop-in replacement for Sonnet 5 or Opus 5 on reasoning quality, instruction-following, or tool-calling reliability: the breakeven volume tells you when the infrastructure line item flips, not when the two options are interchangeable. Someone has to provision that server, patch it, monitor it, and respond when it falls over at 3am, and none of that labor cost is in the EUR184. The GEX44 is also a hard capacity ceiling, not an elastic one: past a certain request rate you add a second box, and the cost curve becomes a step function rather than the smooth line this arithmetic implies.
The comparison also ignores prompt caching, which Anthropic prices at roughly a tenth of the standard input rate for cache hits. A workload with a large, stable system prompt or a repeated document context can cut its effective input cost enough to push the real breakeven volume well above every number in the table above, sometimes by more than the 3x gap between the 1:1 and 10:1 columns already shown. If a meaningful share of your input tokens is the same content across requests, price the API side with caching applied before trusting this table over your own estimate. The EUR/USD rate is a snapshot too: it was 1.1699 on the day this was measured and moves with the currency market, which shifts every dollar figure derived from the EUR184 server price by the same percentage the rate moves.
Finally, none of this accounts for egress bandwidth, the setup fee Hetzner charges once per server, or the fact that Anthropic's list prices are not necessarily what a high-volume account actually pays once a negotiated enterprise rate applies. Both sides of this comparison use public list prices; a real quote on either side can differ from what is modeled here.
Reproducing this
This step is for readers who want to plug in their own numbers, not a requirement for reading this page: the Raw data table above already covers three model tiers at three ratios, and most workloads land close to one of those nine cells. If that is not you, skip to Sources.
If you want your own numbers without running anything, the LLM API cost calculator runs this exact formula in the browser, across five Claude tiers plus GPT-5 and Gemini: pick a model, drag the ratio, enter your own server cost, and the result recalculates as you type (free to use; the number itself is revealed after an email).
If you would rather not trust a hosted tool, the artifact linked at the top of this page is the same calculation as a plain Node file: no install, no dependencies, no network calls, every price a constant declared at the top of the file and sourced from the links below. It is the one to check if Anthropic, Hetzner, or the EUR/USD rate moves after this was published; the table above and the calculator will both drift from it until someone updates all three.
Sources
Claude API pricing per model, including the note that Sonnet 5's introductory $2/$10 rate became the standard rate rather than rising to $3/$15 on 2026-09-01, comes from Anthropic's Claude Platform pricing docs, fetched 2026-08-24. Prompt caching's roughly 10x input discount on cache hits, referenced in "What these numbers do not say", is documented on the same platform's prompt caching page. The GEX44 specification and its EUR184/month price come from Hetzner's GPU dedicated server matrix. The EUR/USD conversion uses the ECB euro reference exchange rate of 1.1699, published 2026-08-21.
Reported cases
Just your email, nothing else to fill in. Alex writes back.