---
title: "The best API for RAG and retrieval"
canonical: "https://router.xark.io/use-cases/rag-and-retrieval"
description: "What embeddings and generation actually cost for a retrieval-augmented app, priced at a real corpus size rather than per thousand tokens."
section: "use-cases"
updated: "2026-09-02"
source: "https://router.xark.io/use-cases/rag-and-retrieval.md"
---

# The best API for RAG and retrieval

RAG has two bills with different shapes: a one-off embedding cost to index the corpus, then a recurring generation cost per query. Embedding a million-document corpus with Qwen3-Embedding-8B costs about $0.03 per million tokens of text — usually a rounding error next to the generation that follows it.

**Availability:** 7 of the 24 catalogued models are callable today. The rest are listed at their intended rate but no configured upstream serves them, so a request naming one returns `no available channel`. Every table below marks which is which.

## Why this workload is different

Indexing is a one-time cost proportional to corpus size. Querying is a recurring cost proportional to traffic, and each query carries the retrieved chunks as input — so retrieval quality shows up directly in the bill. Returning ten chunks where three would do triples the input tokens on every request, forever.

This is the workload where people most often optimise the wrong number. Embedding rates are already so low that halving them saves little; the leverage is in retrieving fewer, better chunks, which cuts the generation input that dominates the total.

## What actually matters when choosing

| Criterion | Why it decides this workload |
| --- | --- |
| Embedding dimensions | Wider vectors cost more to store and search, and past a point add little recall. Matching width to corpus size is a real cost decision. |
| Generation input rate | Retrieved context is input on every single query. At scale this is the whole bill, not the embeddings. |
| Cached input | A fixed system prompt and instruction block repeat on every query and can be served from cache. |

## Recommended models, priced at 100,000 queries/month, 4K context each

| Model | Our monthly cost | Official monthly cost | Saving | Callable | Document |
| --- | --- | --- | --- | --- | --- |
| Qwen3 Embedding 8B | $12.00 | $20.00 | 40% | Yes | [read](https://router.xark.io/models/qwen3-embedding-8b.md) |
| GLM-5.2 | $404.50 | $692.00 | 42% | Yes | [read](https://router.xark.io/models/glm-5-2.md) |
| DeepSeek V4 Flash | $41.40 | $64.40 | 36% | Yes | [read](https://router.xark.io/models/deepseek-v4-flash.md) |

## Questions

### Should I re-embed when a better model appears?

Only if retrieval quality is measurably failing. Re-embedding means re-indexing the whole corpus and invalidating every stored vector, and embedding rates are low enough that the switching cost is usually higher than the saving.