Image Moderation 2.0 uses a custom-trained Qwen large model combined with expert models to detect non-compliant content in images — including pornography, sexually suggestive material, politically sensitive content, violence, terrorism, contraband, religious content, spam, and other undesirable content. This topic describes how to set up and call the image moderation service.
The large model for image moderation is in active development. Contact your business manager with feedback or suggestions.
How it works
All requests use the ImageModeration API operation with the postImageCheckByVL_global service code. Submit an image by URL, OSS reference, or direct upload. The service runs inference in the Singapore region and returns a list of risk labels with confidence scores and an overall risk level.
For Virginia and Frankfurt regions, inference runs in Singapore, but data and logs are stored locally in the respective regions.
Service selection
| Service | Description | Supported regions | Use cases |
|---|---|---|---|
Image Moderation for Large and Small Model Integration (postImageCheckByVL_global) | Combines a large model and expert models to provide more granular labels, such as pornography subcategories, specific behaviors, and specific objects. Offers a wider detection range and richer labels. Provides the best overall performance with low false positive and false negative rates. | Singapore | Social media, live streaming, gaming, e-commerce, and education businesses that require strict risk control and fine-grained policies. Businesses that need detailed risk labels. Highly recommended for new users with high performance requirements. |
Prerequisites
Before you begin, ensure that you have:
An active Image Moderation 2.0 subscription (pay-as-you-go)
An Alibaba Cloud account or a RAM user with the
AliyunYundunGreenWebFullAccesspolicyAn AccessKey pair for authentication
Get started
Step 1: Activate the service
Go to the service activation page and activate Image Moderation 2.0. After activation, billing defaults to pay-as-you-go — you are only charged for API calls that return HTTP 200.
Step 2: Grant permissions to a RAM user
Create an AccessKey pair for your Alibaba Cloud account or a RAM user. The RAM user must have the AliyunYundunGreenWebFullAccess policy to call Content Moderation APIs.
Log on to the RAM console using your Alibaba Cloud account or as a RAM administrator.
Create a RAM user. For details, see Create a RAM user.
Attach the
AliyunYundunGreenWebFullAccesspolicy to the RAM user. For details, see Manage permissions for RAM users.
Step 3: Install the SDK
Follow the Image Moderation SDK and integration guide to install the SDK and configure your endpoint.
The service is available in three regions:
| Region | Public endpoint | VPC endpoint | Supported service |
|---|---|---|---|
| Asia Pacific SE 1 (Singapore) | green-cip.ap-southeast-1.aliyuncs.com | green-cip-vpc.ap-southeast-1.aliyuncs.com | postImageCheckByVL_global |
| US East 1 (Virginia) | green-cip.us-east-1.aliyuncs.com | green-cip-vpc.us-east-1.aliyuncs.com | |
| Europe Central 1 (Frankfurt) | green-cip.eu-central-1.aliyuncs.com | green-cip-vpc.eu-central-1.aliyuncs.com |
In the Virginia and Frankfurt regions, large model inference runs in the Singapore region. Data and logs are stored locally in the respective regions.
Step 4: Configure detection rules (optional)
In the Content Moderation consoleContent Moderation consoleContent Moderation consoleContent Moderation console, adjust detection rules: enable or disable detection categories, configure a custom image library, query detection records, and review usage data. For details, see Console guide.
API reference
API overview
Operation:
ImageModerationService code:
postImageCheckByVL_globalglobal_globalQPS limit: 50 calls/second per user. Exceeding this limit throttles requests. Contact your business manager for a quota increase.
Billing: Charged per successful request (HTTP 200). USD 1.20 per 1,000 calls, settled daily.
Image Moderation for Large and Small Model Integration:
Combines large and expert models to detect a wide range of non-compliant content in images, such as pornography, suggestive material, politically sensitive content, violence, terrorism, prohibited items, religious content, spam, and other undesirable content. (Note: All large model inference is processed in the Singapore region.) For details on the detection categories, see Rules.
postImageCheckByVL_global: Image Moderation for Large and Small Model Integration
Debug the API
Test the API before integrating using Alibaba Cloud OpenAPI. The tool generates sample code and SDK dependency information.
API calls made through the online debugger count toward your billed usage.
Image requirements
| Constraint | Limit |
|---|---|
| Supported formats | PNG, JPG, JPEG, BMP, WEBP, TIFF, SVG, HEIC (longest edge < 8,192 px), GIF (first frame), ICO (last image) |
| Max file size | 20 MB |
| Max dimensions | 16,384 px (height or width); 250 million total pixels |
| Optimal resolution | At least 200 x 200 px (lower resolutions reduce accuracy) |
| Download timeout | 3 seconds |
| URL restrictions | Publicly accessible; max 2,048 characters; no Chinese characters; one URL per request |
Submit an image
Image Moderation 2.0 supports three ways to submit an image. Choose one per request:
| Method | Required parameters | Notes |
|---|---|---|
| URL | imageUrl | URL must be publicly accessible |
| OSS authorization | ossBucketName, ossObjectName, ossRegionId | Grant AliyunCIPScanOSSRole on the Cloud Resource Access Authorization page |
| Local upload | Upload via SDK | File is deleted 30 minutes after upload; does not consume OSS storage. See the Image Moderation SDK guide for code examples. |
Request parameters
The request body is a JSON object. For required common request parameters, see the Integration guide.
Top-level parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
Service | String | Yes | postImageCheckByVL_global | The detection service. Valid value: postImageCheckByVL_global (Image Moderation for Large and Small Model Integration). |
ServiceParameters | JSONString | Yes | — | A JSON string containing the content detection parameters. |
ServiceParameters fields
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
imageUrl | String | Conditional | https://img.alicdn.com/tfs/TB1U4r9AeH2gK0jSZJnXXaT1FXa-2880-480.png | The URL of the image to moderate. Required when submitting by URL. |
ossBucketName | String | Conditional | bucket_01 | The name of the authorized Object Storage Service (OSS) bucket. Required when submitting by OSS. |
ossObjectName | String | Conditional | 2022023/04/24/test.jpg | The object key of the image in the OSS bucket. Required when submitting by OSS. |
ossRegionId | String | Conditional | cn-beijing | The region where the OSS bucket is located. Required when submitting by OSS. |
dataId | String | No | img123**** | A unique identifier to associate the result with your business data. Accepts letters, digits, underscores (_), hyphens (-), and periods (.). Max 64 characters. |
infoType | String | No | customImage | Additional information to return. Valid value: customImage (returns custom image library match details). |
referer | String | No | www.aliyun.com | The Referer request header, used for hotlink protection. Max 256 characters. |
Request example
{
"Service": "postImageCheckByVL_global",
"ServiceParameters": {
"imageUrl": "https://img.alicdn.com/tfs/TB1U4r9AeH2gK0jSZJnXXaT1FXa-2880-480.png",
"dataId": "img0307****"
}
}Response parameters
Top-level response fields
| Parameter | Type | Example | Description |
|---|---|---|---|
RequestId | String | 70ED13B0-BC22-576D-9CCF-1CC12FEAC477 | The unique request ID generated by Alibaba Cloud for troubleshooting. |
Code | Integer | 200 | The status code. |
Msg | String | OK | The response message. |
Data | Object | — | The detection results. |
Data fields
| Parameter | Type | Example | Description |
|---|---|---|---|
RiskLevel | String | high | The overall risk level of the image, based on the highest-risk label. Valid values: high, medium, low, none. |
DataId | String | img123****** | The data ID of the moderated image. Returned only if dataId was specified in the request. |
Result | Array | — | An array of detected risk labels. Each entry contains Label, Confidence, Description, and RiskLevel. |
Ext | Object | — | Supplementary information, including custom image library matches. |
Result fields
| Parameter | Type | Example | Description |
|---|---|---|---|
Label | String | violent_explosion | The risk label. A single image can match multiple labels. |
Confidence | Float | 81.22 | The confidence score (0–100, two decimal places). A higher score indicates higher confidence. |
Description | String | Fireworks content | A human-readable description of the label. Use Label — not Description — to determine what action to take, as this field may change. |
RiskLevel | String | high | The risk level for this label, based on configured score thresholds. Valid values: high, medium, low, none. |
Ext fields
| Parameter | Type | Description |
|---|---|---|
CustomImage | JSONArray | Details about custom image library matches. Returned when a submitted image matches an entry in your custom image library. |
CustomImage fields
| Parameter | Type | Example | Description |
|---|---|---|---|
LibId | String | lib0001 | The ID of the matched custom image library. |
LibName | String | Custom Image Library A | The name of the matched custom image library. |
ImageId | String | 20240307 | The ID of the matched image in the library. |
Response example
{
"RequestId": "70ED13B0-BC22-576D-9CCF-1CC12FEAC477",
"Code": 200,
"Msg": "OK",
"Data": {
"RiskLevel": "high",
"DataId": "img0307****",
"Result": [
{
"Label": "violent_explosion",
"Confidence": 92.40,
"Description": "Fireworks content",
"RiskLevel": "high"
},
{
"Label": "violent_burning",
"Confidence": 67.15,
"Description": "Burning scenes",
"RiskLevel": "medium"
}
],
"Ext": {}
}
}Request and response examples are formatted for readability. Actual API responses do not include line breaks or indentation.
Risk labels
The service returns risk labels grouped by category. Each label has a confidence score from 0 to 100 — a higher score indicates higher confidence. Enable or disable individual labels in the Content Moderation consoleContent Moderation consoleContent Moderation consoleContent Moderation console.
Understanding risk levels and handling results
Each label has an individual RiskLevel and Confidence score. The RiskLevel in the Data object reflects the highest risk across all returned labels.
Use RiskLevel to guide your moderation workflow:
| Risk level | Recommended action |
|---|---|
high | Block or remove content immediately |
medium | Route to manual review |
low | Process only if your use case requires high recall; otherwise treat as no risk |
none | No risk detected |
Tuning confidence thresholds: The default risk score thresholds determine when a label is assigned high, medium, or low. Lowering a threshold increases recall (fewer missed violations) but also increases false positives. Raising a threshold improves precision but may miss some violations. Adjust thresholds per label in the Content Moderation consoleContent Moderation consoleContent Moderation consoleContent Moderation console to match your platform's tolerance for false positives versus false negatives.
Store the risk labels and confidence scores returned by the system for a defined period. Use them to prioritize content for manual review, build annotation datasets, and apply tiered governance policies based on risk category.
Label reference
Labels are grouped into the categories below. The _tii suffix indicates that the label applies to text detected within the image (text-in-image), rather than the visual content itself.
Pornographic content (pornographic_*)
| Label | Description |
|---|---|
pornographic_adultContent | Adult pornographic content |
pornographic_cartoon | Pornographic cartoon content |
pornographic_adultToys | Adult toys |
pornographic_artwork | Pornographic artwork |
pornographic_underage | Child pornography |
pornographic_adultContent_tii | Pornographic text in the image |
pornographic_suggestive_tii | Vulgar text in the image |
pornographic_o_tii | LGBT-related text in the image |
pornographic_organs_tii | Text describing sexual organs in the image |
pornographic_adultToys_tii | Text about adult toys in the image |
Sexually suggestive content (sexual_*)
| Label | Description |
|---|---|
sexual_suggestiveContent | Vulgar or sexually suggestive content |
sexual_femaleUnderwear | Underwear or swimwear |
sexual_cleavage | Female cleavage |
sexual_maleTopless | Topless males |
sexual_cartoon | Sexually suggestive cartoon content |
sexual_femaleShoulder | Suggestive content featuring female shoulders |
sexual_femaleLeg | Suggestive content featuring female legs |
sexual_pregnancy | Maternity photos or breastfeeding |
sexual_feet | Suggestive content featuring feet |
sexual_kiss | Kissing |
sexual_intimacy | Intimate behavior |
sexual_intimacyCartoon | Intimate acts in cartoons or anime |
Politically sensitive content (political_*)
| Label | Description |
|---|---|
political_historicalNihility | Content related to historical nihilism or sensitive historical events |
political_historicalNihility_tii | Text related to historical nihilism |
political_politicalFigure_1 | Current or former leaders |
political_politicalFigure_2 | Family members of leaders |
political_politicalFigure_3 | Provincial or municipal government officials |
political_politicalFigure_4 | Foreign leaders or their family members |
political_politicalFigure_name_tii | Names of leaders in image text |
political_prohibitedPerson_1 | Disgraced national-level officials |
political_prohibitedPerson_2 | Disgraced provincial- or municipal-level officials |
political_prohibitedPerson_tii | Names of disgraced officials in image text |
political_taintedCelebrity | Public figures involved in scandals or major negative events |
political_taintedCelebrity_tii | Names of scandal-involved celebrities in image text |
political_CNFlag | The national flag of China |
political_CNMap | A map of China |
political_logo | Logos of banned media outlets |
political_outfit | Military or police uniforms, or combat attire |
political_badge | National or party emblems |
political_racism_tii | Special expressions in image text. See the Content Moderation consoleContent Moderation consoleContent Moderation consoleContent Moderation console for details. |
Violence and terrorism (violent_*)
| Label | Description |
|---|---|
violent_explosion | Fireworks or explosions |
violent_armedForces | Terrorist organizations |
violent_burning | Burning scenes |
violent_weapon | Military equipment |
violent_crowding | Crowd gatherings |
violent_gun | Guns |
violent_knives | Knives |
violent_horrific | Horrific content |
violent_nazi | Nazi-related content |
violent_bloody | Bloody content |
violent_extremistGroups_tii | Text related to terrorist organizations |
violent_extremistIncident_tii | Text related to terrorist incidents |
violence_weapons_tii | Text describing firearms, ammunition, or weapons |
violent_ACU | Combat uniforms |
Contraband (contraband_*)
| Label | Description |
|---|---|
contraband_drug | Illegal drugs or medication |
contraband_drug_tii | Text describing illegal drugs |
contraband_gamble | Gambling-related items |
contraband_gamble_tii | Text describing gambling activities |
contraband_certificate_tii | Spam or ads for fake certificates or cash-out services in image text |
Religious content (religion_*)
| Label | Description |
|---|---|
religion_flag | Religious flags or symbols |
religion_clothing | Specific attire or symbols. See the Content Moderation consoleContent Moderation consoleContent Moderation consoleContent Moderation console for details. |
religion_logo | |
religion_taboo1_tii | |
religion_taboo2_tii |
Flags
| Label | Description |
|---|---|
flag_country | Flag-related content |
Spam and promotional content (pt_*)
| Label | Description |
|---|---|
pt_logotoSocialNetwork | Watermarks from social media platforms |
QR code | QR codes |
pt_logo | Logos |
pt_toDirectContact_tii | Contact information used for spam in image text |
pt_custom_01 | Custom label 01 |
pt_custom_02 | Custom label 02 |
Inappropriate behavior (inappropriate_*)
| Label | Description |
|---|---|
inappropriate_smoking | Smoking-related content |
inappropriate_drinking | Drinking-related content |
inappropriate_tattoo | Tattoos |
inappropriate_middleFinger | Middle finger gesture |
inappropriate_foodWasting | Food waste |
Profanity (profanity_*)
| Label | Description |
|---|---|
profanity_oral_tii | Profanity or vulgar slang in image text |
profanity_offensive_tii | Severely abusive language in image text |
Custom image library labels
Configure a custom image library for any risk category in the console. When a submitted image is highly similar to an image in your library, the system returns the corresponding label with a _lib suffix (for example, violent_explosion_lib). The Confidence score reflects the degree of similarity.
No-risk labels
| Label | Confidence score | Description |
|---|---|---|
nonLabel | Not returned | No threats detected, or all detection categories are disabled. |
nonLabel_lib | 0–100 | The image is highly similar to an exempted image in your custom library. |
Status codes
Requests are billed only for status code 200.
| Code | Description |
|---|---|
200 | The request succeeded. |
400 | A required request parameter is empty. |
401 | A request parameter is invalid. |
402 | A request parameter exceeds the allowed length. Correct the length and retry. |
403 | The request exceeds the QPS limit. Reduce request concurrency and retry. |
404 | Failed to download the image. Check the image URL or retry. |
405 | Image download timed out. Verify the image is accessible and retry. |
406 | The image file is too large. Resize the image and retry. |
407 | The image format is not supported. Use a supported format and retry. |
408 | The account lacks permission. Verify that the service is activated, the account has no overdue payments, and the RAM user has the required policy. |
500 | A system error occurred. |
Billing
Image Moderation 2.0 uses pay-as-you-go billing. Fees are settled daily based on actual usage. Requests that return non-200 status codes are not charged.2.02.02.02.0242.0
| Billing category | Included service | Unit price |
|---|---|---|
Image Moderation advanced (image_advanced) | postImageCheckByVL_global | USD 1.20 per 1,000 calls |
Example: 100 calls to the postImageCheckByVL_global service cost USD 0.12.
In bill details, the moderationType field identifies the moderation type. View your bill details.