Counter (GeN13)
Make each queue in your batch a different seed, box or file
- reset
- INT
- FLOAT
- STRING
The batch counter at the top of the ComfyUI menu re-runs the same graph N times with the same inputs. For seeds that's fine - randomize handles it. For everything else it's useless: you can't walk a folder of images, you can't step through a list of prompt variants, you can't produce a numbered series where each render knows which one it is.
Counter (GeN13) is that missing piece. Each queue it advances, and it outputs the current number as INT, FLOAT and STRING.
How the counting works
There's a run widget - an integer that the frontend bumps by one after every queue, and doesn't bump while the node is bypassed or muted. Everything else is derived from it on the backend, at execution time, which matters: queue a batch of 20 and each one is computed correctly as it runs, not all at submit time. Reset, hold and auto-reset all behave inside a single batch.
mode decides the direction and the end behaviour:
increment/decrement- just keep going, ignoreend.increment_to_end/decrement_to_end- stop atend.increment_reset_after_end/decrement_reset_after_end- wrap back tostartafterend. This is the default, and it's the loop.
start, end and step define the walk. step is a size only - direction comes from the mode, so you don't get a negative step doing something surprising. Counting down means start should be greater than end; if it isn't, the node gives you one value and sits there rather than looping forever.
hold repeats each value N times before moving on, which is how you do nested loops: hold 4, step 1, and you get four queues of "0", four of "1", and so on. Pair it with a second counter running its own range and you've got a two-dimensional sweep without any code.
Resetting, three ways
- The RESET button on the node (frontend), which drops
runback to 0. - The
resetinput - optional, any type. Whenever the upstream value changes, the count returns tostart; if it doesn't change, counting continues. So you can hang it off a prompt string, an index, or the pack's own Trigger node, and the series restarts when your input changes rather than when you remember to press something. auto_reset-off,every hour(resets on the hour) orevery day(resets at the start of the day). This one is enforced through the cache: the node's cache key includes the current hour or day, so a new period forces a re-run even when nothing else in the graph changed. That's the correct way to do it and it's the part hobby counter nodes usually get wrong.
State is kept in memory, keyed by workflow ID plus node ID, so two workflows that both happen to have a node numbered 5 don't share a count. Restarting ComfyUI clears it and the count re-derives from run.
Outputs
Three, all the same number:
INT- the value rounded to nearest.FLOAT- the exact value, for whenstepis fractional (it accepts six decimals).STRING- the value as text with trailing zeros trimmed, so7.50becomes7.5. Use it for filenames, prompt interpolation, or anything that wants one part of a series labelled.
Wire INT into anything that takes an index - Load Latest Image Private's index, a seed after you convert the seed widget to an input, Text Switch's box selection. STRING into a filename prefix or a text node.
Reading it while it runs
The frontend adds an info line under the node showing the next value, progress through the range, and the hold count, plus a RESET button and a progress bar. That's more than core gives you for anything, and it's the difference between a counter you trust and one you have to test by queueing ten times.
Installing
Manager → search GeN13 → install → restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/heigen13/ComfyUI-GeN13
pip install -r ComfyUI-GeN13/requirements.txt
requirements.txt is nvidia-ml-py alone - for the pack's monitor, not this node. The counter is pure Python. No models, no downloads.
Where people get tripped up
Editing run by hand to a lower number resets the internal base and starts counting from there again; that's helpful when you're rerunning a failed batch, confusing if you did it by accident.
And if you drive ComfyUI through the API, prompts carry no workflow object, so the state key falls back to the node ID alone. One workflow per node ID is fine; several API clients sharing an install can theoretically collide.
The other one: if you get the same number twice, check whether something upstream is an output node forcing a cached node to re-run, or whether mode is one of the to_end variants and you've already arrived. It stops exactly where it says it does.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| run | INT | 00–1000000000 | Run count: adds 1 after each queue, not while bypassed. RESET sets it to 0, which returns to start. |
| mode | COMBO | increment_reset_after_end | Mode: count up or down; to_end stops at end, reset_after_end starts over from start after end. |
| start | FLOAT | 0.000-1000000000–1000000000 | Start: the first number output, and the number a reset returns to. |
| end | FLOAT | 10.000-1000000000–1000000000 | End: the last number in the to_end and reset_after_end modes. |
| step | FLOAT | 1.0000.000001–1000000000 | Step: amount added or subtracted each time; only the size counts, mode sets the direction. |
| hold | INT | 11–100000 | Hold: times each number is output before moving on; for nested loops. |
| auto_reset | COMBO | off | Auto reset: every hour returns to start on the hour, every day at the start of each day. |
| resetopt | * | Reset: returns to start whenever the upstream value changes; otherwise counting continues. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| INT | INT | Integer: the value rounded. |
| FLOAT | FLOAT | Decimal: the exact value. |
| STRING | STRING | Text: trailing zeros removed. |