Nodes/gemini-3-simply-comfyui/Gemini Seed (int32)
ComfyUI Node

Gemini Seed (int32)

Your SD seed is too big for Gemini. This node fixes that.

By lazyq666·Created 9 months ago·Updated 6 months ago· 3
Gemini Seed (int32)
    • seed
    seed-1
    moderandom_if_negative

    Gemini Seed (int32) is the most boring node in this pack and the one you'll silently depend on. It takes any integer and normalizes it into the range Gemini actually accepts - 0 to 2147483647, a signed int32. That range is a real constraint: Gemini's generation_config.seed is a signed 32-bit integer, and a seed outside it either errors or quietly breaks your reproducibility. ComfyUI's own seed space goes up to 2^64, SD workflows happily hand out negative seeds, and random seed nodes spew huge values - so if you're reusing a seed you loved in SDXL or Flux inside a Gemini workflow, you're already in danger territory.

    The fix is a one-node shim. Feed it any seed, get back a clean int32, wire that into the seed input of the pack's Gemini Text or Gemini 3 Pro Image node. It also exists because the pack's own nodes treat -1 as "random every run" - so if you want a fixed seed, you pipe one through this node instead of leaving the default.

    How it works

    Three modes, all deterministic except one:

    • random_if_negative (default) - a negative seed becomes a fresh random value in range; anything non-negative gets wrapped
    • wrap - always takes the value modulo 2^31, so a huge seed rolls around into range
    • clamp - cuts to the bounds: anything below 0 becomes 0, anything above 2147483647 becomes 2147483647

    The random path uses a cryptographic random source, which sounds fancy but just means you won't get predictably patterned seeds when you leave -1 in. The wrap behavior is why random_if_negative is the safe default - it preserves the "negative means random" convention the rest of the pack already uses, while keeping positive values reproducible.

    Inputs and output

    Only two inputs, which is the whole point:

    • seed - any integer
    • mode - random_if_negative, wrap, or clamp

    Output is a single seed INT, always in the 0–2147483647 range. That's it. It's a pure local computation - no API key, no network call, no cost, and the same input always produces the same output (except in random mode, obviously).

    Install

    Same as the pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/lazyq666/gemini-3-simply-comfyui
    pip install -r requirements.txt
    

    You don't need an API key for this node itself, though the pack's other nodes will want one. There's nothing to troubleshoot on a node this small - the only real "gotcha" is remembering to use it. If you're coming from a local stack, just know your ComfyUI seeds and Gemini's seeds are not the same universe, and this is the adapter between them.

    CategoryGemini 3

    Inputs (2)

    NameTypeDefaultDescription
    seedINT-1-1–18446744073709550000
    modeCOMBOrandom_if_negative3 options: random_if_negative, wrap, clamp

    Outputs (1)

    NameTypeDescription
    seedINT