Moderations
Classify text against a set of safety categories. Use this to pre-filter user input before sending it to a generative model, or to post-filter model output before showing it to users.
POST
/v1/moderationsRequest
📋Request
1{
2 "model": "your-moderation-model",
3 "input": "I want to learn about chemistry."
4}Parameters
modelstringrequired
Moderation model id (type: moderation).
inputstring | string[]required
Text to classify. Send an array to classify multiple inputs at once.
Response
📋200 OK
1{
2 "id": "modr-abc123",
3 "model": "your-moderation-model",
4 "results": [
5 {
6 "flagged": false,
7 "categories": {
8 "sexual": false,
9 "hate": false,
10 "harassment": false,
11 "self-harm": false,
12 "violence": false
13 },
14 "category_scores": {
15 "sexual": 0.0001,
16 "hate": 0.0008,
17 "harassment": 0.0003,
18 "self-harm": 0.0002,
19 "violence": 0.0014
20 }
21 }
22 ]
23}ℹ
Multimodal moderation
Models with the
multimodalModeration capability also accept image and audio inputs in the same shape used by chat content parts.