Embedding cost optimization: cheaper vectors at scale
Generating embeddings costs per token via an embedding model, and re-embedding large corpora or every query adds up. Caching embeddings, choosing right-sized models, and batching cut the bill. Here is how.
Quick answer
Embeddings are generated per token by an embedding model, so cost scales with how much text you embed: your document corpus (once, plus on updates) and every query. The levers: cache embeddings so you do not re-embed unchanged documents or repeated queries, choose a right-sized embedding model (smaller dimensions and cheaper models often serve retrieval well), batch embedding requests for any batch discount, and only re-embed what actually changed. Documents change rarely, so most embedding cost is avoidable re-computation.
Turning text into embedding vectors costs money per token, and for RAG and semantic search you embed both your document corpus and every incoming query. The corpus is embedded once and re-embedded on changes, and queries are embedded continuously, so the cost scales with text volume, and much of it is avoidable re-computation.
Where embedding cost comes from
| Source | Cost pattern |
|---|---|
| Corpus embedding | One-time (per token) plus on updates |
| Query embedding | Per query, ongoing |
| Re-embedding | On document changes or model swaps |
Embedding a large corpus is a per-token cost proportional to its size, paid once, but re-embedding it (on a model change, or unnecessarily on every index) repeats that cost. Query embedding is small per query but continuous. So the big avoidable costs are re-embedding unchanged documents and re-embedding repeated queries.
Cache and right-size
Cache document embeddings so unchanged documents are never re-embedded, only embed what actually changed on updates, and cache query embeddings for repeated queries. Choose a right-sized embedding model: smaller, cheaper models with lower dimensionality often serve retrieval well, and they also reduce vector database storage. Batch embedding requests where the API offers a batch discount for large indexing jobs.
Controlling embedding cost
Cache embeddings and re-embed only changed documents (the biggest saving, since documents change rarely), choose a right-sized embedding model rather than the largest (smaller dimensions serve retrieval well and cut downstream storage), batch large indexing jobs for any discount, and cache query embeddings for repeated queries. Because embedding is per token, avoiding re-embedding what has not changed is the whole game, part of the broader RAG cost picture.
FAQ
What drives embedding cost?
Embeddings are generated per token by an embedding model, so cost scales with how much text you embed: your document corpus (once, plus on updates) and every query. Corpus embedding is a per-token cost proportional to its size, and query embedding is small but continuous. Much of the cost is avoidable re-computation of unchanged content.
How do I reduce embedding cost?
Cache embeddings so you do not re-embed unchanged documents or repeated queries, choose a right-sized embedding model (smaller dimensions and cheaper models often serve retrieval well), batch embedding requests for any batch discount, and only re-embed what actually changed. Since documents change rarely, most embedding cost is avoidable re-computation.
Should I cache embeddings?
Yes, it is the biggest saving. Documents change rarely, so caching document embeddings means you never re-embed unchanged content, embedding only what actually changed on updates. Caching query embeddings for repeated queries avoids re-embedding the same query text. Because embedding is per token, not re-embedding unchanged content is the primary cost lever.
Does the embedding model size affect cost?
Yes. Larger embedding models cost more per token and often produce higher-dimension vectors, which also increase vector database storage and search cost. Smaller, cheaper embedding models with lower dimensionality often serve retrieval quality well, so right-sizing the embedding model to your quality bar cuts both embedding and downstream storage cost.
Should I batch embedding requests?
For large indexing jobs, yes, if the API offers a batch discount. Embedding a whole corpus is a bulk operation that can often use a discounted batch endpoint, reducing the per-token cost of the one-time indexing. Query embedding is real-time and per-query, so batching applies mainly to the corpus indexing and re-indexing jobs.
Does C3X estimate embedding cost?
Embedding cost is token-driven usage rather than infrastructure, so C3X prices the surrounding infrastructure (the vector database, RAG compute) and you model your corpus size, update rate, and query volume to estimate the embedding-model charges alongside the infrastructure cost.
What to do next
Price the infrastructure behind your embeddings before you build. C3X reads your Terraform and prices your resources against a live catalog. Start with the quickstart.
Share this post
Try C3X on your own Terraform
Free and open source. No API key required. One command to install, one command to estimate.