Chat API with DMS Data Masking capabilities.
Operation description
Chat API with DMS Data Masking capabilities.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- For mandatory resource types, indicate with a prefix of * .
- If the permissions cannot be granted at the resource level,
All Resourcesis used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
| Operation | Access level | Resource type | Condition key | Associated operation |
|---|---|---|---|---|
| dms:ChatWithDesensitize | none | *All Resources * |
| none |
Request parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| InstanceId | long | Yes | The ID of the instance, used to specify the corresponding data masking rules. You can call the ListInstances or GetInstance operation to query the ID of the instance. | 123*** |
| Messages | array<object> | No | The conversation context passed to the model, arranged in chronological order. | |
| object | No | For each message body of the dialog, the standard format is as follows: { "content": "$message", "role": "$role:system,user,assistant" } | ||
| Model | string | No | The model name. Supported Models: Qwen series text-only Large Language Models (Commercial and Open-source). Multi-modal models are not supported. | qwen-plus |
| Stop | array | No | Stop sequences. | |
| string | No | Stop sequences: Generation will terminate immediately if the model generates any of the strings specified in the 'stop' parameter. | \n | |
| NeedDesensitization | boolean | No | Whether to enable data masking. Defaults to false. | false |
| DesensitizationRule | string | No | Masking category. Required when needDataMasking is true. | UserInfo |
| MaxTokens | integer | No | Limits the maximum number of tokens the model can generate. If the output exceeds this value, generation will be truncated. Suitable for scenarios where you need to control the output length. | 256 |
| PresencePenalty | number | No | Controls the degree of repetition in generated text. Valid values: [-2.0, 2.0]. Positive values decrease repetition, while negative values increase it. | 0.0 |
| ResponseFormat | string | No | The format of the returned content. Valid values: text: Plain text response; json_object: Standardized JSON string. | text |
| Seed | integer | No | Random seed. Used to ensure the reproducibility of results under the same input and parameters. Valid values: [0, 2^31−1]. | 1 |
| EnableThinking | boolean | No | Specifies whether to enable Thinking Mode when using hybrid thinking models. | true |
| ThinkingBudget | integer | No | The maximum number of tokens allowed for the model's internal reasoning process. | 256 |
| Temperature | number | No | The sampling temperature controls the diversity of the generated text. The higher the temperature, the more diverse the generated text, and conversely, the more deterministic the generated text. Valid values: [0, 2). | 1 |
| TopLogprobs | integer | No | Specifies the number of most likely candidate tokens to return at each generation step. Valid values: [0, 5]. | 1 |
| TopK | integer | No | Specifies the number of candidate tokens to consider during sampling. Higher values increase randomness, while lower values make the output more deterministic. Set to null or a value greater than 100 to disable. | 10 |
| TopP | number | No | The probability threshold for nucleus sampling, used to control the diversity of the generated text. Higher Top-P values result in more diverse generated text. Valid values: (0,1.0]. | 0.5 |
| XDashScopeDataInspection | string | No | Specifies whether to further identify non-compliant information in both input and output content, building upon the built-in content safety capabilities of the Tongyi Qianwen API. | {} |
| SearchOptions | object | No | Web search strategy. | |
| string | No | The strategy key-value pair for Web search. | {} | |
| ModalitiesList | array | No | Output data modality; only applicable to the Qwen-Omni model. | |
| string | No | Output data modality. | text | |
| AudioJson | string | No | Output audio voice and format; only applicable to the Qwen-Omni model, provided that the modalities parameter is set to ["text", "audio"]. | {} |
| EnableCodeInterpreter | boolean | No | Specifies whether to enable the code interpreter feature. Takes effect only when model is qwen3-max-preview and enable_thinking is true. | false |
| Logprobs | boolean | No | Specifies whether to return the log probabilities of the output tokens. | false |
| VlHighResolutionImages | boolean | No | Specifies whether to increase the maximum pixel limit of input images to the equivalent of 16,384 tokens. | false |
| EnableSearch | boolean | No | Whether to enable web search. | false |
Response parameters
Examples
Sample success responses
JSONformat
{
"RequestId": "0C1CB646-1DE4-4AD0-B4A4-7D47DD52E931",
"ErrorCode": "UnknownError",
"ErrorMessage": "UnknownError",
"Success": true,
"Data": {
"Created": 1763710100,
"Model": "qwen-plus",
"Choices": [
{
"FinishReason": "stop",
"Message": {
"Content": "",
"ReasoningContent": "",
"Role": "system"
},
"Logprobs": {
"key": {}
}
}
],
"Usage": {
"CompletionTokens": 10,
"PromptTokens": 9,
"TotalTokens": 19,
"PromptTokensDetails": {
"key": {}
},
"CompletionTokensDetails": {
"key": {}
}
},
"Message": "InvalidParameter",
"StatusCode": 200,
"Type": "invalid_request_error"
}
}Error codes
For a list of error codes, visit the Service error codes.
Change history
| Change time | Summary of changes | Operation |
|---|---|---|
| 2025-11-26 | The request parameters of the API has changed. The response structure of the API has changed | View Change Details |
| 2025-11-25 | Add Operation | View Change Details |
