All Products
Search
Document Center

AI Guardrails:Live Video Stream Moderation API 2.0

Last Updated:Mar 31, 2026

Submits, queries, and cancels asynchronous moderation jobs for live video streams, detecting risky content in video frames and audio.

This document covers three API operations:

OperationPurposeBilled
Submit a live stream moderation jobYes
VideoModerationResultQuery the result of a moderation jobNo
VideoModerationCancelCancel a running moderation jobNo

Prerequisites

Before you begin, ensure that you have:

Submit a moderation job

Operation: VideoModeration

Submits an asynchronous moderation job for a live video stream. Results are not returned immediately. Retrieve them using a callback URL or by polling with VideoModerationResult.

Choose your result retrieval method before submitting:

  • Callback: Specify the callback parameter when submitting. AI Guardrails pushes results to your endpoint as they are detected.

  • Polling: Omit the callback parameter. Call VideoModerationResult at intervals of at least 30 seconds to retrieve results.

Supported regions and endpoints

RegionPublic endpointVPC endpointSupported services
Singaporegreen-cip.ap-southeast-1.aliyuncs.comgreen-cip-vpc.ap-southeast-1.aliyuncs.comliveStreamDetection_global, liveStreamDetectionByVL_global
US (Virginia)https://green-cip.us-east-1.aliyuncs.comhttps://green-cip-vpc.us-east-1.aliyuncs.comliveStreamDetection_global
US (Silicon Valley)green-cip.us-west-1.aliyuncs.comNot available
Germany (Frankfurt)green-cip.eu-central-1.aliyuncs.comNot available

Billing

Charged based on the moderation policies configured for video frames and audio:

  • Video frames: number of snapshots x unit price per service. Multiple frame moderation services can be selected and each is billed separately.

  • Audio: video duration x unit price of the audio moderation feature.

For pricing details, see Billing.

Live stream requirements

  • Supported protocols: RTMP, HLS, HTTP-FLV, RTSP

  • Maximum duration: 24 hours per job. Jobs that exceed this limit end automatically.

Default moderation configurations

Configure moderation rules in the AI Guardrails console. If no rules are configured, the following defaults apply:

ServiceDefault configuration
liveStreamDetection_globalFrame capture: 1 frame/second<br>Frame detection: General baseline detection (baselineCheck_global)<br>Audio detection: Enabled (live_stream_detection_global)<br>Result filter: Returns only results with detected threats
liveStreamDetectionByVL_globalFrame capture: 1 frame/second<br>Frame detection: Image moderation with large and small models (postImageCheckByVL)<br>Audio detection: Enabled (live_stream_detection_cb)<br>Result filter: Returns only results with detected threats<br>
Note

Currently supported only in the Beijing and Shanghai regions. Limited to 10 concurrent ingest endpoints.

QPS limits

  • QPS limit: 100 per user

  • Concurrent stream limit: 50 jobs processed simultaneously

If either limit is exceeded, the API call is throttled. To increase your limits, contact your business manager.

Debugging

Debug the VideoModeration API online in Alibaba Cloud OpenAPI to view sample code, SDK dependency information, and a full parameter overview.VideoModerationCancelVideoModerationResultVideoModeration

Important

Online debugging calls the API using your logged-in account. These calls count toward the billable usage of your account.

Request parameters

NameTypeRequiredExampleDescription
ServiceStringYesliveStreamDetection_globalThe moderation service to use. Valid values: liveStreamDetection_global (standard), liveStreamDetectionByVL_global
  • liveStreamDetection_global: live video stream moderation

  • liveStreamDetectionByVL_global: live video stream moderation (large model edition)

(large model edition).
ServiceParametersJSONStringYesA JSON string containing the parameters for the moderation service. See the following table.

ServiceParameters

NameTypeRequiredExampleDescription
urlStringYeshttp://www.aliyundoc.com/a.flvThe URL of the live stream to moderate. Must be accessible over the Internet, up to 2,048 characters. Cannot contain Chinese characters. Specify only one URL per request.
callbackStringNohttp://www.aliyundoc.comThe URL to receive moderation results. Supports HTTP and HTTPS. The endpoint must accept POST requests with UTF-8 encoded data and the checksum and content form parameters.<br><br>AI Guardrails sets these parameters as follows:<br>- checksum: SHA256 hash of user UID + seed + content. Verify the checksum against this value to confirm the result was not tampered with.
Note

Use your Alibaba Cloud account UID, not a RAM user UID. Find your UID in the Alibaba Cloud Management Console.<br>- content: A JSON-formatted string. Parse and deserialize it to obtain the result object. See the response example under Query moderation results.<br><br>After your callback server returns HTTP 200, the result is considered received. For any other status code, AI Guardrails retries up to 16 times. If the result is still not received after 16 retries, it is no longer pushed. Check your callback endpoint status regularly.<br><br>If left blank, use polling to retrieve results.

seedStringNoabc\*\*\*\*A random string used to sign callback notifications. Can contain letters, digits, and underscores (_), up to 64 characters. Required when using a callback.
cryptTypeStringNoSHA256The encryption algorithm for the callback signature. Valid values:<br>- SHA256 (default): SHA256 algorithm.<br>- SM3: HMAC-SM3 algorithm. Returns a hexadecimal string of lowercase letters and digits. For example, encrypting abc with SM3 returns 66c7f0f462eeedd9d1f2d46bdc10e4e24167c4875cf2f7a2297da02b8f4ba8e0.
dataIdStringNovideoId\*\*\*\*A custom identifier for the object, up to 128 characters. Supports uppercase letters, lowercase letters, digits, underscores (_), hyphens (-), and periods (.). Use this ID to map results back to your business data.
liveIdStringNoliveId\*\*\*\*An ID for the live stream, used to prevent duplicate moderation jobs. If specified, the system checks whether a job is already running for the same uid + service + liveId combination. If one exists, the system returns the TaskId of the existing job instead of starting a new one.

Response parameters

NameTypeExampleDescription
CodeInteger200The status code. See Status codes.
DataJSONObject{"TaskId": "AAAAA-BBBBB"}The result data, containing the TaskId of the submitted job.
MessageStringOKThe response message.
RequestIdStringABCD1234-1234-1234-1234-123\*\*\*\*The request ID.

Example

Request:

{
    "Service": "liveStreamDetection_global",
    "ServiceParameters": {
        "taskId": "abcd****"
    }
}

Response:

{
    "Msg": "OK",
    "Code": 200,
    "Data": {
        "TaskId": "AAAAA-BBBBB",
        "DataId": "videoId****"
    },
    "RequestId": "ABCD1234-1234-1234-1234-123****"
}

Query moderation results

Operation: VideoModerationResult

Queries the results of a live stream moderation job by its TaskId. This operation is free of charge.

Query behavior:

  • Query no sooner than 30 seconds after submitting the job.

  • Results are retained for 24 hours. After that, the result is deleted and the API returns status code 409.

  • If the stream is still running, the last 10 moderation results are returned per query.

  • If the stream has ended, all moderation results are returned.

QPS limits

QPS limit: 100 per user. If exceeded, the API call is throttled.

Debugging

Debug the VideoModerationResult API online in Alibaba Cloud OpenAPI to view sample code and SDK dependency information.

Request parameters

NameTypeRequiredExampleDescription
ServiceStringYesliveStreamDetection_globalThe moderation service type. Must match the value used when submitting the job.
ServiceParametersJSONStringYesA JSON string containing the query parameters. See the following table.

ServiceParameters

NameTypeRequiredExampleDescription
taskIdStringYesabcd\*\*\*\*The task ID of the job to query. Call VideoModeration to get the TaskId from the submit job response. Specify only one task ID per request.

Response parameters

NameTypeExampleDescription
CodeString200The status code. 280 means moderation is in progress; 200 means complete. See Status codes.
MessageStringOKThe response message.
RequestIdStringABCD1234-1234-1234-1234-123\*\*\*\*The request ID, used for troubleshooting.
DataObjectThe moderation result. See the following tables.

Data

NameTypeExampleDescription
DataIdStringvideoId\*\*\*\*The data ID specified in the moderation request. Returned only if dataId was specified.
LiveIdStringliveId\*\*\*\*The live stream ID specified in the moderation request. Returned only if liveId was specified.
TaskIdStringAAAAA-BBBBBThe task ID of the moderation job.
RiskLevelStringhighThe overall risk level, determined from both video frames and audio. Valid values: high, medium, low, none. Act immediately on high-risk content, review medium-risk content manually, and treat low-risk content the same as none unless high recall is required. Configure risk score thresholds in the AI Guardrails console.
FrameResultJSONObjectVideo frame moderation results. See FrameResult below. Status code 280 means moderation is in progress; 200 means complete. Results reflect detections from the start of moderation to the current time while the stream is running.
AudioResultJSONObjectAudio moderation results. See AudioResult below.

FrameResult

NameTypeExampleDescription
FrameNumInteger200The number of snapshots returned.
RiskLevelStringhighThe risk level for video frames, calculated across all snapshots. Valid values: high, medium, low, none.
FrameSummarysJSONArrayA summary of labels across all video frames. See FrameSummarys below.
FramesJSONArrayDetails of frames that matched a label. See Frames below.

FrameSummarys

NameTypeExampleDescription
LabelStringviolent_armedForcesThe detection label.
DescriptionStringSuspected to contain fireworksA description of the label. This field is informational and may change. Base your handling logic on Label, not this field.
LabelSumInteger8The number of times this label was detected.

Frames

NameTypeExampleDescription
TempUrlStringhttp://www.aliyundoc.com/test.jpgA temporary URL to the frame image, valid for 30 minutes. Save the frame promptly. If video evidence storage is enabled, the OSS URL of the stored frame is returned instead.
OffsetFloat50.5The timestamp of the frame relative to the start of the live stream, in seconds.
TimestampInteger1684559739000The absolute timestamp when the frame was processed, in milliseconds.
RiskLevelStringhighThe risk level of this frame. Valid values: high, medium, low, none. Configure risk score thresholds in the AI Guardrails console.
ResultsJSONArrayThe moderation results for this frame, including labels and confidence scores. See Results below.

Results

NameTypeExampleDescription
ServiceStringbaselineCheck_globalThe frame moderation service that produced this result.
ResultArrayThe risk labels and confidence scores for this frame. See Result below.

Result

NameTypeExampleDescription
LabelStringviolent_explosionThe detection label. For supported labels, see General baseline detection supported labels.
ConfidenceFloat81.22The confidence score, from 0 to 100, accurate to two decimal places.
DescriptionStringSuspected to contain fireworksA description of the label. This field is informational and may change. Base your handling logic on Label, not this field.

AudioResult

NameTypeExampleDescription
RiskLevelStringhighThe risk level for audio, calculated across all audio segments. Valid values: high, medium, low, none.
AudioSummarysJSONArrayA summary of labels across all audio. See AudioSummarys below.
SliceDetailsJSONArrayDetails of each transcribed audio segment. See SliceDetails below.

AudioSummarys

NameTypeExampleDescription
LabelStringprofanityThe detection label for audio.
LabelSumInteger8The number of times this label was detected.

SliceDetails

NameTypeExampleDescription
StartTimeInteger0The start time of the audio segment, in seconds.
EndTimeInteger4065The end time of the audio segment, in seconds.
StartTimestampInteger1678854649720The absolute start timestamp of the segment, in milliseconds.
EndTimestampInteger1678854649720The absolute end timestamp of the segment, in milliseconds.
TextStringdisgustingThe text transcribed from the audio segment.
UrlStringhttps://aliyundoc.com/test.wavThe temporary URL of the audio segment, valid for 30 minutes. Save the file promptly.
LabelsStringpolitical_content,xxxxComma-separated detection labels. Valid values: ad, violence, political_content, specified_speaking, specified_lyrics, sexual_content, sexual_sounds, contraband, profanity, religion, cyberbullying, negative_content, nontalk, C_customized.
RiskLevelStringhighThe risk level of this audio segment. Valid values: high, medium, low, none.
RiskWordsStringAAA,BBB,CCCComma-separated risk words detected in the segment.
RiskTipsStringporn_vulgar_words,porn_descriptionComma-separated sub-labels.
ExtendString{"riskTips":"porn_vulgar_words","riskWords":"pornographic_service"}A reserved field.

Examples

Request:

{
    "Service": "liveStreamDetection_global",
    "ServiceParameters": {
        "taskId": "abcd****"
    }
}

Response — video frames only:

{
    "Code": 200,
    "RequestId": "25106421-XXXX-XXXX-XXXX-15DA5AAAC546",
    "Message": "success finished",
    "Data": {
        "DataId": "dc16c28f-xxxx-xxxx-xxxx-51efe0131080",
        "LiveId": "live0307-0728-****",
        "RiskLevel": "high",
        "AudioResult": {
            "AudioSummarys": [
                {
                    "Label": "sexual_sounds",
                    "LabelSum": 3
                }
            ],
            "RiskLevel": "high",
            "SliceDetails": [
                {
                    "EndTime": 60,
                    "EndTimestamp": 1698912813192,
                    "Labels": "",
                    "RiskLevel": "none",
                    "StartTime": 30,
                    "StartTimestamp": 1698912783192,
                    "Text": "AI Guardrails",
                    "Url": "http://abc.oss-ap-southeast-1.aliyuncs.com/test.wav"
                },
                {
                    "EndTime": 30,
                    "EndTimestamp": 1698912813192,
                    "Extend": "{\"customizedWords\":\"service\",\"customizedLibs\":\"test\"}",
                    "Labels": "C_customized",
                    "RiskLevel": "high",
                    "StartTime": 0,
                    "StartTimestamp": 1698912783192,
                    "Text": "Welcome to Alibaba Cloud AI Guardrails service",
                    "Url": "http://abc.oss-ap-southeast-1.aliyuncs.com/test.wav"
                }
            ]
        },
        "FrameResult": {
            "FrameNum": 2,
            "FrameSummarys": [
                {
                    "Label": "violent_explosion",
                    "Description": "Suspected to contain fireworks",
                    "LabelSum": 8
                },
                {
                    "Label": "sexual_cleavage",
                    "Description": "Suspected to contain nudity or sexual content",
                    "LabelSum": 8
                }
            ],
            "RiskLevel": "medium",
            "Frames": [
                {
                    "Offset": 1,
                    "RiskLevel": "none",
                    "Results": [
                        {
                            "Result": [
                                {
                                    "Label": "nonLabel",
                                    "Description": "No risk detected"
                                }
                            ],
                            "Service": "baselineCheck_global"
                        }
                    ],
                    "TempUrl": "http://abc.oss-ap-southeast-1.aliyuncs.com/test1.jpg",
                    "Timestamp": 1704769999000
                },
                {
                    "Offset": 2,
                    "RiskLevel": "medium",
                    "Results": [
                        {
                            "Result": [
                                {
                                    "Confidence": 74.18,
                                    "Label": "violent_explosion",
                                    "Description": "Suspected to contain fireworks"
                                },
                                {
                                    "Confidence": 78.88,
                                    "Label": "sexual_cleavage",
                                    "Description": "Suspected to contain nudity or sexual content"
                                }
                            ],
                            "Service": "baselineCheck_global"
                        }
                    ],
                    "TempUrl": "http://abc.oss-ap-southeast-1.aliyuncs.com/test2.jpg",
                    "Timestamp": 1704769989000
                }
            ]
        }
    }
}

Response — video frames and audio:

{
    "Code": 200,
    "RequestId": "25106421-XXXX-XXXX-XXXX-15DA5AAAC546",
    "Message": "success finished",
    "Data": {
        "DataId": "dc16c28f-xxxx-xxxx-xxxx-51efe0131080",
        "LiveId": "live0307-0728-****",
        "RiskLevel": "high",
        "AudioResult": {
            "AudioSummarys": [
                {
                    "Label": "sexual_sounds",
                    "LabelSum": 3
                }
            ],
            "RiskLevel": "high",
            "SliceDetails": [
                {
                    "EndTime": 60,
                    "EndTimestamp": 1698912813192,
                    "Labels": "",
                    "RiskLevel": "none",
                    "StartTime": 30,
                    "StartTimestamp": 1698912783192,
                    "Text": "AI Guardrails",
                    "Url": "http://abc.oss-ap-southeast-1.aliyuncs.com/test.wav"
                },
                {
                    "EndTime": 30,
                    "EndTimestamp": 1698912813192,
                    "Extend": "{\"customizedWords\":\"service\",\"customizedLibs\":\"test\"}",
                    "Labels": "C_customized",
                    "RiskLevel": "high",
                    "StartTime": 0,
                    "StartTimestamp": 1698912783192,
                    "Text": "Welcome to Alibaba Cloud AI Guardrails service",
                    "Url": "http://abc.oss-ap-southeast-1.aliyuncs.com/test.wav"
                }
            ]
        },
        "FrameResult": {
            "FrameNum": 2,
            "FrameSummarys": [
                {
                    "Label": "violent_explosion",
                    "Description": "Suspected to contain fireworks",
                    "LabelSum": 8
                },
                {
                    "Label": "sexual_cleavage",
                    "Description": "Suspected to contain nudity or sexual content",
                    "LabelSum": 8
                }
            ],
            "RiskLevel": "medium",
            "Frames": [
                {
                    "Offset": 1,
                    "RiskLevel": "none",
                    "Results": [
                        {
                            "Result": [
                                {
                                    "Label": "nonLabel",
                                    "Description": "No risk detected"
                                }
                            ],
                            "Service": "baselineCheck_global"
                        }
                    ],
                    "TempUrl": "http://abc.oss-ap-southeast-1.aliyuncs.com/test1.jpg",
                    "Timestamp": 1704769999000
                },
                {
                    "Offset": 2,
                    "RiskLevel": "medium",
                    "Results": [
                        {
                            "Result": [
                                {
                                    "Confidence": 74.18,
                                    "Label": "violent_explosion",
                                    "Description": "Suspected to contain fireworks"
                                },
                                {
                                    "Confidence": 78.88,
                                    "Label": "sexual_cleavage",
                                    "Description": "Suspected to contain nudity or sexual content"
                                }
                            ],
                            "Service": "baselineCheck_global"
                        }
                    ],
                    "TempUrl": "http://abc.oss-ap-southeast-1.aliyuncs.com/test2.jpg",
                    "Timestamp": 1704769989000
                }
            ]
        }
    }
}

Cancel a moderation job

Operation: VideoModerationCancel

Cancels a running live stream moderation job. This operation is free of charge.

Debugging

Debug the VideoModerationCancel API online in Alibaba Cloud OpenAPI to view sample code and SDK dependency information.

Request parameters

NameTypeRequiredExampleDescription
ServiceStringYesliveStreamDetection_globalThe moderation service type. Must match the value used when submitting the job.
ServiceParametersJSONStringYesA JSON string containing the cancellation parameters. See the following table.

ServiceParameters

NameTypeRequiredExampleDescription
taskIdStringYesabcd\*\*\*\*The task ID of the job to cancel. Call VideoModeration to get the TaskId from the submit job response. Specify only one task ID per request.

Response parameters

NameTypeExampleDescription
CodeInteger200The status code. See Status codes.
MessageStringOKThe response message.
RequestIdStringAAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE\*\*\*\*The request ID.

Example

Request:

Response:

{
    "Msg": "OK",
    "Code": 200,
    "RequestId": "70ED13B0-BC22-576D-9CCF-1CC12FEAC477"
}

Status codes

Requests returning status code 200 or 280 are billed. All other status codes are not billed.

CodeDescription
200Request successful or moderation complete.
280Moderation in progress.
400Request parameters are empty.
401Request parameters are invalid.
402A parameter value exceeds the allowed length. Check the parameter and try again.
403QPS limit exceeded. Reduce the number of concurrent requests and try again.
404Failed to download the video. Check the stream URL and try again.
405Video download timed out. The stream may be inaccessible. Check the stream URL and try again.
406Video file is too large. Check the video size and try again.
407Video format not supported. Check the format and try again.
408Not authorized. Your account may not have the service activated, may have an overdue payment, or may not have the required permissions.
409The specified task ID does not exist. The result may have expired after 24 hours.
480Concurrent stream limit exceeded. Reduce the number of concurrent jobs and try again.
500System error.