Retrieval-augmented generation gets described as a vector-database problem. It is really a decision about how many tokens you are willing to send with every question — and that decision is made in three places: the chunk size, the number of chunks you retrieve, and whether you needed retrieval at all.
This page prices those choices. It also starts with the constraint most tutorials skip: DeepSeek’s API does not publish an embeddings endpoint, so any RAG pipeline on DeepSeek is a two-provider pipeline from day one.
Quick answer. DeepSeek provides generation, not embeddings — the API reference documents chat completions, and the embeddings path returns 404. So you pair DeepSeek with an embedding model from another provider. At 500-token chunks and five retrieved chunks, an answer costs about $0.00066, or $0.66 per thousand answers. Retrieving twenty chunks instead of five makes that $1.79. Sending a 50,000-token document without retrieval costs $7.79 — unless you cache it, which drops repeated questions about the same document to roughly $0.00039.
The embedding gap
DeepSeek’s API documentation covers chat completions. The embeddings endpoint that OpenAI-compatible clients expect is not part of it — the create-embeddings path returned a 404 when tested on 27 November 2026. That single fact shapes the architecture:
- Two providers, two bills, two sets of terms. Your embedding provider sees every document you index, in full. For most corpora that is a bigger data-exposure question than the generation call, because indexing happens once over everything.
- Two rate limits. A generation spike and a re-index spike fail differently, and neither retries the other.
- Model changes are silent. If your embedding model is retired or updated, your index has to be rebuilt. Generation model changes do not require that.
None of that makes RAG a bad design. It makes the embedding choice an architectural commitment rather than a configuration detail, and it is worth picking a provider whose dimensions and versioning policy you are willing to live with for a year.
Where the money actually goes
A RAG answer has three cost lines, and only one of them is usually discussed:
| Line | When it is paid | Scales with |
|---|---|---|
| Embedding the corpus | Once, plus on every document change | Total corpus size |
| Embedding the question | Every request | Number of questions — negligible |
| Generation | Every request | Retrieved tokens × questions |
Vector storage and search add another cost. If you already run PostgreSQL, compare pgvector and Pinecone costs for a DeepSeek RAG app to see when a separate service is worth paying for.
The generation line is where the variance lives, because k — the number of chunks you retrieve — multiplies every single request. Moving from k=5 to k=20 quadruples the input tokens whether or not the extra fifteen chunks help.
What chunk size does to the bill
Take a 10,000-token document. Chunk size determines how many pieces exist, and k determines how many of them ride along with each question.
| Chunk size | Chunks in a 10K document | Tokens retrieved at k=5 | Trade-off |
|---|---|---|---|
| 200 tokens | 50 | 1,000 | Precise matching, but answers lose surrounding context |
| 500 tokens | 20 | 2,500 | The reasonable default for prose |
| 1,000 tokens | 10 | 5,000 | Better context, more irrelevant text per chunk |
| 2,000 tokens | 5 | 10,000 | Fewer retrieval calls, double the bill per question |
Two things are worth noticing. First, doubling chunk size doubles retrieved tokens at fixed k — the cost curve is linear and nobody notices until the invoice. Second, small chunks are not automatically cheaper: if a 200-token chunk lacks the context needed to answer, you will retrieve more of them or ask again, and both cost more than the 500-token version would have.
Retrieve, or put it all in the context window
V4.1-Flash supports contexts of up to one million tokens, which means retrieval is now a cost decision rather than a hard limit. There are two architectures worth pricing against each other:
| Approach | What you pay per question | Suits |
|---|---|---|
| Retrieval (RAG) | Only the retrieved chunks | Large corpus, many documents, questions spread across all of it |
| Whole document in context | The whole document, every time | One document, many questions about it |
| Whole document, cached | Cache-read rate after the first call | The same document, repeated questions — usually the cheapest option |
| Hybrid: cached summary plus retrieval | A small cached prefix plus a few chunks | Medium corpora where a summary carries the framing |
The cached row is the one teams miss. Cached input bills at $0.003 per million tokens against $0.15 for a cache miss, so a 50,000-token document costs $0.00015 per question when it hits the cache and $0.0075 when it does not — a 50× difference on the same content. Our context caching guide covers what makes a prefix cacheable.
What a thousand answers cost
Assumptions: 400 output tokens per answer, 300 tokens of instructions and question, Flash off-peak rates of $0.15 input and $0.60 output per million tokens. Embeddings are excluded because they are a separate provider and a one-off cost.
| Approach | Input tokens per answer | Cost per 1,000 answers |
|---|---|---|
| RAG, 500-token chunks, k=5 | 2,800 | $0.66 |
| RAG, 500-token chunks, k=20 | 10,300 | $1.79 |
| One 50,000-token document, no cache | 50,300 | $7.79 |
| 200,000 tokens in context | 200,300 | $30.29 |
Read the last row as a warning rather than a recommendation. Long context is a capability, not a strategy: at 200,000 tokens per question, answering 10,000 questions a month costs about $300 on input alone — roughly $303 with output included — for a corpus you could have indexed once.
Measuring retrieval before optimising cost
Cheaper retrieval that finds the wrong chunk is not an optimisation. Before tuning k downward, measure whether the right chunk is being found at all:
- Write 50 real questions your users actually ask, not ones derived from the documents.
- Label the chunk that contains each answer. If no chunk contains it, your chunking is wrong and no model will fix it.
- Measure recall@k — the share of questions whose labelled chunk appears in the top k results.
- Only then tune k. If recall@5 is above 90%, dropping to k=3 saves tokens. If it is 60%, a better embedding model or better chunking beats a cheaper generation call.
The failure that hides here is confident and wrong: retrieval returns five chunks, none of which contains the answer, and generation writes a fluent paragraph from adjacent material. That is why the labelled-chunk step matters more than the scoring.
When RAG is the wrong pattern
- Your corpus fits in the context window comfortably. If the whole thing is 30,000 tokens and questions repeat, caching it beats building an index.
- Questions need the whole document, not a passage. “Summarise this contract” is not a retrieval problem; retrieval will hand you four clauses and call it a summary.
- The corpus changes hourly. Re-embedding cost and index staleness can exceed the value; sometimes a direct database query is the honest answer.
- You cannot send documents to an embedding provider. Two providers means two data reviews. If one of them fails, the pipeline does not ship.
A minimal pipeline, in order
- Chunk at 500 tokens with a 50–100 token overlap, keeping section headings attached to their text.
- Embed with a provider whose model version you can pin, and store the model name next to every vector.
- Retrieve k=5, then re-rank or filter rather than raising
k. - Put stable instructions in a cacheable prefix; put retrieved chunks after it.
- Log token counts per answer, not just totals — the API setup guide shows where the usage block lives.
- Re-run the 50-question recall test on every chunking or embedding change.
Quick answers
Does DeepSeek have an embeddings API?
Not in the documented API: the reference covers chat completions, and the embeddings endpoint path returned 404 when tested on 27 November 2026. Plan for a second provider for vectors.
What chunk size should I start with?
500 tokens with a small overlap, for prose. Measure recall@5 on 50 real questions before changing it, and remember that halving chunk size halves retrieved tokens but can cost you the context the answer needed.
Is RAG cheaper than sending the whole document?
For a large corpus, yes by an order of magnitude: $0.66 against $30.29 per thousand answers in the table above. For one document asked about repeatedly, caching the document beats both.
How many chunks should I retrieve?
As few as recall allows. Five is a common start; move it only after measuring. Each extra chunk adds 500 tokens to every request whether it helps or not.
Does context caching work with RAG?
It works on the stable prefix — instructions, schema, and any fixed framing — not on the retrieved chunks, which change every question. Caching can still be the largest saving when you also pin a document or summary in that prefix.
What is the biggest cause of bad RAG answers?
Retrieval that misses the relevant chunk while still returning plausible neighbours. The model then answers fluently from adjacent material, which reads better than an error and is harder to detect.
Sources
- DeepSeek API documentation — endpoint reference used to confirm the absence of an embeddings route
- Models & Pricing — input, output, and cached-input rates used above
- DeepSeek-V4.1-Flash model card — context length up to one million tokens
- DeepSeek Privacy Policy — processing location, relevant to what you index
