Inference
When does self-hosting an LLM beat an API? A break-even worksheet
Compare monthly API and GPU costs with editable inputs, three worked scenarios, and a capacity check that catches false savings.

Evidence and testing
Review record: Tensor Almanac automated evidence gate (no independent human review). Example versions, recorded outputs and limitations appear below.
Find the crossover, then check the GPU can serve it
The hosted API bills for tokens. A dedicated GPU bills for the hours you keep it running, including the hours it sits idle. At 450,000 requests per month in our worked example, the API costs $1,350 and one GPU plus operating overhead costs $984.80. At 850,000 requests the same GPU looks even cheaper on paper, but it cannot serve that workload at the assumed throughput. [1, 2]
A useful break-even number needs two tests. Will the self-hosted model meet your quality and latency targets? Can the configuration serve enough requests to reach the crossover? The worksheet runs the arithmetic. A workload replay and a task-level evaluation tell you whether the result applies.
Price the same workload on both sides
The examples use text rates checked on November 24, 2026. OpenAI lists GPT-5.4 mini at $0.75 per million uncached input tokens, $0.075 per million cached input tokens, and $4.50 per million output tokens. Runpod lists an L40S Pod with 48 GB of VRAM at $1.09 per hour. These are public list rates in USD, not quotes for a particular region or deployment. [1, 2]
Start with 1,000 billable input and 500 billable output tokens per request, with no cache hits. The API then costs $0.003 per request. Use the API's billed usage for these counts, including any billable reasoning tokens, and account for retries or follow-up calls in your average if they are material. This example excludes API tool fees, discounts and premiums. If they apply, use the actual effective bill. [1]
For the GPU option, budget the full paid schedule, then add incremental operations. The example uses $200 per month, which you could enter as four hours of maintenance at $50 per hour, before any additional costs. Add the storage, network, staffing and redundancy your own deployment needs. The GPU hourly rate alone does not price a whole service. [2]
Three cases with one GPU
All three cases assume a single GPU meeting its service targets at 1,000 successful requests per hour. That is an illustrative input, not a measured L40S result. Light scheduled assumes requests fit inside a 160-hour operating window. The other two keep the GPU allocated for a full 30-day month. Idle hours below are paid hours remaining after the workload at the assumed rate. They describe this arithmetic model, not GPU utilization telemetry.
In the steady case, dividing $984.80 by $0.003 gives equality at 328,266.67 monthly requests. The first whole request count at which hosting is strictly cheaper is 328,267, provided the traffic fits. The 850,000-request case needs 850 GPU hours, so the $984.80 line is not the cost of a viable replacement. Re-price a larger or additional GPU, or model API overflow separately. For example, even if all 720,000 requests of theoretical GPU capacity were usable, putting the other 130,000 on this API would add $390 before redundancy, changes in quality or extra operating overhead.
| Case | Requests | Paid GPU hours | Paid idle hours | API cost | One-GPU cost | Result |
|---|---|---|---|---|---|---|
| Light scheduled | 25,000 | 160 | 135 | $75.00 | $374.40 | API costs less |
| Steady production | 450,000 | 720 | 270 | $1,350.00 | $984.80 | Self-host costs less if equivalent |
| Over capacity | 850,000 | 720 | Not feasible | $2,550.00 | $984.80 (cost line only) | No one-GPU comparison |
Use your own numbers
Hold the paid-hour schedule and request mix fixed for each calculation. Multiply requests by API cost per request to get monthly API cost. Multiply paid GPU hours by the hourly rate and add fixed GPU overhead for monthly self-host cost. For cached input, multiply the uncached rate by the uncached share and the cached rate by the cached share, add them, and use that blended rate in the token calculation. At 50% cached input, with everything else held fixed, the steady case first favors self-hosting at 369,878 requests instead of 328,267. [1, 2]
Divide monthly self-host cost by API cost per request for the equality volume. Round down and add one to find the first whole request count at which hosting costs less. If that number exceeds paid GPU hours times sustainable requests per hour, you cannot reach it on that configuration. If the API has no marginal token cost, the worksheet reports no finite crossing in favor of the GPU. Recalculate when adding a replica or changing the number of paid hours, since each step changes the cost curve.
Copy the Python worksheet below and edit the scenario rows or pass your own token counts, prices and cache share to the worksheet function. Use decimal strings such as `'1.09'` to keep cent-level arithmetic exact. The code runs locally without a GPU or an API call.
Executed arithmetic with Python 3.12.14 and 3.13.5; no model or GPU benchmark was run.
"""Editable monthly cost worksheet; gets no data from a network."""
from fractions import Fraction as F
def worksheet(requests, paid_hours, requests_per_hour, overhead,
input_tokens=1000, output_tokens=500, cached_share="0",
input_rate="0.75", cached_rate="0.075", output_rate="4.50",
hourly_rate="1.09"):
"""Use numeric strings for exact decimal-rate arithmetic."""
requests, paid_hours, requests_per_hour = map(
F, (requests, paid_hours, requests_per_hour)
)
overhead, input_tokens, output_tokens, hourly_rate = map(
F, (overhead, input_tokens, output_tokens, hourly_rate)
)
share = F(cached_share)
input_rate, cached_rate, output_rate = map(
F, (input_rate, cached_rate, output_rate)
)
if not 0 <= share <= 1 or requests_per_hour <= 0:
raise ValueError("Use a cache share from 0 to 1 and positive throughput.")
if min(requests, paid_hours, overhead, input_tokens, output_tokens,
hourly_rate, input_rate, cached_rate, output_rate) < 0:
raise ValueError("Volumes, hours and rates must be nonnegative.")
blended_input = (1 - share) * input_rate + share * cached_rate
api_per_request = (input_tokens * blended_input + output_tokens * output_rate) / 1_000_000
api_month = api_per_request * requests
host_month = paid_hours * hourly_rate + overhead
capacity = paid_hours * requests_per_hour
busy = requests / requests_per_hour
idle = paid_hours - busy if requests <= capacity else None
equality = host_month / api_per_request if api_per_request else None
first_cheaper = equality // 1 + 1 if equality is not None else None
if idle is None:
decision = "GPU capacity exceeded"
elif host_month < api_month:
decision = "self-host costs less"
elif api_month < host_month:
decision = "API costs less"
else:
decision = "modeled costs tie"
return (api_month, host_month, capacity, busy, idle, equality,
first_cheaper, decision)
if __name__ == "__main__":
# Edit (name, monthly requests, paid GPU hours) for your workload.
cases = [
("Light scheduled", 25_000, 160),
("Steady production", 450_000, 720),
("Over capacity", 850_000, 720),
]
for name, volume, hours in cases:
api, host, capacity, busy, idle, equality, first, decision = worksheet(
requests=volume, paid_hours=hours, requests_per_hour=1000, overhead=200
)
idle_label = "n/a" if idle is None else f"{float(idle):,.0f} h"
cutoff = (
"no crossing" if first is None
else f"{float(equality):,.2f} (first cheaper: {first:,})"
)
print(f"{name}: API ${float(api):,.2f}; one GPU ${float(host):,.2f}; {decision}")
print(f" Capacity {float(capacity):,.0f}; required busy {float(busy):,.0f} h; paid idle {idle_label}")
print(f" Equality volume: {cutoff}")
*_, first, _ = worksheet(450_000, 720, 1000, 200, cached_share="0.5")
print(f"Steady production, 50% cached input: first cheaper at {first:,} requests.")
Recorded output
Light scheduled: API $75.00; one GPU $374.40; API costs less Capacity 160,000; required busy 25 h; paid idle 135 h Equality volume: 124,800.00 (first cheaper: 124,801) Steady production: API $1,350.00; one GPU $984.80; self-host costs less Capacity 720,000; required busy 450 h; paid idle 270 h Equality volume: 328,266.67 (first cheaper: 328,267) Over capacity: API $2,550.00; one GPU $984.80; GPU capacity exceeded Capacity 720,000; required busy 850 h; paid idle n/a Equality volume: 328,266.67 (first cheaper: 328,267) Steady production, 50% cached input: first cheaper at 369,878 requests.
Measure goodput on your workload
Choose a self-hosted model only after checking representative tasks side by side: for example, expected extraction fields, malformed inputs, refusals and invalid structured output. The GPT-5.4 mini price is an API reference point, not evidence that any specific open-weight model on this GPU is equivalent. Different models can tokenize the same text differently. Count tokens for the API bill, and use successful requests on comparable inputs and outputs for self-host capacity.
Replay your actual prompt lengths and traffic bursts. Measure the highest sustained rate of successful requests that meets your error budget, tail time to first token, and tail end-to-end latency. This incorporates prompt processing, generation, batching and queuing in a way that a headline output-token rate does not. Serving benchmarks such as vLLM's can report latency percentiles and goodput against specified service targets; use separate task evaluation for answer quality. [3]
Even 450 busy GPU hours can miss a deadline if they cluster into short bursts. Leave headroom for cold starts and outages, and test demand peaks against the hours when the GPU is actually available. If the API is presently cheaper, you now know the threshold to revisit. If self-hosting appears cheaper but misses quality or capacity, the savings are not yet comparable.
References: [3]