跳转到主要内容
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

Authorization
string
必填
所有接口均需要使用 Bearer Token 进行认证。获取 API Key:访问 API Key 管理页面 获取您的 API Key。使用时在请求头中添加:
Authorization: Bearer YOUR_API_KEY

Body

model
string
必填
审核模型名称。
  • omni-moderation-latest - 通用内容审核模型
input
string | string[] | object[]
必填
待审核内容。支持纯文本、文本数组、内容块数组。内容块数组可包含:
  • text - 文本内容块
  • image_url - 图片 URL 内容块
stream
boolean
默认值:"false"
是否流式返回。
  • 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
}

使用说明

  1. input 为内容块数组时,每个元素通过 type 区分内容类型。
  2. 图片审核建议使用公网可访问 URL;若使用 base64,请使用标准 Data URI 格式:data:image/{format};base64,{data}
  3. 如无特殊需求,建议统一传 stream: false