Cheap embeddings API for RAG: open models, priced per token

Embeddings are the part of a RAG pipeline you call most and think about least. Here's how to pick an open embedding model, how a cheap embeddings API for RAG prices them, and how to call it with the OpenAI SDK you already use.

Listen to this post · 7 min

Accessibility: the whole post is read aloud — Space plays or pauses, ← → skip 10 seconds, and you can change the speed. It keeps playing with your screen locked.

Share this post

In short

  • Open embedding models such as nomic-embed, bge-m3, Qwen3 Embedding and EmbeddingGemma are good enough for most RAG today.
  • Embeddings are billed on input tokens only, at the host's listed price per million tokens.
  • The endpoint is OpenAI's /v1/embeddings, so LangChain, LlamaIndex and vector databases work with a changed base URL.
  • Some embedding models are free within limits, with no card, which is enough to prototype a pipeline.
  • Whichever model you pick, embed your documents and your queries with the same one, or search quality collapses.

Every document you index and every question your users ask passes through an embedding model. In a busy RAG app that's thousands of calls a day, so the price and speed of embeddings matter more than people expect. Here's how to choose an open model and use a cheap embeddings API for RAG without changing your code.

Choosing an open embedding model

ModelGood forNotes
nomic-embed-textFast English retrievalA popular default; small and quick
bge-m3Multilingual, long passagesStrong all-rounder across languages
Qwen3 Embedding 0.6BModern small embedderGood quality for its size
EmbeddingGemma 2Laptops and small serversMultimodal family; our EmbeddingGemma 2 first look covers the sizes
mxbai-embed-large, bge-largeHigher quality EnglishLarger and slower

The honest advice: take two candidates, embed a few hundred of your own documents, write twenty real questions, and see which one puts the right passage in the top three more often. Benchmarks rarely match your data.

How embeddings are priced

Embeddings are billed on input tokens only, at the host's listed price per million tokens. There's no output to pay for, no per-request fee, and failed requests cost £0. Hosts compete on price per model, so the marketplace filtered to embeddings shows who serves what and for how much, alongside measured latency.

A rough way to estimate cost: a token is about four characters of English. A 500-page manual of 250,000 words is around 330,000 tokens, so indexing it is a third of a million tokens. Queries are tiny by comparison.

Calling it with the OpenAI SDK

from openai import OpenAI
client = OpenAI(base_url="https://inpherio.co.uk/v1", api_key="YOUR_KEY")
r = client.embeddings.create(model="bge-m3:latest",
        input=["How do I reset my password?", "Billing runs on the 1st."])
vectors = [d.embedding for d in r.data]

Because it's OpenAI's /v1/embeddings shape, it plugs straight into LangChain's OpenAIEmbeddings, LlamaIndex, and the embedding settings of vector databases like Qdrant, Weaviate and pgvector tools: set the base URL, the key and the model name. Send lists of strings to batch your requests. The developer guide has more examples.

Free embeddings for prototyping

Some embedding models are free within limits, such as Qwen3 Embedding 0.6B and EmbeddingGemma 2 270M at the time of writing: up to 50 calls an hour per model and 100 free calls a day, from any account with a verified email and no card. That's enough to build and test a small pipeline. The free models page shows the current list.

A minimal RAG loop

Here's the whole retrieval side of a RAG app in a few lines, using plain Python and the OpenAI SDK:

import numpy as np
def embed(texts):
    r = client.embeddings.create(model="bge-m3:latest", input=texts)
    return np.array([d.embedding for d in r.data])

chunks = split_into_chunks(documents, size=400, overlap=60)
doc_vecs = embed(chunks)
doc_vecs /= np.linalg.norm(doc_vecs, axis=1, keepdims=True)

def search(question, k=4):
    q = embed([question])[0]; q /= np.linalg.norm(q)
    best = np.argsort(doc_vecs @ q)[::-1][:k]
    return [chunks[i] for i in best]

Pass the top passages to a chat model with the question, and you have a working RAG prototype. Swap the numpy array for a vector database when you outgrow memory.

Speed and batching

Embedding latency matters most at query time, when a user is waiting. Small models such as nomic-embed-text and EmbeddingGemma 2 return in tens of milliseconds on a GPU, and the marketplace shows each host's measured latency. Indexing is the opposite: it's throughput that counts, so send batches of passages in one request and run a few requests in parallel. Embedding a whole knowledge base overnight on paid credit is usually cheap, because you only pay for input tokens and there's no output.

Multilingual and long documents

If your users write in more than one language, pick a multilingual model from the start. bge-m3 handles many languages in one vector space, so a question in French can find an answer written in English. For long documents, embed chunks rather than whole files: even models with long context windows retrieve better from focused passages, and smaller chunks make the answers you show users more precise.

Choosing dimensions and storage

Embedding vectors from these models are typically 384 to 1,024 numbers long. Longer vectors can capture more nuance but take more storage and make searches slower. For most apps the difference in retrieval quality matters far more than the storage cost, so choose the model on quality first. If storage becomes a problem at millions of passages, store vectors as 16-bit floats or use your vector database's built-in compression; both usually cost very little accuracy.

Re-ranking for better answers

Embedding search finds passages that are close in meaning, but the order isn't always right. A cheap improvement is to fetch more candidates than you need, say the top 20, then ask a small chat model to pick the four most relevant to the question. That second step costs a few hundred tokens per question and often fixes the "right document, wrong passage" problem that makes RAG answers vague.

Five RAG embedding mistakes

  1. Mixing models. Documents and queries must use the same model. Vectors from different models aren't comparable.
  2. Not storing the model name. Save it with every vector, so a later model change means a planned re-index, not silent garbage.
  3. Chunks that are too big. 200 to 500 tokens per chunk with some overlap retrieves better than whole pages.
  4. Skipping the prefix. Some models expect task prefixes such as search_query: and search_document: (nomic-embed does). Read the model card.
  5. Embedding on every request. Cache query embeddings for repeated questions; never re-embed unchanged documents.

Running it on your own hardware

Embedding models are small. Most run comfortably on a CPU or a modest GPU, so they're one of the easiest things to self-host. If you already run Ollama, vLLM, Infinity or TEI at home, self-serve gives you an API key for your own machine at £0, and you can list your embedding models on the marketplace to earn when you aren't using them. If you want your embedding box to pay its way, hosting your own models explains how.

Questions people ask

What's the cheapest embeddings API?

For open models, prices are set per model by competing hosts. The marketplace lists every embedding model with its live price per million tokens; small models are usually the cheapest.

Which open embedding model is best for RAG?

bge-m3 is a strong multilingual all-rounder, nomic-embed-text a fast English default, and Qwen3 Embedding and EmbeddingGemma small modern options. Test two on your own documents.

Can I switch embedding models later?

Only by re-embedding everything. Vectors from different models live in different spaces, so pick carefully and store the model name with each vector.

Are there free embeddings?

Yes. Some embedding models are free within limits (50 calls an hour per model, 100 free calls a day) from any account with a verified email.

Models in this post — live on Inpherio

Have a GPU, a Mac or a spare PC?

Let it earn while you sleep.

Run open models for people who need them. You set the price and keep everything but the 15% fee.

Become a host

Building with AI?

Every open model, one API.

OpenAI-compatible. Priced by the people who run the hardware.

Start free See the marketplace

Read “Cheap embeddings API for RAG: open models, priced per token” at https://inpherio.co.uk/blog/cheap-embeddings-api-for-rag