Nodes/SaltAI-Open-Resources/Primitive Value Converter
ComfyUI Node

Primitive Value Converter

The any-type glue node every graph eventually needs

By get-salt-AI·Created 2 years ago·Updated 2 years ago· 84
Primitive Value Converter
  • input_value
  • output
output_type
sub_data_type
index_or_key

Every ComfyUI graph eventually hits the same wall: one node hands you a STRING and the next node wants an INT, or you've got a DICT of settings and need exactly one value out of it as a FLOAT. SAIPrimitiveConverter is Salt's answer - a wildcard-input type-coercion node that'll connect to almost anything and force it into the primitive type you actually need.

What it does

input_value is typed * - a wildcard, meaning ComfyUI will let you plug essentially any output into it, unlike most nodes which only accept one specific type. output_type is a dropdown covering STRING, INT, FLOAT, BOOLEAN, LIST, and DICT - pick the type you want the value cast into. Two optional fields handle the case where your input isn't a plain scalar to begin with: sub_data_type (with an ORIGIN option alongside STRING/INT/FLOAT/BOOLEAN) and index_or_key - together these let you reach into a LIST or DICT input, grab one element by position or key, and optionally cast that element to a further type rather than trying to convert the whole container at once. The output, output, is also typed *, so it'll plug into whatever's next regardless of what type it actually ended up being.

Where it's actually useful

This is plumbing, not a creative node - you reach for it when two otherwise-perfect nodes refuse to connect because of a type mismatch. Common cases: a count that came out as a STRING needs to become an INT for a loop or a resize node; a settings DICT produced somewhere upstream needs one specific key pulled out as a usable value; a LIST of results needs one element extracted by index rather than the whole list. If you've used a similar "any type" converter in another pack, this is that same category of utility, just Salt's implementation of it.

Installing it

ComfyUI Manager: search SaltAI-Open-Resources. Manual install:

cd ComfyUI/custom_nodes
git clone https://github.com/get-salt-AI/SaltAI

Restart ComfyUI. No dependencies beyond the pack itself.

Common issues

Casting a non-numeric STRING to INT or FLOAT will fail - "banana" doesn't become a number no matter what type you ask for, so make sure whatever you're converting actually contains something coercible to the target type before you wire it in. If you're outputting LIST or DICT, remember the next node has to actually understand that type too - not every node in ComfyUI accepts a bare list or dict, so this converter alone doesn't guarantee compatibility with whatever's downstream. And when reaching into a container with index_or_key, a typo in a dict key or an out-of-range list index is the most likely source of a confusing error - double check the exact key name or index against what actually produced the container upstream, since this node has no way to know what keys or indices are valid ahead of time.

CategorySALT/Utility/Conversion

Inputs (4)

NameTypeDefaultDescription
input_value*
output_typeCOMBO6 options: STRING, INT, FLOAT, BOOLEAN, LIST, DICT
sub_data_typeoptCOMBO5 options: ORIGIN, STRING, INT, FLOAT, BOOLEAN
index_or_keyoptSTRING

Outputs (1)

NameTypeDescription
output*