Nodes/Duanyll Nodepack/LLM Client Set Seed
ComfyUI Node

LLM Client Set Seed

Pin a seed onto the client

By Duanyll·Created about a year ago·Updated 4 months ago· 2
LLM Client Set Seed
  • client
  • LLM_CLIENT
seed0

Every diffusion user knows what a seed is for - same seed, same image. LLM Client Set Seed is the attempt to give you that same lever for your language model calls: it pins a seed onto the client, and every completion made through that client carries it. If you're tired of a prompt giving you a different answer on every rerun and making your workflow untestable, this is the node you want.

How it works

It's a two-line operation under the hood: the node takes the LLM_CLIENT and writes your seed into the client's model_options as {"seed": seed}. From then on, every request the client sends includes that seed field in the payload, because the client merges model_options into every chat completion request.

The critical thing to understand - and this is where expectations need calibration - is that this only does something if the model/provider honors a seed parameter at all. OpenAI's API supports seed and will give you near-deterministic output when paired with the same parameters and prompt; many local servers and open-weight models accept or ignore it with varying fidelity. The node is doing its part faithfully; whether the model plays along is another story.

Inputs and outputs

  • client - an LLM_CLIENT from LLM Create Client.
  • seed - an INT, default 0, up to 2^31 - 1. Any int in range; 0 is a perfectly valid seed, not "no seed."

Output: the same LLM_CLIENT, now seeded. Wire it into LLM Chat Completion (or anywhere else the client goes).

How to use it

Drop this node between LLM Create Client and your completion nodes, and feed it a seed from any standard seed source (a fixed number for reproducibility, or a random seed node for variety). Same seed + same model + same prompt + same temperature → (usually) same output. That makes reruns debuggable: when a workflow behaves differently on the second run, you can now distinguish "I changed something" from "the model rolled dice again."

The honest caveat, one more time: don't expect bit-for-bit reproducibility, especially across model versions or providers. Think of it as "the model's sampling is now biased toward determinism," not a promise. If your downstream logic depends on exact output, add validation rather than trusting the seed alone.

Installing it

It's in Duanyll Nodepack. ComfyUI Manager → search "Duanyll Nodepack" → install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/Duanyll/duanyll_nodepack

Under duanyll/llm. Note this family requires a network-visible OpenAI-compatible endpoint and an API key - the seed is cosmetic without a real call behind it.

Categoryduanyll/llm

Inputs (2)

NameTypeDefaultDescription
clientLLM_CLIENT
seedINT00–2147483647

Outputs (1)

NameTypeDescription
LLM_CLIENTLLM_CLIENT