What is TEI Embeddings?
Embeddings are the quiet recurring cost of RAG: every document chunk and every query goes through the API meter, forever. Small open models ended that trade - bge-small at 384 dimensions handles real retrieval workloads, and Hugging Face’s TEI serves it from CPU in about half a gigabyte of RAM, no GPU anywhere.
TEI is a Rust server with an OpenAI-compatible /v1/embeddings endpoint, so existing clients just change the base URL. It is internal-only by design (no built-in auth): apps in your project call http://tei:5000 over the private network.
This completes the catalogue’s self-contained RAG loop: embed with tei, store in qdrant or chromadb, generate via the litellm gateway, trace in langfuse or phoenix - with the embedding leg now off the per-token meter.
What you get
- OpenAI-compatible /v1/embeddings plus native /embed and /rerank
- bge-small default: 384-dim, tens of ms per text on CPU
- Rust + candle: ~512 MB RSS, no Python, no GPU
- Model cached on a volume - fast restarts
- Swap MODEL_ID for other embedders or rerankers
- Apache-2.0, internal-only posture by default
How it runs on Lyngbak
| Service | Role | Public |
|---|---|---|
tei | embeddings API (:5000) | no (by design - no built-in auth) |
Sizing and billing
bge-small fits comfortably in 1 GiB; larger embedders (bge-base/large) want the next plans. One model per instance - run a second instance for a reranker.
A resource is a flat monthly price, with RAM and disk add-ons when the stack needs a little more than a tier, and room for your own apps on a larger one. On Usage Billing each service takes the smallest size that fits it and is billed by the second it runs, so a stopped stack stops costing CPU and RAM. Its 1.95 GiB of volumes cost $0.15 per GiB a month ($0.29/mo) for as long as they exist. One workspace can use both. See pricing
Run it locally first
The same compose file runs with plain Docker Compose. Clone the template source, copy .env.example to .env, and run docker compose up -d.
Questions
How good is bge-small compared to API embeddings?
For typical RAG retrieval it is competitive with commercial small embeddings - strong MTEB scores at 384 dimensions, which also halves your vector storage versus 768+ dim models. Test with your corpus; swapping MODEL_ID is one variable.
What does this actually save?
API embeddings meter every chunk at index time and every query forever, and re-indexing a corpus repeats the whole bill. Self-hosted, the marginal cost of embedding is zero - re-index freely, embed logs, embed everything.
Why is it internal-only?
TEI ships no authentication, so it must not face the internet. In-project apps reach tei:5000 over the private network - the same posture as the qdrant and chromadb templates it pairs with.
Can it rerank too?
Yes - TEI serves reranker models on /rerank. Run a second instance with a reranker MODEL_ID (e.g. bge-reranker variants) and call it after retrieval for a meaningful quality lift.