Rerank
Package ai is Hanzo AI — the model API on /v1 (/v1/chat/completions, /v1/messages, /v1/models and the rest of hanzoai/ai's surface) — mounted into a cloud binary with the money, ingest and telemetry…
Package ai is Hanzo AI — the model API on /v1 (/v1/chat/completions, /v1/messages, /v1/models and the rest of hanzoai/ai's surface) — mounted into a cloud binary with the money, ingest and telemetry callbacks cloud BUILDS but cannot INSTALL.
| Base URL | https://api.hanzo.ai |
| Operations | 1 |
| Auth | Authorization: Bearer $HANZO_API_KEY |
rerank
POST /v1/rerank
Implements POST /v1/rerank (Cohere/Jina-compatible).
Body: {"model": "...", "query": "...", "documents": ["...", ...]|[{"text":"..."}],
"top_n"?: int, "return_documents"?: bool}
Response: {"object":"list","model":...,"results":[{"index","relevance_score","document"?}],"usage":{...}}
Backend selection is provider-driven (one endpoint, one contract):
- If the model routes to a native rerank provider (Jina/Cohere/Voyage) the request is proxied to that provider's /rerank endpoint.
- Otherwise scores are computed as a real bi-encoder ranking: embed the query and documents through the resolved embedding model and rank by cosine similarity. No rerank-specific key required.
How is this guide?