A minimal FastAPI service that embeds text with BAAI/bge-small-en-v1.5
using fastembed (ONNX Runtime),
- Push this folder to its own GitHub repo (or a subfolder Render can target with a custom root directory).
- On Render, New → Blueprint, point it at the
repo —
render.yamlhere defines everything. Or New → Web Service manually with:- Runtime: Python 3
- Build command:
pip install -r requirements.txt - Start command:
uvicorn main:app --host 0.0.0.0 --port $PORT - Plan: Free
- Render auto-generates
EMBEDDING_API_KEY(seerender.yaml) — copy it from the service's Environment tab. ( Not enablesd now ) - In your RAG backend, set:
EMBEDDING_URLS=https://your-service1.onrender.com,https://your-service2.onrender.com,https://your-service3.onrender.com EMBEDDING_API_KEY=<the generated key> USE_LOCAL_FALLBACK=false
POST /embed
{ "texts": ["some text", "more text"] }
→ { "embeddings": [[...], [...]], "model": "bge-small-en-v1.5" }
GET /health
→ { "status": "ok", "model": "bge-small-en-v1.5" }
Auth: send X-API-Key: <EMBEDDING_API_KEY> on every request. If
EMBEDDING_API_KEY is unset, auth is skipped (fine for local dev, not
for a public Render URL).