POST /v1/rerank
curl --request POST \
--url https://api.example.com/v1/rerank \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"documents": [
"<string>"
],
"model": "<string>",
"query": "<string>",
"provider": {
"allow_fallbacks": true,
"enforce_distillable_text": true,
"ignore": [
"<string>"
],
"max_price": {
"audio": "<string>",
"completion": "<string>",
"image": "<string>",
"prompt": "<string>",
"request": "<string>"
},
"only": [
"<string>"
],
"order": [
"<string>"
],
"preferred_max_latency": 123,
"preferred_min_throughput": 123,
"quantizations": [],
"require_parameters": true,
"zdr": true
},
"top_n": 123
}
'import requests
url = "https://api.example.com/v1/rerank"
payload = {
"documents": ["<string>"],
"model": "<string>",
"query": "<string>",
"provider": {
"allow_fallbacks": True,
"enforce_distillable_text": True,
"ignore": ["<string>"],
"max_price": {
"audio": "<string>",
"completion": "<string>",
"image": "<string>",
"prompt": "<string>",
"request": "<string>"
},
"only": ["<string>"],
"order": ["<string>"],
"preferred_max_latency": 123,
"preferred_min_throughput": 123,
"quantizations": [],
"require_parameters": True,
"zdr": True
},
"top_n": 123
}
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({
documents: ['<string>'],
model: '<string>',
query: '<string>',
provider: {
allow_fallbacks: true,
enforce_distillable_text: true,
ignore: ['<string>'],
max_price: {
audio: '<string>',
completion: '<string>',
image: '<string>',
prompt: '<string>',
request: '<string>'
},
only: ['<string>'],
order: ['<string>'],
preferred_max_latency: 123,
preferred_min_throughput: 123,
quantizations: [],
require_parameters: true,
zdr: true
},
top_n: 123
})
};
fetch('https://api.example.com/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.example.com/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([
'documents' => [
'<string>'
],
'model' => '<string>',
'query' => '<string>',
'provider' => [
'allow_fallbacks' => true,
'enforce_distillable_text' => true,
'ignore' => [
'<string>'
],
'max_price' => [
'audio' => '<string>',
'completion' => '<string>',
'image' => '<string>',
'prompt' => '<string>',
'request' => '<string>'
],
'only' => [
'<string>'
],
'order' => [
'<string>'
],
'preferred_max_latency' => 123,
'preferred_min_throughput' => 123,
'quantizations' => [
],
'require_parameters' => true,
'zdr' => true
],
'top_n' => 123
]),
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.example.com/v1/rerank"
payload := strings.NewReader("{\n \"documents\": [\n \"<string>\"\n ],\n \"model\": \"<string>\",\n \"query\": \"<string>\",\n \"provider\": {\n \"allow_fallbacks\": true,\n \"enforce_distillable_text\": true,\n \"ignore\": [\n \"<string>\"\n ],\n \"max_price\": {\n \"audio\": \"<string>\",\n \"completion\": \"<string>\",\n \"image\": \"<string>\",\n \"prompt\": \"<string>\",\n \"request\": \"<string>\"\n },\n \"only\": [\n \"<string>\"\n ],\n \"order\": [\n \"<string>\"\n ],\n \"preferred_max_latency\": 123,\n \"preferred_min_throughput\": 123,\n \"quantizations\": [],\n \"require_parameters\": true,\n \"zdr\": true\n },\n \"top_n\": 123\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.example.com/v1/rerank")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"documents\": [\n \"<string>\"\n ],\n \"model\": \"<string>\",\n \"query\": \"<string>\",\n \"provider\": {\n \"allow_fallbacks\": true,\n \"enforce_distillable_text\": true,\n \"ignore\": [\n \"<string>\"\n ],\n \"max_price\": {\n \"audio\": \"<string>\",\n \"completion\": \"<string>\",\n \"image\": \"<string>\",\n \"prompt\": \"<string>\",\n \"request\": \"<string>\"\n },\n \"only\": [\n \"<string>\"\n ],\n \"order\": [\n \"<string>\"\n ],\n \"preferred_max_latency\": 123,\n \"preferred_min_throughput\": 123,\n \"quantizations\": [],\n \"require_parameters\": true,\n \"zdr\": true\n },\n \"top_n\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/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 \"documents\": [\n \"<string>\"\n ],\n \"model\": \"<string>\",\n \"query\": \"<string>\",\n \"provider\": {\n \"allow_fallbacks\": true,\n \"enforce_distillable_text\": true,\n \"ignore\": [\n \"<string>\"\n ],\n \"max_price\": {\n \"audio\": \"<string>\",\n \"completion\": \"<string>\",\n \"image\": \"<string>\",\n \"prompt\": \"<string>\",\n \"request\": \"<string>\"\n },\n \"only\": [\n \"<string>\"\n ],\n \"order\": [\n \"<string>\"\n ],\n \"preferred_max_latency\": 123,\n \"preferred_min_throughput\": 123,\n \"quantizations\": [],\n \"require_parameters\": true,\n \"zdr\": true\n },\n \"top_n\": 123\n}"
response = http.request(request)
puts response.read_body{
"model": "<string>",
"results": [
{
"document": {
"image": "<string>",
"text": "<string>"
},
"index": 123,
"relevance_score": 123
}
],
"id": "<string>",
"provider": "<string>",
"usage": {
"cost": 123,
"search_units": 123,
"total_tokens": 123
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Forwarding
POST /v1/rerank
Available at the instance root or under a provider/namespace prefix. Shared paths select the wire dialect from client headers; without dialect evidence, the first listed route wins.
POST
/
v1
/
rerank
POST /v1/rerank
curl --request POST \
--url https://api.example.com/v1/rerank \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"documents": [
"<string>"
],
"model": "<string>",
"query": "<string>",
"provider": {
"allow_fallbacks": true,
"enforce_distillable_text": true,
"ignore": [
"<string>"
],
"max_price": {
"audio": "<string>",
"completion": "<string>",
"image": "<string>",
"prompt": "<string>",
"request": "<string>"
},
"only": [
"<string>"
],
"order": [
"<string>"
],
"preferred_max_latency": 123,
"preferred_min_throughput": 123,
"quantizations": [],
"require_parameters": true,
"zdr": true
},
"top_n": 123
}
'import requests
url = "https://api.example.com/v1/rerank"
payload = {
"documents": ["<string>"],
"model": "<string>",
"query": "<string>",
"provider": {
"allow_fallbacks": True,
"enforce_distillable_text": True,
"ignore": ["<string>"],
"max_price": {
"audio": "<string>",
"completion": "<string>",
"image": "<string>",
"prompt": "<string>",
"request": "<string>"
},
"only": ["<string>"],
"order": ["<string>"],
"preferred_max_latency": 123,
"preferred_min_throughput": 123,
"quantizations": [],
"require_parameters": True,
"zdr": True
},
"top_n": 123
}
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({
documents: ['<string>'],
model: '<string>',
query: '<string>',
provider: {
allow_fallbacks: true,
enforce_distillable_text: true,
ignore: ['<string>'],
max_price: {
audio: '<string>',
completion: '<string>',
image: '<string>',
prompt: '<string>',
request: '<string>'
},
only: ['<string>'],
order: ['<string>'],
preferred_max_latency: 123,
preferred_min_throughput: 123,
quantizations: [],
require_parameters: true,
zdr: true
},
top_n: 123
})
};
fetch('https://api.example.com/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.example.com/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([
'documents' => [
'<string>'
],
'model' => '<string>',
'query' => '<string>',
'provider' => [
'allow_fallbacks' => true,
'enforce_distillable_text' => true,
'ignore' => [
'<string>'
],
'max_price' => [
'audio' => '<string>',
'completion' => '<string>',
'image' => '<string>',
'prompt' => '<string>',
'request' => '<string>'
],
'only' => [
'<string>'
],
'order' => [
'<string>'
],
'preferred_max_latency' => 123,
'preferred_min_throughput' => 123,
'quantizations' => [
],
'require_parameters' => true,
'zdr' => true
],
'top_n' => 123
]),
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.example.com/v1/rerank"
payload := strings.NewReader("{\n \"documents\": [\n \"<string>\"\n ],\n \"model\": \"<string>\",\n \"query\": \"<string>\",\n \"provider\": {\n \"allow_fallbacks\": true,\n \"enforce_distillable_text\": true,\n \"ignore\": [\n \"<string>\"\n ],\n \"max_price\": {\n \"audio\": \"<string>\",\n \"completion\": \"<string>\",\n \"image\": \"<string>\",\n \"prompt\": \"<string>\",\n \"request\": \"<string>\"\n },\n \"only\": [\n \"<string>\"\n ],\n \"order\": [\n \"<string>\"\n ],\n \"preferred_max_latency\": 123,\n \"preferred_min_throughput\": 123,\n \"quantizations\": [],\n \"require_parameters\": true,\n \"zdr\": true\n },\n \"top_n\": 123\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.example.com/v1/rerank")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"documents\": [\n \"<string>\"\n ],\n \"model\": \"<string>\",\n \"query\": \"<string>\",\n \"provider\": {\n \"allow_fallbacks\": true,\n \"enforce_distillable_text\": true,\n \"ignore\": [\n \"<string>\"\n ],\n \"max_price\": {\n \"audio\": \"<string>\",\n \"completion\": \"<string>\",\n \"image\": \"<string>\",\n \"prompt\": \"<string>\",\n \"request\": \"<string>\"\n },\n \"only\": [\n \"<string>\"\n ],\n \"order\": [\n \"<string>\"\n ],\n \"preferred_max_latency\": 123,\n \"preferred_min_throughput\": 123,\n \"quantizations\": [],\n \"require_parameters\": true,\n \"zdr\": true\n },\n \"top_n\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/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 \"documents\": [\n \"<string>\"\n ],\n \"model\": \"<string>\",\n \"query\": \"<string>\",\n \"provider\": {\n \"allow_fallbacks\": true,\n \"enforce_distillable_text\": true,\n \"ignore\": [\n \"<string>\"\n ],\n \"max_price\": {\n \"audio\": \"<string>\",\n \"completion\": \"<string>\",\n \"image\": \"<string>\",\n \"prompt\": \"<string>\",\n \"request\": \"<string>\"\n },\n \"only\": [\n \"<string>\"\n ],\n \"order\": [\n \"<string>\"\n ],\n \"preferred_max_latency\": 123,\n \"preferred_min_throughput\": 123,\n \"quantizations\": [],\n \"require_parameters\": true,\n \"zdr\": true\n },\n \"top_n\": 123\n}"
response = http.request(request)
puts response.read_body{
"model": "<string>",
"results": [
{
"document": {
"image": "<string>",
"text": "<string>"
},
"index": 123,
"relevance_score": 123
}
],
"id": "<string>",
"provider": "<string>",
"usage": {
"cost": 123,
"search_units": 123,
"total_tokens": 123
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}授权
beareranthropicKeygoogleKeyqueryKey
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
请求体
application/json