RAG Document Q&A API Cost Calculator
Retrieval-Augmented Generation (RAG) prompts are heavily input-bound: system instructions plus top-k retrieved chunks routinely reach 6,000–12,000 input tokens while answers stay around 400–800 output tokens. Adjust the preset below to compare live channel rates and see how prompt caching and clean Markdown preprocessing shrink your monthly bill.
Preset baseline: 2,000 queries/day (~60K/month), 8,000 avg input tokens (system prompt + 5–8 retrieved chunks), 600 avg output tokens, 40% prompt cache hit rate on shared instructions/hot chunks, 0% batch.
Daily usage is converted using a 30-day month.
Passing raw PDF, Word, or HTML? Converting to clean Markdown typically trims input tokens by 35%–60%: toolkit.fun/document-to-markdown
Channels without a published cache price use the regular input price.
Assumes the common 50% Batch discount; confirm channel eligibility before use.
Monthly cost comparison
Paid channels are sorted by USD-normalised monthly cost.
Free channels usually have rate or usage limits, so they are listed separately from the paid ranking.
| Model | Channel | Input price | Output price | Cache | Est. monthly | Visit |
|---|---|---|---|---|---|---|
| DeepSeek V4.1 Flash (1017) | 词元所China | ¥0.74/1M | ¥2.96/1M | ¥0.01 | $46.74Lowest paid¥322.52 native | |
| DeepSeek V4.1 Flash (1017) | OpenCode GoGlobal | $0.15/1M | $0.60/1M | $0.00 | $65.38USD normalised | |
| DeepSeek V4.1 Flash (1017) | Fireworks AIGlobal | $0.30/1M | $1.20/1M | $0.01 | $130.75USD normalised | |
| DeepSeek V4.1 Flash (1017) | DeepSeekChina | $0.30/1M | $1.20/1M | $0.01 | $130.75USD normalised | |
| DeepSeek V4.1 Flash (1017) | Vercel AI GatewayGlobal | $0.30/1M | $1.20/1M | $0.01 | $130.94USD normalised | |
| GPT 5.6 Sol | XiuRouterGlobal | $0.28/1M | $1.40/1M | $0.03 | $136.42USD normalised | |
| DeepSeek V4.1 Flash (1017) | Together AIGlobal | $0.30/1M | $1.20/1M | — | $187.20USD normalised | |
| Claude Sonnet 5.5 | XiuRouterGlobal | $0.60/1M | $3.00/1M | $0.03 | $286.56USD normalised | |
| Claude Sonnet 5.5 | OpenRouterGlobal | $1.00/1M | $5.00/1M | $0.05 | $477.60USD normalised | |
| Gemini 4 Carbon | OpenRouterGlobal | $1.00/1M | $5.00/1M | $0.05 | $477.60USD normalised | |
| GPT 5.6 Sol | XycAiChina | ¥6.56/1M | ¥39.33/1M | ¥0.66 | $497.04¥3,429.58 native | |
| Gemini 4 Carbon | XycAiChina | ¥8.28/1M | ¥41.40/1M | ¥0.41 | $573.12¥3,954.53 native | |
| Claude Sonnet 5.5 | OpenRouterGlobal | $2.00/1M | $10.00/1M | $0.10 | $955.20USD normalised | |
| Claude Sonnet 5.5 | AnthropicGlobal | $2.00/1M | $10.00/1M | $0.10 | $955.20USD normalised | |
| Gemini 4 Carbon | Gemini(Google)Global | $2.00/1M | $10.00/1M | $0.10 | $955.20USD normalised | |
| Gemini 4 Carbon | Google Vertex AIGlobal | $2.00/1M | $10.00/1M | $0.10 | $955.20USD normalised | |
| Gemini 4 Carbon | OpenRouterGlobal | $2.00/1M | $10.00/1M | $0.10 | $955.20USD normalised | |
| Gemini 4 Carbon | Vercel AI GatewayGlobal | $2.00/1M | $10.00/1M | $0.10 | $955.20USD normalised | |
| GPT 5.6 Sol | Azure OpenAIGlobal | $4.00/1M | $20.00/1M | $0.40 | $1,948.80USD normalised | |
| GPT 5.6 Sol | OpenRouterGlobal | $4.00/1M | $20.00/1M | $0.40 | $1,948.80USD normalised |
Scenario frequently asked questions
Why do input tokens dominate RAG document Q&A API bills?
In a typical RAG call, retrieved passages account for 85%–95% of total tokens (for example, 8,000 input vs 600 output tokens). Even when output rates per million tokens are 3×–5× higher than input rates, input volume still drives most of the monthly invoice—making chunk hygiene and prompt caching the highest-leverage levers.
How much can converting PDFs or HTML to Markdown save in a RAG pipeline?
Raw HTML, Word XML, and poorly extracted PDFs carry repeated headers, layout wrappers, and boilerplate that inflate chunk length. Normalizing source files into structured Markdown before chunking typically trims input tokens by 35%–60% without removing semantic headings or tables.
Does prompt caching work well for RAG workloads?
Yes, when you place static system instructions, tool schemas, and frequently referenced policy/document prefixes at the start of the prompt. Dynamic per-query chunks placed after the static prefix still bill at standard input rates, so a 30%–50% cache hit rate is a realistic starting assumption.
Are embedding and vector-database costs included in this calculator?
No. This calculator covers LLM generation token costs (input, cached input, output, and optional batch discounts). Embedding and reranking APIs are billed separately; you can inspect their current rate cards on the Embedding Models and Rerank Models pages.