Nodes/ComfyUI-Gemini-3/Gemini 3 安全设置
ComfyUI Node

Gemini 3 安全设置

Loosening the leash, up to Google's actual limits

By xuchenxu168·Created 10 months ago·Updated 10 months ago· 4
Gemini 3 安全设置
    • response
    • safety_ratings
    prompt生成内容...
    api_providergoogle
    api_key
    modelgemini-3-pro-preview
    thinking_levelhigh
    harassment_thresholdBLOCK_MEDIUM_AND_ABOVE
    hate_speech_thresholdBLOCK_MEDIUM_AND_ABOVE
    sexually_explicit_thresholdBLOCK_MEDIUM_AND_ABOVE
    dangerous_content_thresholdBLOCK_MEDIUM_AND_ABOVE

    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_HIGH or BLOCK_NONE and see if it clears the block; don't nuke all four out of the gate.
    • prompt and 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_NONE doesn'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_ratings shows confidence levels per category. A NEGLIGIBLE rating 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.
    CategoryGemini3/安全

    Inputs (9)

    NameTypeDefaultDescription
    promptSTRING生成内容...
    api_providerCOMBOgoogle1 options: google
    api_keySTRING
    modelCOMBOgemini-3-pro-preview1 options: gemini-3-pro-preview
    thinking_levelCOMBOhigh2 options: high, low
    harassment_thresholdCOMBOBLOCK_MEDIUM_AND_ABOVE4 options: BLOCK_NONE, BLOCK_ONLY_HIGH, BLOCK_MEDIUM_AND_ABOVE, BLOCK_LOW_AND_ABOVE
    hate_speech_thresholdCOMBOBLOCK_MEDIUM_AND_ABOVE4 options: BLOCK_NONE, BLOCK_ONLY_HIGH, BLOCK_MEDIUM_AND_ABOVE, BLOCK_LOW_AND_ABOVE
    sexually_explicit_thresholdCOMBOBLOCK_MEDIUM_AND_ABOVE4 options: BLOCK_NONE, BLOCK_ONLY_HIGH, BLOCK_MEDIUM_AND_ABOVE, BLOCK_LOW_AND_ABOVE
    dangerous_content_thresholdCOMBOBLOCK_MEDIUM_AND_ABOVE4 options: BLOCK_NONE, BLOCK_ONLY_HIGH, BLOCK_MEDIUM_AND_ABOVE, BLOCK_LOW_AND_ABOVE

    Outputs (2)

    NameTypeDescription
    responseSTRING
    safety_ratingsSTRING