Створити moderation
Використовуйте CometAPI POST /v1/moderations, щоб перевіряти текст або multimodal input за допомогою OpenAI-сумісного moderation request.
Використовуйте цей endpoint, щоб перевіряти контент, створений користувачами, перш ніж надсилати його до endpoint моделі. Надішліть OpenAI-сумісний moderation request із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 | Контент для перевірки. Використовуйте string для одного текстового input, масив рядків для пакетної перевірки тексту або multimodal parts у стилі OpenAI, як-от текст плюс image_url. |
model | string | Yes | model ID moderation. Використовуйте omni-moderation-latest для moderation тексту та зображень, якщо у вас немає конкретної вимоги до moderation model. |
omni-moderation-latest. Публічні URL зображень мають бути доступні для завантаження серверами CometAPI. Для тесту зображення, який можна легко скопіювати, використовуйте base64 data URL.
Приклади запитів
Надсилайте один текстовий рядок, якщо вам потрібно класифікувати лише один текстовий input:Структура відповіді
Відповідь міститьid, model, results і usage. Кожен елемент у results повідомляє, чи було позначено відповідний input, булеві значення категорій, оцінки категорій і типи input, застосовані до кожної категорії. Для пакетного текстового запиту results містить один елемент на кожен рядок input. Використовуйте 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.