Text moderation enhanced edition 2.0 multilingual service

更新时间:
复制 MD 格式

Text Moderation 2.0 upgrades multi-language model capabilities with automatic language detection and expanded language support. It provides moderation policies and a labeling system designed for international business. This topic describes the multi-language service for Text Moderation 2.0 and how to use it.

Features

Compared to the multi-language moderation service of Text Moderation 1.0, Text Moderation 2.0 uses a separate policy and labeling system designed for international business. It also provides additional features to simplify integration and assist manual review.

Feature

Text Moderation 2.0

Text Moderation 1.0

Language support

Supports 38 languages.

Supports 18 languages.

Moderation capabilities

Runs multiple models in parallel, combining language and regional characteristics for more precise policies.

Uses a single model incorporating language characteristics. Its policy balances precision and recall.

Labeling system

Uses an internationalized labeling system with additional labels for profanity and regional content, and supports multiple risk labels and subcategory labels.

Uses the labeling system designed for Chinese-language contexts and supports only a single risk label.

API behavior

Does not require you to specify the input language—it automatically detects the language. After moderation, the service returns the detected language type and an English translation of the content to assist manual review.

Requires you to specify the input language. No translation is returned.

Supported languages

Text Moderation Enhanced Edition supports 38 languages.

Language

Name

Language code

English

English

en

Simplified Chinese

Simplified Chinese

zh

Traditional Chinese

Traditional Chinese

zh-tw

Indonesian

Indonesian

id

Malay

Malay

ms

Thai

Thai

th

Vietnamese

Vietnamese

vi

Tagalog

Tagalog

tl

Hindi

Hindi

hi

Arabic

Arabic

ar

Turkish

Turkish

tr

French

French

fr

German

German

de

Russian

Russian

ru

Portuguese

Portuguese

pt

Spanish

Spanish

es

Italian

Italian

it

Dutch

Dutch

nl

Polish

Polish

pl

Japanese

Japanese

ja

Korean

Korean

ko

Urdu

Urdu

ur

Uyghur

Uyghur

ug

Bengali

Bengali

bn

Persian

Persian

fa

Swedish

Swedish

sv

Danish

Danish

da

Norwegian

Norwegian

no

Icelandic

Icelandic

is

Finnish

Finnish

fi

Belarusian

Belarusian

be

Lithuanian

Lithuanian

lt

Czech

Czech

cs

Slovak

Slovak

sk

Hungarian

Hungarian

hu

Greek

Greek

el

Romanian

Romanian

ro

Irish

Irish

ga

Internationalization labels

The multi-language service of Text Moderation Enhanced Edition uses an internationalized labeling system. If content contains multiple risk categories, the service returns multiple labels simultaneously. The label categories include but are not limited to the following:

Type

Category

Level-1 labels (labels)

  • violence: violence

  • contraband: contraband

  • sexuality: pornography

  • profanity: profanity and abuse

  • pullinTraffic: advertising content

  • regional: regional hostility

  • C_customized: custom library hit

Subcategory labels (riskTips)

Subcategory labels are returned in the xxx_yyy format. For example: contraband_Drugs.

Subcategory labels help identify specific violation reasons and allow you to handle content based on regional compliance requirements. For a complete list of subcategory label types, contact our support team.

Billing methods

Text Moderation Enhanced Edition supports pay-as-you-go and resource package deduction billing.

Pay-as-you-go

After you activate the Text Moderation Enhanced Edition service, the default billing method is pay-as-you-go. You are billed daily based on actual usage. No fees are charged if you do not call the service.

Type

Service

Unit price

Advanced text moderation (text_advanced)

Multi-language detection for international business: comment_multilingual_pro

CNY 15 per 10,000 calls

Resource package deduction

If you have a high moderation volume or relatively consistent moderation needs, we recommend purchasing a resource package. Larger packages offer greater discounts. Multiple packages can be purchased and stacked. For more information, see Purchase a resource package for Content Moderation Enhanced Edition.

This resource package covers Content Moderation Enhanced Edition usage and cannot be shared with Content Security 1.0 traffic packages. The deduction factors are as follows:

Type

Service

Deduction factor

Advanced text moderation (text_advanced)

Multi-language detection for international business: comment_multilingual_pro

The deduction factor is 2, meaning each successful API call deducts 2 units from the resource package capacity.

Note

For example, if your resource package has a capacity of 10 calls, one successful API call deducts 2 calls, leaving a remaining balance of 8 calls.

Integration

Step 1: Activate the service

Go to service activation to activate the Text Moderation 2.0 service.

After you activate the Text Moderation 2.0 service, the default billing method is pay-as-you-go. You are billed daily based on actual usage. No fees are charged if you do not call the service. After you integrate with the API, the system automatically generates bills based on your usage. For more information, see Billing.You can also purchase a resource package. Resource packages offer tiered discounts compared to pay-as-you-go pricing and are suitable for users with predictable or high usage volumes.

Step 2: Grant permissions to a RAM user

Before you integrate the SDK or call the API, you must grant the required permissions to a RAM user. You can create an AccessKey pair for your Alibaba Cloud account or for a RAM user. All API calls require an AccessKey for authentication. For instructions, see Obtain an AccessKey.

Grant permissions to a RAM user

  1. Log on to the RAM console using your Alibaba Cloud account.

  2. Create a RAM user. For details, see Create a RAM user.

  3. Grant the AliyunYundunGreenWebFullAccess system policy to the RAM user. This policy grants full access to Content Moderation. For details, see Manage RAM user permissions.

    The RAM user can now call the Content Moderation API.

Step 3: Integrate the SDK

The following table lists the supported regions. For the Text Moderation Enhanced Edition SDK, see Integration guide.

Region

Public endpoint

VPC endpoint

China (Shanghai)

green-cip.cn-shanghai.aliyuncs.com

green-cip-vpc.cn-shanghai.aliyuncs.com

China (Beijing)

green-cip.cn-beijing.aliyuncs.com

green-cip-vpc.cn-beijing.aliyuncs.com

China (Hangzhou)

green-cip.cn-hangzhou.aliyuncs.com

green-cip-vpc.cn-hangzhou.aliyuncs.com

China (Shenzhen)

green-cip.cn-shenzhen.aliyuncs.com

green-cip-vpc.cn-shenzhen.aliyuncs.com

China (Chengdu)

green-cip.cn-chengdu.aliyuncs.com

N/A

Singapore

green-cip.ap-southeast-1.aliyuncs.com

green-cip-vpc.ap-southeast-1.aliyuncs.com

US (Virginia)

green-cip.us-east-1.aliyuncs.com

green-cip-vpc.us-east-1.aliyuncs.com

US (Silicon Valley)

green-cip.us-west-1.aliyuncs.com

N/A

UK (London)

green-cip.eu-west-1.aliyuncs.com

N/A

Note

If you need SDK sample code in other programming languages, use OpenAPI Explorer to debug API operations online. The tool automatically generates SDK sample code for the corresponding API.

API

Usage

Endpoint: https://green-cip.{region}.aliyuncs.com.

Call this operation to create a text content moderation task. For information about how to construct an HTTP request, see Request structure. You can also use a pre-constructed HTTP request. For more information, see Access guide.

  • Billing:

    This is a paid operation. Only requests that return an HTTP status code of 200 are metered and billed. Requests that return other error codes are not charged. For more information about billing, see Billing methods.

QPS limit

The per-user QPS limit for this operation is 100 calls per second. Exceeding this limit triggers throttling, which may affect your business. Plan your API calls accordingly.

Request parameters

Parameter

Type

Required

Example

Description

Service

String

Yes

comment_multilingual_pro

The moderation service type. Set the value to comment_multilingual_pro for multi-language detection for international business.

ServiceParameters

JSONString

Yes

The parameter set required by the moderation service, in JSON string format. For descriptions of each field, see ServiceParameters.

Table 1. ServiceParameters

Parameter

Type

Required

Example

Description

content

String

Yes

testing content

The text content to moderate. Maximum length: 600 characters.

dataId

String

No

text0424****

The data ID corresponding to the object to moderate.

Contains uppercase and lowercase letters, digits, underscores (_), hyphens (-), and periods (.). Maximum length: 64 characters. Use this to uniquely identify your business data.

accountId

String

No

10123****

The account ID that uniquely identifies an account.

deviceId

String

No

20240307****

The device ID that uniquely identifies a device.

deviceToken

String

No

MzQvo1d7scyZ3tl_RcJ******

The device token obtained through the risk control SDK.

Response parameters

Parameter

Type

Example

Description

Code

Integer

200

The status code. For more information, see Error codes.

Data

JSONObject

The moderation result data. For more information, see Data.

Message

String

OK

The response message for the request.

RequestId

String

AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****

The request ID.

Table 2.Data

Parameter

Type

Example

Description

Labels

String

sexual_content

The risk labels. Multiple labels are separated by commas (,). Valid values:

  • violence: violence

  • contraband: contraband

  • sexuality: sexual content

  • profanity: profanity

  • pullinTraffic: promotional content

  • regional: regional hostility

  • C_customized: custom library hit

Reason

String

{"customizedWords": "HXXXXX","detectedLanguage": "en","riskTips": "sexuality_Suggestive","riskWords": "pxxxxy","translatedContent": "pxxxxy sxxxx, HXXXXX","customizedLibs": "ZXXXXX"}

A JSON string for locating the reason, which includes the following fields:

  • riskLevel: The risk level, returned based on the system-recommended risk level. Valid values:

    • high: high risk

    • medium: medium risk

    • low: low risk

    Note

    High-risk content: take action immediately. Medium-risk content: send for manual review. Low-risk content: handle only when high recall is needed. Otherwise, treat it the same as content with no risk detected.

  • riskTips: Subcategory labels.

  • riskWords: The risk content that was matched.

  • customizedWords: The custom keywords that were matched.

  • customizedLibs: The name of the custom library that was matched.

  • translatedContent: The translated text content. Returned only after the text translation feature is enabled.

    Note

    The text translation feature is currently supported only in the Singapore region. Configure it by managing detection rules in the console. Enabling this feature incurs additional costs. For billing details, see Billing methods.

AccountId

String

10123****

The account ID.

Note

This field is returned only if you pass accountId in the request parameters.

DeviceId

String

20240307****

The device ID.

Note

This field is returned only if you pass deviceId in the request parameters.

Examples

Request example

{
    "Service": "comment_multilingual_pro",
    "ServiceParameters": {
        "content": "testing content",
        "accountId": "10123****",
        "dataId": "text0424****"
    }
}

Response examples:

  • If both custom keywords and risk content are detected:

{
    "Code": 200,
    "Data": {
        "DataId": "text0424****",
        "Labels": "C_customized,profanity",
        "Reason": "{\"riskLevel\":\"high\",\"customizedWords\":\"HXXXXX\",\"detectedLanguage\":\"en\",\"riskTips\":\"sexuality_Suggestive\",\"riskWords\":\"pxxxxy\",\"translatedContent\":\"pxxxxy sxxxx,HXXXXX\",\"customizedLibs\":\"ZXXXXX\"}"
    },
    "Message": "OK",
    "RequestId": "AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****"
}
  • If only custom keywords are detected:

{
    "Code": 200,
    "Data": {
        "DataId": "text0424****",
        "Labels": "C_customized",
        "Reason": "{\"riskLevel\":\"high\",\"customizedWords\":\"HXXXXX\",\"detectedLanguage\":\"en\",\"translatedContent\":\"HXXXXX\",\"customizedLibs\":\"ZXXXXX\"}"
    },
    "Message": "OK",
    "RequestId": "AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****"
}
  • If only risk content is detected:

{
    "Code": 200,
    "Data": {
        "DataId": "text0424****",
        "Labels": "sexuality",
        "Reason": "{\"riskLevel\":\"high\",\"detectedLanguage\":\"ar\",\"riskTips\":\"sexuality_Suggestive\",\"riskWords\":\"pxxxxy\",\"translatedContent\":\"pxxxxy sxxxx\"}"
    },
    "Message": "OK",
    "RequestId": "AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****"
}
  • If neither custom keywords nor risk content are detected:

{
    "Code": 200,
    "Data": {
        "DataId": "text0424****",
        "Labels": "",
        "Reason": "{\"detectedLanguage\":\"en\",\"translatedContent\":\"AXXXXXX\"}"
    },
    "Message": "OK",
    "RequestId": "AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****"
}

Error codes

Code

Status message

Description

200

OK

The request is successful.

400

BAD_REQUEST

Invalid request. Check your request parameters.

407

NOT_SUPPORT

The specified language is not recognized or is unsupported.

408

PERMISSION_DENY

Possible causes: the account is not authorized, has overdue payments, the service is not activated, or the account is disabled.

500

GENERAL_ERROR

An internal server error occurred. Retry the request. If the error persists, contact Support and Services.

581

TIMEOUT

The request timed out. Retry the request. If the error persists, contact Support and Services.

588

EXCEED_QUOTA

The request frequency exceeds the QPS limit.