OpenAI API - Seed
Make your in-graph LLM calls actually reproducible
- other_options
- Options
If you've ever had a chat-based prompt-rewrite node give you a different answer on every run and gone slightly mad, this is the node for you. OAIAPI_Seed does one thing: it pins the seed parameter on the chat completion request so the same prompt and settings produce the same result. In the image world that's table stakes; for language models it's surprisingly rare, and it's the difference between "tweak this workflow until it's right" and "roll the dice every queue."
How it works
It's an options node, which in this pack means it builds a small dictionary and hands it downstream. You set a seed integer (default 42), it records seed: 42 into an OAIAPI_OPTIONS payload, and the Chat Completion node pulls that value out and passes it as the named seed argument to the API call. One detail the author got right: the seed widget has control_after_generate enabled, so you get the same little randomize arrow you know from KSampler - click it and the seed rolls to something new, or right-click to lock it into a fixed value.
The inputs and output
- seed - an integer. Any value works; it's just a starting point for the sampler.
- other_options (optional) - if you're chaining multiple option nodes, feed the previous one's output here to merge. Later nodes overwrite earlier keys, so keep the seed last if you want it to win.
- Output: Options (
OAIAPI_OPTIONS), which you wire into the next option node or straight into Chat Completion'soptionsinput.
Installing it
Nothing special - it's one of the ten nodes in the comfyui-openai-api pack. Search "OpenAI API" in ComfyUI Manager and install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/hekmon/comfyui-openai-api
Then restart. The only new dependency is openai; there are no model files to fetch.
The honest caveat
Don't expect image-generation-grade determinism. OpenAI's own docs describe seed as best-effort - same seed and same parameters will usually return the same output, but it's not guaranteed, and exactly how reproducible it is varies by model and by the server you're talking to. Ollama's seed behavior is looser than the cloud API's, so if you're debugging a local workflow, treat it as "more consistent," not "identical." Also worth knowing: the underlying API marks seed as deprecated in favor of new sampling controls, but the author deliberately kept it because it's what actually works across the OpenAI-compatible servers most people run - vLLM, Ollama, TGI. For reproducible prompt expansion in a workflow you're iterating on, it's the first option node you should add.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| seed | INT | 42 | — |
| other_optionsopt | OAIAPI_OPTIONS | Others options to merge with |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Options | OAIAPI_OPTIONS | Merged options to forward |