Rerank documents
curl --request POST \
--url https://api.aisa.one/v1/rerank \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "jina-reranker-v3",
"query": "What is the capital of France?",
"documents": [
"Paris is the capital of France.",
"Berlin is the capital of Germany.",
"The Eiffel Tower is in Paris."
],
"top_n": 2
}
'import requests
url = "https://api.aisa.one/v1/rerank"
payload = {
"model": "jina-reranker-v3",
"query": "What is the capital of France?",
"documents": ["Paris is the capital of France.", "Berlin is the capital of Germany.", "The Eiffel Tower is in Paris."],
"top_n": 2
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'jina-reranker-v3',
query: 'What is the capital of France?',
documents: [
'Paris is the capital of France.',
'Berlin is the capital of Germany.',
'The Eiffel Tower is in Paris.'
],
top_n: 2
})
};
fetch('https://api.aisa.one/v1/rerank', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/v1/rerank",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'jina-reranker-v3',
'query' => 'What is the capital of France?',
'documents' => [
'Paris is the capital of France.',
'Berlin is the capital of Germany.',
'The Eiffel Tower is in Paris.'
],
'top_n' => 2
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/v1/rerank"
payload := strings.NewReader("{\n \"model\": \"jina-reranker-v3\",\n \"query\": \"What is the capital of France?\",\n \"documents\": [\n \"Paris is the capital of France.\",\n \"Berlin is the capital of Germany.\",\n \"The Eiffel Tower is in Paris.\"\n ],\n \"top_n\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/v1/rerank")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"jina-reranker-v3\",\n \"query\": \"What is the capital of France?\",\n \"documents\": [\n \"Paris is the capital of France.\",\n \"Berlin is the capital of Germany.\",\n \"The Eiffel Tower is in Paris.\"\n ],\n \"top_n\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/v1/rerank")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"jina-reranker-v3\",\n \"query\": \"What is the capital of France?\",\n \"documents\": [\n \"Paris is the capital of France.\",\n \"Berlin is the capital of Germany.\",\n \"The Eiffel Tower is in Paris.\"\n ],\n \"top_n\": 2\n}"
response = http.request(request)
puts response.read_body{
"model": "jina-reranker-v3",
"results": [
{
"index": 0,
"relevance_score": 0.98,
"document": {
"text": "Paris is the capital of France."
}
},
{
"index": 2,
"relevance_score": 0.71,
"document": {
"text": "The Eiffel Tower is in Paris."
}
}
],
"usage": {
"total_tokens": 27
}
}Embeddings & Rerank
Rerank Documents
Reorder documents by relevance to a query using Jina rerank, served via the OpenAI-compatible AIsa relay.
POST
https://api.aisa.one/v1
/
rerank
Rerank documents
curl --request POST \
--url https://api.aisa.one/v1/rerank \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "jina-reranker-v3",
"query": "What is the capital of France?",
"documents": [
"Paris is the capital of France.",
"Berlin is the capital of Germany.",
"The Eiffel Tower is in Paris."
],
"top_n": 2
}
'import requests
url = "https://api.aisa.one/v1/rerank"
payload = {
"model": "jina-reranker-v3",
"query": "What is the capital of France?",
"documents": ["Paris is the capital of France.", "Berlin is the capital of Germany.", "The Eiffel Tower is in Paris."],
"top_n": 2
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'jina-reranker-v3',
query: 'What is the capital of France?',
documents: [
'Paris is the capital of France.',
'Berlin is the capital of Germany.',
'The Eiffel Tower is in Paris.'
],
top_n: 2
})
};
fetch('https://api.aisa.one/v1/rerank', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/v1/rerank",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'jina-reranker-v3',
'query' => 'What is the capital of France?',
'documents' => [
'Paris is the capital of France.',
'Berlin is the capital of Germany.',
'The Eiffel Tower is in Paris.'
],
'top_n' => 2
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/v1/rerank"
payload := strings.NewReader("{\n \"model\": \"jina-reranker-v3\",\n \"query\": \"What is the capital of France?\",\n \"documents\": [\n \"Paris is the capital of France.\",\n \"Berlin is the capital of Germany.\",\n \"The Eiffel Tower is in Paris.\"\n ],\n \"top_n\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/v1/rerank")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"jina-reranker-v3\",\n \"query\": \"What is the capital of France?\",\n \"documents\": [\n \"Paris is the capital of France.\",\n \"Berlin is the capital of Germany.\",\n \"The Eiffel Tower is in Paris.\"\n ],\n \"top_n\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/v1/rerank")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"jina-reranker-v3\",\n \"query\": \"What is the capital of France?\",\n \"documents\": [\n \"Paris is the capital of France.\",\n \"Berlin is the capital of Germany.\",\n \"The Eiffel Tower is in Paris.\"\n ],\n \"top_n\": 2\n}"
response = http.request(request)
puts response.read_body{
"model": "jina-reranker-v3",
"results": [
{
"index": 0,
"relevance_score": 0.98,
"document": {
"text": "Paris is the capital of France."
}
},
{
"index": 2,
"relevance_score": 0.71,
"document": {
"text": "The Eiffel Tower is in Paris."
}
}
],
"usage": {
"total_tokens": 27
}
}Rerank a list of documents against a
query using jina-reranker-v3. Provide a non-empty query and a non-empty documents array; results come back ordered by relevance_score. Use the optional top_n to return only the most relevant documents. This pairs naturally with embeddings-based retrieval: embed and shortlist candidates, then rerank for final ordering.
Served via the AIsa relay path /v1/rerank — OpenAI-compatible. Billing is token-based at $0.050 per 1M tokens; the usage.total_tokens field reports the tokens billed for each request.
curl https://api.aisa.one/v1/rerank \
-H "Authorization: Bearer $AISA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "jina-reranker-v3",
"query": "What is the capital of France?",
"documents": [
"Paris is the capital of France.",
"Berlin is the capital of Germany.",
"The Eiffel Tower is in Paris."
],
"top_n": 2
}'
import requests
resp = requests.post(
"https://api.aisa.one/v1/rerank",
headers={"Authorization": "Bearer sk-aisa-..."},
json={
"model": "jina-reranker-v3",
"query": "What is the capital of France?",
"documents": [
"Paris is the capital of France.",
"Berlin is the capital of Germany.",
"The Eiffel Tower is in Paris.",
],
"top_n": 2,
},
)
print(resp.json()["results"])
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Rerank model name.
Example:
"jina-reranker-v3"
Non-empty query string to rank documents against.
Example:
"What is the capital of France?"
Non-empty array of document strings to rerank.
Minimum array length:
1Example:
[
"Paris is the capital of France.",
"Berlin is the capital of Germany.",
"The Eiffel Tower is in Paris."
]
Optional. Return only the top N most relevant documents.
Example:
2
⌘I