内容安全
curl --request POST \
--url https://open.bigmodel.cn/api/paas/v4/moderations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "moderation",
"input": "审核内容安全样例字符串。"
}
'import requests
url = "https://open.bigmodel.cn/api/paas/v4/moderations"
payload = {
"model": "moderation",
"input": "审核内容安全样例字符串。"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: 'moderation', input: '审核内容安全样例字符串。'})
};
fetch('https://open.bigmodel.cn/api/paas/v4/moderations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://open.bigmodel.cn/api/paas/v4/moderations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"moderation\",\n \"input\": \"审核内容安全样例字符串。\"\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://open.bigmodel.cn/api/paas/v4/moderations"
payload := strings.NewReader("{\n \"model\": \"moderation\",\n \"input\": \"审核内容安全样例字符串。\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://open.bigmodel.cn/api/paas/v4/moderations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'moderation',
'input' => '审核内容安全样例字符串。'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"id": "<string>",
"created": 123,
"request_id": "<string>",
"result_list": [
{
"content_type": "<string>",
"risk_level": "<string>",
"risk_type": [
"<string>"
]
}
],
"usage": {
"moderation_text": {
"call_count": 123
}
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}工具 API
内容安全
可对文本、图片、音频、视频格式类型的内容进行检测,精准识别涉黄、涉暴、违法违规等风险内容,并输出结构化审核结果(包括内容类型、风险类型及具体风险内容片段),快速定位和处理违规信息。点击 Try it 按钮可快速试用。
POST
/
paas
/
v4
/
moderations
内容安全
curl --request POST \
--url https://open.bigmodel.cn/api/paas/v4/moderations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "moderation",
"input": "审核内容安全样例字符串。"
}
'import requests
url = "https://open.bigmodel.cn/api/paas/v4/moderations"
payload = {
"model": "moderation",
"input": "审核内容安全样例字符串。"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: 'moderation', input: '审核内容安全样例字符串。'})
};
fetch('https://open.bigmodel.cn/api/paas/v4/moderations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://open.bigmodel.cn/api/paas/v4/moderations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"moderation\",\n \"input\": \"审核内容安全样例字符串。\"\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://open.bigmodel.cn/api/paas/v4/moderations"
payload := strings.NewReader("{\n \"model\": \"moderation\",\n \"input\": \"审核内容安全样例字符串。\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://open.bigmodel.cn/api/paas/v4/moderations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'moderation',
'input' => '审核内容安全样例字符串。'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"id": "<string>",
"created": 123,
"request_id": "<string>",
"result_list": [
{
"content_type": "<string>",
"risk_level": "<string>",
"risk_type": [
"<string>"
]
}
],
"usage": {
"moderation_text": {
"call_count": 123
}
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Body
application/json
Was this page helpful?
⌘I