Chat API: Data Masking with Data Management Service (DMS)
Operation description
A Chat API with data masking capabilities powered by Data Management (DMS).
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
dms:ChatWithDesensitize |
none |
*All Resource
|
None | None |
Request syntax
POST / HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
integer |
Yes |
The ID of the instance containing the desensitization rule to be applied. Obtain this ID by calling the ListInstances or GetInstance API. |
123*** |
| Messages |
array |
No |
A chronological list of message objects that provides context for the Large Language Model (LLM). |
[ { "content": "你好", "role": "user" } ] |
|
any |
No |
A message object in the conversation. The standard format is as follows: { "content": "$MessageContent", "role": "$MessageRole: system, user, or assistant" } |
{ "content": "你好", "role": "user" } |
|
| Model |
string |
No |
The ID of the model to use. Supported models include text-only Large Language Models (LLMs) from the Qwen series, such as commercial and open-source versions. Multimodal models are not supported. |
qwen-plus |
| Stop |
array |
No |
A list of stop words. |
["\n"] |
|
string |
No |
A stop word. Generation stops immediately when the model outputs a string listed in the |
\n |
|
| NeedDesensitization |
boolean |
No |
Specifies whether to enable data desensitization. The default value is |
false |
| DesensitizationRule |
string |
No |
The category of the desensitization rule. This parameter is required when |
UserInfo |
| MaxTokens |
integer |
No |
The maximum number of tokens to generate. Generation stops once the output reaches this limit. |
256 |
| PresencePenalty |
string |
No |
Controls token repetition in the generated text. Valid range: |
0.0 |
| ResponseFormat |
string |
No |
The format of the response content. Valid values are |
text |
| Seed |
integer |
No |
A random number seed. Use this parameter to ensure reproducible results for the same input and parameters. Valid range: |
1 |
| EnableThinking |
boolean |
No |
Specifies whether to enable the thinking mode when you use a hybrid thinking model. |
true |
| ThinkingBudget |
integer |
No |
The maximum number of tokens for the thinking process. |
256 |
| Temperature |
string |
No |
The sampling temperature, which controls the diversity of the generated text. A higher temperature results in more diverse text, while a lower temperature produces more deterministic text. Valid range: |
1 |
| TopLogprobs |
integer |
No |
Specifies the number of most likely candidate tokens for which to return logprobs at each generation step. Valid range: |
1 |
| TopK |
integer |
No |
Specifies the number of candidate tokens to sample from during generation. A higher value results in more random output, while a lower value produces more deterministic output. This feature is disabled if the value is set to |
10 |
| TopP |
string |
No |
The probability threshold for nucleus sampling, which controls text diversity. Higher values result in more diverse text. Valid range: |
0.5 |
| XDashScopeDataInspection |
string |
No |
Specifies whether to perform additional violation detection on input and output content in addition to the built-in content safety features of the Qwen API. |
{} |
| SearchOptions |
object |
No |
The strategy for web search. |
{} |
|
string |
No |
Key-value pairs for the web search strategy. |
{} |
|
| ModalitiesList |
array |
No |
Specifies the desired output modalities. This parameter applies only to the Qwen-Omni model. |
["text","audio"] |
|
string |
No |
Specifies a single output modality. |
text |
|
| AudioJson |
string |
No |
The timbre and format settings for the audio output. This parameter applies only to the Qwen-Omni model and when the |
{} |
| EnableCodeInterpreter |
boolean |
No |
Specifies whether to enable the Code Interpreter feature. This parameter takes effect only when the |
false |
| Logprobs |
boolean |
No |
Specifies whether to return the log probabilities (logprobs) for each output token. |
false |
| VlHighResolutionImages |
boolean |
No |
Specifies whether to increase the input image pixel limit to the equivalent of 16,384 tokens. |
false |
| EnableSearch |
boolean |
No |
Specifies whether to enable web search. |
false |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response body. |
||
| RequestId |
string |
The ID of the request. |
0C1CB646-1DE4-4AD0-B4A4-7D47DD52E931 |
| ErrorCode |
string |
The error code. |
UnknownError |
| ErrorMessage |
string |
The error message. |
UnknownError |
| Success |
boolean |
Indicates whether the request was successful. Valid values:
|
true |
| Data |
object |
The returned data. |
|
| Created |
string |
The Unix timestamp (in seconds) when the request was created. |
1763710100 |
| Model |
string |
The model used for this request. |
qwen-plus |
| Choices |
array<object> |
An array of candidate responses generated by the model. |
|
|
array<object> |
A candidate response generated by the model. |
||
| FinishReason |
string |
The reason why the model stopped generating the response. Valid values: |
stop |
| Message |
object |
The message generated by the model. |
|
| Content |
string |
The content of the model's response. |
你好呀! |
| ReasoningContent |
string |
The in-depth reasoning content from the model. |
嗯,用户发了个“你好”,看起来是想打招呼... |
| Role |
string |
The role of the message. |
system |
| Logprobs |
object |
Log probability information for the model's output tokens. |
{} |
|
any |
Detailed token information. |
{} |
|
| Usage |
object |
Token usage information for this request. |
|
| CompletionTokens |
string |
The number of tokens in the model's output. |
10 |
| PromptTokens |
string |
The number of tokens in the input. |
9 |
| TotalTokens |
string |
The total number of tokens consumed. |
19 |
| PromptTokensDetails |
object |
A fine-grained breakdown of input tokens. |
{} |
|
string |
A fine-grained token category. |
{} |
|
| CompletionTokensDetails |
object |
A fine-grained breakdown of output tokens when you use the Qwen-VL model. |
{} |
|
string |
A fine-grained token category. |
{} |
|
| Message |
string |
The error message. This parameter is returned only if the |
InvalidParameter |
| StatusCode |
string |
The status code. A value of |
200 |
| Type |
string |
The error type. |
invalid_request_error |
Examples
Success response
JSON format
{
"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
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.