Theme
Rerank
POST
https://www.kkiai.com/v1/rerank
Given a prompt, the model will return one or more predicted completions, and can also return the probability of alternative tokens at each position.
Create a completion for the provided prompt and parameters
Official documentation: https://docs.siliconflow.cn/cn/api-reference/rerank/create-rerank
Request Parameters
Authorization
Add the Authorization parameter to the Header, with its value being the Token concatenated after Bearer
Example: Authorization: Bearer ********************
Header Parameters
| Parameter Name | Type | Required | Description | Example |
|---|---|---|---|---|
Content-Type | string | Required | application/json | |
Accept | string | Required | application/json | |
Authorization | string | Optional | Bearer {{YOUR_API_KEY}} | |
X-Forwarded-Host | string | Optional | localhost:5173 |
Body Parameters (application/json)
| Parameter Name | Type | Required | Description |
|---|---|---|---|
model | string | Required | |
documents | array[string] | Required | |
query | string | Required | |
top_n | integer | Required | |
instruct | string | Required |
Request Example
json
{
"model": "qwen3-rerank",
"documents": [
"Text ranking models are widely used in search engines and recommendation systems. They rank candidate passages based on their relevance to a query.",
"Quantum computing is an advanced field of computer science that studies computation using quantum-mechanical principles.",
"The development of pretrained language models has brought significant improvements to text ranking models."
],
"query": "What is a text ranking model?",
"top_n": 2,
"instruct": "Given a web search query, retrieve relevant passages that answer the query."
}cURL Example
bash
curl --location --request POST 'https://www.kkiai.com/v1/rerank' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "qwen3-rerank",
"documents": [
"Text ranking models are widely used in search engines and recommendation systems. They rank candidate passages based on their relevance to a query.",
"Quantum computing is an advanced field of computer science that studies computation using quantum-mechanical principles.",
"The development of pretrained language models has brought significant improvements to text ranking models."
],
"query": "What is a text ranking model?",
"top_n": 2,
"instruct": "Given a web search query, retrieve relevant passages that answer the query."
}'Response
🟢 200 OK
Response Body
| Parameter Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | |
object | string | Required | |
created | integer | Required | |
choices | array[object] | Required | |
└ index | integer | Optional | |
└ message | object | Optional | |
└ finish_reason | string | Optional | |
usage | object | Required | |
└ prompt_tokens | integer | Required | |
└ completion_tokens | integer | Required | |
└ total_tokens | integer | Required |
Response Example
json
{
"id": "chatcmpl-123",
"object": "chat.completion",
"created": 1677652288,
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "\n\nHello there, how may I assist you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 9,
"completion_tokens": 12,
"total_tokens": 21
}
}