Nodes/ComfyUI-MoonNodes/♊ Gemini Advanced Settings
ComfyUI Node

♊ Gemini Advanced Settings

Gemini's settings, without wallpapering your workflow in sliders

By m0rtus59·Created 3 months ago·Updated 9 days ago· 8
♊ Gemini Advanced Settings
    • advanced_settings
    temperature1.00
    top_p0.95
    top_k40
    max_output_tokens0
    thinking_leveldefault
    structured_outputs_jsonfalse
    google_search_groundingfalse
    code_executionfalse

    If the Gemini Persistent Chat node is the engine of MoonNodes' LLM side, this is the optional options panel. GeminiAdvancedSettings bundles every Gemini generation parameter into a single advanced_settings object you feed into the chat node, so the chat node itself stays readable and you only expose the knobs you actually touch.

    On its own it does nothing. It's a pure configuration node - the kind ComfyUI people call a "settings bundle." You wire its output into the chat node's optional advanced_settings input and leave it alone, or you dial it in once and forget it.

    What's inside

    All the standard Google AI Studio controls, one per field:

    • temperature (0–2, default 1) - creativity. The source notes 1.0 is the practical minimum for the newer Gemini thinking models, so don't crank it to the floor expecting better reasoning.
    • top_p (0–1, default 0.95) and top_k (0–100, default 40) - the two sampling cutoffs. Leave them alone unless you know why you're touching them.
    • max_output_tokens (default 0) - response length cap. 0 means "let the API decide," which is what you usually want; set it if a model is cutting itself off.
    • thinking_level - default, minimal, low, medium, or high. Any non-default value flips on the model's thought stream, which is what feeds the chat node's separate thoughts output.
    • structured_outputs_json - force the response to be valid JSON (response_mime_type: application/json). The one you'll actually use if you're chaining Gemini output into another tool.
    • google_search_grounding - lets Gemini search the web before answering. Slower, costlier, and only supported by some models.
    • code_execution - lets Gemini run Python as a tool. Useful for math that the model shouldn't guess at.

    The output is one value: advanced_settings (type GEMINI_SETTINGS), which only plugs into GeminiPersistentChat.

    Install

    Same pack, same steps as every MoonNodes node:

    cd ComfyUI/custom_nodes
    git clone https://github.com/m0rtus59/ComfyUI-MoonNodes.git
    cd ComfyUI-MoonNodes && pip install -r requirements.txt
    

    Restart ComfyUI. It shares the pack's one dependency (google-genai) with the chat node, and it needs no API key of its own - the key lives on the chat node.

    Things worth knowing

    The settings only apply per-request; if the chat node is mid-conversation and you change a setting, the node detects the change, picks up the current history, and starts a fresh session with the new config. That's handled automatically, so you can tune temperature mid-chat without losing context.

    One honest gotcha: several of these toggles (grounding, code execution, structured output, thinking levels) aren't supported by every Gemini model. If you tick a box and the chat node starts returning "Gemini API Error: ..." as plain text, that's usually the model rejecting an unsupported tool rather than a broken install. The error text comes back through the node's string output, not as a crash - read it, don't panic.

    CategoryMoonNodes

    Inputs (8)

    NameTypeDefaultDescription
    temperatureFLOAT1.000–2
    top_pFLOAT0.950–1
    top_kINT400–100
    max_output_tokensINT00–65536
    thinking_levelCOMBOdefault5 options: default, minimal, low, medium, high
    structured_outputs_jsonBOOLEANfalse
    google_search_groundingBOOLEANfalse
    code_executionBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    advanced_settingsGEMINI_SETTINGS