<!-- BusyBot node reference — https://busybot.net/tools/openai-moderation/ -->

> Node: OpenAI Moderation (`openai_moderation`) · Action · v1
> Category: AI · Credentials: OpenAI (`openai`)
> Updated: 2026-08-16

# 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](https://busybot.net/credentials/openai/) 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.

```json
{
  "moderation": {
    "flagged": false,
    "categories": { "hate": false, "violence": false },
    "categoryScores": { "hate": 0.0002, "violence": 0.0011 }
  },
  "flagged": false
}
```

- `categories` holds one boolean per harm category the model evaluated; `categoryScores` holds the matching confidence score for each. The exact category names come from the moderation model.
- `flagged` is `true` when 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:

```json
{
  "type": "openai_moderation",
  "parameters": {
    "text": "{{ $json.text }}"
  }
}
```

Moderate at volume and keep the original record for routing:

```json
{
  "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.