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.
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 một model endpoint. Gửi một yêu cầu moderation tương thích OpenAI với giá trị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 và input.
Authorization: Bearer <COMETAPI_KEY>.Request body
| Field | Type | Required | Description |
|---|---|---|---|
input | string hoặc array | Yes | Nội dung cần kiểm tra. Dùng một string cho một đầu vào văn bản, một array các string để kiểm tra hàng loạt văn bản, hoặc các phần multimodal theo kiểu OpenAI như văn bản cộng với image_url. |
model | string | Yes | model ID moderation. Sử dụng omni-moderation-latest cho moderation văn bản và hình ảnh trừ khi bạn có yêu cầu cụ thể về model moderation. |
omni-moderation-latest. URL hình ảnh công khai phải có thể được máy chủ CometAPI tải xuống. Để kiểm thử hình ảnh có thể sao chép, hãy dùng một base64 data URL.
Request examples
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:Response shape
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 category, điểm số category và các kiểu đầu vào được áp dụng cho từng category. Đối 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. Additional provider accounting fields can be present.