opyebCloudCostCal

What one RAG answer costs, and why the model is 20× the retriever

Retrieval, embeddings and re-ranking are cheap. The generation call is the bill, and the model choice is the lever.

2026-11-28 · OPYEB

A RAG pipeline has four cost centres: embedding the corpus, embedding the query, retrieving and re-ranking, and generating the answer. Only one of them scales with your model choice, and it is the one that dominates.

The generation call

Per query: 800 tokens of retrieved context, 400 tokens of question and instructions, 300 tokens of answer. One thousand queries:

ModelInput /1MOutput /1MPer 1,000 queries10k queries/day, monthly
Claude Haiku 5.5$0.10$0.50$0.27$81
GPT-6 Luna$0.10$0.50$0.27$81
Gemini 4 Hydrogen$1.50$7.50$4.05$1,215
Claude Sonnet 5.5$2.00$10.00$5.40$1,620
Claude Opus 5.5$4.00$20.00$10.80$3,240

The difference between the cheapest and the most expensive row is 40×, for the same retrieved context and the same question. That is the whole guide.

The rest of the pipeline

Embedding a corpus is priced per token at a small fraction of generation — typically 1/20th to 1/100th of a frontier model's input price, depending on the provider. Re-ranking costs a call per candidate set, which at 50 candidates per query is comparable to one extra generation call. Vector storage is usually a flat monthly fee that does not move with query volume at all.

What this means practically: at 10,000 queries a day, generation on Sonnet is $1,620 a month while retrieval, embeddings and storage together are typically under $200. Optimising the retriever is a quality exercise; optimising the model is a cost exercise.

Three levers that keep quality

  1. Route by difficulty. Send simple lookups to Haiku and only escalate to Sonnet when the retrieved chunks disagree or the question is multi-hop. Most teams find 60–80% of traffic is simple.
  2. Cache the system prompt. The instructions and the retrieval format are identical across queries; at a 60% hit rate the input line falls by more than half (see the caching guide).
  3. Cut context, not quality. Dropping from 800 to 400 tokens of retrieved context halves the input line; better re-ranking often improves the answer at the same time.
A RAG bill is a generation bill with a small retrieval surcharge. Price the model first, then the rest.

Enter your context and answer length · Caching for RAG →

Guides →
Rate library About Contact