NAME
OpenAPI::Client::OpenAI::Path::moderations - Documentation for the /moderations path.
OPERATIONS
POST /moderations
createModeration
$client->create_moderation({
body => { ... },
});
Classifies if text and/or image inputs are potentially harmful. Learn more in the moderation guide .
Request body
Content-Type: application/json
Example:
{
"id" : "modr-AB8CjOTu2jiq12hp1AQPfeqFWaORR",
"model" : "text-moderation-007",
"results" : [
{
"categories" : {
"harassment" : true,
"harassment/threatening" : true,
"hate" : false,
"hate/threatening" : false,
"self-harm" : false,
"self-harm/instructions" : false,
"self-harm/intent" : false,
"sexual" : false,
"sexual/minors" : false,
"violence" : true,
"violence/graphic" : false
},
"category_scores" : {
"harassment" : 0.521563529968262,
"harassment/threatening" : 0.569474577903748,
"hate" : 0.22706663608551,
"hate/threatening" : 0.0235473290085793,
"self-harm" : 2.22711992137192e-06,
"self-harm/instructions" : 1.11987552564585e-09,
"self-harm/intent" : 1.6469409729325e-06,
"sexual" : 1.17260124170571e-05,
"sexual/minors" : 7.10735221787218e-08,
"violence" : 0.997113466262817,
"violence/graphic" : 3.39182988682296e-05
},
"flagged" : true
}
]
}
Responses
200 - OK
Content-Type: application/json
Example:
{
"id" : "modr-AB8CjOTu2jiq12hp1AQPfeqFWaORR",
"model" : "text-moderation-007",
"results" : [
{
"categories" : {
"harassment" : true,
"harassment/threatening" : true,
"hate" : false,
"hate/threatening" : false,
"self-harm" : false,
"self-harm/instructions" : false,
"self-harm/intent" : false,
"sexual" : false,
"sexual/minors" : false,
"violence" : true,
"violence/graphic" : false
},
"category_scores" : {
"harassment" : 0.521563529968262,
"harassment/threatening" : 0.569474577903748,
"hate" : 0.22706663608551,
"hate/threatening" : 0.0235473290085793,
"self-harm" : 2.22711992137192e-06,
"self-harm/instructions" : 1.11987552564585e-09,
"self-harm/intent" : 1.6469409729325e-06,
"sexual" : 1.17260124170571e-05,
"sexual/minors" : 7.10735221787218e-08,
"violence" : 0.997113466262817,
"violence/graphic" : 3.39182988682296e-05
},
"flagged" : true
}
]
}
SCHEMAS
CreateModerationRequest
Properties:
input(oneOf, required) - Input (or inputs) to classify. Can be a single string, an array of strings, or an array of multi-modal input objects similar to other models.model(anyOf) - The content moderation model you would like to use. Learn more in the moderation guide , and learn about available models here .Default: omni-moderation-latest
CreateModerationResponse
Properties:
id(string, required) - The unique identifier for the moderation request.model(string, required) - The model used to generate the moderation results.results(array of object, required) - A list of moderation objects.
SEE ALSO
COPYRIGHT AND LICENSE
Copyright (C) 2023-2026 by Nelson Ferraz
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.0 or, at your option, any later version of Perl 5 you may have available.