⚡ नया — Kimi K3 अब लाइव: अपनी Moonshot key जोड़ें →
दस्तावेज़

Generate embeddings for search & RAG

← कुकबुक

One /v1/embeddings endpoint — first-party bge-m3 at ₹1/Mtok stays in India, or bring your own key for OpenAI, Gemini and Cohere embeddings.

/v1/embeddingsएक्सेसशुरुआती6 min

Retrieval, clustering and semantic search all start with embeddings. BharatRouter serves them through the same OpenAI /v1/embeddings shape — so any client that already calls OpenAI embeddings just points at the gateway and picks a model.

You'll use: the /v1/embeddings endpoint. First-party bge-m3 is multilingual (strong on Indic text) and India-resident.

Embed some text

from openai import OpenAI

client = OpenAI(base_url="https://api.bharatrouter.com/v1", api_key="br-...")

r = client.embeddings.create(
    model="bge-m3",                         # first-party, ₹1/Mtok, India-resident
    input=["order not delivered", "where is my package"],
)
vecs = [d.embedding for d in r.data]
print(len(vecs), "vectors of dim", len(vecs[0]))

Picking a model

ModelProviderResidencyNotes
bge-m3BharatRouter (first-party)🇮🇳 IndiaMultilingual, ₹1/Mtok — the default
text-embedding-3-small / -largeOpenAIGlobalBYOK
gemini-embedding-2GoogleGlobalBYOK
embed-v4.0CohereGlobalBYOK

How it works

  • Same routing engine as chat: optimize, data_policy and per-request upstream_key all apply, and a BYOK route falls back to the platform model only for engines BR serves on its own infra.
  • Keep data_policy: "india_only" on and only bge-m3 stays eligible — so a residency-pinned RAG pipeline never sends document text offshore.
  • Pin one embedding model for the life of an index: vectors from different models aren't comparable, so re-embed everything if you switch.

Pair this with a fallback chain and residency pinning for a fully India-resident RAG stack — see Guarantee no prompt leaves India.

और रेसिपी कुकबुक में, या पूराAPI reference देखें।