curl -X POST "https://t.ato2.nodesms.com/v1/rerank" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "rerank-english-v2.0",
"query": "What is the capital of the United States?",
"documents": [
"Carson City is the capital city of the American state of Nevada.",
"The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.",
"Washington, D.C. is the capital of the United States.",
"Capital punishment has existed in the United States since before it was a country."
],
"top_n": 3
}'
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxxxx",
base_url="https://t.ato2.nodesms.com/v1"
)
response = client.post(
"/rerank",
json={
"model": "rerank-english-v2.0",
"query": "What is the capital of the United States?",
"documents": [
"Carson City is the capital city of the American state of Nevada.",
"Washington, D.C. is the capital of the United States."
],
"top_n": 2
}
)
print(response.json())
{
"id": "string",
"results": [
{
"index": 2,
"relevance_score": 0.9871293,
"document": {}
},
{
"index": 1,
"relevance_score": 0.3456789,
"document": {}
}
],
"meta": {}
}
Rerank
Rerank a list of documents by relevance to a query, returning results sorted by relevance.
POST
/
v1
/
rerank
curl -X POST "https://t.ato2.nodesms.com/v1/rerank" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "rerank-english-v2.0",
"query": "What is the capital of the United States?",
"documents": [
"Carson City is the capital city of the American state of Nevada.",
"The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.",
"Washington, D.C. is the capital of the United States.",
"Capital punishment has existed in the United States since before it was a country."
],
"top_n": 3
}'
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxxxx",
base_url="https://t.ato2.nodesms.com/v1"
)
response = client.post(
"/rerank",
json={
"model": "rerank-english-v2.0",
"query": "What is the capital of the United States?",
"documents": [
"Carson City is the capital city of the American state of Nevada.",
"Washington, D.C. is the capital of the United States."
],
"top_n": 2
}
)
print(response.json())
{
"id": "string",
"results": [
{
"index": 2,
"relevance_score": 0.9871293,
"document": {}
},
{
"index": 1,
"relevance_score": 0.3456789,
"document": {}
}
],
"meta": {}
}
Headers
string
required
Bearer token authentication. Format:
Authorization: Bearer sk-xxxxxxBody
Format:application/json
string
required
Model ID.
string
required
Query text.
(string | object)[]
required
List of documents to rerank.
integer
Return the top N results.
boolean
default:"false"
Whether to return the original document content in the results.
Response
200 Successfully reranked
Format:application/json
string
Rerank task ID.
object[]
object
Metadata.
curl -X POST "https://t.ato2.nodesms.com/v1/rerank" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "rerank-english-v2.0",
"query": "What is the capital of the United States?",
"documents": [
"Carson City is the capital city of the American state of Nevada.",
"The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.",
"Washington, D.C. is the capital of the United States.",
"Capital punishment has existed in the United States since before it was a country."
],
"top_n": 3
}'
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxxxx",
base_url="https://t.ato2.nodesms.com/v1"
)
response = client.post(
"/rerank",
json={
"model": "rerank-english-v2.0",
"query": "What is the capital of the United States?",
"documents": [
"Carson City is the capital city of the American state of Nevada.",
"Washington, D.C. is the capital of the United States."
],
"top_n": 2
}
)
print(response.json())
{
"id": "string",
"results": [
{
"index": 2,
"relevance_score": 0.9871293,
"document": {}
},
{
"index": 1,
"relevance_score": 0.3456789,
"document": {}
}
],
"meta": {}
}
Last modified on October 28, 2026
Was this page helpful?