refusal rate
Subscribe

Self-hosted LLM cost vs API, with the formula and three worked cases: solo dev, 10-dev team and batch job. Prices and GPU rates checked October 27, 2026.

[ fig. 01 — cost ]48×5
[ fig. 01 — cost ]16×5

Short answer

Self-hosting an LLM is cheaper than an API only when the GPU stays busy. Against a frontier API like Claude Sonnet 5.5 ($2 and $10 per million tokens), one owned RTX 5090 costs about a quarter as much for a solo developer. Against a hosted open model at $0.07 to $0.15 input per million, it rarely does for one developer. Batch jobs are the exception.

Claude Sonnet 5.5
$2 in / $10 out per MTok
Qwen3-Coder-30B-A3B API
$0.07-$0.15 in / $0.28-$0.60 out
RTX 5090 rental (RunPod)
$0.69-$1.19 per hour
US residential power
18.16 c/kWh (Aug 2026)

Key takeaways

  1. The fair comparison is the same open model on an API. Qwen3-Coder-30B-A3B costs $0.07 input and $0.28 output per million tokens on one OpenRouter provider (checked Oct 27, 2026), which is about 8x cheaper than owning a GPU at solo-developer volume.
  2. Against Claude Sonnet 5.5 ($2/$10), a $2,000 RTX 5090 setup costs about $65 a month versus about $242 for the same solo workload. That saving only counts if the open model is good enough for your work.
  3. Batching decides everything. Cloudrift measured 4,570 output tokens/s for Qwen3-Coder-30B on one RTX 5090 under load, versus roughly 230 tokens/s for a single Ollama stream.
  4. A rented RTX 5090 at $0.69 an hour beats a $0.35-per-1,000-request open-model API only above about 12% sustained utilization of that batched throughput.
  5. Electricity is not the main cost. At the US residential average of 18.16 cents per kWh, a card drawing its full 575 W costs about $0.10 an hour.

When does self-hosting an LLM beat an API?

A developer who measured electricity on an RTX 3090 found that a dense 27B model cost about €0.71 per million output tokens in power alone, more than the roughly €0.55 they cited for a hosted Flash-class API, and the rest of this page works out why. In short, self-hosted LLM cost beats an API when the GPU is busy most of the time, or when the API you would otherwise pay is a frontier model priced at $2 or more per million input tokens. Self-hosting loses when your traffic is light and bursty, or when the same open model is already sold per token at a few cents.

That gives three rules of thumb, each worked out below:

  • Versus a frontier API, one owned GPU wins at under a million tokens a day, provided the open model is good enough for the job.
  • Versus the same open model on an API, one developer almost never breaks even. A team might, and a batch workload usually does.
  • Utilization is the variable. A rented GPU bills by the hour whether or not you send a request.

The model used throughout is Qwen3-Coder-30B-A3B, an Apache 2.0 mixture-of-experts coder with about 30.5B total and 3.3B active parameters (model card). It is the only coding model for which this page found a published, serving-grade throughput benchmark and a per-token API price on the same day. Treat the totals as illustrations of the method, not as a quality-equivalent comparison across models.

What goes into the cost of self-hosting?

The cost of self-hosting is hardware (bought or rented), electricity, idle time and your own time. Only the first is large for a single GPU.

  1. Hardware. Buy a card and spread the price over its useful life, or rent by the hour. This page assumes $2,000 for an RTX 5090 and 36 months, an assumption taken from the MSRP the Knoop and Holtmann paper uses, because NVIDIA’s own product page does not publish a price. The PC around the card is not counted.
  2. Electricity. The RTX 5090 has a 575 W total graphics power. At the EIA’s August 2026 US residential average of 18.16 cents per kWh, that is about $0.10 an hour at full draw (commercial: 14.47 cents).
  3. Idle draw. A box left on all month still pays. The calculations below borrow a 50 W idle assumption from a community cost write-up, which comes to about $6.60 a month.
  4. Ops time. Patching drivers, restarting a crashed server, watching a queue. A shared server needs this; a laptop does not.

For memory sizing, see how much VRAM a coding LLM needs. A 30B MoE at 4-bit fits a 24 GB card, which is why it is a common first target.

What do GPU rentals and APIs charge?

Rented GPUs run from about $0.34 to $4.29 an hour for the cards below, and the same open model sells per token for a small fraction of what a frontier model charges. All prices are USD, checked October 27, 2026 unless marked.

GPU (per hour)RunPod communityRunPod secureLambda (1x)
RTX 4090$0.34$0.89n/a
RTX 5090$0.69$1.19n/a
A100 SXM$1.39$1.79$1.99 (40 GB)
H100 SXM$2.69$3.99$4.29

RunPod’s page is dated October 8, 2026 and the community column came from its structured data; Lambda’s is a current list price. Together AI lists a dedicated HGX H100 at $5.49 per GPU-hour.

API (per million tokens)InputOutput1,000 in + 1,000 out
Claude Sonnet 5.5$2.00$10.00$0.0120
Claude Haiku 5.5 (prompts up to 100k)$0.10$0.50$0.0006
Qwen3-Coder-30B-A3B, Amazon Bedrock$0.15$0.60$0.00075
Qwen3-Coder-30B-A3B, SiliconFlow (fp8)$0.07$0.28$0.00035

Anthropic prices come from its pricing page, which also lists a 50% Batch API discount ($1 and $5 for Sonnet 5.5). The Qwen prices come from the OpenRouter endpoints listing, which showed two providers that day. Providers reprice often, so rerun the numbers before you commit. The cheapest open-model rows also show why per-token API vendors are the real competitor to your own GPU.

How fast is a self-hosted model, really?

One user on one stream gets a few hundred tokens a second; a server handling many requests at once gets roughly twenty times that from the same card. This gap is the whole economic story.

[ fig. 01 — Output tokens per second for Qwen3-Coder-30B-A3B. Sources: ai.rs community report (Ollama) and Cloudrift (vLLM). Different quants and tools, so the comparison is approximate. ]
One RTX 5090 generates about 231 tokens per second for a single Ollama stream and 4,570 under batched vLLM load
  • Single stream. One community report (May 2026) measured about 231 tokens/s on an RTX 5090 running Qwen3-Coder-30B-A3B at Q5_K_M through Ollama, with a 32K context. That is steady-state generation on a short completion, and the author notes long prompts add a delay before the first token.
  • Batched serving. Cloudrift ran vLLM with 4-bit AWQ on the same model and reported the figures below, using 1,000 input and 1,000 output tokens per request and high concurrency. The test was sponsored by a GPU host, and it is synthetic traffic.
Setup (Cloudrift, Oct 2025)Output tokens/s
1x RTX 40902,259
1x RTX 50904,570
1x RTX PRO 60008,425

The mechanism is not specific to this model. A small community repo measured vLLM on a 6 GB laptop GPU serving a 0.5B model and saw throughput climb from 129 tokens/s with one request in flight to 1,916 with sixteen, with p95 latency flat near 1.1 seconds. Decoding is limited by memory reads, so extra requests are nearly free until the batch gets large. For tools that do the batching, see Ollama vs llama.cpp vs vLLM.

What does the arithmetic look like in three cases?

In all three cases a frontier API costs the most, the open model on an API costs the least, and self-hosting lands between them unless the workload is a batch. Every input is stated so you can swap in your own.

[ fig. 02 — Case 1 monthly cost for a solo developer. Source: the arithmetic below, with Anthropic, OpenRouter and Amazon Bedrock prices checked October 27, 2026. ]
For one developer an owned RTX 5090 costs about $65 a month, roughly a quarter of Claude Sonnet 5.5 at $242 and about eight times the cheapest hosted open-model API at $7.70

Case 1: solo developer, owned RTX 5090. Assume 3M input and 0.5M output tokens per working day for 22 days, so 66M input and 11M output a month. Hardware is $2,000 over 36 months, idle draw is 50 W all month, and the card runs at its full 575 W for 30 hours of actual generation and prefill (an assumption).

OptionMonthly cost
Claude Sonnet 5.5$242
Qwen3-Coder on Bedrock$16.50
Claude Haiku 5.5$12.10
Qwen3-Coder on SiliconFlow$7.70
Own RTX 5090 ($56 hardware + $7 idle + $3 active)$65

Own-GPU cost is about four times lower than Sonnet 5.5 and about eight times higher than the cheapest open-model API. If you already own the card for gaming or work, the hardware line is sunk and the comparison improves.

Case 2: 10-developer team, shared server. Ten times the load: 660M input and 110M output a month. Two rented RTX 5090s for the 176 working hours in a month cost $243 at the community rate or $419 at secure. Add 4 hours of ops at an assumed $100 an hour and the total is $643 to $819.

OptionMonthly cost
Claude Sonnet 5.5$2,420
Claude Haiku 5.5$121
Qwen3-Coder on Bedrock$165
Qwen3-Coder on SiliconFlow$77
Two rented RTX 5090s plus ops$643-$819

Rental still loses to the open-model API by a wide margin. It beats Sonnet 5.5 by roughly 3x, again only if the open model is good enough. One caveat points the other way: the Cloudrift test used 1,000-token prompts, while agentic coding sessions carry much longer contexts, so budget more GPU than the benchmark suggests. A fuller team setup is covered in self-hosting an LLM for a dev team.

Case 3: batch workload. Take 20 million requests a month at 1,000 input and 1,000 output tokens each, such as classifying or rewriting documents with no latency requirement. At Cloudrift’s 4,570 output tokens/s that is 20 billion output tokens, or about 1,216 GPU-hours on one RTX 5090.

OptionMonthly cost
Claude Sonnet 5.5$240,000 ($120,000 via Batch API)
Qwen3-Coder on Bedrock$15,000
Claude Haiku 5.5$12,000 ($6,000 via Batch API)
Qwen3-Coder on SiliconFlow$7,000
Rented RTX 5090s at benchmark throughput$839 (community) to $1,447 (secure)
Same, at half the benchmark throughput$1,678 to $2,893

Here self-hosting wins by a factor of 2.4 to 8 even against the cheapest open-model API, and the margin survives a 50% haircut on throughput. The benchmark was synthetic and used a 4-bit quant, so validate on your own prompts first.

What do developers report in practice?

Community write-ups agree with the arithmetic: self-hosting is cheap per token at high load and not cheap at all for a single user.

  • The RTX 3090 electricity measurement mentioned at the top, run with Ollama, covered a dense 27B Gemma model. A 26B mixture-of-experts model in the same write-up came in at about €0.27 per million output tokens. The author counted only marginal GPU energy.
  • A personal cost breakdown (updated August 2026) assumed a $1,800 RTX 4090, an 8B model and 500,000 generated tokens a day. It found no break-even against a budget API at that volume, and about 20 months against a flagship-priced one.
  • The Knoop and Holtmann paper argues the opposite, reporting self-hosted electricity-only costs of $0.001 to $0.04 per million tokens on consumer Blackwell cards. Read its assumptions first: 30 million tokens a day, small models of 8B to 27B, a US commercial power price of $0.12 per kWh, and tables that disagree with each other on some API throughput figures.

The pattern: results flip depending on model size (dense versus MoE), batching, and what you compare against. No community report found a single-developer case that beat a hosted open model on cost alone.

What hidden costs and benefits does the headline math miss?

The headline math misses quality, privacy, availability and your own time, and each can outweigh a $50 monthly difference.

  • Model quality. A 30B open model is not Claude Sonnet 5.5. If the cheaper model needs more retries or review, the savings shrink. See local LLM vs Claude for coding.
  • Privacy and control. Self-hosting keeps code on hardware you control and lets you pin a model version. Providers can change models or policies without notice, including refusal behavior (see why LLMs over-refuse).
  • Rate limits. APIs throttle; your own GPU does not, until it saturates.
  • Ops. A rented GPU bills while a crashed server sits idle. Autoscaling to zero helps, but adds engineering time.
  • Idle waste. A GPU used for four hours a day is billed or depreciated for twenty-four.

How do you estimate your own break-even?

Compute monthly cost both ways, then find the utilization at which they cross. The formulas use only inputs you can look up.

text
API   = M_in x P_in + M_out x P_out            (M in millions of tokens)
Own   = hardware / months + kW x hours x $/kWh + idle_kW x 730 x $/kWh + ops
Rent  = $/hr x hours billed + ops
Break-even utilization u* = ($/hr) / (requests_per_hr_at_saturation x API_cost_per_request)

For the batch case, a rented RTX 5090 at 4,570 tokens/s serves about 16,450 requests of 1,000 output tokens an hour. The table shows the share of that capacity you must actually use, around the clock, before renting wins.

API you are replacingu* at $0.69/hru* at $1.19/hr
Qwen3-Coder, SiliconFlow12%21%
Qwen3-Coder, Bedrock5.6%9.6%
Claude Haiku 5.57.0%12%
Claude Sonnet 5.50.35%0.6%

For an owned card, divide its fixed monthly cost (about $62 for a 5090 with idle draw) by your API cost per million tokens. In the solo mix above, that works out to about 620M tokens a month versus SiliconFlow, about 290M versus Bedrock and about 20M versus Sonnet 5.5. Those are the volumes at which the card pays for itself, and they are far above what one interactive user generates.

FAQ

Is it cheaper to self-host an LLM?

Only at high, steady volume or against a frontier-priced API. For one developer, a hosted open model at a few cents per million tokens is cheaper than owning a GPU.

How much does it cost to run an LLM on a cloud GPU?

On RunPod (Oct 8, 2026), an RTX 5090 is $0.69 to $1.19 an hour and an H100 SXM is $2.69 to $3.99. Left running all month, the RTX 5090 costs about $504 to $869 before any ops time.

How many tokens a day justify buying a GPU?

Against Claude Sonnet 5.5, under 1M tokens a day; against a cheap hosted open model, tens of millions. See the break-even section for the formula.

Does electricity make self-hosting expensive?

Rarely. A 575 W card costs about $0.10 an hour at the EIA’s August 2026 residential average, far below the $0.69 or more that renting the same card costs. Dense models on slow cards are the exception.

Is a self-hosted open model as good as Claude?

Not by default. The cost comparison in this article holds only if the open model passes your own evaluation set.

Sources (10)
  1. Pricing, Claude API documentation (Anthropic), checked Oct 27, 2026
  2. Qwen3-Coder-30B-A3B-Instruct endpoints and pricing, OpenRouter API, checked Oct 27, 2026
  3. GPU cloud pricing, RunPod (page dated Oct 8, 2026)
  4. GPU cloud pricing, Lambda, checked Oct 27, 2026
  5. Serverless and dedicated inference pricing, Together AI, checked Oct 27, 2026
  6. Electric Power Monthly, Table 5.6.A: average retail price of electricity, EIA (released Oct 23, 2026)
  7. RTX 4090 vs 5090 vs PRO 6000: LLM Inference Benchmark, Cloudrift (Oct 9, 2025)
  8. Qwen3-Coder-30B-A3B-Instruct model card, Hugging Face
  9. NVIDIA GeForce RTX 5090 specifications
  10. Private LLM Inference on Consumer Blackwell GPUs, Knoop and Holtmann, arXiv 2601.09527 (2026)

Keep reading

[ fig. 02 — comparison ]18×8

Which uncensored AI API serves abliterated models?

Nov 9, 2026 · Comparison

An uncensored AI API is a hosted, OpenAI-style endpoint that serves models with refusals removed or reduced. As of November 9, 2026, Candor's developer API is paused, so there is no clear pick for coding agents: check tool-call support per model ID. As of October 26, 2026, Venice sells its own uncensored models per token, Featherless hosts a large open-model catalog on a subscription, and OpenRouter routes to third-party hosts. Prices, retention wording and terms differ, so read the provider's own page before sending code.

Read
[ fig. 03 — hardware ]18×8

What are the hardware requirements for a local LLM for coding?

Oct 27, 2026 · Hardware

Memory for a local coding LLM is weights plus KV cache plus about 1 GB of overhead. Weights are parameters times bits per weight divided by 8. At Q4_K_M a 9B model needs about 5.7 GB, a 27B about 16.5 GB and a 35B MoE about 22 GB, before context. Recent Qwen models cache only 64 KiB per token or less, so long context costs far less than it did.

Read
[ fig. 04 — guide ]18×8

How do you set up a self-hosted LLM server for a whole dev team?

Nov 2, 2026 · Guide

To self-host a coding LLM for a team, run vLLM or SGLang on a GPU server and put an OpenAI-compatible gateway such as LiteLLM in front of it for per-developer keys, rate limits and spend logs. Size the box by KV cache, not model weights: every concurrent developer needs cache for their full context. Never expose the inference server directly, because vLLM's API key covers only part of its routes.

Read