MaaS Standard API V2
Constraints
This function is only supported in CN-Hong Kong.
API Information
| Parameter | Description | Example Value |
|---|---|---|
| API URL | API URL for calling the model service. | https://api-ap-southeast-1.modelarts-maas.com/v2/chat/completions |
| Authentication request header | Provides the server with identity authentication/authorization credentials. | "Authorization": "Bearer $MaaS_API_Key" |
Supported Models
You can log in to the MaaS console and enable the following models on the Model Inference > Real-Time Inference > Built-in Services page. On the model details page in the Model Square, you can view detailed information about the models.
| Model | Name | Supported Region | Value of model |
|---|---|---|---|
| GLM | GLM-5 | CN-Hong Kong | glm-5 |
| GLM-5.1 | CN-Hong Kong | glm-5.1 | |
| GLM-5.2 | CN-Hong Kong | glm-5.2 | |
| DeepSeek | DeepSeek-V4-Pro | CN-Hong Kong | deepseek-v4-pro |
| DeepSeek-V4-Flash | CN-Hong Kong | deepseek-v4-flash | |
| DeepSeek-V3.1 | CN-Hong Kong | deepseek-v3.1-terminus | |
| DeepSeek-V3 | CN-Hong Kong | DeepSeek-V3 | |
| DeepSeek-V3.2 | CN-Hong Kong | deepseek-v3.2 | |
| DeepSeek-R1-0528 | CN-Hong Kong | deepseek-r1-250528 |
Request Parameters
| Category | Parameter | Type | Mandatory | Range | Description |
|---|---|---|---|---|---|
| General | model | string | Yes | - | Model ID for generating content. For details about the options of model, see Supported Models. Default value: N/A |
| messages | object[] | Yes | - | List of messages in a dialog. Different models support different types of messages. Default value: N/A | |
| System message | messages.role | string | Yes | system | Role that sends a message. Default value: N/A |
| messages.content | string/object[] | Yes | - | Message sent by the current role. Default value: N/A | |
| messages.content.type | string | Yes | text | Message type. Default value: N/A | |
| messages.content.text | string | Yes | - | Text content of the message. Default value: N/A | |
| User message | messages.role | string | Yes | user | Role that sends a message. Default value: N/A |
| messages.content | string/object[] | Yes | - | Message sent by the current role. Default value: N/A | |
| messages.content.type | string | Yes | text | Message type. Default value: N/A | |
| messages.content.text | string | Yes | - | Text content of the message. Default value: N/A | |
| Assistant message | messages.role | string | Yes | assistant | Role that sends a message. Default value: N/A |
| messages.content | string/object[] | Yes | - | Message sent by the current role. Default value: N/A | |
| messages.tool_calls | array | No | - | Tool call records from previous model responses in the dialog history. Default value: N/A | |
| messages.tool_calls.id | string | Yes | - | ID of the called tool. Default value: N/A | |
| messages.tool_calls.type | string | Yes | function | Tool type. Default value: N/A | |
| messages.tool_calls.function | object | Yes | - | Function information corresponding to the tool called by the model. Default value: N/A | |
| messages.tool_calls.function.arguments | string | Yes | - | JSON parameters generated by the model for calling the function. Default value: N/A | |
| messages.tool_calls.function.name | string | Yes | - | Name of the function to be called by the model. Default value: N/A | |
| messages.prefix | boolean | No | - | Controls whether to enable continuation mode. In this mode, the user provides a message starting with assistant, and the model completes the rest based on that beginning and the input instruction. To use this feature, ensure that the last message in the messages list has the role set to assistant and the prefix parameter set to true. Example: messages = [ {"role": "user", "content": "Write a snippet of Python code"}, {"role": "assistant", "content": "```python\n", "prefix": True} ] Default value: false | |
| Tool message | messages.role | string | Yes | tool | Role that sends a message. Default value: N/A |
| messages.tool_call_id | string | Yes | - | ID of the tool called by the model. Default value: N/A | |
| messages.content | string/object[] | Yes | - | Message sent by the current role. Default value: N/A | |
| Deep thinking control | thinking | object | No | - | Controls whether to enable or disable the deep thinking mode for a model. Default value: N/A |
| thinking.type | string | Yes |
|
Default value: The default value varies depending on the model. For details, see Thinking Control for Deep Thinking Models. | |
| Model output behavior configuration | max_completion_tokens | integer/null | No | The value varies depending on the model. For details, see the maximum output length and maximum chain-of-thought (CoT) length on the model details page of the MaaS console. | Maximum length of the model output, including the model answer (content) and CoT (reasoning_content). After this parameter is set, the token length of the model output does not exceed the value of max_completion_tokens.
Default value: N/A |
| max_tokens | integer/null | No | The value varies depending on the model. For details, see the maximum output length on the model details page of the MaaS console. | Maximum length of a model response, in tokens.
Default Value: 4K | |
| temperature | float/null | No | [0,2] | Sampling temperature, used to control the randomness of the content generated by the model. A higher value (for example, greater than 1) will make the model output more random, divergent, and creative, while a lower value (for example, 0.1) will make the output more focused, deterministic, and conservative. It is recommended that you adjust either temperature or top_p. DeepSeek-V3, DeepSeek-R1-0528, and DeepSeek-V4 apply special handling to inputs:
Default value: For other models, the input is used if provided; otherwise, the default is 0.6. | |
| top_p | float/null | No | (0,1] | Nucleus sampling probability threshold, used to control the diversity of the content generated by the model. Similar to the temperature parameter but operates differently, allowing finer control over the vocabulary range of the model's output. When set close to 0, the model samples from only the most probable tokens, resulting in very conservative and highly deterministic outputs. When set close to 1, there is virtually no restriction on the vocabulary, leading to more random and divergent outputs. It is recommended to adjust either temperature or top_p, but not both simultaneously. Default value:
| |
| top_k | integer | No | ≥ 0 | Controls the model to select only from the top k most probable tokens during generation, influencing the randomness of the generated text. Higher values increase randomness, while lower values enhance determinism. Default value: N/A | |
| frequency_penalty | number/null | No | [-2, 2] | Frequency penalty coefficient, where the model penalizes new tokens based on their frequency of occurrence. Positive values reduce the likelihood of repetitive token sequences. DeepSeek-V4: In thinking mode, the value is always 0, regardless of the user input. Default value: 0 | |
| presence_penalty | number/null | No | [-2, 2] | This parameter is not supported by models with deep thinking capabilities. It adjusts the probability of a specified token appearing in the model's output. The input is a JSON object mapping tokens to bias values [-100, 100]. Lower values decrease the likelihood, while higher values increase the chance of selection. DeepSeek-V4: In thinking mode, the value is always 0, regardless of the user input. Default value: 0 | |
| logit_bias | map/null | No | - | This parameter is not supported by models with deep thinking capabilities. It adjusts the probability of a specified token appearing in the model's output to better align with specific preferences. The logit_bias field accepts a map value where each key is a token ID from the vocabulary (obtained via the tokenization API), and each value is the bias for that token, ranging from [-100,100].
Default value: null | |
| stream | boolean/null | No | - | Determines if the response content is returned in a streaming manner.
Default value: false | |
| stream_options | object/null | No | - | Options for streaming responses. Can be set when stream is true. Default value: N/A | |
| stream_options.include_usage | boolean | No | - | Indicates whether to include token usage information for the request during model streaming output. Currently, this feature cannot be disabled. true: An additional chunk is returned before data: [DONE]. In this chunk, the usage field displays the token usage of the entire request, and the choices field is an empty array. Default value: true | |
| stop | string/string[]/null | No | null | When the model encounters the string specified in the stop field, the generation stops and the string itself does not appear in the response. A maximum of four strings are supported. The stop token does not hit the token in the CoT, but only hits the part in the formal answer content. Default value: N/A | |
| reasoning_effort | string | No |
| Controls the reasoning intensity. Involved models: DeepSeek-V4 series and GLM-5.2 Default value: high | |
| Tool calls | tools | object[]/null | No | - | List of tools to be calls. Default value: N/A |
| tools.type | string | Yes | function | Tool type. Default value: N/A | |
| tools.function | object | Yes | - | Information about the tools to be called. Default value: N/A | |
| tools.function.name | string | Yes | - | Name of the function to be called. Default value: N/A | |
| tools.function.description | string | No | - | Description of the function to be called. The model will determine if the tool is needed for the current task based on this description. Default value: N/A | |
| tools.function.parameters | object | No | - | Function request parameters, described in JSON format. Example: {
"type": "object",
"properties": {
"parameter name": {
"type": "parameter type",
"description": "parameter description"
}
},
"required": ["mandatory parameters"]
} Parameters must conform to JSON specifications. Default value: N/A | |
| tool_choice | string/object | No |
| Controls the mode of how the model calls tools.
Default value:
| |
| tool_choice.type | string | Yes | function | Type of the call, which should be function here. Default value: N/A | |
| tool_choice.name | string | Yes | - | Name of the tool to be called. Default value: N/A |
Response Parameters (Non-Streaming)
| Parameter | Type | Description |
|---|---|---|
| created | integer | Unix timestamp of the creation time of this request, in seconds. |
| id | string | Unique identifier of this request. |
| model | string | Model ID used in this request. |
| object | string | Fixed as chat.completion. |
| choices | object[] | Model response content of this request. |
| choices.finish_reason | string | Reason why the model stopped generating:
|
| choices.index | integer | Index of the current element in the choices list. |
| choices.message | object | Content output by the model. |
| choices.message.role | string | Role of the output content. |
| choices.message.content | string | Message content generated by the model. |
| choices.message.reasoning_content | string/null | CoT content generated by the model, only returned by deep thinking models. |
| choices.message.tool_calls | object[]/null | Tool call information generated by the model, returned only if tool calls were triggered. |
| choices.message.tool_calls.id | string | ID of the called tool. |
| choices.message.tool_calls.type | string | Tool type. Currently, it only supports function. |
| choices.message.tool_calls.function | object | Function called by the model. |
| choices.message.tool_calls.function.name | string | Name of the function called by the model. |
| choices.message.tool_calls.function.arguments | string | JSON format input generated by the model for calling the function. |
| usage | object | Token usage information of this request. |
| usage.completion_tokens | integer | Tokens spent on the model's output content. |
| usage.prompt_tokens | integer | Number of tokens input to the model for processing. |
| usage.total_tokens | integer | Total number of tokens consumed by this request (input + output). |
| usage.completion_tokens_details | object | Details of tokens consumed by the model's output. |
| usage.completion_tokens_details.reasoning_tokens | integer | Number of tokens consumed by the output CoT content. |
| usage.prompt_tokens_details | object | Details of the number of tokens input to the model. |
| usage.prompt_tokens_details.cached_tokens | integer | Token usage of the cached input content. |
Response Parameters (Streaming)
| Parameter | Type | Description |
|---|---|---|
| created | integer | Unix timestamp of the creation time of this request, in seconds. |
| id | string | Unique identifier of this request. |
| model | string | Model ID used in this request. |
| object | string | Fixed as chat.completion.chunk. |
| choices | object[] | Model output content of this request. |
| choices.finish_reason | string | Reason why the model stopped generating:
|
| choices.index | integer | Index of the current element in the choices list. |
| choices.delta | object | Incremental output from the model. |
| choices.delta.role | string | Role of the output content. |
| choices.delta.content | string | Message content generated by the model. |
| choices.delta.reasoning_content | string/null | CoT content generated by the model, only returned by deep thinking models. |
| choices.delta.tool_calls | object[]/null | Tool calls generated by the model. |
| choices.delta.tool_calls.id | string | ID of the called tool. |
| choices.delta.tool_calls.type | string | Tool type. Currently, it only supports function. |
| choices.delta.tool_calls.function | object | Function called by the model. |
| choices.delta.tool_calls.function.name | string | Name of the function called by the model. |
| choices.delta.tool_calls.function.arguments | string | JSON format input generated by the model for calling the function. |
| usage | object | Token usage of this request. |
| usage.completion_tokens | integer | Tokens spent on the model's output content. |
| usage.prompt_tokens | integer | Number of tokens input to the model for processing. |
| usage.total_tokens | integer | Total number of tokens consumed by this request (input + output). |
| usage.completion_tokens_details | object | Details of tokens consumed by the model's output content. |
| usage.completion_tokens_details.reasoning_tokens | integer | Number of tokens consumed by the output CoT content. |
| usage.prompt_tokens_details | object | Details of the number of tokens input to the model. |
| usage.prompt_tokens_details.cached_tokens | integer | Token usage of the cached input content. |
Thinking Control for Deep Thinking Models
| Model | thinking.type Default Value | thinking.type Options |
|---|---|---|
| DeepSeek-V4-Flash DeepSeek-V4-Pro | enabled |
|
| DeepSeek-R1-0528 | enabled | enabled |
| DeepSeek-V3.1 | disabled |
|
| DeepSeek-V3.2 | disabled |
|
| GLM-5 | enabled |
|
| GLM-5.1 | enabled |
|
| GLM-5.2 | enabled |
|
Tool Choices for Models
| Model | Supported Tool Choice |
|---|---|
| GLM-5.1 GLM-5.2 |
|
| GLM-5 |
|
| DeepSeek-V4-Flash DeepSeek-V4-Pro DeepSeek-V3.2 DeepSeek-R1-0528 |
|
| DeepSeek-V3 DeepSeek-V3.1 |
|
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot