All posts

Self-hosted LLM vs API: how to work out the real break-even before you rent a GPU

Self-hosting an open-weight LLM looks cheaper per token, until utilisation, engineering time and quality are counted. A break-even method you can run with your own numbers.

CodeKrypt 4 min read

A founder sees that an open-weight model is free to download, sees the API bill growing, and asks the obvious question: why are we paying per token? The honest answer to self-hosted LLM vs API is that it depends on one number most teams never measure, GPU utilisation. This post gives you a method to find your own break-even with your own figures, instead of trusting anyone's headline price comparison, including ours.

Why is the per-token price comparison misleading?

Because the two options are priced on different axes. An API charges for tokens actually processed and nothing when you are idle. A GPU you rent or own charges for time, whether it is busy or not. So the comparison is not "price per million tokens" against "price per million tokens". It is a pay-per-use cost against a fixed cost whose per-token price depends on how full you keep it.

If your traffic is spiky, say a business-hours internal tool, the GPU sits idle most of the day and the effective per-token cost is far higher than the hardware's best case. If traffic is steady and heavy, the fixed cost is spread thin and self-hosting can win.

How do you calculate the break-even?

Use your own numbers in this order. We deliberately give no prices here because they change often; take current ones from your provider's pricing pages.

  1. Monthly API cost today: pull it from your usage dashboard, split by feature.
  2. Monthly self-hosting cost: GPU instances needed to meet your peak load and latency target, multiplied by hours (all of them, not just busy ones), plus a second instance if you need redundancy, plus storage and networking.
  3. People cost: the fraction of an engineer's month spent on serving, monitoring, upgrades and incidents, priced at what that engineer costs you.
  4. Quality adjustment: if the open model needs more tokens, more retries or a human-review step to reach the same pass rate, add that cost.

Self-hosting wins only if (2) + (3) + (4) is lower than (1) for the traffic you will have, not the traffic you hope for.

FactorAPISelf-hosted open-weight model
Cost when idleZeroFull GPU cost
Cost shapeVariable, scales with usageMostly fixed, step changes when you add GPUs
Capacity planningProvider's job, subject to rate limitsYours: peak load, batching, autoscaling
ReliabilityProvider SLA plus your fallbackYours: redundancy, on-call
Model upgradesChange a model ID (see deprecation planning)Re-evaluate, re-deploy, re-tune serving
Data leaves your environmentYes, under provider termsNo
Best fitVariable or early-stage trafficSteady high volume, strict data control

What costs do teams forget?

That last point matters most: many teams compare self-hosting with their naive API spend. If caching and model routing already cut that spend, the gap you are trying to close shrinks.

When does self-hosting make sense anyway?

Cost is not the only reason, and sometimes it is not the main one:

For open-ended reasoning, long documents or agentic tasks, the gap between frontier API models and what you can run yourself is more likely to show up in your quality metrics.

A sensible path

Start on an API. It lets you learn real traffic patterns and which features carry volume. Build your eval set and a thin model-abstraction layer from day one, so switching is a config change. Once a single high-volume, narrow feature shows steady load, test an open-weight model on that one feature against your eval set, and run the break-even above with real figures. A hybrid, where the API handles hard and rare requests and a self-hosted small model handles the bulk, is often the end state rather than an all-or-nothing choice. The reasoning is the same as in build vs buy for AI features.

What to do next

  1. Export your last three months of API usage by feature.
  2. Identify any feature with steady, high volume and a narrow task.
  3. Build an eval set for it and score one or two open-weight candidates.
  4. Run the break-even with current prices, redundancy and people cost included.

If you want a second pair of eyes on that analysis before committing to GPUs, see how we approach AI SaaS development.

CodeKrypt avatar

CodeKrypt

Drafted by CodeKrypt's AI writing pipeline, built and maintained by our engineers, under fixed rules on sources and claims. How we write

Frequently asked questions

Is self-hosting an LLM cheaper than using an API?
Only when a GPU stays busy. An API charges per token and costs nothing when idle; a rented or owned GPU costs the same whether it serves one request or a thousand. Self-hosting tends to win on steady, high-volume, predictable workloads and lose on spiky or low-volume ones.
What costs do teams forget when comparing self-hosting to an API?
Engineering and on-call time, redundancy (a second instance so one failure is not an outage), idle capacity, evaluation of the open model against your task, and the work of upgrading when a better model is released.
Are there reasons to self-host other than cost?
Yes. Data residency or contractual limits on sending data to a third party, offline or air-gapped deployment, and control over model versions can justify self-hosting even when it costs more.
How do I compare an open-weight model with an API model fairly?
Run both against the same evaluation set built from your real inputs, with pass criteria defined in advance, and compare quality, latency and cost per successful task, not per token.

Related reading

Chat on WhatsApp