All Products
Search
Document Center

AI Guardrails:Image Moderation with LLMs

Last Updated:Sep 09, 2026

Image Moderation 2.0 uses a custom-trained Qwen large language model (LLM) combined with expert models to detect non-compliant content in images, including pornography, suggestive content, politically sensitive content, violence and terrorism, contraband, religious content, ad traffic and spam, inappropriate content, and other risk categories. The service also supports returning raw LLM results. This topic describes how to activate and call the image moderation service.

Image moderation models are under active development. Contact your business manager to provide feedback.

How it works

Image Moderation 2.0 uses a custom-trained Qwen LLM based on image content risk characteristics, providing the following image moderation services:

  • 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.

  • China Mainland Edition of the Large and Small Model Fusion Image Moderation Service (postImageCheckByVL_ec):

    Uses large models and expert models to comprehensively detect non-compliant content in images, including pornography, suggestive material, political content, violence and terrorism, prohibited items, religious content, spam, and other harmful content.Image moderation service tailored for the Chinese mainland region, providing fine-grained risk labels and localized content understanding. For details on the detection categories, see Rules.

For the US (Virginia), Germany (Frankfurt), and China (Hong Kong) regions, LLM inference runs in Singapore. Data and logs are stored locally in the respective regions (Frankfurt and Hong Kong).

Select your service

Service

Description

Supported regions

Use cases

Image Moderation for Large and Small Model Integration(postImageCheckByVL_global)

Combines an LLM 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 low false positive and false negative rates.

Singapore, China (Hong Kong), US (Virginia), Germany (Frankfurt)

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.

postImageCheckByVL_ec

Designed for cross-border businesses entering the Chinese mainland. Extends the Image Moderation for Large and Small Model Integration service with optimizations for Chinese-language context and domestic regulatory compliance requirements.

China (Shanghai), China (Hangzhou), China (Beijing), China (Shenzhen), China (Chengdu)

  • Cross-border platforms and overseas applications that need to moderate Chinese-language content.

  • Overseas businesses that must meet Chinese mainland compliance requirements.

The detection capabilities of postImageCheckByVL_cb cover all detection capabilities of baselineCheck_cb, and additionally provide 12 detection labels (such as pornographic_underage, QRCode, and ). Some risk labels use different names between the two services, for example: pornographic_art (baselineCheck_cb) vs. pornographic_artwork (postImageCheckByVL_cb), sexual_shoulder (baselineCheck_cb) vs. sexual_femaleShoulder (postImageCheckByVL_cb), and violent_blood (baselineCheck_cb) vs. violent_bloody (postImageCheckByVL_cb). To obtain the original label names, call the two services separately.

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 AliyunYundunGreenWebFullAccess policy

  • An AccessKey pair for authentication

Get started

Step 1: Activate the service

Visit the service activation page and activate Image Moderation 2.0. After activation, the default billing method is pay-as-you-go. Fees are settled daily based on actual usage. You are not charged if you do not call the service. For details on the billing methods, see Billing.

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.

  1. Log on to the RAM console using your Alibaba Cloud account or as a RAM administrator.

  2. Create a RAM user. See Create a RAM user.

  3. Attach the AliyunYundunGreenWebFullAccess policy to the RAM user. 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 following table lists all supported regions and endpoints:

Region

Public endpoint

VPC endpoint

Supported service

China (Shanghai)

green-cip.cn-shanghai.aliyuncs.com

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

postImageCheckByVL_ec

China (Hangzhou)

green-cip.cn-hangzhou.aliyuncs.com

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

postImageCheckByVL_ec

China (Beijing)

green-cip.cn-beijing.aliyuncs.com

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

postImageCheckByVL_ec

China (Shenzhen)

green-cip.cn-shenzhen.aliyuncs.com

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

postImageCheckByVL_ec

China (Chengdu)

green-cip.cn-chengdu.aliyuncs.com

N/A

postImageCheckByVL_ec

Singapore

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

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

postImageCheckByVL_global

Malaysia (Kuala Lumpur)

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

N/A

Indonesia (Jakarta)

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

N/A

China (Hong Kong)

green-cip.cn-hongkong.aliyuncs.com

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

US (Virginia)

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

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

Germany (Frankfurt)

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

green-cip-vpc.eu-central-1.aliyuncs.com

Important

In the Germany (Frankfurt) and China (Hong Kong) regions, LLM inference runs in the Singapore region. Data and logs are stored locally in the respective regions (Frankfurt and Hong Kong).

Note

The UK (London), Malaysia (Kuala Lumpur), and Indonesia (Jakarta) regions reuse the console configuration of the Singapore region. The US (Silicon Valley) region reuses the console configuration of the US (Virginia) region.

Step 4: Configure detection rules (optional)

In the Content Moderation console, configure detection rules: enable or disable detection categories, copy a service, configure a custom image library, configure a custom glossary, query detection records, and review usage data. See Console guide.

API reference

API overview

  • API: ImageModeration

  • Service code: postImageCheckByVL_global, postImageCheckByVL_ec

  • QPS limit: 50 calls/second per user. Exceeding this limit throttles requests. Contact your business manager for a quota increase.

  • Billing: Billed per successful request (HTTP 200), settled daily. Pricing varies by service. For details, see the Billing section.

Debug the API

Before integration, you can use Alibaba Cloud OpenAPI online debugging to try the and Image Moderation 2.0 APIs. You can also view sample code and SDK dependency information to obtain an overview of how to use these APIs and their parameters.

Important

API calls through the online debugger are billed.

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

Submit an image using one of the following methods 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 values:

  • postImageCheckByVL_global: Image Moderation for Large and Small Model Integration

  • postImageCheckByVL_ec: Hybrid Model Image Moderation Service

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. Alphanumeric characters, underscores, hyphens, and periods. Max 64 characters.

infoType

String

No

customImage

Specifies additional information to return. Valid values: customImage (returns custom image library match details). Separate multiple values with commas.

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. Used for troubleshooting.

Code

Integer

200

The status code.

Msg

String

OK

The response message.

Data

Object

Detection results.

Data fields

Parameter

Type

Example

Description

RiskLevel

String

high

Overall risk level, based on the highest-risk label. Valid values: high, medium, low, none.

DataId

String

img123******

Data ID from the request. Returned only if dataId was specified in the request.

Result

Array

Array of detected risk labels. Each entry contains Label, Confidence, Description, and RiskLevel.

Ext

Object

Supplementary information, including custom library matches.

Result fields

Parameter

Type

Example

Description

Label

String

violent_explosion

Risk label. A single image can match multiple labels.

Confidence

Float

81.22

Confidence score (0–100, two decimal places). Higher score means higher confidence.

Description

String

Fireworks content

Human-readable label description. Use Label — not Description — to determine actions, as this field may change.

RiskLevel

String

high

Risk level for this label, based on configured score thresholds. Valid values: high, medium, low, none.

Ext fields

Parameter

Type

Description

CustomImage

JSONArray

Custom library match details. Returned when a submitted image matches a library entry.

CustomImage fields

Parameter

Type

Example

Description

LibId

String

lib0001

ID of the matched custom library.

LibName

String

Custom Image Library A

Name of the matched custom library.

ImageId

String

20240307

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 (0–100). Higher score means higher confidence. Enable or disable individual labels in the Content Moderation console.

Understanding risk levels and handling results

Each label has a RiskLevel and Confidence. The RiskLevel in the Data object reflects the highest risk across all 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: 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 console to match your platform's tolerance for false positives versus false negatives.

Store returned risk labels and confidence scores. Use them to prioritize manual review, build annotation datasets, and apply tiered governance policies.

Label reference

Labels are grouped into the categories below. The _tii suffix indicates text detected within the image (text-in-image), not visual content.

Pornographic content (pornographic_*)

Label

Description

pornographic_adultContent

Image suspected to contain pornographic content.

pornographic_adultToys

Image suspected to contain adult toy content.

pornographic_artwork

Image suspected to contain erotic artwork content.

pornographic_underage

Image suspected to contain underage pornographic content.

pornographic_adultContent_tii

Image text suspected to contain pornographic content.

Sexually suggestive content (sexual_*)

Label

Description

sexual_suggestiveContent

Image suspected to contain vulgar or sexual hint content.

sexual_breastBump

Image suspected to contain nipple outline content.

sexual_cleavage

Image suspected to contain female cleavage features.

sexual_femaleUnderwear

Image suspected to contain underwear or swimsuit content.

sexual_maleTopless

Image suspected to contain male shirtless content.

sexual_femaleShoulder

Image suspected to contain shoulder sexy content.

sexual_femaleLeg

Image suspected to contain leg sexy content.

sexual_pregnancy

Image suspected to contain pregnancy or breastfeeding content.

sexual_cartoon

Image suspected to contain cartoon sexy content.

sexual_underage

Image suspected to contain underage sexy content.

sexual_feet

Image suspected to contain foot sexy content.

Politically sensitive content (political_*)

Label

Description

political_historicalNihility

Image suspected to involve historical nihilism or inappropriate historical events.

political_historicalNihility_tii

Image text suspected of historical nihilism.

political_politicalFigure_metaphor_tii

Image text suspected to contain metaphor or alias for key leaders.

political_politicalFigure_name_tii

Image text contains leader names.

political_prohibitedPerson_tii

Image text suspected to contain names of fallen officials.

political_taintedCelebrity_tii

Image text suspected to contain names of tainted celebrities.

political_taintedCelebrity

Image suspected to contain tainted or heavily negative public figures.

political_Chinaflag

Image suspected to contain Chinese national flag.

political_otherflag

Image suspected to contain other national flags.

political_Chinamap

Image suspected to contain Chinese map.

political_logo

Image suspected to contain banned media logos.

political_outfit

Image suspected to contain military or police uniforms.

political_badge

Image suspected to contain national or party emblems.

political_politicalFigure_1

Image suspected to contain current or former leaders.

political_politicalFigure_2

Image suspected to involve leader family members.

political_politicalFigure_3

Image suspected to involve provincial or municipal government personnel.

political_politicalFigure_4

Image suspected to involve foreign leaders and family members.

political_prohibitedPerson_1

Image suspected to contain national-level fallen officials.

political_prohibitedPerson_2

Image suspected to contain provincial or municipal-level fallen officials.

political_racism_tii

Image text suspected to contain racist expressions.

political_medicalOutfit

Image suspected to contain medical attire.

Violence and terrorism (violent_*)

Label

Description

violent_crowding

Image suspected to contain crowd gathering.

violent_explosion

Image suspected to contain fireworks or explosion elements.

violent_armedForces

Image suspected to contain armed forces elements.

violent_gun

Image suspected to contain firearms.

violent_knives

Image suspected to contain knives.

violent_gunKnives_tii

Image text contains firearm or knife descriptions.

violent_blood

Image suspected to contain bloody content.

violent_horrific

Image suspected to contain horrific content.

violent_horrific_tii

Image text suspected to describe violence or terror content.

violent_burning

Image suspected to contain burning content.

violent_ACU

Image suspected to contain combat uniforms.

Contraband (contraband_*)

Label

Description

contraband_drug

Image suspected to involve drugs or medicines.

contraband_drug_tii

Image text suspected to describe drugs, contraband, or prohibited items.

contraband_gamble

Image suspected to contain gambling items.

contraband_gamble_tii

Image text suspected to describe gambling behavior.

contraband_certificate_tii

Image text suspected to contain certificate or cash-out adtraffic diversion.

contraband_illegal

Image suspected to contain contraband items.

contraband_illegal_tii

Image text suspected to contain contraband descriptions.

Religious content (religion_*)

Label

Description

religion_funeral

Image suspected to contain funeral or memorial hall content.

religion_buddhism

Image suspected to contain Buddhist or Taoist attire or symbols.

religion_christianity

Image suspected to contain Christian attire or symbols.

religion_muslim

Image suspected to contain Muslim attire or symbols.

religion_tii

Image text contains religious elements or information.

Flags

Label

Description

political_Chinaflag

Image suspected to contain Chinese national flag.

political_otherflag

Image suspected to contain other national flags.

Spam and promotional content (pt_*)

Label

Description

pt_logotoSocialNetwork

Image suspected to contain common social network platform watermarks.

pt_qrCode

Image suspected to contain QR codes.

pt_programCode

Image suspected to contain mini program codes.

pt_toDirectContact_tii

Image text contains contact information for traffic diversion.

pt_toSocialNetwork_tii

Image text contains social platform traffic diversion information.

pt_toShortVideos_tii

Image text contains short video platform traffic diversion information.

pt_investment_tii

Image text contains investment or financial advertising information.

pt_recruitment_tii

Image text contains part-time recruitment advertising information.

Inappropriate behavior (inappropriate_*)

Label

Description

inappropriate_smoking

Smoking.

inappropriate_drinking

Drinking.

inappropriate_tattoo

Tattoo.

inappropriate_middleFinger

Middle finger gesture.

inappropriate_foodWasting

Food wasting content.

inappropriate_underage

Underage content.

Profanity (profanity_*)

Label

Description

profanity_oral_tii

Image text contains vulgar or offensive language.

profanity_offensive_tii

Image text contains severe abusive content.

Custom image library labels

Configure a custom image library in the console. When a submitted image matches a library image, the system returns the label with a _lib suffix (for example, violent_explosion_lib). The Confidence score reflects 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

Request succeeded.

400

A required parameter is empty.

401

A parameter value is invalid.

402

A parameter exceeds the maximum length. Correct and retry.

403

QPS limit exceeded. Reduce concurrency and retry.

404

Image download failed. Check the URL or retry.

405

Image download timed out. Verify accessibility and retry.

406

Image file too large. Resize and retry.

407

Unsupported image format. Use a supported format and retry.

408

Insufficient permissions. Verify service activation, no overdue payments, and RAM user has the required policy.

500

Internal system error. Retry later.

Billing

Image Moderation 2.0 LLM image moderation service supports pay-as-you-go billing. Requests returning non-200 status codes are not charged.

Pay-as-you-go

After activating Image Moderation 2.0, the default billing method is pay-as-you-go. Fees are settled daily based on actual usage. You are not charged if you do not call the service.

Billing category

Included service

Unit price

Image Moderation advanced (image_advanced)

  • Image Moderation for Large and Small Model Integration: postImageCheckByVL_global

USD 1.20 per 1,000 calls

Note

Each call to any of the services listed on the left counts as one billing unit. Fees are based on actual usage. For example, 100 calls to the Image Moderation for Large and Small Model Integration service cost USD 0.12.

Image Moderation China Mainland Edition (image_vl_standard_cn)

  • Hybrid Model Image Moderation Service: postImageCheckByVL_ec

USD 0.70 per 1,000 calls

Note

Content Moderation 2.0 pay-as-you-go billing is settled once daily (within 24 hours). In bill details, the moderationType field identifies the moderation type. View your bill details.

Resource plan deduction

For large-volume or consistent moderation needs, purchase a resource plan in advance. Larger plans offer greater discounts. You can purchase and use multiple plans at the same time. For more information, see Purchase a resource plan for Content Moderation Enhanced Edition.

This resource plan applies to Content Moderation Enhanced Edition. It cannot be shared with the resource plans for Content Moderation 1.0. The deduction ratios are as follows:

Type

Deduction ratio

Image Moderation advanced (image_advanced)

Deduction ratio: 4. Each API call deducts 4 from your resource plan quota.

Example: a 100-call quota minus one API call leaves a balance of 96 calls.

Image Moderation China Mainland Edition (image_vl_standard_cn)

Deduction ratio: 2.34. Each API call deducts 2.34 from your resource plan quota.

Example: a 100-call quota minus one API call leaves a balance of 97.66 calls.

Resource plan quota is applied before pay-as-you-go billing. When the quota is exhausted, usage is billed on a pay-as-you-go basis. Monitor your resource plan balance and pay-as-you-go bills. You can set up low-balance alerts in the Resource Plan system of the Alibaba Cloud User Center.

What's next