OpenAlchemyOpenAlchemy
← All modalities

Reorder · Relevance scoring

Reranker

Beta

Reorder search results by relevance and lift top-K precision.

Overview

Reranker

Given a query and candidate documents, return ranked relevance scores. Useful at the tail of a RAG pipeline, for refining search results, FAQ matching, and product search.

Endpoint
/v1/rerank
Example model
bge-reranker-v2-m3

API

API example

# 1) discover an online reranker — Grid's set changes constantly,
#    don't hardcode an id in your code.
MODEL=$(curl -s https://api.openalchemy.io/v1/models \
  -H "Authorization: Bearer $OPENALCHEMY_API_KEY" \
  | jq -r '.data[] | select(.online and .endpoint_type=="rerank") | .id' \
  | head -1)

# 2) rerank — results come back as {index, relevance_score},
#    index points into your documents array
curl https://api.openalchemy.io/v1/rerank \
  -H "Authorization: Bearer $OPENALCHEMY_API_KEY" \
  -H "X-Project-Id: $YOUR_PROJECT_ID" \
  -H "Content-Type: application/json" \
  -d "{
    \"model\": \"$MODEL\",
    \"query\": \"Where is the best ramen in Tokyo?\",
    \"documents\": [
      \"Ichiran has 24-hour shops in Shibuya.\",
      \"Tsuta in Sugamo holds a Michelin star.\",
      \"The Tsukiji market is famous for sushi.\",
      \"Afuri serves yuzu shio ramen in Ebisu.\"
    ],
    \"top_n\": 4
  }"

Status

Quota and pricing (per project)

Allotments and rate limits apply to the project that issued the API key. A second domain-scoped policy layer constrains which origins may invoke each modality.

Read the docs for this modality →

START TODAY

Ready to turn inference cost into something closer to alchemy?

Sign up and get 2,000 free credits ($2) — no credit card required.