AI Search Open Platform lets you call large language model (LLM) services via an API. These services include Retrieval-Augmented Generation (RAG) specific large language models that are fine-tuned based on Alibaba's proprietary foundation models. You can use these models in RAG scenarios in combination with document processing and retrieval services to improve answer accuracy and reduce the hallucination rate.
|
Service |
Service ID (service_id) |
Description |
QPS limit (for both Alibaba Cloud accounts and RAM users) |
|
Qwen3-235B-A22B |
qwen3-235b-a22b |
A next-generation large language model (LLM) in the Qwen series. Based on extensive training, Qwen3 achieves breakthroughs in inference, instruction following, agent capabilities, and multilingual support. It supports over 100 languages and dialects, demonstrating powerful multilingual understanding, reasoning, and generation. |
3 Note
To request a higher API QPS limit, submit a ticket to technical support. |
|
OpenSearch-Qwen-Turbo |
ops-qwen-turbo |
This model uses the Qwen-Turbo large language model as its foundation. It is fine-tuned using supervised learning to enhance retrieval capabilities and reduce harmful content generation. |
|
|
Qwen-Turbo |
qwen-turbo |
The fastest and most cost-effective model in the Qwen series. It is suitable for simple tasks. |
|
|
Qwen-Plus |
qwen-plus |
A balanced model offering performance, cost, and speed between Qwen-Max and Qwen-Turbo. It is suitable for moderately complex tasks. |
|
|
Qwen-Max |
qwen-max |
The highest-performing model in the Qwen series. It is suitable for complex, multi-step tasks. |
|
|
DeepSeek-R1 |
deepseek-r1 |
A large language model that specializes in complex reasoning tasks. It excels at understanding complex instructions, ensuring result accuracy, and supporting the web search feature. |
|
|
DeepSeek-V3 |
deepseek-v3 |
DeepSeek-V3 is a Mixture-of-Experts (MoE) model that excels in processing long texts, code, mathematics, and encyclopedic knowledge, with outstanding proficiency in Chinese. |
|
|
DeepSeek-R1-distill-qwen-7b |
deepseek-r1-distill-qwen-7b |
A model created by using knowledge distillation to fine-tune Qwen-7B with training samples generated by DeepSeek-R1. |
|
|
DeepSeek-R1-distill-qwen-14b |
deepseek-r1-distill-qwen-14b |
A model created by using knowledge distillation to fine-tune Qwen-14B with training samples generated by DeepSeek-R1. |
|
|
DeepSeek-V4-Pro |
deepseek-v4-pro |
A flagship Mixture-of-Experts (MoE) large model with 1.6T total parameters and 49B activated parameters, natively supporting an ultra-long context of millions of tokens. Built on massive high-quality training data, it possesses top-tier capabilities in mathematical logic, complex reasoning, professional coding, and deep analysis of long texts. It is ideal for advanced scenarios such as high-level scientific research, complex office tasks, and deep intelligent agents. |
|
|
DeepSeek-V4-Flash |
deepseek-v4-flash |
An efficient and lightweight Mixture-of-Experts (MoE) model with 284B total parameters and 13B activated parameters, natively supporting an ultra-long context of millions of tokens. It features fast inference, low latency, and low cost. With balanced overall capabilities, it is designed for high-concurrency, lightweight tasks and is suitable for general-purpose scenarios like daily conversation, content creation, basic RAG, and batch text processing. |
Prerequisites
-
Get authentication credentials
The AI Search open platform requires an API key for authentication. For instructions, see Get an API key.
-
Get the service endpoint
You can call the service via the public network or a VPC. For details, see Get the service endpoint.
Request
General notes
-
The request body cannot exceed 8 MB.
HTTP method
POST
URL
{host}/v3/openapi/workspaces/{workspace_name}/text-generation/{service_id}
Path parameters
-
host: The endpoint for the service. You can call the API over the internet or from within a VPC. For more information, see Obtain a service endpoint.
On the API keys page, in the Access Domain Names section, you can find the Public API Domain Name and Private API Domain Name (VPC). Select the appropriate domain name as the host. You can switch to the target workspace by using the drop-down list at the top of the page.
-
workspace_name: The name of the workspace. Example: default.
-
service_id: The ID of the built-in service. Example: ops-qwen-turbo.
Request parameters
Header parameters
API key authentication
|
Parameter |
Type |
Required |
Description |
Example |
|
Content-Type |
String |
Yes |
The request format. Must be |
application/json |
|
Authorization |
String |
Yes |
The API key for authentication. |
Bearer OS-d1**2a |
Body parameters
|
Parameter |
Type |
Required |
Description |
Example |
|
messages |
List |
Yes |
The conversation history between the user and the model. Each element in the list is an object with a
|
|
|
stream |
Boolean |
No |
Specifies whether to return a streaming response. The default is If set to |
false |
|
enable_search |
Boolean |
No |
Specifies whether to enable web search. The default is When set to Note
This feature is currently supported only by the deepseek-r1 model. |
false |
|
csi_level |
String |
No |
The content moderation level. Default: Valid values:
|
strict |
|
parameters |
Map |
No |
A map of adjustable parameters for the large language model. |
N/A |
|
parameters.search_return_result |
Boolean |
No |
This parameter takes effect only when
|
false |
|
parameters.search_top_k |
Integer |
No |
The number of web search results to return. Note
This parameter takes effect only when |
5 |
|
parameters.search_way |
String |
No |
The web search strategy, which is the same as that of the web search API.
Note
This parameter takes effect only when |
normal |
|
parameters.seed |
Integer |
No |
A random number seed for generation. It controls the randomness of the model's output. The seed must be a 64-bit unsigned integer. When a seed is provided, the model attempts to produce the same or similar results, but deterministic output is not guaranteed. |
"parameters":{"seed":666} |
|
parameters.max_tokens |
Integer |
No |
The maximum number of tokens to generate. For Qwen-Turbo, the maximum and default value is 1,500. For Qwen-Max and Qwen-Plus, the maximum and default value is 2,000. |
"parameters":{"max_tokens":1500} |
|
parameters.top_p |
Float |
No |
The probability threshold for nucleus sampling. For example, a value of |
"parameters":{"top_p":0.7} |
|
parameters.top_k |
Integer |
No |
The size of the candidate set for sampling. For example, a value of |
"parameters":{"top_k":50} |
|
parameters.repetition_penalty |
Float |
No |
Controls the penalty for repeating tokens in a sequence. Higher values reduce repetition. A value of |
"parameters":{"repetition_penalty":1.0} |
|
parameters.presence_penalty |
Float |
No |
Controls the penalty for repeating tokens anywhere in the entire output. Higher values reduce repetition. The value must be in the range [-2.0, 2.0]. |
"parameters":{"presence_penalty":1.0} |
|
parameters.temperature |
Float |
No |
Controls the degree of randomness and diversity in the output. A higher temperature value smooths the probability distribution of candidate tokens, making less likely words more probable and increasing diversity. A lower value sharpens the peak of the distribution, making high-probability words more likely and increasing determinism. The value must be in the range [0, 2). A value of 0 is not recommended. |
"parameters":{"temperature":0.85} |
|
parameters.stop |
string/array |
No |
Provides precise control by stopping generation before the model produces a specified string or token ID. The generated content will not include the stop sequence. The value can be a string or an array.
|
"parameters":{"stop":["Hello","Weather"]} |
The maximum token limit for ops-qwen-turbo is 4,000.
Response parameters
|
Parameter |
Type |
Description |
Example |
|
result.text |
String |
The text generated by the model. |
Zhengzhou is a... |
|
result.search_results |
List<SearchResult> |
If |
[] |
|
result.search_results[].title |
String |
The title of the search result. |
Today's weather in Zhengzhou |
|
result.search_results[].url |
String |
The URL of the search result. |
https://xxxx.com |
|
result.search_results[].snippet |
String |
A brief snippet from the content of the search result web page. |
The weather in Zhengzhou is sunny today. |
|
usage.output_tokens |
Integer |
The number of tokens in the generated text. |
100 |
|
usage.input_tokens |
Integer |
The number of tokens in the input prompt. |
100 |
|
usage.total_tokens |
Integer |
The total number of tokens for the request (input and output). |
200 |
cURL request example
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
"http://xxxx-hangzhou.opensearch.aliyuncs.com/v3/openapi/workspaces/default/text-generation/qwen-max" \
-d '{
"messages":[
{
"role":"system",
"content":"You are a helpful assistant."
},
{
"role":"user",
"content":"What is the capital of Henan Province?"
},
{
"role":"assistant",
"content":"Zhengzhou"
},
{
"role":"user",
"content":"What is the weather like in Zhengzhou today?"
}
],
"parameters":{
"search_return_result":true,
"search_top_k":5,
"search_way":"normal"
},
"stream":false,
"enable_search":true
}'
Response examples
Sample success response
{
"request_id": "450fcb80-f796-****-8d69-e1e86d29aa9f",
"latency": 564.903929,
"result": {
"text":"According to the latest weather forecast, it will be cloudy in Zhengzhou today, with temperatures between 9°C and 19°C, and a light northeasterly breeze...",
"search_results":[
{
"url":"https://xxxxx.com",
"title":"xxxx",
"snippet":"The weather in Zhengzhou is sunny today."
}
]
},
"usage": {
"output_tokens": 934,
"input_tokens": 798,
"total_tokens": 1732
}
}
Sample error response
If an error occurs, the response includes a code and message that explain the error.
{
"request_id": "45C8C9E5-6BCB-****-80D3-E298F788512B",
"latency": 0,
"code": "InvalidParameter",
"message": "JSON parse error: Unexpected character ..."
}
Status codes
For more information, see Status codes for AI Search Open Platform.