# Alibaba Cloud RAI API

> Alibaba Cloud RAI API on Apizie: 36 endpoints (Detects content in batches asynchronously, Batch content sync detection, Checks whether a user has activated the service and returns the account status, Asynchronously detect a single piece of content, …) returned as clean JSON through one API key. Send your own provider key in the x-upstream-key header. Call it over REST at https://www.apizie.tech/v1/cloud:aliyun-rai/{endpoint} or from Claude, ChatGPT and Cursor through the Apizie MCP server. Free plan: 1,000 requests a month.

- Project key: `cloud:aliyun-rai`
- Category: Cloud
- Status: byok
- Source: https://api.alibabacloud.com/product/rai
- Page: https://www.apizie.tech/api/cloud/aliyun-rai
- OpenAPI: https://www.apizie.tech/api/cloud/aliyun-rai/openapi.json

Alibaba Cloud OpenAPI for RAI (rai, version 2024-07-01). Calls are signed with ACS3-HMAC-SHA256 using your AccessKey ID and secret.

## Endpoints

### Detects content in batches asynchronously
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/batch-content-async-detect` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | The region ID |
| SceneName | string | no | The scenario name |
| ServiceName | string | no | The service name |
| serviceParameterList | string | no | The list of objects to detect (JSON-encoded) |

### Batch content sync detection
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/batch-content-sync-detect` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | Region ID |
| SceneName | string | no | Scenario name |
| ServiceName | string | no | Service name |
| serviceParameterList | string | no | List of batch Content Moderation detection items. The maximum number of items is 20 (JSON-encoded) |

### Checks whether a user has activated the service and returns the account status
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/check-account` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | The region ID |

### Asynchronously detect a single piece of content
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/content-async-detect` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | Region ID |
| SceneName | string | no | Scenario name |
| ServiceName | string | no | Service name |
| serviceParameter | string | no | Detection parameter object (JSON-encoded) |

### Detects a single content synchronization
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/content-sync-detect` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | Region ID |
| SceneName | string | no | Scenario name |
| ServiceName | string | no | Service name |
| serviceParameter | string | no | Detection object (JSON-encoded) |

### Creates a model instance
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/create-model-instance` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| ModelCategoryId | integer | no | Model category ID |
| EasServiceName | string | no | EAS service name |
| EasServiceId | string | no | EAS service ID |
| ModelUrl | string | no | EAS Internet Endpoint |
| ModelVpcUrl | string | no | EAS VPC Endpoint |
| ModelToken | string | no | EAS Token |
| ModelCallName | string | no | Model name parameter in OpenAI API |
| WorkspaceId | integer | no | Workspace ID |

### Creates a detection policy
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/create-policy` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | Region ID |
| PolicyName | string | no | Detection policy name |
| HarmfulCategoryConfigInfoList | string | no | List of harmful category configurations (JSON-encoded) |
| WordGroupInfoList | string | no | List of keyword group objects (JSON-encoded) |
| PromptAttackInfo | string | no | Prompt injection detection result object (JSON-encoded) |
| PromptAttackInfoList | string | no | List of prompt injection detections (JSON-encoded) |
| TopicConfigInfoList | string | no | List of sensitive topics (JSON-encoded) |
| WorkspaceId | integer | no | Workspace ID |
| EnableSensitiveInputCheck | integer | no | The EnableSensitiveInputCheck |
| EnableSensitiveOutputCheck | integer | no | The EnableSensitiveOutputCheck |
| SceneType | integer | no | The SceneType |
| InputSafeAnswer | string | no | The InputSafeAnswer |
| OutputSafeAnswer | string | no | The OutputSafeAnswer |
| InputSafeAnswerSwitch | integer | no | The InputSafeAnswerSwitch |
| OutputSafeAnswerSwitch | integer | no | The OutputSafeAnswerSwitch |
| IsSidecarPolicy | integer | no | The IsSidecarPolicy |
| ContentSafeModelInstanceId | integer | no | The ContentSafeModelInstanceId |
| PromptAttackModelInstanceId | integer | no | The PromptAttackModelInstanceId |
| SensitiveTopicModelInstanceId | integer | no | The SensitiveTopicModelInstanceId |
| SensitiveWordList | string | no | The SensitiveWordList (JSON-encoded) |
| SensitiveConfigList | string | no | The SensitiveConfigList (JSON-encoded) |
| RegularExpressList | string | no | The RegularExpressList (JSON-encoded) |
| SensitiveTopicList | string | no | The SensitiveTopicList (JSON-encoded) |

### Creates a sensitive topic
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/create-topic` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | The region ID |
| TopicName | string | no | The name of the topic to create |
| TopicDefinition | string | no | The definition of the topic |
| WorkspaceId | integer | no | The workspace ID |
| BodyData | string | no | The request object (JSON-encoded) |

### CreateWordGroup
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/create-word-group` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | Region ID |
| GroupName | string | no | Keyword group name |
| Commit | string | no | Whether to commit. false: Not actually saved, only checked true: Commit and save |
| WorkspaceId | integer | no | Workspace ID |
| BodyData | string | no | Request object (JSON-encoded) |

### Delete a model instance
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/delete-model-instance` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| ModelInstanceIdList | string | no | List of instance IDs to delete (JSON-encoded) |

### DeletePolicy
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/delete-policy` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | Region ID |
| PolicyIdList | string | no | List of detection policy IDs (JSON-encoded) |

### Deletes sensitive topics
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/delete-topic` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | The region ID |
| TopicIdList | string | no | A list of IDs of the sensitive topics to delete (JSON-encoded) |

### DeleteWordGroup
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/delete-word-group` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | Region ID |
| GroupIdList | string | no | List of keyword strategy IDs (JSON-encoded) |

### Query the results of an asynchronous content detection task
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/get-content-detect-result` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | Region ID |
| TaskId | string | no | Task ID |

### GetModelInputContentDetectResult
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/get-model-input-content-detect-result` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | Region ID |
| TaskId | string | no | Task ID |

### Retrieves information about a model instance
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/get-model-instance-info` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| ModelInstanceId | integer | no | Model instance ID |
| SceneType | integer | no | Scenario type. Valid values: 0 (input), 1 (output), or 2 (input and output) |

### GetModelOutputContentDetectResult
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/get-model-output-content-detect-result` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | Region ID |
| TaskId | string | no | Task ID |

### GetPolicyDefaultOptions
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/get-policy-default-options` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | Region ID |

### Queries the details of a detection policy
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/get-policy-info` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | Region ID |
| PolicyId | integer | no | Detection policy ID |

### Queries information about a sensitive topic
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/get-topic` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | The region ID |
| TopicId | integer | no | The ID of the sensitive topic |

### GetWordGroup
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/get-word-group` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | Region ID |
| GroupId | integer | no | Keyword group ID |

### Lists model categories
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/list-model-category` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| ModelSource | string | no | Model source. Valid values: 1 for PAI, 2 for other sources |
| ContentSafeTextSupported | integer | no | Indicates whether text content safety detection is supported |
| ContentSafeImageSupported | integer | no | Indicates whether image content safety detection is supported |
| PromptAttackTextSupported | integer | no | Indicates whether prompt injection detection for text is supported |
| SensitiveTopicTextSupported | integer | no | Indicates whether sensitive topic detection for text is supported |
| ModelCategoryName | string | no | Model category name |

### Lists model instances
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/list-model-instance` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | Region ID |
| PageNumber | integer | no | Page number. This value matches the PageNumber parameter in your request |
| PageSize | integer | no | Page size. Maximum number of results to return per page |
| EasServiceName | string | no | EAS service name |
| ModelSource | string | no | Model source. Valid values: 1 (PAI), 2 (other) |
| IsSupportContentSafe | integer | no | Indicates whether content moderation is supported |
| IsSupportPromptAttack | integer | no | Indicates whether prompt injection detection is supported |
| IsSupportSensitiveTopic | integer | no | Indicates whether sensitive topic detection is supported |
| IsSidecarPolicy | integer | no | Policy type. Valid values: 0 (public cloud policy), 1 (sidecar policy) |
| Order | string | no | Sort order. Valid values: asc (default): ascending desc: descending |
| SortBy | string | no | Field to sort by |
| WorkspaceId | integer | no | Workspace ID |

### Query the list of detection policies
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/list-policy` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | Region ID |
| PageNumber | integer | no | Page number |
| PageSize | integer | no | Page size. The maximum number of results displayed per page.Maximum limit: 100 |
| PolicyName | string | no | Policy Name |
| PolicyIdentifier | string | no | Policy Identifier |
| WorkspaceId | integer | no | Workspace ID |
| SortBy | string | no | Sorting field |
| Order | string | no | Sorting method. Valid values: asc (default): Ascending order. desc: Descending order |
| IsSidecarPolicy | integer | no | The IsSidecarPolicy |
| SceneType | integer | no | The SceneType |

### Lists sensitive topics
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/list-topic` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | Region ID |
| PageNumber | integer | no | Page number. Matches the PageNumber in the request |
| PageSize | integer | no | Page size. Maximum number of results to return per page |
| TopicName | string | no | Topic name |
| WorkspaceId | integer | no | Workspace ID |
| SortBy | string | no | Sort field |
| Order | string | no | Sort order. Valid values: asc (default): ascending desc: descending |

### ListWordGroup
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/list-word-group` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | Region ID |
| PageNumber | integer | no | Page number |
| PageSize | integer | no | Page size, the maximum number of results returned per page. Maximum limit: 100 |
| GroupName | string | no | Keyword group name |
| WorkspaceId | integer | no | Workspace ID |
| SortBy | string | no | Sort field |
| Order | string | no | When performing a paginated query, sort the specified field in ascending or descending order. Values are as follows: asc: Ascending. desc:… |

### ModelInputContentAsyncDetect
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/model-input-content-async-detect` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | Region ID |
| SceneName | string | no | Scene name |
| ServiceName | string | no | Service name |
| PolicyIdentifier | string | no | Policy ID |
| BodyData | string | no | Request object (JSON-encoded) |

### Synchronously detects model input content and returns the results
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/model-input-content-sync-detect` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | The region ID |
| SceneName | string | no | The scenario name |
| ServiceName | string | no | The service name |
| PolicyIdentifier | string | no | The policy ID |
| BodyData | string | no | The request object (JSON-encoded) |

### ModelOutputContentAsyncDetect
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/model-output-content-async-detect` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | Region ID |
| SceneName | string | no | Scene name |
| ServiceName | string | no | Service name |
| PolicyIdentifier | string | no | Policy ID |
| BodyData | string | no | Request object (JSON-encoded) |

### Synchronously detects model output content and immediately returns the results
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/model-output-content-sync-detect` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | Region ID |
| SceneName | string | no | Scenario name |
| ServiceName | string | no | Service name |
| PolicyIdentifier | string | no | Policy ID |
| BodyData | string | no | Request object (JSON-encoded) |

### Registers a new user for the service. This operation registers users who are not yet registered
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/register-account` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | The ID of the region |
| Memo | string | no | A note about the user |

### Updates a model instance
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/update-model-instance` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| ModelCategoryId | integer | no | The ID of the model category |
| EasServiceName | string | no | The name of the Elastic Algorithm Service (EAS) service |
| EasServiceId | string | no | The ID of the EAS service |
| ModelUrl | string | no | The Internet endpoint of the EAS service |
| ModelVpcUrl | string | no | The Virtual Private Cloud (VPC) endpoint of the EAS service |
| ModelToken | string | no | The token of the model |
| ModelCallName | string | no | The model name parameter in the OpenAI API |
| Description | string | no | The description of the model |
| ModelInstanceId | integer | no | The ID of the model instance |
| WorkspaceId | integer | no | The ID of the workspace |

### Updates a detection policy
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/update-policy` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | The region ID |
| PolicyId | integer | no | The detection policy ID |
| PolicyName | string | no | The name of the detection policy |
| HarmfulCategoryConfigInfoList | string | no | A list of harmful content classification configurations (JSON-encoded) |
| WordGroupInfoList | string | no | A list of keyword group objects (JSON-encoded) |
| PromptAttackInfo | string | no | The object that contains the prompt injection detection results (JSON-encoded) |
| PromptAttackInfoList | string | no | A list of prompt injection attack configurations (JSON-encoded) |
| TopicConfigInfoList | string | no | A list of sensitive topic configurations (JSON-encoded) |
| EnableSensitiveInputCheck | integer | no | The EnableSensitiveInputCheck |
| EnableSensitiveOutputCheck | integer | no | The EnableSensitiveOutputCheck |
| InputSafeAnswer | string | no | The InputSafeAnswer |
| InputSafeAnswerSwitch | integer | no | The InputSafeAnswerSwitch |
| OutputSafeAnswer | string | no | The OutputSafeAnswer |
| OutputSafeAnswerSwitch | integer | no | The OutputSafeAnswerSwitch |
| IsSidecarPolicy | integer | no | The IsSidecarPolicy |
| ContentSafeModelInstanceId | integer | no | The ContentSafeModelInstanceId |
| PromptAttackModelInstanceId | integer | no | The PromptAttackModelInstanceId |
| SensitiveTopicModelInstanceId | integer | no | The SensitiveTopicModelInstanceId |
| WorkspaceId | integer | no | The WorkspaceId |
| SensitiveWordList | string | no | The SensitiveWordList (JSON-encoded) |
| SensitiveConfigList | string | no | The SensitiveConfigList (JSON-encoded) |
| RegularExpressList | string | no | The RegularExpressList (JSON-encoded) |
| SensitiveTopicList | string | no | The SensitiveTopicList (JSON-encoded) |
| SceneType | integer | no | The SceneType |

### Updates a sensitive topic
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/update-topic` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | The region ID |
| TopicId | integer | no | The ID of the sensitive topic returned after a successful call |
| TopicName | string | no | The name of the topic to create |
| TopicDefinition | string | no | The definition of the sensitive topic |
| BodyData | string | no | The request object (JSON-encoded) |

### UpdateWordGroup
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/update-word-group` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |
| RegionId | string | no | Region ID |
| GroupId | integer | no | Keyword group ID |
| GroupName | string | no | Keyword group name |
| WordInfoListModified | string | no | Whether the keyword information has been modified |
| Commit | string | no | Whether to commit. false: Not actually saved, only checked true: Commit and save |
| BodyData | string | no | Request object (JSON-encoded) |

### version
`POST https://www.apizie.tech/v1/cloud:aliyun-rai/version` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://rai.cn-shanghai.aliyuncs.com |

## Example
```
curl "https://www.apizie.tech/v1/cloud:aliyun-rai/batch-content-async-detect" \
  -H "x-api-key: $APIZIE_KEY" \
  -H "x-upstream-key: $PROVIDER_KEY"
```

## FAQ

### How do I call the Alibaba Cloud RAI API?
Create a free Apizie key, then send POST https://www.apizie.tech/v1/cloud:aliyun-rai/batch-content-async-detect with the header x-api-key. Every endpoint returns { project, data, timestamp }.

### Is the Alibaba Cloud RAI API free on Apizie?
Yes. The Free plan includes 1,000 requests a month at 100 requests a minute, no credit card. Alibaba Cloud RAI itself also needs your own key from aliyuncs.com.

### Can AI agents use the Alibaba Cloud RAI API?
Yes. Add the Apizie MCP server (https://www.apizie.tech/mcp) to Claude, ChatGPT, Cursor or VS Code, then ask in plain language. The agent calls run_scraper with project key cloud:aliyun-rai.

### What is the status of the Alibaba Cloud RAI API?
Needs your own provider key (bring your own key)
