Origin Docs

Rerank documents

POST
/v1/rerank
AuthorizationBearer <token>

API key as a bearer token: Authorization: Bearer sk-ollm-<public_id>-<secret>. Required on the dev gateway; the prod gateway is open and ignores this header.

In: header

modelstring

Model name as registered in the gateway config (e.g. vercel_rerank_2_5).

querystring
documents

Documents to rank. Each item is a plain string or an object with a text field.

top_n?integer

Maximum results to return.

Formatint32
Range1 <= value
return_documents?boolean

Include document text in results.

ollm::tags?

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://api.gateway.orgn.com/v1/rerank" \  -H "Content-Type: application/json" \  -d '{    "model": "vercel_rerank_2_5",    "query": "What is the capital of France?",    "documents": [      "Paris is the capital of France.",      "Berlin is in Germany."    ],    "top_n": 1  }'
{
  "id": "string",
  "results": [
    {
      "document": {},
      "index": 0,
      "relevance_score": 1
    }
  ],
  "meta": {}
}
{
  "error": {
    "message": "string",
    "type": "string",
    "code": "string",
    "param": "string"
  }
}
{
  "error": {
    "message": "string",
    "type": "string",
    "code": "string",
    "param": "string"
  }
}
{
  "error": {
    "message": "string",
    "type": "string",
    "code": "string",
    "param": "string"
  }
}
Empty