NanoBanana - Safety Settings
Turn Gemini's content filters up or down, per category
- safety_settings_json
Google's Gemini API ships with a set of content filters on by default, and they're real - the closed-source models like Nano Banana are "aggressive, opaque" with their safety filtering, as the community likes to complain. This node is your control panel for that filtering. It takes four per-category threshold dropdowns and emits a JSON string you feed into the safety_settings_json input of the pack's generative nodes.
It doesn't do any generation itself. It's pure config plumbing: pick thresholds, get JSON, wire it in. Which makes it a two-minute setup you'll be glad exists the first time a perfectly innocent prompt gets refused because the default thresholds are stricter than your use case - or the first time you want them more strict for a workflow that runs unattended.
How it works
Gemini's safety system is organized into four harm categories, and each one has a threshold you can set. The node maps four dropdowns to those categories:
- harassment → HARM_CATEGORY_HARASSMENT
- hate_speech → HARM_CATEGORY_HATE_SPEECH
- sexually_explicit → HARM_CATEGORY_SEXUALLY_EXPLICIT
- dangerous_content → HARM_CATEGORY_DANGEROUS_CONTENT
Each has the same four threshold options: BLOCK_NONE, BLOCK_ONLY_HIGH, BLOCK_MEDIUM_AND_ABOVE, BLOCK_LOW_AND_ABOVE. BLOCK_LOW_AND_ABOVE is the strictest (blocks even low-confidence matches), BLOCK_NONE disables filtering for that category entirely. Default is BLOCK_MEDIUM_AND_ABOVE across the board, which is the standard middle ground.
The node serializes your choices into a JSON list of {category, threshold} objects and outputs it as the safety_settings_json string. That string is what you plug into any NanoBanana node that exposes a safety_settings_json input - ImageGen, TextGen, and friends. If you've never touched this, don't: leave the generative node's input empty and Google's defaults apply.
One genuinely thoughtful detail in the pack: if you hand a generative node a malformed safety JSON string, it raises an error rather than silently continuing with filters not applied. That's the correct behavior - a well-formed-but-unapplied filter is how you get output you thought was being blocked.
Installation
Part of the NanoBanana2 pack - install once, use everywhere:
cd ComfyUI/custom_nodes
git clone https://github.com/IxMxAMAR/ComfyUI-NanoBanana2
pip install google-genai
Or search NanoBanana2 in ComfyUI Manager. Restart, and the node lives under NanoBanana2/Config.
Gotchas
Two things worth internalizing. First, BLOCK_NONE is exactly as risky as it sounds - set it and the category isn't filtered, so think before you loosen anything on a workflow that processes arbitrary input. Second, this node configures the Gemini-side filters only. The Imagen endpoint (separate node, separate API) has its own safety_filter_level and person_generation settings, and the Developer API is notably pickier about which levels it accepts - if you're fighting Imagen refusals, that's a different control than this one.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| harassment | COMBO | BLOCK_MEDIUM_AND_ABOVE | Threshold for harassment content. |
| hate_speech | COMBO | BLOCK_MEDIUM_AND_ABOVE | Threshold for hate speech content. |
| sexually_explicit | COMBO | BLOCK_MEDIUM_AND_ABOVE | Threshold for sexually explicit content. |
| dangerous_content | COMBO | BLOCK_MEDIUM_AND_ABOVE | Threshold for dangerous content. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| safety_settings_json | STRING | — |