Reorder documents by relevance to a query.
POST https://opendunes.com/v1/rerankBilled, with an API key: Authorization: Bearer $OPENDUNES_API_KEY. The rerank models on sale are listed by GET /v1/models?output_modalities=rerank. The guide is Rerank.
curl https://opendunes.com/v1/rerank \
-H "Authorization: Bearer $OPENDUNES_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "cohere/rerank-4-fast",
"query": "livraison à Oran",
"documents": [
"Nous livrons à Alger, Oran et Constantine sous 48 heures.",
"Le paiement se fait par carte CIB ou Edahabia.",
"Les retours sont acceptés pendant 7 jours."
],
"top_n": 2
}'| Field | Description |
|---|---|
model · query · documents | Required |
top_n | How many of the best documents to return |
provider | Routing; provider.max_price is in DA |
The answer lists the documents by relevance, each with its index in what you sent and its relevance_score, and usage.cost — the charge in DA. It carries X-Generation-Id. A model that is not a rerank model is a 404, and nothing is charged.