Tạo một moderation
Sử dụng CometAPI POST /v1/moderations để kiểm tra văn bản hoặc đầu vào multimodal bằng một yêu cầu moderation tương thích OpenAI.
model và input.
Authorization: Bearer $COMETAPI_KEY.Nội dung request
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:Cấu trúc phản hồi
Phản hồi bao gồmid, 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
CometAPI API key used for model requests. Send it as Authorization: Bearer $COMETAPI_KEY.
Nội dung
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."
Phản hồi
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.