Cheapest way to host a 27B vision model
Prepared: Mon Nov 23, 2026, 4:58 AM ET · For: Rick James · Job: a443ef19
Recommendation (short version)
| # | Use this | Cost | Why |
|---|---|---|---|
| 1 | Google AI Studio free tier — gemma-4-31b-it (27B+ class, vision) |
$0.00 | Verified live, correct OCR, 30 req/min. Zero setup. Use it while you build. Caveat: RPM is measured at 30, but Google publishes no daily (RPD) cap for Gemma, so treat heavy production volume as unproven — see the gap note below. |
| 2 | DeepInfra gemma-3-27b-it |
$0.028 per 1,000 requests (~$0.08/$0.16 per 1M tokens) | Cheapest paid per-token option for an exact 27B vision model. No idle cost. |
| 3 | Vast.ai RTX 3090 24GB — self-host with vLLM | $0.122/hr ≈ $89/mo | Cheapest working self-host. Wins only above ~4,400 requests/hour. |
Do not rent a GPU for low or moderate volume. A rented GPU bills 730 hours a month whether you use it or not; the per-token API bills nothing when idle. One 24 GB GPU only beats the API once you sustain ~4,400 requests/hour — and to actually reach that you must batch, not serve requests one at a time.
The proof (it actually responds)
work/test_vision.py sends a real 1280×720 frame with planted ground truth — the words “SHIP IT FRIDAY” / “TRANSOVO CLIPS” and a large pink circle — and scores the reply against that ground truth. “I got some text back” is not proof; matching the planted content is.
Result against the recommended free endpoint:
verdict: PASS 3/3 runs
model: gemma-4-31b-it (262,144 ctx, image+text+video)
latency: min 9.25s · median 9.26s · max 9.34s
answer: "TEXT: SHIP IT FRIDAY Transovo CLIPS | ep. 42 | 00:07:31
CIRCLE: pink"
Both API shapes pass: native Gemini (:generateContent) 3/3, and OpenAI-compatible (/v1beta/openai/chat/completions) 2/2 — the latter matters because that is the shape any self-hosted vLLM or Ollama server exposes, so the same script tests both.
The test can fail — verified, not assumed:
| Control | Expected | Measured |
|---|---|---|
| Blank image, correct endpoint | FAIL | FAIL — answered “TEXT: None / CIRCLE: None” |
Non-existent model no-such-model |
FAIL | FAIL — HTTP 404 |
gemma-3-27b-it on Gemini API |
FAIL | FAIL — HTTP 404, not served there |
Three independent controls all fail correctly, so a PASS means something.
What “27B” actually costs, measured
Per-request cost at a realistic workload — one 720p frame, short answer (290 input tokens):
| Model | Input / Output per 1M | Cost per 1,000 requests |
|---|---|---|
gemma-4-31b-it — free tier |
$0 / $0 | $0.00 |
gemma-3-27b-it — DeepInfra |
$0.080 / $0.160 | $0.028 |
gemma-3-27b-it — OpenRouter |
$0.080 / $0.160 | $0.028 |
qwen3-vl-30b-a3b — OpenRouter |
$0.150 / $0.600 | $0.062 |
gemma-4-26b-a4b — OpenRouter |
$0.090 / $0.300 | $0.124 |
gemma-4-31b-turbo — DeepInfra |
$0.090 / $0.340 | $0.137 |
gemma-4-31b — DeepInfra |
$0.200 / $0.400 | $0.188 |
gemma-4-31b — Together.ai |
$1.05 / $2.62 | $1.156 |
The catch that doubles the bill: reasoning tokens
Gemma 3 27B answers with ~30 output tokens. Gemma 4 31B burns 230–296 reasoning tokens on the same trivial question — roughly 5× the billed output for the same answer. I tried to switch it off:
thinkingBudget: 0→400 INVALID_ARGUMENT: Thinking budget is not supported for this model.thinkingLevel: low→400 INVALID_ARGUMENT: Thinking level is not supported for this model.
It cannot be disabled through the API (both errors reproduced verbatim, above). Since output tokens are priced 2× input, this is the single biggest lever on cost. If you want cheap, use Gemma 3 27B, not Gemma 4. Gemma 4 is only free because the free tier ignores the cost.
Rented GPU: the real floor
Throughput is measured, not guessed — llm-speed.com benchmark (Ollama, Q4_K_M, RTX 4090): Gemma 3 27B → 46.95 tok/s decode, 817 ms TTFT. Cross-check: 325 out-tokens ÷ 46.95 + 0.82 s = 7.7 s, against the 9.26 s I measured live. The model is sound.
| GPU | $/hr | $/mo always-on | Break-even vs API |
|---|---|---|---|
| Vast.ai V100 32GB | $0.069 | $50.37 | 2,464 req/hr |
| Salad RTX 3090 (Batch) | $0.090 | $65.70 | 3,214 req/hr |
| Vast.ai RTX 4090D 24GB | $0.108 | $78.84 | 3,857 req/hr |
| Vast.ai RTX 3090 24GB | $0.122 | $89.06 | 4,357 req/hr |
| Salad RTX 4090 (Batch) | $0.160 | $116.80 | 5,714 req/hr |
| Vast.ai RTX 5090 32GB | $0.213 | $155.49 | 7,607 req/hr |
| RunPod RTX 4090 24GB | $0.340 | $248.20 | 12,143 req/hr |
| RunPod A100 PCIe 80GB | $2.09 | $1,525.70 | overkill for 27B |
Why not the $0.069 V100? It is the cheapest line item and it is a trap. V100 is SM70 — no bf16, patchy vLLM support. It would cost more in engineering time than it saves. The honest cheapest working answer is a 24 GB RTX 3090/4090.
The capacity catch. One stream on an RTX 4090 serves ~2,473 req/hr at 30 output tokens — almost exactly its own 4,357 req/hr break-even. So a plain single-stream server never pays for itself. Self-hosting only wins if you run continuous batching (vLLM does this by default) to reach 8× concurrency.
The honest bottom line on scale
| Sustained load | Cheapest option | Monthly |
|---|---|---|
| up to ~4,400 req/hr | per-token API | $0–$120 |
| above ~4,400 req/hr | rented RTX 3090 + vLLM batching | $89 flat |
| above ~30,000 req/hr | rented GPU, unavoidable | scales by GPU count |
At the free tier’s measured ceiling (1,800 req/hr, 24/7) the traffic would cost $36.79/mo on DeepInfra — still cheaper than any GPU. Free tier is the answer for essentially any workload you have today.
Why no live self-hosted endpoint was left running
sudo is available and the APIs are reachable, but no cloud account is logged in here — no Vast/RunPod/Salad/Modal credentials, no HF token, no gh auth. Vast’s console API returns 403 Forbidden from this environment. Standing up a paid GPU pod requires creating a billing account in Rick’s name, which I will not do unasked.
So the endpoint I proved live is the free, keyless-to-set-up Google AI Studio one, which is also the actual recommendation. The self-host path is fully costed and the test script is ready to point at a vLLM URL the moment there is an account.
Nothing was left running. Verified: no vLLM/Ollama/tunnel processes, no listening ports. Total spend: $0.00 — the only API used is free-tier.
Known gap (stated, not hidden)
- Daily quota is undocumented. I measured 30 req/min by bursting until HTTP 429. I could not find a published requests-per-day cap for Gemma, and I did not run a multi-day test, so I cannot state a safe daily volume. If you plan to push more than a few thousand requests a day, add a paid fallback rather than trusting the free tier.
- Self-host throughput is modelled, not rented. The 46.95 tok/s anchor is a third-party measured benchmark on an RTX 4090, cross-checked against my 9.26 s live latency (7.7 s predicted). I did not rent a GPU, so vLLM + 8× batching performance is an inference from the single-stream rate.
Files
| File | What |
|---|---|
work/test_vision.py |
The proof script. Works on Gemini and OpenAI-compatible shapes. |
work/cost_model.py |
Full cost model, every price with its source. |
work/cost_model.json |
Machine-readable results. |
work/proof_gemma4_31b.json |
Raw 3/3 PASS evidence. |
work/proof_openai_shape.json |
Raw 2/2 PASS evidence, OpenAI shape. |
work/throughput.json |
30 req/min sustained measurement. |
src/or_models.json, src/di.json, src/vast2.json, src/runpod.json |
Captured live price data. |
Price sources (all read 2026-11-23)
- Gemini API pricing: ai.google.dev/gemini-api/docs/pricing — Gemma 4 “Free of charge”, paid “Not available”
- DeepInfra:
api.deepinfra.com/models/list(live JSON) - OpenRouter:
openrouter.ai/api/v1/models(live, 477 models) - Vast.ai:
console.vast.ai/api/v0/bundles(64 live offers) - RunPod:
runpod.io/pricing+ GraphQL - Salad:
salad.com/pricing - Together:
together.ai/pricing - Throughput: llm-speed.com/blog/gemma-3-speed-rtx-4090 (2026-07-03)
Test the recommended endpoint yourself
python3 work/test_vision.py \
--url "https://generativelanguage.googleapis.com/v1beta/models/gemma-4-31b-it:generateContent" \
--model gemma-4-31b-it --key GEMINI_API_KEY --image work/frame_test.png --runs 3Exit code 0 = passed. Add --shape openai --url .../v1beta/openai/chat/completions to test against a vLLM/Ollama server instead.