Gemini 3 安全设置
Loosening the leash, up to Google's actual limits
- response
- safety_ratings
Every Gemini call ships with default safety thresholds, and every so often a legitimate prompt trips one and the whole answer comes back as a block. Gemini3SafetySettings exists for that moment: it's the same text-generation node, but with the four content-category thresholds exposed as dropdowns so you can tune exactly how aggressive the filter is. The safety_ratings output tells you what the model actually thought about your content, which is more transparency than you get from the default nodes.
But let's be straight about what this can and can't do, because this is where people get burned. The thresholds map to Google's safetySettings - you can set a category to BLOCK_NONE and Google will still enforce whatever it enforces at the model and policy layer (external-api-nodes.md puts it plainly: the filter follows the model, not the node). There is no "fully uncensored" setting on a closed API, and no amount of threshold loosening changes that. What this node gives you is control over the configurable layer and a clear view of what got blocked and why.
How it works
The four required inputs are the thresholds for Google's harm categories: harassment_threshold, hate_speech_threshold, sexually_explicit_threshold, and dangerous_content_threshold. Each is one of BLOCK_NONE, BLOCK_ONLY_HIGH, BLOCK_MEDIUM_AND_ABOVE (default), or BLOCK_LOW_AND_ABOVE. The node maps them onto HARM_CATEGORY_HARASSMENT (etc.) in the request's safetySettings. When a call is blocked, the node reports the block reason from promptFeedback instead of failing silently, and dumps the model's own safety ratings to the safety_ratings output.
Inputs and outputs that matter
- The four threshold dropdowns - start by moving one category to
BLOCK_ONLY_HIGHorBLOCK_NONEand see if it clears the block; don't nuke all four out of the gate. promptand the standard auth/model/thinking fields.
Outputs: response (the content, or a block-reason message) and safety_ratings (JSON of per-category ratings with confidence scores - genuinely useful for diagnosing which category tripped).
Install
Standard pack install. ComfyUI Manager (search "ComfyUI-Gemini-3") or:
cd ComfyUI/custom_nodes
git clone https://github.com/xuchenxu168/ComfyUI-Gemini-3
cd ComfyUI-Gemini-3
pip install -r requirements.txt
No downloads. Google AI Studio key via api_key field, config.json, or GEMINI_API_KEY.
Common issues
BLOCK_NONEdoesn't unblock everything - expected. The node controls the configurable threshold layer; model-level and policy refusals still stand. If you genuinely need uncensored output, a local model is the answer, and no Gemini node is.- Block message with an empty response - the node returns
content blocked: <reason>plus the ratings; the reason string is your clue to which category fired and whether a threshold change would even help. - Ratings without context -
safety_ratingsshows confidence levels per category. ANEGLIGIBLErating with a block means the block came from elsewhere in Google's policy, not from the four thresholds you control. - Don't leave everything at BLOCK_NONE - besides not working the way people hope, it can trigger the API's own guardrails in ways that are harder to debug than a normal block. Loosen only what your workflow actually trips.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | 生成内容... | — |
| api_provider | COMBO | 1 options: google | |
| api_key | STRING | — | |
| model | COMBO | gemini-3-pro-preview | 1 options: gemini-3-pro-preview |
| thinking_level | COMBO | high | 2 options: high, low |
| harassment_threshold | COMBO | BLOCK_MEDIUM_AND_ABOVE | 4 options: BLOCK_NONE, BLOCK_ONLY_HIGH, BLOCK_MEDIUM_AND_ABOVE, BLOCK_LOW_AND_ABOVE |
| hate_speech_threshold | COMBO | BLOCK_MEDIUM_AND_ABOVE | 4 options: BLOCK_NONE, BLOCK_ONLY_HIGH, BLOCK_MEDIUM_AND_ABOVE, BLOCK_LOW_AND_ABOVE |
| sexually_explicit_threshold | COMBO | BLOCK_MEDIUM_AND_ABOVE | 4 options: BLOCK_NONE, BLOCK_ONLY_HIGH, BLOCK_MEDIUM_AND_ABOVE, BLOCK_LOW_AND_ABOVE |
| dangerous_content_threshold | COMBO | BLOCK_MEDIUM_AND_ABOVE | 4 options: BLOCK_NONE, BLOCK_ONLY_HIGH, BLOCK_MEDIUM_AND_ABOVE, BLOCK_LOW_AND_ABOVE |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| response | STRING | — |
| safety_ratings | STRING | — |