Nodes/ComfyUI_AITECCAFE_Toolkit/🛡️ AITEC Image Moderation
ComfyUI Node

🛡️ AITEC Image Moderation

An OpenAI moderation call that can black out flagged images mid-workflow

By AI-TEC·Created about a year ago·Updated about a month ago· 4
🛡️ AITEC Image Moderation
  • image
  • image
  • moderation_result
api_keysk-proj-...
output_format
language
block_flaggedfalse

If you run a batch workflow that renders images unattended and you want a guardrail before anything gets saved or posted, AITEC Image Moderation is a one-node trip to OpenAI's omni-moderation-latest - with the useful twist that it can replace a flagged image with a black frame so nothing bad flows downstream.

Mechanically it's straightforward: the node base64-encodes your image as a JPEG, sends it to the moderation API, and gets back scores across 13 categories - harassment, hate, illicit, self-harm, sexual, violence, and their variants, sexual_minors included. It then formats the result as text and hands you both the (possibly blocked) image and that text. It's not cheap-and-free like the pack's local NSFW Checker; every call costs you API credits, and the image is uploaded to OpenAI, so it's not a fit for private batch pipelines.

The inputs that actually matter:

  • api_key - your OpenAI key. The node rejects the placeholder sk-proj-... and any key shorter than 20 chars, which is a nice touch.
  • block_flagged - the big one. On, a flagged image is replaced with a solid black frame of the same size before it leaves the node; off, the image passes through untouched and you just get the report.
  • output_format - detail gives a text breakdown with a per-category ASCII bar chart; simple is one line plus the top category; JSON gives you the raw scores as parseable JSON.
  • language - English or Japanese (the author's pack is JP-first, so the Japanese output is actually the more polished of the two).

Outputs: image (the original or the black frame) and moderation_result (STRING) with the verdict. Note the block only activates when OpenAI's own flagged flag is set - this is not a threshold slider like the local NSFW node; you get OpenAI's call or nothing.

Installing it pulls in the pack-wide dependencies, which for this node's sake is mostly just openai:

cd ComfyUI/custom_nodes
git clone https://github.com/AI-TEC/ComfyUI-AITECCAFE-Toolkit
pip install -r ComfyUI-AITECCAFE-Toolkit/requirements.txt

or search "AITECCAFE" in ComfyUI Manager. The requirements.txt also installs tensorflow and opennsfw2 for the pack's other nodes - you're stuck with that overhead even if moderation is all you wanted.

Two cautions, both from the README and both worth taking seriously. First, the same API-key-in-workflow warning as the pack's ChatGPT node: keys are stored as plain text in the workflow, so never share a saved workflow with a key in it. Second, the author's own note: treat the scores as a rough reference, not gospel. Moderation models misclassify - that's true of omni-moderation too. For a no-cost, no-key alternative that runs entirely locally, the pack's AITEC NSFW Checker is the counterpart; this node is the stricter, API-backed option with the finer-grained category breakdown.

CategoryAITECCAFE-Toolkit

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
api_keySTRINGsk-proj-...
output_formatCOMBO3 options: detail, simple, JSON
languageCOMBO2 options: English, Japanese
block_flaggedBOOLEANfalse

Outputs (2)

NameTypeDescription
imageIMAGE
moderation_resultSTRING