The AI Search Open Platform enables you to call document relevance scoring services via APIs. You can integrate this service into your business workflow to enhance retrieval performance.
Service name | Service ID | Service description | QPS limits on API calls (Alibaba Cloud account and RAM users) |
BGE re-ranking model | ops-bge-reranker-larger | Provides a document scoring service based on the BGE model. It can rank documents based on the relevance between the query and document content, from highest to lowest score, and output the corresponding scoring results. The model supports both Chinese and English and has a maximum input token length of 512 (query + document). | 20 Note To apply for higher QPS, submit a ticket. |
OpenSearch text re-ranking model-001 | ops-text-reranker-001 | A re-ranking model developed by OpenSearch that integrates training from multiple industry datasets to provide high-quality reranking services. It can rank documents based on the semantic relevance between the query and documents, from highest to lowest. The model supports both Chinese and English and has a maximum input token length of 512 (query + document). | |
Qwen3 ranking service-0.6B | ops-qwen3-reranker-0.6b | Qwen3 series document re-ranking service, supporting 100+ languages, with a maximum input token length of 32k (query + document) and 0.6B parameters. |
Prerequisites
The authentication information is obtained.
When you call an AI Search Open Platform service by using an API, you need to authenticate the caller's identity.
The service access address is obtained.
You can call a service over the Internet or a virtual private cloud (VPC). For more information, see Get service registration address.
Request description
General description
The request body must not exceed 8 MB.
Request method
POST
URL
{host}/v3/openapi/workspaces/{workspace_name}/ranker/{service_id} Parameter description:
host: The service endpoint. You can call the API service over the Internet or through a VPC. For more information, see Obtain service registration addresses.
workspace_name: The name of the workspace, such as default.
service_id: The built-in service ID, for example, ops-bge-reranker-larger.
Request parameters
Header parameters
API-KEY authentication
Parameter | Type | Required | Description | Example value |
Content-Type | String | Yes | Request type: application/json | application/json |
Authorization | String | Yes | API-Key | Bearer OS-d1**2a |
Body parameters
Parameter | Type | Required | Description | Example value |
query | String | Yes | The query content. | What are the fun places in Shanghai? |
docs | List<String> | Yes | The document content (list). | ["There are many fun places in Shanghai", "There are many fun places in Beijing"] |
Response parameters
Parameter | Type | Description | Example value |
request_id | String | The request ID. | A5B25952-4406-45BF-99EC-E8020246**** |
latency | Float/Int | The request latency. Unit: ms. | 10 |
usage.doc_count | Int | The number of input documents in this request. | 2 |
result.scores | List<score> | The results of ranking documents by score from highest to lowest. | [ { "index":1, "score":0.99 }, { "index":2, "score":0.05 } ] |
result.scores[].index | Int | The position index value of this document in the input candidate document array. | 1 |
result.scores[].score | Float | The scoring result. A higher value indicates higher relevance. | 0.99 |
Curl request example
curl -XPOST -H"Content-Type: application/json"
"http://****-hangzhou.opensearch.aliyuncs.com/v3/openapi/workspaces/default/ranker/ops-bge-reranker-larger"
-H "Authorization: Bearer your API-KEY"
-d "{
\"query\":\"opensearch documentation\",
\"docs\":[
\"what is opensearch\",
\"what is LLM-based conversational search edition\",
\"What is the advantage of LLM-based conversational search edition\"
]
}"Response example
Normal response example
{
"request_id":"24B004E0-ADEF-****-879B-F28359BFAD1D",
"latency":19,
"usage":{
"doc_count":3
},
"result":{
"scores":[
{
"index":0,"score":0.45026873385713345
},
{
"index":1,"score":1.1412238544346029E-4
},
{
"index":2,"score":8.029784284533197E-5
}
]
}
}Abnormal response example
If an error occurs during the access request, the output will specify the error reason through the code and message.
{
"request_id": "45C8C9E5-6BCB-****-80D3-E298F788512B",
"latency": 0,
"code": "InvalidParameter",
"message": "JSON parse error: Unexpected character ..."
}Status code
For more information, see Status codes.