Rerank
POST
/v1/rerankReorder candidate documents by relevance to a query.
The selected model Provider determines the result shape and relevance scores. This guide does not assume a fixed score range or batch limit.
Core request fields
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | A rerank model ID. |
query | string | Yes | The query used to score relevance. |
documents | array | Yes | Candidate documents to reorder. |
top_n | integer | No | Requested result count when supported by the model. |
Request examples
curl
curl https://api.noxgate.net/v1/rerank \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{"model":"YOUR_MODEL_ID","query":"What is NoxGate?","documents":["An AI API gateway","A weather report"],"top_n":2}'Python · requests
import requests
response = requests.post(
"https://api.noxgate.net/v1/rerank",
headers={"Authorization": "Bearer sk-your-api-key"},
json={"model": "YOUR_MODEL_ID", "query": "What is NoxGate?", "documents": ["An AI API gateway", "A weather report"]},
)
print(response.json())Node.js · fetch
const response = await fetch("https://api.noxgate.net/v1/rerank", {
method: "POST",
headers: { Authorization: "Bearer sk-your-api-key", "Content-Type": "application/json" },
body: JSON.stringify({ model: "YOUR_MODEL_ID", query: "What is NoxGate?", documents: ["An AI API gateway", "A weather report"] }),
});
console.log(await response.json());Successful response
JSON
{"id":"rerank_example","results":[{"index":0,"relevance_score":0.97},{"index":1,"relevance_score":0.08}],"usage":{"total_tokens":18}}