CheckPre

RAG Cost Calculator

What retrieval-augmented question answering costs per question and per month, when every answer is built from retrieved passages.

Updated · By Niraj Kumar · 6 sources

Model

Each request

Count text inCount text in
tokens

System prompt, conversation history, documents and tool definitions are all resent on every call.

tokens

The visible answer.

Count tokens from a prompt or JSON payloadShow

Plain text, OpenAI Chat or Responses JSON, or Anthropic Messages JSON. A final assistant message or a response body counts as output. Counted in your browser; nothing is uploaded.

Loading the tokenizer…

Counts use OpenAI's o200k tokenizer, so they are exact for GPT-6 and GPT-5 models, plus a few tokens of message framing. Other providers' tokenizers count the same text differently and do not publish a conversion factor; Anthropic says Claude models from 4.7 on produce about 30% more tokens than earlier Claude models. For an exact count on another model, paste one of its API responses: the usage it reports is shown above.

tokens

Thinking tokens are billed as output. Leave at 0 for models or settings that do not reason.

Volume

PricePrice

60,000 requests over 30 days.

Discounts

%
0%100%

The share of input that repeats exactly at the start of every request, such as a fixed system prompt. The prompt caching calculator prices cache writes and expiry in detail.

Batch APIBatch API
Monthly cost$1,070$0.0178 a request on Claude Sonnet 5
Per 1,000 requests
$17.84
Input
$816.00
Cached input
$14.40
Output
$240.00
Price rank
15th cheapest of 24
Cheapest listed model
Claude Haiku 5.5
$53.52 a month, $1,017 less
Output22%
  • Input76%
  • Cached input1%
  • Output22%
Every model on this workload, per month8,000 tokens in (15% cached), 400 out, 2,000 a day. Hover or focus a row for rates.
  1. 1Claude Haiku 5.5Anthropic$53.52
  2. 2GPT-6 LunaOpenAI$53.52
  3. 3Qwen3.8 FlashAlibaba$83.28
  4. 4GPT-5.6 LunaOpenAI$111.84
  5. 5DeepSeek V4.1 FlashDeepSeek$151.63
  6. 6Gemini 3.5 Flash-LiteGoogle$184.56
  7. 7Qwen3.7 PlusAlibaba$204.48
  8. 8Gemini 3.8 FlashGoogle$401.40
  9. 9Claude Haiku 4.5Anthropic$535.20
  10. 10Grok 4.3xAI$584.40
  11. 11DeepSeek V4 ProDeepSeek$636.77
  12. 12Grok 4.7xAI$996.00
  13. 13Claude Sonnet 5.5Anthropic$1,063
  14. 14GPT-6.1 SolOpenAI$1,063
  15. 15Claude Sonnet 5Anthropic$1,070
  16. 16GPT-6 SolOpenAI$1,070
  17. 17Qwen3.8 MaxAlibaba$1,104
  18. 18GPT-5.6 TerraOpenAI$1,118
  19. 19Gemini 3.1 ProGoogle$1,118
  20. 20Claude Opus 5.5Anthropic$2,126
  21. 21GPT-5.6 SolOpenAI$2,141
  22. 22Claude Opus 5Anthropic$2,676
  23. 23Claude Fable 5.1Anthropic$5,298
  24. 24GPT-6 AstraOpenAI$5,352

How the RAG Cost Calculator works

cost = (fresh input × input rate + cached input × cache rate + (output + reasoning) × output rate) ÷ 1,000,000

This page uses the same method as the LLM API Cost Calculator, which explains each term and assumption in full.

Worked example

2,000 questions a day, each answered from about 7,000 tokens of retrieved passages plus a 1,000-token instruction block. Retrieved passages change with every question, so only the instructions cache. Priced on Claude Sonnet 5.

  1. 1Each request: 8,000 input tokens (15% cached), 400 output
  2. 2Input costs $0.0138 and output $0.004, so $0.0178 a request
  3. 3× 60,000 requests over 30 days = $1,070

$1,070 a month on Claude Sonnet 5. The cheapest listed model, Claude Haiku 5.5, would cost $53.52.

Frequently asked questions

What drives the cost of a RAG pipeline?

Input. Each question sends the retrieved passages, often several thousand tokens, while the answer is a few hundred, so input can be 90% of the bill. Retrieving fewer, better chunks saves more than switching models. Embedding and vector database costs are separate and usually small next to generation.

Can RAG prompts be cached?

Only the part that repeats: the instructions and any fixed reference material placed before the retrieved passages. The passages differ per question, so they do not cache, which is why the preset assumes only about 15% of the input is cached. Order the prompt so stable content comes first.

Sources

Related calculators

More in AI, Cloud & Developer