API models vs self-hosted open models
Monday, 10:00: Karim has a quote for four GPUs at 7,200 EUR a month to run an open-weight model ourselves and "stop paying per token". The AI bill is 12,000 EUR, and a 60-hotel chain wants guest data kept in the EU. Lina: "You lead the decision."
Rent an AI model by the word, or run your own on your own machines? It's mostly a question of how busy you can keep them.
- Problem
StayHub's AI bill is ~€12,000 a month even after routing and caching, a GPU quote looks similar, and a new enterprise customer (Riviera Group, 60 hotels) asks that guest messages are processed in the EU, not retained and not used for training.
- Why the simple system fails
'Just run an open model on a GPU' ignores that a GPU costs money every hour whether busy or idle, that one request at a time wastes most of its capacity, that the best open model may be weaker at your task, and that someone now gets paged at 3 a.m. for it.
- Engineering concept
Compare fully loaded cost per useful output at your real volume and utilisation, plus quality on your evals, plus privacy and latency needs, plus the operational burden. Self-hosting wins at high, steady volume or hard data constraints; APIs win almost everywhere else.
- Technology
Hosted model APIs (including batch APIs and regional endpoints) vs open-weight models served by an inference server with continuous batching, quantization and GPU autoscaling, often behind the same AI gateway.
- Trade-offs
APIs: variable cost, best models, no ops, data leaves your boundary. Self-hosted: fixed cost, full control and residency, cheaper at scale if utilisation is high, but you own capacity, upgrades, evals and on-call.
The problem
2 min- Karim · CTO4 GPUs, 7,200 EUR a month. Our AI bill is 12,000. Let's run an open-weight model and stop paying per token.
- Maya · Product managerAnd Riviera Group, 60 hotels, wants guest messages processed in the EU, not used for training, not retained.
- Lina · Senior engineer, your mentorYou lead this one. I'll check your numbers.
The big idea
4 minCompare the fully loaded cost at real utilisation against the cheapest hosted option that passes your evals, for the tasks the open model can actually do.
Taxi or your own van: the van is cheaper per trip only if you drive it all day, you pay for it while it sits still, and it can't do every trip.
How it works
5 minAn open-weight model publishes its weights, so you can run it on your own GPUs. APIs charge per token and nothing when idle; GPUs charge per hour, busy or not.
- 1Write the exact requirements
Quality per task, latency at peak, and the exact data rule ("EU, no training, no retention"), not "privacy" in general.
- 2Evaluate the open model per task
Golden set per task. Quantization (fewer bits per weight, to fit smaller GPUs) is a new model version: evaluate each precision.
- 3Price the cheapest option that passes
The tasks it passes already run on the small API model: ~1,200 EUR a month.
- 4Fully load the GPUs
Fully loaded cost: GPUs 24/7 + engineer time + monitoring. 7,200 + 4,000 + 300 ≈ 11,500 EUR a month.
- 5Check utilisation
Utilisation is the share of paid GPU time doing useful work. The evening peak is 3× the average, so a peak-sized pool is ~30% busy.
- 6Decide per task, write a trigger
Keep what fails evals on the API; self-host only where it clearly pays; write down when to revisit.
Watch a decision being made
4 minYou decide: API or self-hosted (Lina checks)
Answer Karim with numbers, meet Riviera's data rule, and leave a rule for when to revisit.
- 1Evaluate per task
The 8B model at 8-bit passes FAQ, classification, summaries; fails booking (multi-room 74% vs 90%) and refunds. 4-bit loses 6 more points on price extraction.
Why: The model can only replace calls it handles.
- 2Compute break-even
Against the small API model at ~0.0009 EUR a call:
pythonfixed = 4 * 2.5 * 24 * 30 + 4000 + 300 # 11,500 EUR/month break_even = fixed / (30 * 0.0009) # ~426,000 easy calls/dayWhy: We have ~45,000 easy calls a day. GPUs bill when idle, and people are part of the cost.
- 3Meet the data rule simply
Legal confirms the provider's EU regional endpoint with zero retention and no training meets Riviera's wording; the gateway routes their hotels there.
Why: Self-host for privacy only if contracts and regional endpoints can't meet the exact rule.
- 4Decide and set a trigger
Stay hosted. Revisit above ~400,000 easy calls a day, if no provider can meet a customer rule, or if an open model passes the booking slices.
Why: A written trigger turns a monthly debate into a check anyone can run.
In real life
3 minGitHub Copilot: hosted models
- Publicly built on models from external providers
- Gets new frontier models as they're released; data governed by contracts
Best models fast; depends on providers.
Apple Intelligence: its own models
- Publicly described as running on-device and on Apple's own "Private Cloud Compute"
- Privacy and control were the stated reasons; still integrates ChatGPT for some requests
Full control at enormous engineering cost.
What goes wrong
3 minThe alternative is the cheapest hosted option for the tasks the open model passes.
Evaluate per task, then compare fully loaded cost against what it replaces.
Above capacity a queue only grows; GPUs take minutes to start.
Size for peak, autoscale early, overflow to the API via the gateway.
Regional endpoints and zero-retention terms often meet the exact rule.
Write the exact rule; check provider terms with legal first.
Trade-offs
3 min| Option | Fits when | Costs |
|---|---|---|
| Hosted API | Variable volume, quality-sensitive tasks, no GPU team | Grows with usage; third-party processing |
| Self-hosted open model | High steady volume on a task it passes, a team to run it | Idle capacity, on-call, slow scaling |
| Hybrid behind a gateway | One high-volume simple task plus a complex long tail | Two stacks to evaluate |
- Karim · CTOProviders can change prices under us. Owning capacity is strategic.
- Omar · On-call SREOwning capacity means 3 a.m. pages for drivers and a server we've never run. We have no one.
- Karim · CTOWe'll never have someone if we never start.
Your job as tech lead
4 minClaude Code can write the code for this. You still own the decisions, and you have to know what good looks like to accept or reject its work.
- What you compare against: today's routed and cached API bill (~12,000 EUR), not the old all-large-model one.
- Which tasks may move: only slices that pass evals at the exact precision you'll deploy.
- Capacity: sized for the evening peak (~3× average), with API fallback when the GPU queue grows.
Prepare, don't deploy, a self-hosting pilot for easy concierge FAQs behind `services/ai-gateway/`. Plan first. Only the FAQ route moves; 8B open model at 8-bit; size the pool for the evening peak using last month's hourly traffic from the usage logs (show me); fall back to the hosted API when queue time passes 2 s or the pool errors. Write a load test replaying the 20:00 peak, and a cost sheet at our real volume including ops time.
- The cost sheet includes GPU hours, engineer time and utilisation.
- The peak number comes from measured hourly traffic, not an assumed average.
- Stopping the staging pool sends traffic to the API.
- Pool sized from the average because "autoscaling will handle peaks".
- Self-hosting compared with the old 48,000 EUR bill.
- 4-bit chosen to save memory without the price-extraction evals.
Check yourself
2 minNext episode: a new product, Room Ready. On its first day the AI calls 297 of 300 housekeeping photos "ready", stained sheets included.
Mark it complete to update your skill map.
Go deeper (optional)You don't need this to understand the lesson. Open it when a project needs the details: Technical deep dive, Interactive simulation, Visual diagram, Analogy, Check your understanding, Practice ladder, Explain it yourself.
Technical deep dive
You decide: API or self-hosted (Lina checks)
Answer Karim's proposal with numbers, meet Riviera's data rule, and leave a clear rule for when to revisit.
- 1Write down the requirements
Quality: each task must pass its golden-set slice. Latency: concierge p95 under 3 s at the 20:00 peak. Data: Riviera's guest messages processed in the EU, no training, no retention.
Why: "Privacy" and "cheaper" are too vague to decide anything. Exact requirements often turn out to be met by simpler options.
- 2Evaluate the open model per task
Run the open 8B model at 8-bit and 4-bit through the eval suite. 8-bit passes FAQ, classification, summaries; fails booking (multi-room 74% vs 90%) and refunds. 4-bit loses 6 more points on price extraction.
Why: The model can only replace calls it handles. Quantization is a model version, so it gets its own eval run.
- 3Price the alternative it would replace
The tasks it passes run today on the small API model: ~45,000 calls/day × ~0.0009 EUR ≈ 1,200 EUR/month.
Why: Compare against the cheapest hosted option that passes, not against the whole bill or the most expensive model.
- 4Fully load the self-hosted cost
4 GPUs × 2.5 EUR × 24 × 30 = 7,200; + ~4,000 for engineer time and monitoring; + 300 overhead ≈ 11,500 EUR/month, sized for a peak 3× the average (~30% average utilisation).
pythonfixed = 4 * 2.5 * 24 * 30 + 4000 + 300 # 11,500 EUR/month break_even = fixed / (30 * 0.0009) # ≈ 426,000 easy calls/dayWhy: GPUs bill when idle, and people are part of the cost. Utilisation turns a cheap-looking quote into an expensive one.
- 5Meet the data rule the simple way
Legal confirms our provider's EU regional endpoint with zero retention and no training meets Riviera's wording. The gateway routes Riviera's hotels there.
Why: Self-hosting for privacy only makes sense if contracts and regional endpoints can't meet the exact rule.
- 6Decide and set a trigger
Stay hosted. Revisit when easy-task volume passes ~400,000 calls/day, when a customer rule can't be met by any provider, or when an open model passes the booking slices.
Why: A written trigger turns a recurring debate into a check anyone can run.
| Model size | 16-bit weights | 8-bit | 4-bit | Notes |
|---|---|---|---|---|
| 8B parameters | ~16 GB | ~8 GB | ~4 GB | Fits one mid-range GPU with room for the KV cache |
| 30B parameters | ~60 GB | ~30 GB | ~15 GB | One large GPU when quantized |
| 70B parameters | ~140 GB | ~70 GB | ~35 GB | Several GPUs at 16-bit; one large GPU at 4-bit |
| Dimension | Hosted API | Self-hosted open model |
|---|---|---|
| Cost shape | Per token; zero when idle | Per GPU-hour; paid when idle |
| Best quality | Frontier proprietary models | Best open-weight models; often strong on narrow tasks |
| Scaling | Instant (within rate limits) | Minutes per replica |
| Data control | Provider terms, regional endpoints, retention settings | Stays in your network |
| Ops burden | Keys, limits, fallbacks | GPUs, drivers, inference server, autoscaling, on-call |
Interactive simulation
Visual diagram
A hybrid setup (StayHub's "if triggered" stage, not today's): the gateway sends steady high-volume work to self-hosted GPUs and hard tasks to a hosted API.
Analogy
- Getting around a cityTaking taxis, paying per rideRunning AI modelsHosted API, paying per token
- Getting around a cityOwning vans, even when parkedRunning AI modelsSelf-hosted GPUs, paid even when idle
- Getting around a cityHiring mechanicsRunning AI modelsRunning the machines yourself
- Getting around a cityFilling every seat in the vanRunning AI modelsBatching many requests together
- Getting around a cityA smaller, lighter vanRunning AI modelsQuantization: a smaller model copy
A delivery company with steady routes buys vans. A consultant who travels twice a month takes taxis. Many companies do both. Where the analogy breaks: you can buy any van, but the very best AI models usually aren't available to run yourself.
Check your understanding
Practice ladder
Trace a cost comparison
Estimation Warm-upThe nightly review-summary job: 6,000 reviews/day, ~1,500 input + 200 output tokens each. Options: - Small API model: 0.20 / 0.80 EUR per million input/output tokens; batch API at 50% off. - Self-hosted: 1 GPU at 2.5 EUR/hour, but only 4 hours a night (started and stopped by a scheduler), + 1,500 EUR/month of engineer time.
The open model passes the review-summary eval. Trace the monthly cost of each option and say which is cheaper.
Finish the decision memo
Decision PracticeYour memo to Karim has two empty sections. Fill in Data and Revisit when.
- Quality: the open 8B model passes FAQ, classification and review summaries; fails booking and refund slices.
- Cost: self-hosted ~11,500 EUR/month fully loaded vs ~1,200 EUR/month of API calls it could replace.
- Latency: peak is 3× average; a peak-sized pool averages ~30% utilisation.
- Data: ___
- Decision: stay on hosted APIs through the gateway.
- Revisit when: ___
A fine-tuned model for hotel tags
Design PracticeThe revenue team wants to tag every review with 40 hotel-specific labels ("thin walls", "lift slow", "great rooftop"). The small API model gets 78% on the tagging eval; a fine-tuned open 8B model gets 91%. Volume: 6,000 reviews/day, all nightly. Design the deployment: where it runs, sizing, fallback, evals, and the cost comparison you'd present.
A customer who forbids any third party
Decision StretchA new prospect, a government-owned hotel group (40 hotels), requires that guest messages are processed only on infrastructure StayHub operates: no third-party model provider at all, even in the EU. They'd be 15% of concierge traffic. The best open model passes FAQ and classification but fails our booking slice.
Write a short decision: "We chose X over Y because…, accepting the risk of…".
Explain it yourself
Explain to a CFO why 'open models are free' doesn't mean self-hosting is cheaper, and when it actually is.