创建审核
使用 CometAPI POST /v1/moderations 通过与 OpenAI 兼容的审核请求来检查文本或多模态(Multimodal)输入。
在将用户生成内容发送到模型端点之前,使用此端点进行检查。发送一个与 OpenAI 兼容的审核请求,其中包含Documentation Index
Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt
Use this file to discover all available pages before exploring further.
model 和 input 值。
Authorization: Bearer <COMETAPI_KEY>。请求体
| Field | Type | Required | Description |
|---|---|---|---|
input | string or array | Yes | 要检查的内容。单条文本输入使用字符串,批量文本检查使用字符串数组,或者使用 OpenAI 风格的多模态部分,例如文本加上 image_url。 |
model | string | Yes | 审核 model ID。除非你有特定的审核模型要求,否则文本和图像审核请使用 omni-moderation-latest。 |
omni-moderation-latest。公开图片 URL 必须能够被 CometAPI 服务器下载。若要进行可复制的图片测试,请使用 base64 data URL。
请求示例
当你只需要对单条文本输入进行分类时,发送一个文本字符串:响应结构
响应包含id、model、results 和 usage。results 中的每一项都会报告对应 input 是否被标记、类别布尔值、类别分数,以及应用于各类别的输入类型。对于批量文本请求,results 会为每个输入字符串包含一项。使用 usage 获取计费和监控字段。授权
CometAPI API key used for model requests. Send it as Authorization: Bearer <COMETAPI_KEY>.
请求体
Required moderation model ID. Use omni-moderation-latest for text and image moderation unless you have a specific moderation model requirement.
"omni-moderation-latest"
Content to check. Use a string for one text input, an array of strings for batch text checks, or OpenAI-style multimodal parts such as text plus image_url when the selected model supports it.
"I want to check this text before sending it to a model."
响应
Moderation decisions and token usage.
Moderation request ID.
"modr-1594"
Model used for moderation.
"omni-moderation-latest"
Moderation decisions. For batch text input, this array contains one result per input string.
Token usage for the moderation request. Additional provider accounting fields can be present.