Skip to main content
POST
Sử dụng endpoint này để kiểm tra nội dung do người dùng tạo trước khi bạn gửi nó đến một endpoint model. Gửi một yêu cầu moderation tương thích OpenAI với giá trị modelinput.
Sử dụng khóa API CometAPI trong bearer header: Authorization: Bearer $COMETAPI_KEY.

Nội dung request

Đối với moderation multimodal, hãy gửi đầu vào multimodal kiểu OpenAI với một model hỗ trợ nó, chẳng hạn như omni-moderation-latest. URL hình ảnh công khai phải có thể được máy chủ CometAPI tải xuống. Để thử nghiệm hình ảnh có thể sao chép, hãy sử dụng một URL dữ liệu base64.

Ví dụ request

Gửi một chuỗi văn bản duy nhất khi bạn chỉ cần phân loại một đầu vào văn bản:
Gửi một mảng chuỗi khi bạn muốn kiểm tra nhiều đầu vào văn bản trong một request:
Gửi văn bản cộng với một URL hình ảnh khi đầu vào moderation của bạn bao gồm một hình ảnh mà CometAPI có thể tải xuống:
Sử dụng một URL dữ liệu base64 khi bạn cần một request hình ảnh tự chứa:

Cấu trúc phản hồi

Phản hồi bao gồm id, model, results, và usage. Mỗi mục trong results cho biết đầu vào tương ứng có bị gắn cờ hay không, các giá trị boolean của danh mục, điểm số danh mục, và các loại đầu vào được áp dụng cho từng danh mục. Với một request văn bản theo lô, results chứa một mục cho mỗi chuỗi đầu vào. Sử dụng usage cho các trường tính phí và giám sát.

Ủy quyền

Authorization
string
header
bắt buộc

CometAPI API key used for model requests. Send it as Authorization: Bearer $COMETAPI_KEY.

Nội dung

application/json
model
string
bắt buộc

Required moderation model ID. Use omni-moderation-latest for text and image moderation unless you have a specific moderation model requirement.

Ví dụ:

"omni-moderation-latest"

input
bắt buộc

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.

Ví dụ:

"I want to check this text before sending it to a model."

Phản hồi

Moderation decisions and token usage.

id
string
bắt buộc

Moderation request ID.

Ví dụ:

"modr-1594"

model
string
bắt buộc

Model used for moderation.

Ví dụ:

"omni-moderation-latest"

results
object[]
bắt buộc

Moderation decisions. For batch text input, this array contains one result per input string.

usage
object
bắt buộc

Token usage for the moderation request.