☁️moderation text
A content safety gate for your agent pipeline
- flag
- flagged_categories
- text
If you're building anything that takes user input and hands it to an LLM - or takes an LLM's output and shows it to someone else - you eventually want a check somewhere in the middle asking "should this actually go through?" That's what this node does: it calls an OpenAI-format moderation endpoint against a piece of text and tells you whether it tripped any policy category, without you having to write that API call yourself.
The required fields are minimal: is_enable to toggle it on or off, and text - whatever you want checked, typically wired from either a user-prompt input further up your graph (checking input before it reaches your LLM) or an assistant_response output (checking what the model produced before it goes anywhere else, like into the GPT-SoVITS node or out to a chat platform). base_url and api_key are both optional, following the same pattern as the pack's other API-backed nodes: leave them blank to inherit from config.ini, or fill them in on the node if this particular check needs different credentials than the rest of your workflow.
Three outputs come back. flag is the boolean you'll actually branch on - true means something tripped the moderation check. flagged_categories gives you the specific category or categories that triggered it, which is useful if you want different handling for different kinds of violations rather than one blanket "blocked" response. text is a passthrough of the original input, included so you can wire this node inline in a chain without needing a separate branch just to keep the original text flowing alongside the check result.
The natural place to use flag is feeding it into the pack's String Logic node, or into whatever conditional/routing mechanism you're using, to send flagged content down a different path than clean content - a retry, a rejection message, a human review queue, whatever fits your actual use case.
Installing it means installing the pack: search "comfyui_LLM_party" in ComfyUI Manager, or git clone https://github.com/heshengtao/comfyui_LLM_party into custom_nodes and restart, then run pip install -r requirements.txt from inside the pack folder using ComfyUI's own Python (portable installs: python_embeded\python.exe -m pip install -r requirements.txt, not your system pip).
A couple of practical notes. This node is only as good as the moderation endpoint behind it - it's calling out to an external API, so it needs working credentials just like any of the pack's other API nodes, and if base_url/api_key are misconfigured you'll get an error here rather than a useful moderation result, not a silent pass-through. And don't treat a clean flag as a guarantee of anything - automated moderation endpoints are tuned for their provider's own policy categories, which may or may not line up with whatever you actually care about filtering for in your specific application; it's a reasonable first line of defense, not a substitute for actually thinking through what content your workflow should and shouldn't allow through.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| is_enable | BOOLEAN | true | — |
| text | STRING | — | |
| base_urlopt | STRING | — | |
| api_keyopt | STRING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| flag | BOOLEAN | — |
| flagged_categories | STRING | — |
| text | STRING | — |