API or Local Models: Where the Cost Break-Even Sits
When does running a model yourself beat paying for an API? A total-cost framework, an illustrative break-even calculation and the non-cost factors that decide.
A team has a spare GPU workstation and a hosted-model bill that keeps growing. The reasoning writes itself: the hardware is already paid for, so running an open-weight model locally must be free. It is not, but the reason is not that the hardware costs money. It is that the hardware is only one line in the real cost of running a model yourself.
TL;DR
Compare the monthly cost of the API with the full monthly cost of self-hosting, which includes hardware spread over its life, power and hosting, and, in many cases, the engineering time to run, update, monitor and secure it. Because most self-hosting cost is fixed, self-hosting only wins above a certain volume, provided the local model is good enough and the hardware can serve your peak load. Then check the factors cost cannot capture: quality, privacy, latency, reliability and the effort of staying current. Use your own measured numbers; every figure in this post is an illustrative assumption.
What goes into each side
Both options have costs beyond the headline price. Listing them side by side stops the comparison being decided by whichever number is easiest to find.
Using an API
- Per-token charges for input and output
- Little or no operations work for you to run
- Cost scales with usage, and a spike scales the bill
- Provider changes can alter price, limits and behaviour
- Data goes to the provider, under its terms
Running locally
- Hardware, spread over its useful life
- Power, cooling, space and hosting
- Engineer time to deploy, update, monitor and secure
- A mostly fixed cost whether you use it a little or a lot
- Data stays inside your boundary
An illustrative break-even calculation
The numbers below are assumptions chosen to make the arithmetic easy to follow. They are not real prices and not a benchmark. Replace every one with your own measured values, and use the site's API vs Local calculator, which models hardware write-off, operations and power, to do it with your own inputs.
- Assumed blended API cost per million tokens
- $2
- Illustrative assumption
- Assumed hardware cost, written off over 36 months
- $12,000
- Illustrative assumption, about $333 a month
- Assumed power and hosting per month
- $60
- Illustrative assumption
- Assumed engineering time per month, about one tenth of an engineer
- $1,000
- Illustrative assumption
With those assumptions, self-hosting costs about $333 (hardware) plus $60 (power and hosting) plus $1,000 (people), roughly $1,393 a month, regardless of volume. The API costs $2 for every million tokens. Setting them equal:
fixed_local_per_month = 12_000 / 36 + 60 + 1_000 # hardware + power + people
api_cost_per_million_tokens = 2.0 # assumed
break_even_millions = fixed_local_per_month / api_cost_per_million_tokens
print(f"Local = ${fixed_local_per_month:,.0f}/month fixed")
print(f"Break-even at about {break_even_millions:,.0f} million tokens per month")
# Local = $1,393/month fixed
# Break-even at about 697 million tokens per monthUnder these assumed numbers, self-hosting only pays off above roughly 700 million tokens a month. Below that, the API is cheaper even though the hardware is "free". Change one input and the answer moves a lot: halve the engineering time and the break-even falls, double the hardware cost and it rises. That sensitivity is the point of doing the calculation yourself.
What the arithmetic leaves out
A break-even volume is a necessary check, not a sufficient one.
Capacity
Good: The hardware can serve your peak load with acceptable latency
Red flag: The comparison uses average volume only
Quality
Good: The local model scored well enough on your own evaluation set
Red flag: The cheaper model was assumed to be equivalent
Operations
Good: Someone owns updates, monitoring, security patches and on-call
Red flag: Running it is assumed to take no ongoing effort
Utilisation
Good: The hardware is busy a meaningful share of the time
Red flag: It sits idle most of the day, and cost per token is far higher than it looks
Switching cost
Good: You know how you would move back to an API if needed
Red flag: The architecture only works with one setup
The quality row is the one teams most often skip. If the local model is worse on your task, the savings can be wiped out by wrong answers, rework and lost trust. Measure it with the same evaluation set you use for the API model, as described in LLM evaluation fundamentals.
When cost is not the deciding factor
Some reasons to run locally have little to do with price.
If
Data cannot leave your network for legal or contractual reasons
Choose
Run locally
Because
Privacy is a constraint, not a preference
If
Low and unpredictable volume
Choose
Use an API
Because
Fixed local costs are paid even when usage is small
If
High, steady volume of a task a smaller model handles well
Choose
Evaluate local seriously
Because
Fixed costs are spread over many tokens
If
Need for the strongest model available
Choose
Use an API
Because
The strongest hosted models may not be available to run yourself
If
Offline or very low-latency operation is required
Choose
Run locally
Because
The network is the constraint
If
Unsure
Choose
Start with an API behind a gateway
Because
You keep the option to route some traffic locally later
Some teams end up with both: an API for hard or rare requests and a local model for high-volume, well-understood ones, with routing between them. The model router pattern and how to reduce LLM costs describe that approach, and an LLM gateway is where the routing usually lives.
Choosing a model that fits your hardware
If you do go local, the model has to fit the memory you have. Open-weight models differ widely in size, and techniques such as quantisation can shrink them, sometimes at a cost to quality. The Local Model Advisor lists open-weight models that fit a given GPU or unified memory, with parameter counts sourced from Hugging Face, and the local and open-source models chapter covers the options. Check each model's licence and the quality on your own task before committing.
A short decision process
Step 1: Measure your usage
Tokens per month, peak load and the growth you expect
Step 2: Cost the API honestly
Current price, expected growth and any volume terms
Step 3: Cost local honestly
Hardware life, power, hosting and the real engineering time
Step 4: Test quality
Run your evaluation set on the candidate local model
Step 5: Check the constraints
Privacy, latency, availability and the cost of switching back
Step 6: Decide and revisit
Choose, record the assumptions and review when prices or volume change
Frequently asked questions
Is running a local model cheaper than using an API? Only above a break-even volume. Self-hosting has mostly fixed costs (hardware, power, and above all engineering time), while an API charges per token. Below the break-even volume the API is cheaper, even if you already own the hardware.
What are the hidden costs of self-hosting a model? Engineering time to deploy, update, monitor and secure it, plus power and hosting, capacity headroom for peak load, and the cost of errors if the local model is weaker than the API model on your task.
How do I calculate the break-even point? Add up the monthly fixed cost of running locally (hardware spread over its life, power, hosting and people time) and divide by the API cost per million tokens. The result is the monthly volume above which local is cheaper, assuming equal quality and enough capacity.
Should I use the same evaluation set for both? Yes. Run the same task-based evaluation on the API and the local model so you compare quality as well as cost. A cheaper model that is not good enough is not a saving.
When should I run a model locally for non-cost reasons? When data cannot leave your network, when you need offline or very low-latency operation, or when you want control over the model version. These can justify local hosting even when the cost is higher.
Can I use both an API and a local model? Yes, and some teams do. Route hard or rare requests to a hosted model and high-volume, well-understood ones to a local model, usually through a gateway so applications do not need to know which served the request.
How do I pick a local model for my hardware? Check how much GPU or unified memory you have, choose models that fit it, consider quantisation and test quality on your own task. The Local Model Advisor on this site filters open-weight models by the memory you have.
Related
AI platform engineering
Your next step
Reading is the start. Turn it into skill: read the chapter, practise on something real, check the numbers, then follow a path.
More on Cost and production
- LLM Gateways: What They Do and How to Choose OneWhat an LLM gateway does, when you need one and how to choose: authentication, routing, budgets, caching, logging and policy, with a vendor-neutral scorecard.
- What an AI Platform Engineer Actually OwnsWhat an AI platform team builds and runs: gateway, serving, evaluation pipelines, observability, cost and security, and where product teams take over.
- LLM Observability: What to Trace and WhyWhat to trace and log in a production LLM app: prompts, retrieved context, tool calls, tokens, cost and latency, with sampling, privacy and alerting guidance.
Discuss this article
Got a question, a counter-example or a correction? Bring it to the community.
Prefer a feed reader? Follow by RSS.