RAG / Docs Q&A LLM Cost Calculator
A typical RAG pipeline runs ~3,000 input + 400 output tokens per request (tune below). Here's the effective price and monthly bill — with caching on the stable prefix modeled in.
For engineers budgeting LLM API calls — shows the effective price you actually pay per million tokens (output skew + caching included), not just the advertised input rate.
Model prices from OpenRouter · updated 2026-07-13
01 Your setup
$2/M in · $10/M out · cache reads $0.2/M
02 Advertised vs effective
Output is 55% of this bill — your workload is input-heavy; caching and context discipline matter most.
$730/month · $0.01/request
$2 listed + $0.94 output premium − $0.79 caching = $2.15/M effective
Caching your 50% stable prefix saves $270/month.
03 Where the money goes
04 Cheapest model at this workload
Top 10 of 315models, ranked by monthly cost at this exact workload with each model's own cache pricing applied. Cheapest is a shortlist, not a verdict.
Related cost calculators
Prices from OpenRouter, snapshot 2026-07-13, synced daily. Per request = input × [(1−cachedShare) × in + cachedShare × cacheRead] + output × out, per 1M tokens; cached share applies only where a cache-read price is published. Write premiums, TTL and misses are modeled in the dedicated caching calculator. All math runs in your browser.
How the math works
The advertised price is the input rate — Claude Sonnet 5 lists $2 per million input tokens. But output tokens bill at $10/M (5.0× dearer), and your workload mixes both. This page's defaults — 3,000 input + 400 output per request — blend to an effective $2.15 per million tokens (7% above the listed rate). Same baseline, one identity: $2 listed + $0.94 output premium − $0.79 caching = $2.15/M.
Output drives 55% of this bill. That has a practical consequence naive calculators miss: when output dominates, trimming response length (tighter max_tokens, terser formats) saves more than switching models — the input price you shopped on barely matters.
Prompt caching (on by default here) re-bills the stable share of your input — system prompt, tools, shared docs — at Claude Sonnet 5's cache-read rate of $0.2/M instead of $2/M. At this page's default 50% cached share that saves $270 a month ($1,000 → $730). Write premiums, TTL and misses are modeled in our dedicated caching calculator.
Worked example at this page's defaults — 100,000 requests a month on Claude Sonnet 5: $0.01 per request, $730 per month. The live ranking below re-prices all 315 catalog models at this exact workload.
Prices sync daily from OpenRouter and the page shows its snapshot date. Every calculation runs in your browser with tested, open formulas — nothing is estimated by an AI.
Frequently asked questions
How much does a RAG pipeline cost per month?
At this page's defaults — 3,000 input + 400 output tokens per request, 100,000 requests a month, 50% cached prefix — Claude Sonnet 5 bills $0.01 per request and $730 per month. Tune every input above for your real workload.
Why does my effective price differ from the advertised $2/M?
Two forces on the same baseline: output bills at $10/M and adds $0.94/M at this workload's mix, while caching the stable prefix subtracts $0.79/M — netting $2.15/M, 7% above the listed rate. Comparing models on the input headline alone routinely picks the wrong one; comparing effective rates doesn't.
What actually cuts an LLM API bill?
In order of typical impact: cap output length (output is usually 60–85% of the bill), enable prompt caching on the stable prefix (saves $270/month at these defaults), batch non-realtime work (~50% off on major providers), and only then consider switching models — using the effective rate, not the advertised one.
What's the cheapest model at this workload?
Right now: Ling-2.6-flash at $3.00/month, then Llama 3.1 8B Instruct ($7.20) and Mistral Nemo ($7.20) — refreshed daily from live prices. Cheapest only matters if quality holds on your task; the ranking is a shortlist, not a verdict.
What formula does this calculator use?
Per request = input × [(1 − cachedShare) × inputRate + cachedShare × cacheReadRate] + output × outputRate, all per million tokens. Effective $/M = per-request cost ÷ total tokens × 1M. The cached share applies only when the model publishes a cache-read price and the toggle is on; cache writes and misses are modeled in the dedicated caching calculator.
Are these prices current?
Prices sync daily from OpenRouter's public catalog and the page shows its snapshot date. If a sync fails, the last verified snapshot keeps serving. All math runs client-side with tested code.