GenAI System Design
8. Cost and Capacity Planning

Build vs Buy

A structured way to decide between hosted APIs and self-hosting, covering the cost break-even, quality, control, risk and team capability, plus the hybrid strategies most companies land on.

Lesson 4 of 5 9 min

The shape of the two curves

Build vs buy break-even

Hosted API cost grows linearly with traffic. Self-hosting is a fixed floor (redundant replicas plus engineering) that rises in steps as you add replicas.

×
tok/s

From a benchmark or the roofline estimate

People to run the platform

10K100K1M10M100M$10K$100K$1M$10Mrequests per day (log scale)
Hosted API (list price) Self-hosted (≥ 2 replicas + engineering)Solid line: break-even ≈ 199.5K requests/day
API per month
$240,000
Self-hosted per month
$69,200
8 replicas × 2 GPUs + engineering
Cheaper option
Build (self-host)
by $170,800/month

Below break-even, self-hosting pays for idle GPUs and a platform team. Above it, API list prices outgrow a fleet sized for peak. Prompt caching, batch discounts and committed-use GPU pricing all move the line, so plug in your real numbers.

  • API ("buy"): a straight line. Twice the traffic costs twice as much.
  • Self-hosted ("build"): starts at a floor made of at least two replicas for redundancy plus the team to run them, then rises in steps as replicas are added.

Below the crossover you pay for idle GPUs and a platform team. Above it, per-token API prices outgrow a fleet that grows in chunks. With the defaults above (a 70B-class model on 2 × H100 against a mid-tier API), the crossover lands around a couple of hundred thousand requests a day. Change the inputs and it moves by orders of magnitude.

A decision checklist

FactorFavours APIFavours self-hosting
VolumeLow, spiky, or uncertainHigh and steady
Quality neededFrontier-level reasoningOpen models pass your evals
Data constraintsContractual controls are sufficientData can't leave your boundary
LatencyStandardSpecial placement, on-prem or edge, tight tail control
CustomisationPrompting, light hosted fine-tuningHeavy fine-tuning, many adapters, custom decoding
TeamNo GPU or inference expertiseAn existing ML platform team
SpeedShip this quarterCan invest months
Risk tolerancePrefer vendor SLAsPrefer control over dependencies

Hybrid strategies

  1. Tiered by task: self-host a fine-tuned small model for high-volume classification and extraction, and use a frontier API for complex reasoning.
  2. Baseline plus burst: self-host (or provision) capacity for steady load, and overflow to a pay-as-you-go API at peaks.
  3. Primary plus fallback: API primary with a self-hosted fallback for outages, or the reverse.
  4. Graduation: start every feature on an API, and move a workload to self-hosting only when it is proven, stable, high-volume and an open model passes evals.

All of these depend on a gateway with a provider-neutral API (Module 6), so moving a workload is a routing change, not a rewrite.

Risks on each side

API risks: price changes, model deprecations (forced migrations), rate limits at critical moments, outages, data-policy changes, and vendor lock-in through provider-specific features.

Self-hosting risks: GPU availability, operational incidents you must fix yourself, falling behind frontier quality, hardware commitments that age badly, and key-person dependency on a small platform team.

Mitigations: pin model versions, keep evals ready to validate alternatives, abstract providers behind the gateway, and avoid multi-year hardware commitments unless utilisation is proven.

Key takeaways

  • API cost scales linearly with traffic. Self-hosting is a step function above a fixed floor of redundant replicas plus engineering.
  • The break-even point depends heavily on utilisation, model quality needs, and engineering cost. Compute it, don't guess.
  • Non-cost factors often decide. Consider data control, latency, customisation, model quality, and your team's ability to operate GPUs.
  • Most companies end up hybrid. They self-host high-volume, stable workloads and use APIs for frontier quality, spikes and experimentation.

Go deeper

Finished reading? Mark it done to track your progress.