Nodes/ComfyUI-NS-Util/Simple LLM Config: Gemini
ComfyUI Node

Simple LLM Config: Gemini

The cheap, long-context option with the 65k token ceiling

By NakamuraShippo·Created about a year ago·Updated 4 months ago· 5
Simple LLM Config: Gemini
    • LLM_CONFIG
    modelgemini-2.5-flash
    temperature0.7
    max_tokens2000
    api_key

    If you're building LLM workflows in ComfyUI and you don't want to spend money like it's going out of style, Google's Gemini is the value pick, and Simple LLM Config: Gemini is the node that points this pack at it. Like all the Simple LLM Config nodes, it does exactly one job: build an LLM_CONFIG object describing which provider, model, and generation settings to use. The call itself happens later, when you wire this into an agent and run a prompt.

    Gemini's superpowers here are price and context. gemini-2.5-flash - the default - is Google's fast, cheap workhorse, and this node lets you crank max_tokens all the way to 65,536, which is a lot of output for a long analysis or a big generated document. No other config node in the pack lets you go that high.

    How it works

    The node bundles driver: "gemini" with your model, temperature, and max_tokens into a dict and outputs LLM_CONFIG. At run time, the pack's Gemini driver calls Google's generateContent endpoint with your key in the URL query string - again, plain requests, no SDK. The key comes from the api_key input or the GOOGLE_API_KEY environment variable. Google's env var name is the confusing bit; it's not GEMINI_API_KEY, and people trip on that constantly.

    The inputs that matter

    • model - dropdown with five options. Default gemini-2.5-flash is the right first choice: fast and cheap. gemini-2.5-pro if you need the bigger brain, gemini-1.5-* if you're pinning to an older generation for reproducibility.
    • temperature - 0 to 2.0, default 0.7. Gemini supports the full range; stay low for structured, factual work.
    • max_tokens - 1 to 65536, default 2000. This one's the differentiator - if your workflow needs long outputs, this is where you get headroom.
    • api_key (optional) - blank is fine if GOOGLE_API_KEY is set. Prefer the env var; a key typed into the node gets baked into your saved workflow and travels with it when you share.

    Output: a single LLM_CONFIG, which feeds into Simple LLM Agent or Simple LLM: Agent with Rules.

    Installing the pack

    # ComfyUI Manager → Install via Git URL:
    https://github.com/NakamuraShippo/ComfyUI-NS-Util
    
    # or:
    cd ComfyUI/custom_nodes
    git clone https://github.com/NakamuraShippo/ComfyUI-NS-Util
    pip install pyyaml watchdog
    

    Restart ComfyUI. No model downloads, no heavy deps - the config nodes don't even touch the network. ComfyUI 0.3+ recommended.

    Common issues

    The "API key not set" error usually means you set GEMINI_API_KEY instead of GOOGLE_API_KEY - Google's own docs use the former, this code reads the latter, so set both if you're not sure. If long outputs come back truncated, raise max_tokens; the 2000 default is conservative for the token budget this model supports. And remember the key-in-URL quirk: the driver sends it as a query parameter, so it can appear in proxy logs - another reason to prefer the env var.

    CategoryNS/LLM/Config

    Inputs (4)

    NameTypeDefaultDescription
    modelCOMBOgemini-2.5-flash5 options: gemini-2.5-flash, gemini-2.5-pro, gemini-2.0-flash, gemini-1.5-flash, gemini-1.5-pro
    temperatureFLOAT0.70–2
    max_tokensINT20001–65536
    api_keyoptSTRING

    Outputs (1)

    NameTypeDescription
    LLM_CONFIGLLM_CONFIG