curl --request POST \
--url https://api.apimart.ai/v1/moderations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "omni-moderation-latest",
"input": [
{
"type": "text",
"text": "请审核这张图是否违规"
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg"
}
}
],
"stream": false
}'
import requests
url = "https://api.apimart.ai/v1/moderations"
payload = {
"model": "omni-moderation-latest",
"input": [
{
"type": "text",
"text": "请审核这张图是否违规"
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg"
}
}
],
"stream": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/moderations";
const payload = {
model: "omni-moderation-latest",
input: [
{
type: "text",
text: "请审核这张图是否违规",
},
{
type: "image_url",
image_url: {
url: "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg",
},
},
],
stream: false,
};
const headers = {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
omni-moderation-latest
omni-moderation-latest 内容审核
- 支持文本、图片以及图文混合内容审核
- 兼容单条文本、多条文本数组和内容块数组输入
- 图片支持公网 URL 和 base64 Data URI
POST
/
v1
/
moderations
curl --request POST \
--url https://api.apimart.ai/v1/moderations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "omni-moderation-latest",
"input": [
{
"type": "text",
"text": "请审核这张图是否违规"
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg"
}
}
],
"stream": false
}'
import requests
url = "https://api.apimart.ai/v1/moderations"
payload = {
"model": "omni-moderation-latest",
"input": [
{
"type": "text",
"text": "请审核这张图是否违规"
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg"
}
}
],
"stream": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/moderations";
const payload = {
model: "omni-moderation-latest",
input: [
{
type: "text",
text: "请审核这张图是否违规",
},
{
type: "image_url",
image_url: {
url: "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg",
},
},
],
stream: false,
};
const headers = {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
使用
omni-moderation-latest 对输入内容进行安全审核。该模型属于审核系列,不归类到图像、视频或音频生成系列。
curl --request POST \
--url https://api.apimart.ai/v1/moderations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "omni-moderation-latest",
"input": [
{
"type": "text",
"text": "请审核这张图是否违规"
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg"
}
}
],
"stream": false
}'
import requests
url = "https://api.apimart.ai/v1/moderations"
payload = {
"model": "omni-moderation-latest",
"input": [
{
"type": "text",
"text": "请审核这张图是否违规"
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg"
}
}
],
"stream": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/moderations";
const payload = {
model: "omni-moderation-latest",
input: [
{
type: "text",
text: "请审核这张图是否违规",
},
{
type: "image_url",
image_url: {
url: "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg",
},
},
],
stream: false,
};
const headers = {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
支持的模型
| 模型名 | 说明 | 支持输入 |
|---|---|---|
omni-moderation-latest | 通用内容审核模型 | 文本、图片、图文混合 |
Authorizations
所有接口均需要使用 Bearer Token 进行认证。获取 API Key:访问 API Key 管理页面 获取您的 API Key。使用时在请求头中添加:
Authorization: Bearer YOUR_API_KEY
Body
审核模型名称。
omni-moderation-latest- 通用内容审核模型
待审核内容。支持纯文本、文本数组、内容块数组。内容块数组可包含:
text- 文本内容块image_url- 图片 URL 内容块
是否流式返回。
false:非流式返回(默认,当前仅支持此值,不支持true)
input 请求方式
图文混合
{
"model": "omni-moderation-latest",
"input": [
{
"type": "text",
"text": "请审核这张图是否违规"
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg"
}
}
],
"stream": false
}
纯文本(单条)
{
"model": "omni-moderation-latest",
"input": "I want to kill someone",
"stream": false
}
纯文本(多条数组)
{
"model": "omni-moderation-latest",
"input": [
"hello",
"I hate you"
],
"stream": false
}
纯图片(图片 URL)
{
"model": "omni-moderation-latest",
"input": [
{
"type": "image_url",
"image_url": {
"url": "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg"
}
}
],
"stream": false
}
纯图片(base64 Data URI)
{
"model": "omni-moderation-latest",
"input": [
{
"type": "image_url",
"image_url": {
"url": "data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAA..."
}
}
],
"stream": false
}
使用说明
input为内容块数组时,每个元素通过type区分内容类型。- 图片审核建议使用公网可访问 URL;若使用 base64,请使用标准 Data URI 格式:
data:image/{format};base64,{data}。 - 如无特殊需求,建议统一传
stream: false。
⌘I