Nodes/RisuTools/UUID Generator
ComfyUI Node

UUID Generator

Need a stable ID that's the same every run? Or a fresh one? Pick your version

By tiamatiramisu·Created about a year ago·Updated about a year ago· 5
UUID Generator
    • uuid
    input_stringseed string
    uuid_versionv5

    UUID Generator is the smallest useful node in RisuTools: feed it a string, pick a UUID version, get a UUID back. It sounds trivial, and it is. But it fills a gap that comes up constantly once your workflows get automatic - giving things stable, collision-proof identities.

    Why would a ComfyUI graph need a UUID? Naming output files uniquely so nothing overwrites, tagging each generation with a request or session ID, deduplicating runs in a pipeline. The pack's stated purpose is RisuAI integration - the chat/roleplay frontend - and the obvious job here is tagging every image a chat session generates with an ID you can trace back. But you don't need RisuAI for this node to earn its place; any "label every run" workflow is a customer.

    How it works

    The mechanism is just Python's uuid module, exposed as a dropdown. Four versions, and the version you pick changes everything:

    • v1 - time and machine-based. Unique-ish, ignores your input string entirely.
    • v4 - pure random. Also ignores your input. This is the classic "I just need a fresh unique ID" option.
    • v3 - MD5 hash of a namespace plus your string. Same input → same UUID, every single run.
    • v5 - SHA-1, same deterministic trick, and the default. This is the one the node reaches for when you leave the dropdown alone.

    So the input string only matters for v3 and v5 - those are deterministic, which is the feature people usually want: the same seed produces the same ID, so you can reference an output by name forever and it won't drift. The namespace is hardcoded in the source (0413fcc2-…), so two different people hashing the same string get the same UUID. That's standard UUID v3/v5 behavior.

    The two inputs that matter

    • input_string (required) - the seed for deterministic versions. Default "seed string" is a placeholder; the author's test uses "test string", so yes, it's that literal.
    • uuid_version (dropdown: v1, v3, v4, v5) - the version selector. Default v5.

    Output is a single STRING named uuid, ready to feed a Save node's filename prefix or any string input.

    The trap worth knowing

    Deterministic is a double-edged sword. With v3/v5, the same input yields the same UUID forever - great for stable filenames, a silent bug if you expected uniqueness. And because this node defines no IS_CHANGED, ComfyUI may serve you a cached result on repeated runs with unchanged inputs rather than re-executing. That's exactly what you want for deterministic versions, but it can make v1/v4 feel broken: the "random" ID looks frozen until an upstream input changes. If you need a genuinely fresh random ID on every queue, test this behavior in your own graph - the underlying function does generate a new one each call, the caching question is ComfyUI-side.

    Installing it

    Same routine as the rest of the pack. ComfyUI Manager → search RisuTools → Install → restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/TiamaTiramisu/risutools
    

    Restart ComfyUI. Zero dependencies beyond pillow and numpy (the shared pack's requirements.txt), no models, nothing to download. The pack itself is early-stage - version 0.0.1, placeholder README - but for a node this small, "read the 40 lines of source" is a completely reasonable review process, and it's all right there.

    CategoryRisuTools/String

    Inputs (2)

    NameTypeDefaultDescription
    input_stringSTRINGseed string
    uuid_versionCOMBOv54 options: v1, v3, v4, v5

    Outputs (1)

    NameTypeDescription
    uuidSTRING