Docs / Language and text
Embeddings and reranking API
Vectors for semantic search in Indian languages and English, and a reranker to order results.
For retrieval (RAG) and search without an API key: turn text into 384 numbers with multilingual-e5-small, so texts that mean the same land close together across about a hundred languages, Hindi, Tamil and the other Indian languages among them; then let bge-reranker-v2-m3 read the query with each candidate and order them. Nothing you send is kept or logged.
https://api.dharun.devNo key needed for most600 units a minute, 3000 with a free keyThis page as MarkdownText embeddings
GET/v1/embedPOST
Up to 64 texts a request (GET: one or more text parameters; POST: JSON {"texts": [...], "type": ...}). Each comes back as 384 numbers scaled to length 1, so a dot product is the cosine similarity. Embed questions with type=query and the documents searched with type=passage, as the model was trained. Each text is read up to 512 tokens.
Also takes POST: JSON: {"texts": ["..."], "type": "query" or "passage"}, or {"text": "..."}. Send it as text/plain, or as JSON {"text": "..."} with the other options beside it, up to 256 KB.
Model endpoint: it will need a free API key, sent as Authorization: Bearer <key> or X-API-Key. Until the date on API keys it answers without one and says so in the X-Key-Notice header. With a key: 500 model requests a day.
What you send here is never written to the log, and the answer is not cached.
| Parameter | Description |
|---|---|
textquery | A text; repeat for several (or POST them). |
typequery | query (default) for questions, passage for the documents searched. One of: query, passage. |
curl
curl "https://api.dharun.dev/v1/embed?type=query&text=How+do+I+renew+my+passport%3F&utm_medium=docs"JavaScript
const response = await fetch("https://api.dharun.dev/v1/embed?type=query&text=How+do+I+renew+my+passport%3F&utm_medium=docs");
const body = await response.json();
if (!response.ok) throw new Error(body.error.message);
console.log(body.data);Python
import requests
response = requests.get("https://api.dharun.dev/v1/embed?type=query&text=How+do+I+renew+my+passport%3F&utm_medium=docs", timeout=10)
body = response.json()
if not response.ok:
raise RuntimeError(body["error"]["message"])
print(body["data"])Try it here
Change the values and send the request from your browser. Needs JavaScript.
Response, with lists and long text shortened
{
"data": {
"model": "multilingual-e5-small",
"type": "query",
"dimensions": 384,
"embeddings": [
[
0.056168,
-0.053384,
-0.02612
]
],
"tokens": [
14
],
"truncated": []
},
"meta": {
"source": {
"name": "multilingual-e5-small (int8)",
"url": "https://huggingface.co/intfloat/multilingual-e5-small",
"licence": "MIT",
"version": "multilingual-e5-small@614241f",
"retrieved": "2026-10-15T12:28:44Z",
"attribution": "Embeddings by multilingual-e5-small (Wang et al., Multilingual E5 Text Embeddings, 2024), MIT."
},
"note": "Each embedding is normalised to length 1, so the dot product of two is their cosine similarity. Embed questions with type=query and the documents searched with …"
}
}Rerank documents for a query
GET/v1/rerankPOST
Scores how well each document answers the query, from 0 to 1, and returns them best first with their place in the request. Up to 100 documents of up to 8,000 characters; each pair is read up to 512 tokens. GET takes query and repeated document parameters; POST takes JSON.
Also takes POST: JSON: {"query": "...", "documents": ["...", "..."], "top": 3}. Send it as text/plain, or as JSON {"text": "..."} with the other options beside it, up to 256 KB.
Model endpoint: it will need a free API key, sent as Authorization: Bearer <key> or X-API-Key. Until the date on API keys it answers without one and says so in the X-Key-Notice header. With a key: 500 model requests a day.
What you send here is never written to the log, and the answer is not cached.
| Parameter | Description |
|---|---|
queryquery, required | The question, up to 2,000 characters. |
documentquery | A candidate; repeat for each (or POST them). |
topquery | Return only the best few. Default all. |
curl
curl "https://api.dharun.dev/v1/rerank?query=capital+of+Tamil+Nadu&document=Chennai+is+the+capital+of+Tamil+Nadu.&document=Mumbai+is+the+financial+capital+of+India.&utm_medium=docs"JavaScript
const response = await fetch("https://api.dharun.dev/v1/rerank?query=capital+of+Tamil+Nadu&document=Chennai+is+the+capital+of+Tamil+Nadu.&document=Mumbai+is+the+financial+capital+of+India.&utm_medium=docs");
const body = await response.json();
if (!response.ok) throw new Error(body.error.message);
console.log(body.data);Python
import requests
response = requests.get("https://api.dharun.dev/v1/rerank?query=capital+of+Tamil+Nadu&document=Chennai+is+the+capital+of+Tamil+Nadu.&document=Mumbai+is+the+financial+capital+of+India.&utm_medium=docs", timeout=10)
body = response.json()
if not response.ok:
raise RuntimeError(body["error"]["message"])
print(body["data"])Try it here
Change the values and send the request from your browser. Needs JavaScript.
Response
{
"data": {
"model": "bge-reranker-v2-m3",
"query": "capital of Tamil Nadu",
"results": [
{
"index": 0,
"score": 0.999823,
"document": "Chennai is the capital of Tamil Nadu."
},
{
"index": 1,
"score": 0.003805,
"document": "Mumbai is the financial capital of India."
}
],
"truncated": []
},
"meta": {
"total": 2,
"source": {
"name": "bge-reranker-v2-m3 (uint8)",
"url": "https://huggingface.co/BAAI/bge-reranker-v2-m3",
"licence": "Apache-2.0",
"version": "bge-reranker-v2-m3-uint8@6f5ff65",
"retrieved": "2026-10-15T14:01:13Z",
"attribution": "Reranking by bge-reranker-v2-m3 (BAAI), Apache-2.0."
},
"note": "Scores run from 0 to 1, most relevant first; index is the document's place in the request. Compare scores within one request rather than against a fixed line."
}
}Data source
multilingual-e5-small (int8), multilingual-e5-small@614241f. Retrieved 2026-10-15T12:28:44Z. Licence: MIT. Embeddings by multilingual-e5-small (Wang et al., Multilingual E5 Text Embeddings, 2024), MIT.
bge-reranker-v2-m3 (uint8), bge-reranker-v2-m3-uint8@6f5ff65. Retrieved 2026-10-15T14:01:13Z. Licence: Apache-2.0. Reranking by bge-reranker-v2-m3 (BAAI), Apache-2.0.
Using an AI assistant? Connect the MCP server and it can call this API by itself. Want every endpoint on one bench? Open the playground.