Skip to content

MaaS_Baichuan

Request Protocol

https

Parameter Name Type Required Description
Content-Type string is Fixed to application /json
Authorization string is Bearer ${YOUR_AK}

Request URL

POST https://{newPlatformDomain}/v1/ai/{endpointPath}/chat/completions

Request Body Parameters

Parameter Name Secondary Parameter Level 3 Parameter Level 4 Parameter Type Required Description
model - - - string is Model ID Used
messages - - - array[json] is Conversation message list (historical conversations are filled in chronological order from oldest to newest)
role - - string is The role of the message author is one of the following: 1. user 2. assistant 3. system
content - - object is Message content, type string or array[json]
- - - string No When content is of type string, the message content is plain text
- - - array[json] No When content is of type array[json], the message content is in text structure
- type - string No Fill in this field when content is of type array[json], content type, must be either text or file
- text - string No Fill in this field when content is of type array[json]; when type is text, fill in the message text
- file - object No Fill in this field when content is of type array[json], and fill in the file content when type is file
- - file_id string No Fill in this field when content is of type array[json].
stream - - - boolean No Whether to use the streaming interface, with a default value of false
temperature - - - float No Value range: [.0f, 1.0f]. Diversity, the higher, the better, default 0.3
top_p - - - float No Value range: [.0f, 1.0f). The smaller the value, the easier it is to get a head, default 0.85
top_k - - - int No Value range: [0, 20]. Search sampling control parameter. The larger the value, the larger the sampling set. A value of 0 means not using the top_k sampling screening strategy. The maximum value is 20 (values exceeding 20 will be corrected to 20), and the default value is 5.
max_tokens - - - int No Maximum number of tokens generated by the response. Range: [1, 32000]
metadata - - - map No Extended Parameters
evidence_scope - - string No Evidence material acquisition scope (only applicable to the Baichuan-M3-Plus model). Supports two types: grounded and cited, with grounded as the default. Grounded refers to aligned evidence, which includes all evidence materials selected and verified during the model grounding phase, but does not require these materials to be explicitly cited in the final answer. Cited refers to cited evidence, which includes evidence materials explicitly cited (e.g., through citation numbers) in the final model output and is a subset of grounded evidence.
disable_follow-up_question_extension - - boolean No Whether to disable question expansion in replies. true: disable expansion; false: do not disable expansion, default is false. (Only applicable to the Baichuan-M3-Plus model).
output_style - - string No Answer style. Supports expert professional mode and patient popular mode; if no parameters are passed, it defaults to professional mode. (Only applicable to the Baichuan-M3-Plus model).
thinking - - - map No Extended parameters for thinking, only applicable to Baichuan-M3.
budget_tokens - - int No Number of tokens for thinking, range: greater than or equal to 1024 and less than max_tokens

Request Example

curl --location --request POST 'https://{新平台域名}/v1/ai/{endpointPath}/chat/completions \
--header 'Authorization: Bearer ${YOUR_AK}' \
--header 'Content-Type: application/json' \
--data-raw '{
            "model": "Baichuan-M3",
            "messages": [
               {
                  "role": "user",
                  "content": "What should be done if a child has a cold and cough but cannot expel phlegm?"
               }
            ],
            "stream": false,
            "max_tokens": 3000,
            "thinking": {
                  "budget_tokens": 2000
            }
         }'

Response Example

{
    "id": "chatcmpl-TT8pnXcBIF38VECBUAWLoaAq",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "**Not for now... If you have any other questions, feel free to ask me. 🙏
(Note: Online consultation cannot replace an in-person visit. If you are unsure about anything, please seek the help of a professional doctor.))",
                "reasoning_content": "Well, the user is asking about what to do when a child has a cold and cough but can't bring up the phlegm... Avoid using overly technical terms so that parents can easily understand. At the same time, emphasize not to self-medicate, especially with antibiotics and cough suppressants."
            },
            "finish_reason": "stop",
            "native_finish_reason": "stop"
        }
    ],
    "created": 1779243318,
    "model": "MaaS_Baichuan_M3_20260113",
    "object": "chat.completion",
    "usage": {
        "prompt_tokens": 43,
        "completion_tokens": 2065,
        "total_tokens": 2108,
        "search_count": 0
    }
}

Streaming Request Example

 curl --location --request POST 'https://{新平台域名}v1/ai/{endpointPath}/chat/completions \
--header 'Authorization: Bearer ${YOUR_AK}' \
--header 'Content-Type: application/json' \
 -d '{
        "model": "Baichuan-M3",
        "messages": [
        {
            "role": "user",
            "content": "question"
        }
        ],
        "stream": true,
        "max_tokens":12000,
        "thinking":{
           "budget_tokens": 2000
        }
    }'

OpenAI SDK Call Method

from openai import OpenAI

client = OpenAI(
    api_key="${YOUR_AK}",
    base_url="{新平台域名}/v1",
)

completion = client.chat.completions.create(
    model="MaaS_Baichuan_M3_20260113",
    messages=[
        {"role": "user", "content": "question"}
    ],
    stream=True
)

for chunk in completion:
    print(chunk.choices[0])