Skip to content
All guides

Guide · Decide

Self-host or call an API? The break-even math

A rented GPU costs the same whether it is busy or idle, while an API charges per token. This guide shows how to compare the two with sourced prices, covers what two independent studies found, and lists the reasons to self-host that have nothing to do with cost.

Suraj Malthumkar12 min readFacts, prices and versions checked November 23, 2026

Self-hosting an open-weight model swaps a per-token bill for a per-hour one. Whether that pays off depends less on the model than on two things: how many of those hours the GPU spends working, and who looks after it.

This guide works through the arithmetic, summarizes two independent cost studies, and covers the reasons to self-host that have nothing to do with cost. Every price is an on-demand list price before tax, checked on 23 November 2026. Check again before you commit.

What you pay for when you self-host

GPU-hours. A cloud GPU instance bills for every hour it runs, and a rented dedicated server bills by the month. Neither one charges by the token.

Utilization. This is the cost most estimates hide. A GPU busy eight hours a day and idle for sixteen pays three times as much per busy hour as one busy around the clock. You can stop instances at night or scale to a minimum, but each scale-up means a cold start while the model loads.

Engineering and on-call time. Someone patches the OS and serving engine, rotates keys, upgrades models, answers the 2 a.m. alert and rebuilds the server when a disk fails. Neither study below counts this, and on a small deployment it can exceed the GPU bill.

Egress and the smaller lines. A text response is a few kilobytes, so outbound data transfer is usually minor for chat. It grows with embeddings at volume, images, audio and copying weights between regions. Disks, load balancers and monitoring add a little more. Check your provider's rates.

A worked monthly estimate

Two AWS instance types cover most single-model deployments:

  • g6.xlarge, with one NVIDIA L4 (24 GB). It holds a model of up to about 9B parameters at 16-bit precision, or about 14B at FP8.
  • g6e.xlarge, with one L40S (48 GB). It holds a 27–35B model at FP8.

The prices below come from AWS's public price list, published 21 November 2026, for Linux on-demand. "24×7" means 730 hours, an average month. "Office hours" means 10 hours a day on 22 working days, 220 hours in total, with the instance stopped the rest of the time.

InstanceRegionPer hour24×7 (730 h)Office hours (220 h)
g6.xlarge, 1× L4 24 GBus-east-1 (N. Virginia)$0.8048$587.50$177.06
g6.xlarge, 1× L4 24 GBap-south-1 (Mumbai)$0.9664$705.47$212.61
g6e.xlarge, 1× L40S 48 GBus-east-1 (N. Virginia)$1.861$1,358.53$409.42
g6e.xlarge, 1× L40S 48 GBap-south-1 (Mumbai)$2.235$1,631.55$491.70

Each cell is the hourly price times the hours, for example $0.8048 × 730 = $587.50. Savings Plans and Reserved Instances cut these rates for a commitment; on-demand prices need none and anyone can check them.

A dedicated GPU server instead

Hetzner's cheapest GPU server, the GEX45 (one RTX PRO 4000 Blackwell, 24 GB, in Helsinki), lists at €214 a month or €0.3429 an hour, plus a one-time €209 setup fee, all excluding VAT. Even the monthly price is well below a g6.xlarge running 24×7. Hetzner's page doesn't state a monthly cap or a minimum term for hourly billing, so confirm both before you plan around switching it off. It is one machine in the EU with no autoscaling. The VPS guide walks through the setup.

Next, add your team's time. Suppose upkeep takes 8 hours a month and an engineer costs $100 an hour. Both numbers are assumptions, so replace them with your own. The g6.xlarge line then goes from $587.50 to $1,387.50 a month. Staff time is often the bigger number.

Compare it with per-token pricing

Per-token APIs price input and output tokens separately, so start from your traffic, not a price list. These functions turn traffic into monthly tokens and an API bill, and give the blended price per million tokens at which a self-hosted GPU and the API cost the same.

def monthly_tokens_m(requests_per_day, input_tokens, output_tokens, days=30):
    """Tokens per month, in millions."""
    return requests_per_day * days * (input_tokens + output_tokens) / 1e6
 
 
def api_cost(requests_per_day, input_tokens, output_tokens, price_in, price_out, days=30):
    """Monthly API bill. Prices are per 1M tokens, from your provider's current price sheet."""
    return requests_per_day * days * (input_tokens * price_in + output_tokens * price_out) / 1e6
 
 
def break_even_price(self_host_monthly, requests_per_day, input_tokens, output_tokens, days=30):
    """Blended API price per 1M tokens at which both options cost the same."""
    return self_host_monthly / monthly_tokens_m(requests_per_day, input_tokens, output_tokens, days)
 
 
# Assumptions, not measurements: 20,000 requests a day, 1,500 input and 300 output tokens each.
print(round(break_even_price(587.50, 20_000, 1_500, 300), 2))   # g6.xlarge 24x7: 0.54
print(round(break_even_price(1387.50, 20_000, 1_500, 300), 2))  # plus 8 h of engineering: 1.28
print(round(break_even_price(1358.53, 20_000, 1_500, 300), 2))  # g6e.xlarge 24x7: 1.26

Under these assumptions the workload is 1,080 million tokens a month: 900 million in and 180 million out. Here is how to read the results:

  • Below $0.54. If the API you'd actually use has a blended price under $0.54 per million tokens for this mix, it costs less than a g6.xlarge running 24×7, even before you count anyone's time.
  • Above $1.28. The GPU can win, but only if one card can carry the load. 1,080 million tokens a month averages about 417 tokens a second, about 69 of them generated, and real traffic peaks well above its average. Load-test your own model and prompts, for example with vllm bench serve, before you trust the number.
  • Finding your blended price. Divide api_cost by monthly_tokens_m, using your provider's current input and output prices. Discounts for cached input and batch jobs lower it.

Compare like with like. Price the API model that actually passes your evaluation, and check that the model you plan to host passes the same evaluation.

What the independent studies say

Pan et al. (arXiv 2509.18101, revised November 2025) compare buying hardware for an on-premises deployment with paying for commercial APIs:

  • Sub-30B models often break even within three months.
  • Medium-scale deployments typically recover their cost within 6 to 24 months, per the conclusion.
  • Large-scale ones often take more than two years.

Two caveats matter. First, the cost model counts only hardware and electricity, at 8 hours a day and 20 days a month, with no staff. Second, the paper's sections don't fully agree: its results give 3.8 to 34 months for medium models such as GLM-4.5-Air and Llama-3.3-70B, and the introduction says about 2 years for medium models and 5 for large ones.

OpenRouter (12 November 2026) expresses break-even as the share of rented GPU hours that must be busy. Two of its results, at API prices from 8 October 2026:

  • Qwen3.8 27B on one rented RTX 3090 at $0.50 an hour needed 8–12% load to match the cheapest zero-data-retention API endpoint. The same post adds that a new endpoint launched on 19 October moved the short-prompt break-even to about 29%.
  • DeepSeek V4.1 Flash on four H200s at $2.90 per GPU-hour never broke even against the cheapest such endpoint. Against the median endpoint it needed 82% load.

OpenRouter is clear about the limits. It left out engineering time and spare capacity for traffic peaks, "so every break-even in this post is a lower bound." Its RTX 3090 throughput was also a best case, measured on a heavily patched vLLM build.

The pattern: small models on modest GPUs can pay back quickly if traffic keeps them busy, large models rarely do, and neither study counts your team's time.

Reasons that aren't about cost

Data residency and control

When the model runs in your own account, prompts, outputs, logs and fine-tuning data stay in a region and network you choose, under retention rules you set. No model provider becomes another processor of your customers' data. For some contracts and regulators, that settles the question whatever the price.

Vendor deprecation

OpenAI's deprecations page lays out how self-serve fine-tuning is being wound down:

  • 7 May 2026. Organizations that had never fine-tuned could no longer start.
  • 2 July 2026. Organizations without recent inference on a fine-tuned model lost the ability to create jobs.
  • 6 January 2027. Nobody can create new fine-tuning jobs.

Existing fine-tuned models keep serving only until their base model is deprecated. o4-mini and its fine-tunes shut down on 23 October 2026. Weights you hold in an open format don't expire when a vendor changes its roadmap.

Latency

A self-hosted model runs next to your application, with no shared queue and no rate limits set by someone else. That doesn't make it faster: one small GPU produces fewer tokens per second than a large provider's fleet. Measure time to first token and tokens per second under your own load.

Incidents at shared providers

Two disclosures from 2026 show the risks of shared infrastructure:

  • Cloudflare. Between 27 August and 9 September 2026, Cloudflare's GLM-5.3 Workers AI model returned 155 responses that contained data from other customers' requests, all to prompts longer than 681,280 tokens. Cloudflare says it "found no evidence of deliberate exploitation" and traced the leak to two overlapping issues. The KV cache pool on its prefill GPUs was smaller than the model's context window, and an SGLang bug mishandled over-length requests in disaggregated prefill/decode mode (Cloudflare's write-up).
  • Fireworks AI. Fireworks disclosed two intrusions: 3 August to 7 October 2026, and 23 to 30 October 2026. In both, secrets, model files or datasets of a small number of customers were accessed. In the second, the attacker also reached account and billing information for all accounts created before 30 October. Fireworks says it doesn't store payment card numbers (Fireworks security bulletins).

Both companies published detailed accounts. A model in your own account limits how far someone else's mistake can reach.

Self-hosted servers get attacked too

The same year brought incidents on the self-hosted side:

  • LiteLLM malware. On 21 October 2026, LiteLLM's official v1.107.0 release carried credential-stealing malware on PyPI, Docker Hub and GHCR, including the latest, main-latest and main-stable image tags. It was live for up to about two and a half hours. LiteLLM's incident post tells anyone who ran it with outbound internet access to assume exfiltration, rotate every key the host could reach and pin a known-good version.
  • LiteLLM SQL injection. For the pre-auth SQL injection CVE-2026-42208, Sysdig's honeypots saw targeted exploitation about 36 hours after the advisory entered vulnerability feeds, as reported by the Cloud Security Alliance.
  • vLLM remote code. Two 2026 vLLM CVEs let a malicious model repository run code even with trust_remote_code turned off: CVE-2026-27893 and CVE-2026-90553.

Self-hosting gives you a smaller blast radius under controls you own. It doesn't remove the risk. The VPS guide covers the hardening we recommend.

If you are in India

  • AWS pricing. On-demand rates in Mumbai run about 20% above us-east-1. A g6.xlarge costs $0.9664 an hour against $0.8048, and a g6e.xlarge costs $2.235 against $1.861.
  • AWS availability. ap-south-1 (Mumbai) lists G4dn, G5, G6, G6e, G6f, Gr6, Gr6f, G7, G7e, Inf1, Inf2, P4d, P5, P5en, P6-B200, Trn1 and Trn2. ap-south-2 (Hyderabad) lists only G6, G6e, P6-B200, P6-B300, Trn2 and Trn2u (AWS instance types by Region). A listed family doesn't guarantee capacity, so check your GPU service quota first.
  • Google Cloud. asia-south1 (Mumbai) offers L4 (G2), T4, H100 (A3 Edge, one zone), H200 (A3 Ultra) and RTX PRO 6000 (G4). asia-south2 (Delhi) offers RTX PRO 6000 and H200. A100 isn't offered in India (GPU regions and zones). A g2-standard-4 with one L4 costs about $0.7358 an hour in Mumbai, against $0.7068 in us-central1. That figure comes from a third-party mirror of Google's SKUs (gcloud-compute.com, updated 22 November 2026).
  • Managed import. Amazon Bedrock Custom Model Import runs only in us-east-1, us-east-2, us-west-2 and eu-central-1 (AWS docs), so it can't keep a model in India.
  • Local providers. E2E Networks lists an H100 at ₹379.05 an hour excluding GST, in Delhi NCR and Chennai (E2E Networks).
  • EU-only hosting. Hetzner's GPU servers are in Finland and Germany. That suits EU data, but not data that must stay in India.

India's Digital Personal Data Protection (DPDP) Rules were notified in November 2025 and phase in over 18 months. According to AZB & Partners, the substantive obligations take effect on 13 May 2027. They cover notice, consent, fiduciary duties, children's data and the rights of data principals. One later source dates the final phase to 13 March 2027, so check the Gazette.

Three other points apply:

  • Breach reporting. From 13 May 2027 (one firm, AMS Shardul, gives 14 May), the data fiduciary must notify affected data principals and the Data Protection Board without delay, then send the Board a detailed report within 72 hours. Separately, CERT-In's directions already require service providers, intermediaries, data centres, body corporates and government organizations to report specified cyber incidents within six hours.
  • Cross-border transfers. These follow a negative-list model, and no list has been notified yet.
  • What self-hosting changes. Running the model in an Indian region keeps prompts, logs and fine-tuning sets in the country, and it keeps one more processor out of the chain.

Not legal advice

This is an engineer's summary of public sources, not legal advice. Usually your client is the data fiduciary and whoever runs the model is a processor. Agree on the contract terms with counsel.

A short checklist

Stay on the API if

  • Traffic is low or spiky, so a GPU would sit idle most of the day.
  • The task needs a level of reasoning that no model you can host reaches in your evaluation.
  • Your blended API price, after counting staff time, is below the break-even price for your volume.
  • Nobody will own patching, upgrades and alerts.
  • You're still working out what the workflow should be. Prompting and retrieval come first.

Self-host if

  • Data must stay in your account or country because of contracts, regulation or client terms.
  • Volume keeps a GPU busy for most of the hours you pay for.
  • A model you can host passes your evaluation on a narrow, repeatable task.
  • You need a fine-tuned model that keeps running on your schedule, not a vendor's.
  • Someone, on your team or ours, owns the endpoint and its runbook.

Sources

Fit check

Should you run your own model? Let's find out.

Sixty minutes on your workload, volumes and data rules. You leave with a recommendation, even when the answer is to stay on an API.