AI Calculator Pro

RAG Query Cost Calculator

Estimate the cost of a single RAG query.

Quick answer

With the default inputs, $0.00763 per query — ~$457.55/month at 2,000 queries/day. Enter your own numbers below to recompute instantly; the full step-by-step math is shown under the worked example.

Results update automatically as you type.

Result
$0.00763 per query
~$457.55/month at 2,000 queries/day
Query embedding
$8.00e-7
Retrieved context
2,560 tokens
Generation cost
$0.00762
Per query
$0.00763
Per month
$457.55

Estimate the per-query cost of a retrieval-augmented answer: the query embedding plus generation over the retrieved chunks. Set top-k and chunk size to see cost per query and per month.

How this is calculated

Per-query cost = query embedding (query tokens × embedding price) + generation (system prompt + query + top-k × chunk size retrieved tokens as input, plus answer tokens as output, at the generation model's rates). Monthly = per-query × queries per day × 30.

Is this a good result? What to do next

The retrieved context (top-k × chunk size) usually dominates a query, and it's resent on every request — so it's the first thing to trim. Query embedding is negligible by comparison.

Typical planning ranges

Retrieved tokens
top-k × chunk size (dominant input)
Query embedding
negligible
Answer tokens
your output setting

Ranges are typical planning figures to sanity-check your result, not authoritative benchmarks. Your numbers will vary with use case, volume, and vendor.

How to improve this number

  • Lower top-k or chunk size to shrink retrieved input.
  • Use a cheaper generation model; cache the system prompt.
  • Rerank so fewer, better chunks are needed.

Common mistakes

  • High top-k that resends more context than the answer needs.
  • Ignoring the system prompt re-sent on every query.

When to use a different approach

For the whole pipeline (ingest + storage + queries), use the RAG cost calculator. To tune chunking, use the chunk size calculator.

Worked example (defaults)

With the default inputs above, here is the result:

Result
$0.00763 per query
~$457.55/month at 2,000 queries/day
Query embedding
$8.00e-7
Retrieved context
2,560 tokens
Generation cost
$0.00762
Per query
$0.00763
Per month
$457.55

Sources & references

Frequently asked questions

What makes a RAG query expensive?+

Retrieving many large chunks (high top-k x chunk size) inflates input tokens on every query. Retrieve fewer, tighter chunks and cache the system prompt to cut cost.

Related calculators

Answering a real question?

This calculator powers these problem-solving guides: