Gemini Safety Settings
The content-filter dial for your calls
- client
- client
Gemini ships with content filters built in, and they don't always agree with what a creative workflow is trying to do. This node is the dial: it attaches safety thresholds to the client, and anything that flows through that client runs with your chosen filter level. It's a pass-through node - client in, configured client out - that sits between Gemini API Config and your generation/vision nodes.
By default Gemini's API blocks or throttles requests it judges against four categories - harassment, hate speech, sexually explicit, dangerous content. Depending on what you're making (and whether you're on a free or paid tier), the stock thresholds either protect you or get in the way. This node lets you set the policy once, per client.
Inputs
- client - required. The
GEMINI_API_CLIENTfrom Gemini API Config (or from a chain of config nodes). - preset -
balanceddefault, with strict/permissive presets pluscustom. - harassment / hate_speech / sexually_explicit / dangerous_content - the per-category thresholds, each defaulting to
medium. These only apply when preset iscustom- the tooltip is explicit about it. In balanced/strict/permissive modes the presets win and your individual picks are ignored.
Output
One output, client - the same client, now carrying your safety config. Wire it into the next node in the chain. Because it's a pass-through, you can also stack it with Gemini System Instruction in either order; both modify the client and both pass it along.
Install
Part of the ERPK Collection:
cd ComfyUI/custom_nodes
git clone https://github.com/eRepublik-Labs/comfyui-nodes-erpk.git erpk
cd erpk && pip install -r requirements.txt
Restart (or ComfyUI Manager → search erpk), Google AI Studio key in Settings > ERPK > API Keys. Free - it changes the client config; the paid cost is on the generation call downstream.
The thing that trips people is the preset/custom split: they set individual thresholds, leave preset on balanced, and see zero effect. Set preset to custom first - that's the switch that makes the per-category dials live. And a reminder that's worth stating: relaxing filters loosens what Gemini will accept, but a blocking model is a blocking model - permissive settings don't unlock things the API categorically refuses.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| client | GEMINI_API_CLIENT | Gemini API client to configure | |
| presetopt | COMBO | balanced | Safety preset or custom configuration |
| harassmentopt | COMBO | medium | Threshold for harassment content (only used if preset=custom) |
| hate_speechopt | COMBO | medium | Threshold for hate speech (only used if preset=custom) |
| sexually_explicitopt | COMBO | medium | Threshold for sexually explicit content (only used if preset=custom) |
| dangerous_contentopt | COMBO | medium | Threshold for dangerous content (only used if preset=custom) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| client | GEMINI_API_CLIENT | — |