How much does a RAG application cost to run on an LLM API?
A RAG app answering 5,000 queries a day with 8,000 input and 500 output tokens costs about $4,725 a month at example prices of $3/$15 per million tokens.
Last updated:
Cost per month
$4,725.00
- Cost per request
- $0.0315
- Cost per 1,000 requests
- $31.50
- Cost per year
- $56,700
- Tokens per month
- 1,275 M tokens
- Share from output tokens
- 24 %
Results are engineering estimates for planning. Final designs must follow your local code and be checked by a qualified professional.
This scenario at a glance
| Requests | 5,000 per day |
|---|---|
| Input tokens per request | 8,000 tokens |
| Output tokens per request | 500 tokens |
| Input price per 1M tokens | 3 $/1M |
| Output price per 1M tokens | 15 $/1M |
| Share of input served from cache | 0 % |
| Discount on cached input | 90 % |
| Batch API (50 % off) | No (real-time) |
| Cost per month | $4,725.00 |
|---|---|
| Cost per request | $0.0315 |
| Cost per 1,000 requests | $31.50 |
| Cost per year | $56,700 |
| Tokens per month | 1,275 M tokens |
| Share from output tokens | 24 % |
Engineering notes for this workload
Retrieval-augmented generation (RAG) pipelines send retrieved document chunks to the model with every question, so input tokens dominate. This scenario models an internal knowledge assistant answering 5,000 queries a day, 150,000 a month, with 8,000 input tokens (system prompt, question and roughly eight retrieved chunks of 900 tokens) and 500 output tokens per answer.
At example prices of $3 per million input and $15 per million output tokens, each query costs about $0.0315 and the month about $4,725. Here input is about 76 % of the cost, the reverse of a typical chatbot. The biggest lever is therefore how much context you retrieve, not how long the answers are.
Retrieval tuning pays off directly. Reducing the context from eight chunks to four with a better reranker cuts input by roughly 3,600 tokens per query and the monthly bill by about a third. Smaller, well-segmented chunks, deduplication of near-identical passages and a relevance threshold that drops weak matches all shrink the context without hurting answer quality, and often improve it.
Caching helps when part of the context repeats. If the system prompt and a shared set of reference documents form a stable prefix, prompt caching can bill those tokens at a large discount; the separate page on prompt caching on this site models the same workload with 70 % of the input cached, which roughly halves the cost. Retrieved chunks that change per query cannot be cached that way.
Do not forget the rest of the pipeline. Embedding generation for indexing and for each query, vector database hosting and re-indexing after document updates add cost, though embedding prices are usually small next to generation. For high-volume internal tools, compare the monthly API bill with a dedicated deployment, but include engineering and GPU costs in that comparison.
Log tokens per query from day one; it is the fastest way to spot runaway context.
Reference table
| Workload | Input tokens | Output tokens | Notes |
|---|---|---|---|
| Chat turn with system prompt | 500–2,000 | 150–600 | History grows each turn |
| RAG answer | 3,000–10,000 | 300–800 | Retrieved chunks dominate |
| Document summary | 2,000–20,000 | 200–500 | Batch-friendly |
| Classification / tagging | 100–500 | 1–20 | Ideal for small models |
| Coding assistant | 10,000–50,000 | 500–3,000 | Large cached context |
| Agent tool step | 5,000–50,000 | 200–2,000 | Many steps per task |
Rule of thumb for English: 1 token ≈ 4 characters ≈ 0.75 words. Other languages and code usually need more tokens per word.
Questions about this scenario
How much does RAG cost per query?
About $0.03 per query in this example: 8,000 input and 500 output tokens at $3/$15 per million tokens.
How can I reduce RAG token costs?
Retrieve fewer, more relevant chunks with a reranker, deduplicate passages, cache stable prefixes and route simple questions to smaller models.
Are embeddings a big part of RAG cost?
Usually not. Embedding prices per token are typically far below generation prices, but re-indexing large corpora adds up.