Reference · Tools
OpenAI Moderation
Classify text for harmful content using OpenAI\
OpenAI Moderation screens text against harmful content categories — sexual, hate, harassment, self-harm and violence — returning a top-level flagged boolean plus per-category flags and confidence scores. A typical build is checking user-submitted content before it is stored or displayed.
- Node type
- Action
- Parameters
- 5
- Outputs
- Output, Error
- Credentials
- OpenAI
OpenAI Moderation
Classify text for harmful content using OpenAI’s moderation models.
Overview
OpenAI Moderation calls the OpenAI Moderations API (POST /moderations) to classify text for harmful content categories such as sexual, hate, harassment, self-harm, violence, and more. Returns flagged status, per-category boolean flags, and per-category confidence scores. Model selection is configurable. Each input item is classified independently. Results are placed in a configurable output field (default: “moderation”) along with a top-level “flagged” boolean.
Category: AI
Tool Name: openai_moderation
Version: 1
Appearance: Icon: openai | Color: #10a37f
Node Type
Action — processes input items and produces output
Input / Output
| Direction | Port(s) |
|---|---|
| Input | Input |
| Output | Output, Error |
Credentials
This tool requires OpenAI credentials. See the Credentials Guide for setup instructions.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| Model | options | No | (current default) | The moderation model to use for classification. Always uses the latest version (auto-updated). |
| Options: the OpenAI moderation models available to your workspace — pick one from the dropdown. | ||||
| Text | string | Yes | — | The text to classify for harmful content. Falls back to item.json.text or item.json.content if empty. Supports expressions. |
| Options | collection | No | {} | Optional output settings — add only the fields you need. |
| — Response Field Name | string | No | moderation | Field name in the output JSON where the moderation results will be placed. |
| Include Input | boolean | No | false | Whether to include the original input item fields in the output alongside the moderation results. |
| Max Concurrency | number | No | 10 | Maximum number of items to process concurrently. |
Output Data
One output item per input item. The full result lands on the field named by Response Field Name (moderation by default), and the overall verdict is repeated at the top level as flagged so you can branch on it directly. The rest of the input item JSON is dropped unless Include Input is on; binary data on the input item is forwarded unchanged.
{
"moderation": {
"flagged": false,
"categories": { "hate": false, "violence": false },
"categoryScores": { "hate": 0.0002, "violence": 0.0011 }
},
"flagged": false
}
categoriesholds one boolean per harm category the model evaluated;categoryScoresholds the matching confidence score for each. The exact category names come from the moderation model.flaggedistruewhen any category tripped. Wire it into a Switch or Filter node to gate the rest of the pipeline.
Reference the result downstream by expression, e.g. {{ $json.flagged }}.
Usage Examples
- Check user-generated content for policy violations
- Filter incoming messages for harmful content before processing
- Classify text as safe or flagged with per-category scores
- Screen customer reviews for hate speech or harassment
- Build a content moderation pipeline for user submissions
Example Configuration
Screen each item’s text with the defaults:
{
"type": "openai_moderation",
"parameters": {
"text": "{{ $json.text }}"
}
}
Moderate at volume and keep the original record for routing:
{
"type": "openai_moderation",
"parameters": {
"text": "{{ $json.comment }}",
"includeInput": true,
"maxConcurrency": 25,
"options": {
"responseFieldName": "safety"
}
}
}
Error Handling
| Mode | Behavior |
|---|---|
| stop | Halts workflow on first error |
| continue | Skips failed items, passes successful ones through |
| errorPort | Routes failed items to Error output port |
Tips
OpenAI Moderation classifies text against harmful content categories including sexual, hate, harassment, self-harm, and violence by calling the OpenAI Moderations API. Use it when a workflow needs to screen user-generated content before storing, routing, or displaying it to enforce content safety policies. It outputs a top-level flagged boolean along with a configurable moderation field containing per-category boolean flags and confidence scores for every evaluated harm category.
Frequently asked questions
What exactly does it return?
A top-level `flagged` boolean plus a configurable moderation field containing per-category boolean flags and confidence scores for every evaluated category — so you can act on the overall verdict or on a specific category.
How should I act on the result?
Branch on `flagged` with an If node for a simple gate, or threshold on individual category scores when you need a stricter or looser policy for particular harms.
Where does it belong in a workflow?
Before content is stored, routed or displayed — screening at the point of ingestion is far easier than removing content after the fact.
Which credential does it need?
An OpenAI credential.
Build with the OpenAI Moderation node
Drop it into a workflow, wire it to an agent, or call it on a schedule. You'll need OpenAI credentials first.
Open BusyBotLast updated . Spotted something wrong? Tell us.