◯ANY-Key◯ → Dict🗂️
Dictionaries With Dict-of-Your-Choice Keys
- dict
- key
- value
- dict
Every other Add node in Dict Tools takes a string key. DictAddAnyKey is the odd one out: both the key and the value are any-type, unvalidated. The display name even warns you - ◯ANY-Key◯ - that the key you're about to use is not necessarily a string.
That sounds like a solution in search of a problem until you've worked with dicts that need non-string keys. A tuple key can tag an entry by a pair of values (say, a resolution and a seed). An integer key is handy when you're indexing entries numerically. If you've ever built a dict in plain Python with keys that aren't strings, this is the node that lets you do the same in a ComfyUI graph instead of stringifying everything.
How it works
Under the hood it's near-identical to DictAddAny - store anything under any key, no type checking on either side - but it skips the key-cleanup machinery entirely. There's no cleanup_key input here, and no key string widget: the key is a wire you connect, or a value you leave dangling if you're feeling brave. Everything else is standard Dict Tools: the result is a fresh frozendict, never a mutation of your input, and keys get sorted on update - which for non-string keys means you should not rely on insertion order.
The inputs that matter
- dict (DICT, optional) - the dict to build on, or leave empty to start fresh.
- key (*, optional) - the any-type key. Wire a string, int, tuple, whatever.
- value (*, optional) - the any-type payload.
Output is dict (DICT).
Honest caveat: this node is for when you know exactly what you're doing. The rest of the pack, and the Extract side of it, mostly assumes string keys. If you store under a tuple key here, you'll need DictExtractAnyKey to get it back, because no string-keyed extractor will find it.
Install
Standard pack install: ComfyUI Manager → search Dict Tools → install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/Lex-DRL/ComfyUI-DictTools
Restart after. Dependency is just frozendict, handled by Manager.
Gotchas
This is one of the newest nodes in the pack (added in v3.2.1), so if your copy is older, update it. And the pack-wide rule still applies: ComfyUI 0.18.0+ is required, since the whole pack runs on the newer node API. If you get a failed-to-load in Manager, update ComfyUI first.
The real footgun is philosophical: with zero type checks and zero cleanup, everything you put in has to come out the same way it went in. Use the typed extractors on this dict's contents and you're on your own - but that's the price of the flexibility you asked for.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| dictopt | DICT | An (optional) Dictionary to work with. | |
| keyopt | * | Key (of ANY type) for the item inserted into the dict. | |
| valueopt | * | The actual any-type item to add into the Dict. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| dict | DICT | — |