All Products
Search
Document Center

Data Management:ChatWithDesensitize

Last Updated:Mar 21, 2026

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

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

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 Stop array.

\n

NeedDesensitization

boolean

No

Specifies whether to enable data desensitization. The default value is false.

false

DesensitizationRule

string

No

The category of the desensitization rule. This parameter is required when NeedDesensitization is set to true.

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: [-2.0, 2.0]. Positive values reduce repetition, and negative values increase it.

0.0

ResponseFormat

string

No

The format of the response content. Valid values are text for a plain text response and json_object for a standard JSON string.

text

Seed

integer

No

A random number seed. Use this parameter to ensure reproducible results for the same input and parameters. Valid range: [0, 2³¹−1].

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: [0, 2.0).

1

TopLogprobs

integer

No

Specifies the number of most likely candidate tokens for which to return logprobs at each generation step. Valid range: [0, 5].

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 null or greater than 100.

10

TopP

string

No

The probability threshold for nucleus sampling, which controls text diversity. Higher values result in more diverse text. Valid range: (0, 1.0].

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 ModalitiesList parameter is set to ["text","audio"].

{}

EnableCodeInterpreter

boolean

No

Specifies whether to enable the Code Interpreter feature. This parameter takes effect only when the model is qwen3-max-preview and EnableThinking is true.

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: The request was successful.

  • false: The request failed.

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 StatusCode is not 200.

InvalidParameter

StatusCode

string

The status code. A value of 200 indicates a successful call. Other values indicate an error.

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.