Integer API Node
Steps and Seeds, Scripted
- output
Most scripts that drive ComfyUI want to control the same five numbers: steps, seed, width, height, batch size. The Integer API Node is how you hand those to a program. It's a pass-through integer - you set a value, it outputs it, and a script can replace that value before each run without you touching the editor.
It's part of hypnodes/ComfyUI_ApiNodes, the little pack that turns a workflow's inputs into an API for scripts. Quick naming warning before you go further: ComfyUI's official "API Nodes" - the paid Partner Nodes that call closed models - are a completely different beast. This pack is local, free, and needs no key. The only thing being "called" is your own ComfyUI server.
How it works
Same pass-through as its siblings: the node returns default_value unchanged, typed as INT, and nothing else. The name field is a label your script matches on - it does nothing to the graph itself. Export the workflow in API format, and the bundled JS library or CLI (or your own script) rewrites inputs.default_value before POSTing to /api/prompt. The workflow runs with your number.
Inputs and outputs
name(STRING, default"name") - the parameter key. Name itstepsorseedso the workflow JSON reads like a config file.default_value(INT, default0) - the integer, and what the node outputs.output- one INT socket.
Wiring it up
Wire it where a whole number belongs. Convert a KSampler's steps or seed widget to an input (right-click → Convert to input) and connect this node. Now the value here is authoritative, and a script can queue a run at 20 steps, then 40, then 60, without opening the UI.
One nice side effect of wiring a seed in: once the seed comes from a wire, the sampler no longer rolls a new one on its own. The control_after_generate drop-down that randomizes seeds is attached to the widget, and there's no widget anymore. If you want a fresh seed every run, your script has to supply it - which is usually exactly what you want in a scripted setup. If you'd rather keep ComfyUI's seed behavior, leave the widget alone and parameterize something else.
ComfyUI treats INT and FLOAT as distinct socket types, so use this node for whole numbers and the Float API Node for fractional values like denoise and CFG.
Install
ComfyUI Manager → search ComfyUI_ApiNodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/hypnodes/ComfyUI_ApiNodes
Restart and you're done. Four small files, zero Python dependencies, no models to download.
Gotchas
The standard pack traps: the script's parameter key must match the node's name exactly, spelling and case included, and duplicate names mean duplicate overwrites - the library matches by name, so two nodes both named seed get the same value. And remember the 0 default: it's a real value, not a hint. If you forget to set it, your scripted workflow will happily run with zero steps, which is one way to learn about validation errors.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| name | STRING | name | — |
| default_value | INT | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output | INT | — |