sum
Add up a whole list in one go
- list
- INT
- FLOAT
Total the numbers in your list
When you have a LIST of numbers and you want their total - total cost of a batch, total steps, sum of a set of weights - this is the node. It takes a LIST, adds everything up, and hands you the result as both an integer and a float, because the pack's author knows you never know which one a downstream node wants.
It's Python's sum() with a ComfyUI skin, and it's the numeric counterpart to the pack's "min" node: one tells you the extremes, the other tells you the total.
How it works
Under the hood it's sum(list, start), where start is an optional value you can add into the total - default 0. The outputs are both the same number, cast to INT and to FLOAT, so you can wire whichever type the next node expects without a cast step in between.
The friendly edge case: an empty list returns start (so 0 by default) instead of throwing. That's a deliberate choice so a workflow that runs on a not-yet-populated list doesn't explode. If your list holds non-numbers, sum() will raise a type error - there's no guard here like the sort node's silent fallback, so keep lists numeric.
Inputs and outputs
- list (LIST) - the numbers to add.
- start (INT, default
0) - an initial value to start the sum from. Leave it alone unless you want to offset the total.
Outputs:
- INT - the total as an integer.
- FLOAT - the same total as a float.
Both outputs carry the same value, so pick the type that matches what you're feeding. Want to know what the total was before adding a start value? Set start to 0.
Installing it
Ships in Basic data handling by StableLlama, the r/StableDiffusion regular whose long-form model comparisons (Flux Klein 9B, RealVisXL) are better known than his code. The pack is minimal by design - zero runtime dependencies in its pyproject, no model files, no GPU involvement - so install is genuinely just clone-and-restart.
Install via ComfyUI Manager (search "Basic data handling") or:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
Restart ComfyUI; find it under Basic/LIST.
Troubleshooting
The main thing to watch is feeding it a list with non-numeric items - that errors with a type error rather than a graceful message, so check what's in your list first. An empty list is safe (returns 0). And note the output gives you two plugs carrying the same number; grabbing the wrong one (INT when you meant FLOAT, or vice versa) rarely matters because they're equal, but the type can matter to a picky downstream node.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| list | LIST | — | |
| startopt | INT | 0 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |
| FLOAT | FLOAT | — |