Nodes/ComfyUI Deploy/External Seed (ComfyUI Deploy)
ComfyUI Node

External Seed (ComfyUI Deploy)

The Seed Input That Knows When to Re-Roll

By BennyKok·Created 3 years ago·Updated 10 months ago· 1,529
External Seed (ComfyUI Deploy)
    • seed
    â—„input_idinput_seedâ–º
    â—„default_value-1â–º
    â—„min_value1â–º
    â—„max_value4294967295â–º
    â—„display_nameâ–º
    â—„descriptionFor default value: "-1" (i.e. not in range): Randomize within the min and max value range. in range: Fixed, always the same value â–º

    Seeds are the most annoying thing to expose through an API, because "random" has to mean actually new each call, and ComfyUI's cache will happily reuse the last result if nothing in your graph looks changed. ComfyUIDeployExternalSeed is the node that solves both halves - it's an external input that lets a caller pin a seed or request a fresh random one, and it deliberately breaks ComfyUI's cache so the random actually happens.

    The one rule that matters

    The author's own tooltip says it best: set default_value to -1 (out of range) and the node randomizes inside min_value–max_value; set it inside the range and it's fixed forever. That's the entire design. Locally, the node behaves like a normal seed source - output seed (INT) goes straight into your KSampler. Deployed, the ComfyUI Deploy backend writes the caller's value into default_value, so a request of {"input_seed": 42} pins 42, and omitting it falls back to the random path.

    The default range (1 to 4294967295) covers everything real. The min_value widget refuses to go below 1, which is worth internalizing: this node cannot emit seed 0. If someone's workflow depends on seed 0, you'll need to pin it elsewhere - the range check treats 0 as "out of range" and rerolls.

    How the re-roll trick works

    ComfyUI caches node outputs to skip work, and a seed node that returned the same thing every time would be useless for randomness. The source handles this with an IS_CHANGED method: in fixed mode it returns the input tuple (stable → cached, so pinning a seed stays fast), and in randomize mode it returns a fresh random value each time, forcing re-execution. That's the mechanism most seed utilities reinvent, and this one gets it right. You can watch it happen - the node logs which mode it took.

    The inputs that matter

    • input_id - request key, default input_seed.
    • default_value (-1) - the pin-vs-random switch described above.
    • min_value / max_value (1 / 4294967295) - range for the random path.
    • display_name / description - form label and help text on the dashboard. The default description actually explains the -1 behavior, which is a nice touch from the author.

    Installing

    It's the ComfyUI Deploy pack, installed the usual way - Manager, search "ComfyUI Deploy", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/BennyKok/comfyui-deploy
    

    Restart and you're done. No model downloads; the requirements (aiofiles, pydantic, opencv-python, imageio-ffmpeg, brotli, tabulate) are all lightweight.

    Gotchas

    Beyond the seed-0 limitation, the gotcha is mode confusion: if you set default_value inside the range thinking it's just a "starting point," you've pinned the seed permanently and every call returns identical images. That's by design, but it's the thing that looks like a bug when it happens. If you want variability per request, leave default_value at -1 and let callers pin only when they ask for it.

    Category🔗ComfyDeploy

    Inputs (6)

    NameTypeDefaultDescription
    input_idSTRINGinput_seed—
    default_valueINT-1—
    min_valueINT11–999999999999999—
    max_valueINT42949672951–999999999999999—
    display_nameoptSTRING—
    descriptionoptSTRINGFor default value: "-1" (i.e. not in range): Randomize within the min and max value range. in range: Fixed, always the same value —

    Outputs (1)

    NameTypeDescription
    seedINT—