All Products
Search
Document Center

OpenSearch:Content generation service

Last Updated:Jun 21, 2026

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.

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 role and content key. The available roles are system, user, and assistant.

  • system: A system-level message. This role can only be used for the first message in the history (messages[0]). Using the system role is optional, but if present, it must be at the start of the list.

  • user and assistant: Represent the dialogue between the user and the model. These roles should alternate to simulate a conversation. The role of the last message must be user.

stream

Boolean

No

Specifies whether to return a streaming response. The default is false.

If set to true, the response is streamed, with each chunk containing the cumulative text generated up to that point.

false

enable_search

Boolean

No

Specifies whether to enable web search. The default is false.

When set to true, the large language model uses an internal prompt to determine whether a web search is needed.

Note

This feature is currently supported only by the deepseek-r1 model.

false

csi_level

String

No

The content moderation level. Default: strict.

Valid values:

  • none: No content moderation.

  • loose: Loose filtering.

  • strict: Strict filtering.

  • rigorous: Rigorous filtering.

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 enable_search is true.

  • true: Returns the web search results.

  • false: Does not return the web search results.

false

parameters.search_top_k

Integer

No

The number of web search results to return.

Note

This parameter takes effect only when enable_search is true. It is supported only by the deepseek-r1 model.

5

parameters.search_way

String

No

The web search strategy, which is the same as that of the web search API.

  • normal (Default): The model rewrites the query, performs a web search, and filters the results using vectorization.

  • fast: The model rewrites the query and performs a web search. The search results are not filtered.

  • full: The model rewrites the query, performs a web search, and then uses the model to evaluate and filter the results.

Note

This parameter takes effect only when enable_search is true. It is supported only by the deepseek-r1 model.

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 0.8 means that only tokens from the smallest set that has a cumulative probability of 80% or higher are considered for sampling. The value must be in the range (0, 1.0). A higher value increases randomness, while a lower value decreases it.

"parameters":{"top_p":0.7}

parameters.top_k

Integer

No

The size of the candidate set for sampling. For example, a value of 50 means that only the top 50 most likely tokens are used as the candidate set for random sampling. A higher value increases randomness, while a lower value increases determinism. Note: If top_k is not specified or its value is greater than 100, this policy is disabled, and only the top_p policy takes effect.

"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 1.0 means no penalty. The value must be greater than 0.

"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.

  • string type

    The model stops when it is about to generate the specified stop word.

    For example, if stop is "Hello", generation stops just before outputting "Hello".

  • array type

    The elements can be strings, token IDs, or an array of token IDs. Generation stops when the next token to be generated (or its corresponding ID) is in the stop array.

    For example, if you set stop to ["hello","weather"] or [108386,104307], the model will stop when it is about to generate "hello" or "weather". If you set stop to [[108386, 103924],[35946, 101243]], the model will stop when it is about to generate "hello there" or "I'm fine".

    Note

    When stop is an array, you cannot mix strings and token IDs in the same top-level array. For example, ["Hello", 104307] is invalid.

"parameters":{"stop":["Hello","Weather"]}

Note

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 enable_search is true and parameters.search_return_result is true, this field contains the web search results.

[]

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.