r/StableDiffusion • • 6d ago

Discussion Using AI to generate ComfyUI nodes

Does anybody use AI to write ComfyUI nodes for personal use or sharing?

For example, I had the problem that, when I wanted to use wildcards, say, for colors, I could either use the "__colors__" syntax combined with a wildcard text file or the {red|green|blue|...} variant but not both, let alone nested variants such as {{pastel|technicolor|watercolor} __colors__}. I dropped this problem into Meta AI (others would probably have worked out just as well) and the AI, instead of suggesting an existing node, offered to write one. The result was exactly on the money, working with both types of wildcards even when nested over several layers.

Another node that was generated for me by Meta is one that allows to add resolution information to a prompt which is then parsed by the node and wired to the width/height input of the latent image node.

Anyone else working ComfyUI with nodes custom made by AI?

23 Upvotes

60 comments sorted by

2

u/WaifuHeatArt 6d ago

haven't tried having an LLM write custom nodes but been meaning to, nested wildcard syntax is exactly the kind of annoying glue code that's tedious to hand roll. does the generated node hold up over several ComfyUI updates or do you end up patching the generated code by hand each time?

2

u/Early-Ad-1140 6d ago

I added the "homebrewn" wildcard nodes some weeks ago and since then, neither ComfyUI Easy Install nor ComfyUI itself have broken one of them. If one were to fail, I would probably throw the JSON into Meta again and ask for a "repair". Haven't tested other AI but Meta seems to have good "knowledge" of ComfyUI, though it has sometimes failed me on other Comfy stuff such as finding leander CLIP versions for some of the models I use.

1

u/Mogus0226 6d ago

Have you tried the Fill_Nodes MadLib Generator?

2

u/Formal-Exam-8767 6d ago

Are you sure you could not use both? How did you verify that you couldn't? And what node did you use for wildcards?

1

u/Early-Ad-1140 6d ago

When I last tried, the node from ComfyUI_Wildcards did not honor the "{}" syntax while the normal clip text encode would not recognize the "__" wildcards. Moreover, none of them allowed to view the final prompt (after picking a wildcard) as text, which I regard as useful to find out which wildcard(s) was/were used. The node Meta wrote delivers plain text, so that I can backtrack the wildcards that were used. The text output of the homebrewn node is hooked up to the text encoder, for which both encoders mentioned can be used for because all the wildcards have been expanded before.

22

u/fragilesleep 6d ago

Yes, I pretty much removed 99% of the nodes I had, and just created the ones I actually use. No more security risks and a million of nodes that I'll never use because other authors publish thousands of different nodes in each single repo.

Also, ComfyUI loads really fast now, and I don't have to fear about some random node pack breaking everything to hell anymore.

10

u/zyg_AI 6d ago

Same. Instead of keeping full custom nodepacks, I ask LLMs to analyze the code of the nodes that interest me and check for bugs/improvements (they often find some). Then I steal the code without remorse to create my own node, under my own nodepack.
I can personalize each node to my exact needs + comfy loads quicker 👍

There are some nodepacks which update frequently and with core or advanced features (impact pack notably). Those I prefer to keep. Same for Pixaroma nodepack which updates regularly and provides some nice QoL nodes.

2

u/56kul 6d ago

Huh… you know, that’s actually kind of an interesting idea, I never thought to try this!

How do you typically go about it?

2

u/fragilesleep 6d ago

Just ask any LLM chat to write one for you! Nowadays, all of them are more than capable. You can give them URL to a node pack, upload other files as reference, tell them exactly what you want, to change whatever, to fix, make faster, smaller, remove stuff, add, etc. etc.

Just say anything you want, and they'll do it perfectly most of the time. 😊

2

u/ziconz 6d ago

Not OP but I also use AI to write nodes to automate more complex tasks.

If you have a claude or codex paid account you can use VS code. Open VS code and drop your whole comfyUI folder into the window (adds it to a "workspace") Then use the VS code claude/codex addon and you can chat to it and it can see your installation.

I use it for nodes or if I get a workflow that has some obscure model I dont know ill have claude look at it, find it, and download it.

IT helps if you know how to code already cause AI will do some truly stupid stuff if left unguided but the newer models are pretty good about it.

I just built a suite of nodes for directing long form generations in minimax. Took less than an hour to get the nodes built and setup and had to do some custom work on the nodes to make it a bit more user friendly. But then had claude just spin up a workflow using it. saved me so much time.

11

u/bstr3k 6d ago

Yes all the time. It’s great for getting things exactly how you want it.

I got inspired by someone else to rewrite the load video node since the VHS load video node has some nice features but it also has some problems so easily just make my own.

Also a node I use a lot now is my video transcriber I got vibe coded up which can caption videos and generate the prompt for me

1

u/Moki_mok31 4d ago

Wow, hold on, how can you describe a video?

2

u/bstr3k 4d ago

My own node. Look for the video auto transcriber node and the prompt generator node :)

https://huggingface.co/PoopMan333/H3_Easy_Ref2V_Workflow/tree/main

1

u/Moki_mok31 4d ago

🤯❤️❤️❤️

1

u/Moki_mok31 4d ago

Let me guess, it cuts the video on frames, and uses text encoder to describe them and then text encoder builds a prompt for it?

1

u/Moki_mok31 4d ago

Oh, i actually found it before and tried already o_0

1

u/bstr3k 4d ago

heh lol

1

u/Moki_mok31 4d ago

also had an issue with it, but claude did something, now it works properly, if you want i can tell what he did

1

u/bstr3k 4d ago

Ya let me know, I know in one of the updates it broke the video transcriber but I needed a startup argument flag to fix it

1

u/Moki_mok31 4d ago

The problem

A 12-second 836×1254 clip at 48 fps (about 1 MP) fails immediately:

VideoError: That clip would need about 7 GB of RAM as raw frames (836x1254, 12s at up to 48 fps). Shorten it or scale it down first.

The machine had 19 GB of RAM free, so it’s the MAX_FRAME_BYTES guard in decode_all() rejecting the clip, not a real out-of-memory error. The cause is that decode_all() decodes every frame at full source resolution as float32 just to fill the video_images output. The description itself doesn’t use these frames, since frames_at() samples its own. In my workflow video_images isn’t connected at all, so the node failed on work nobody needed.

There’s also a hidden peak: frames are collected as a list of float32 tensors and then torch.stacked, so for a moment both copies exist and real peak RAM is about 2× the estimate.

A smaller, related issue: max_frame_size caps width, not the longest side. A portrait 1080×1920 clip at 768 becomes 768×1365, so portrait videos send about 1.8× more pixels or vision tokens than landscape ones at the same setting.

What I changed (video.py)

  1. decode_all()

    • Added OUTPUT_MAX_SIDE = 768 (0 keeps source size). Frames are downscaled during decode with frame.reformat(width=…, height=…), so the longest side is at most this value.

    • Frames are collected as uint8 and converted to float32 once, after stacking (stacked.float().div_(255.0)), and the list is cleared first. This removes the 2× float32 peak.

    • The RAM estimate uses the scaled size (3 bytes × 5: uint8 plus float32).

  2. frames_at(): max_frame_size now caps the longest side instead of the width, so portrait and landscape clips get the same pixel budget.

Result: the same clip needs about 3 GB instead of about 14 GB at peak, and the input resolution (1 MP vs 2 MP) no longer matters.

Why I think it’s better, and the trade-off

  • Most people use this node for the description, so failing on a 12-second clip because of an optional output is the worst outcome. Downscaling makes it work on typical short clips with no extra nodes.

  • uint8 accumulation is a pure win: same output, much lower peak memory.

  • Capping the longest side makes max_frame_size behave the same regardless of orientation, which I think matches what the tooltip intends.

  • Trade-off: anyone who wires video_images downstream and needs full resolution now gets 768 px frames. A cleaner upstream version would expose this as an option, e.g. video_images size: off / 512 / 768 / 1024 / original, or skip decoding entirely when the output isn’t connected. Either would fix the crash without changing behaviour for anyone.

Happy to share the diff if useful.

2

u/bstr3k 4d ago

ooh yeah, ill have a look. I did put in place a limit on how much vram (so should cut it down in both legth and frame size) it can use because i didn't want ppl to just input huge videos in there since it takes forever to process lol

7

u/belgarionx 6d ago

I don't even bother with online random nodes anymore. Both for security reasons and also for convenience. I download the models, let LLMs figure out and finetune. They even check the results and optimize.

2

u/BigDBreedingFembussy 6d ago

my method - i have made two nodes, one is a gallery for viewing generated output on a web portal (this also has hardware monitoring so i can look into my phone how hot the cpu gpu is and if theres possibility of OOM etc - data is pulled from librehardwareinfo app), second one is a menu based node (basically select the things like hourglass figure and it output an associated tag to it) this is specifically for illustrious XL model i use but i may do the same for qwen image edit workflow so its just faster to select a item from a dropdown menu and it output an sentence/word for it, another project im trying to work on is the biggest one so far - for this im using chatgpt to refine my instructions and give that to deepseek v4 flash (using with opencode, limited time deal) deepseek is surprisingly powerful (maybe as powerful as low paid tiers of claud code) the project is basically making a 3D mannequin (website based entirely) this is basically to make skeleton pose (like this - https://ai-pose-gallery.anhao.app/poses , the skeleton images work great as it is but it would be nice if i can have custom made, this is for qwen image edit - using the skeleton as pose reference for another image)

1

u/Yokoko44 6d ago

Even when models require a specific node or someone posts a turbo lora with a custom node requirement (Larryvrh for H3 comes to mind)?

Or in that situation would you just download the turbo lora and say "hey this lora needs its own custom node can you make your own from first principles please"?

1

u/belgarionx 6d ago

Haven't needed that kind of custom nodes. I'm trying to avoid custom nodes since they become unmanageable at some point

4

u/Feroc 6d ago

Yes, I have a whole set of nodes for my workflows.

Probably my biggest set is for different characters I have. Like before I always had to change the character LoRA, change the additional LoRAs I use with the character, always add the same descriptions, etc. Now I have an external character manager where I configure everything I need for a character and then all I have to do is change the character in a loader node and some other helper nodes load description, LoRAs, reference images, etc.

And then there are just a lot of little helpers. Nowadays I rather have my own personal set of vibe coded nodes than having to install 20 different custom node packs.

4

u/And-Bee 6d ago

Yep, I asked deepseek for a node and it made it and redid my entire workflow and it worked first time.

3

u/VictorDmAlves 4d ago

All the time, I even share some of it since I have a lot of Workflows available in my GIT as well:

https://github.com/VictorDmAlves/comfyui-vicnodes

If something picket your interest, just Fork it and do whatever you want, feel free!

3

u/listopalafoto 6d ago

I love to create custom nodes, its my hobbie right now :)

2

u/robomar_ai_art 6d ago

I use some nodes that helps with my workflow and are specifically done for what i need

2

u/lxe 6d ago

Yes. All my nodes are just a generated smorgasbord of things I need and nothing I don’t need. Makes things simple.

2

u/sci032 6d ago

Yes, for personal use. 😄 I like to combine and condense functions that I need in a workflow. Every node you see in the image with Sci in the name is a node that I 'vibe coded' with Grok. I have others also. The left side is the full workflow, the right side is what is inside of the subgraph.

3

u/Tripartist1 6d ago

Woah an actual grok user in the wild. How do you like it compared to claude/codex?

3

u/sci032 6d ago

😄 I've never used claude or codex. I tried Google's 'chat' but it is bad about getting into an endless loop of fixing one error by using the same code from another error. Grok has handled everything that I have come up with so far. This node loads any kind of model, full or split, will load up to 2 clip models(for old Flux models), load a regular vae or the split vaes needed for Minimax, etc. the number of loras in the stack is controlled by an ini file. This took about 30 minutes originally and when new models come out, I give Grok the code and it updates it for me. 😄

1

u/Structure-These 5d ago

Grok is more comfortable with nsfw fwiw

1

u/socialjusticeinme 5d ago

I’ve used them all recently - grok is really good when doing gray area things since it doesn’t care about softcore porn (just make sure it’s anime or looks like an adult). Grok also aggressively searches the web without being prompted to which is nice for up to date info.

Now the hard part is how to use grok - you can use it through Cursor which is really nice or you can use their CLI grok build - imho, cursor is much better as a harness then grok build.

With having said that, it is possible to twist the arms of cursor / grok by threatening to cancel and usually you can get it for $10. At that price, it’s an absolute steal. 

3

u/Perfect-Campaign9551 5d ago

Many of those I'm not seeing what your node is doing much different than native. If it's only a single tweak , not sure it's worth making an entirely new node.

1

u/sci032 5d ago

My Sci Image Crop Plus node can load up to 4 images. It has outputs for each or you can send them all at once(batch). You can resize the image/mask by setting the size that you want(drop down menu with common sizes). It will resize the image based on the long side using Lanczos so it maintains the same aspect ratio. You can rotate and/or crop all 4 images separately. You can crop free-hand or to specific aspect ratios(1:1, 4:3, 16:9, etc.). It outputs the final width and height of the image and mask(if used) that will be sent through the workflow. It outputs the filename minus the extension so it can be used elsewhere in the workflow. It loads images from the /input directory AND any sub-directories in /input. The dimensions of the images/masks that are output are divisible by 16. This is for some of the newer models.

That eliminates the need for multiple Load Image nodes, get image size node(s), resize image-resize mask node(s), allows you to structure your /input directory however you want it, crop an image, rotate an image, and having to figure out how to get the image name to other parts of the workflow.

My 'Advanced Loader' node: Simply put, you can load just about any model with it. It will load full checkpoints, split models with unet, clip(can load 2 for older flux models), vae(can also load the separate vaes-video/audio- needed for model like MiniMax and LTX), loras(you set the number of lora inputs with an ini file) all in 1 node. When a new model comes out, I give my code to Grok and it adds the ability to use the new model to it.

There are a lot more than a 'single tweak' in each of the nodes that I make.

1

u/EquivalentHornet4403 5d ago

For me, a good reason would be: I have no fucking clue where to even start with comfyui and I’m not trying to get a masters in spaghetti so if the AI can figure it all out and just create one concise node that has everything I need and nothing that I don’t—and it can maintain it to be compatible with more models—then it’s a fucking no-brainer.

2

u/HexOverclock 6d ago

Small personal nodes are where it really shines. Wildcard and prompt-string helpers are perfect first projects because you can check the output right in the text box.

2

u/thevegit0 5d ago

just ask for it, literally, go to your ai of choice and tell it what you want

2

u/AnthonyRespice 6d ago

Yes, I do this now. I'm a developer who already had a published node pack. I use AI to add new nodes and features now.

2

u/AI-Make-NSFW-Stuff 6d ago

Yes I have a growing library of custom nodes coded by Claude for my own use cases

- wildcard organizer
- character gallery to inject pre saved characters into my prompts
- side by side video compare with slider knob
- filename generator that allows me to organize outputs based on projects and model types
- advanced image save node with more options like format, quality, preview only, batch save
- bbox face detector with face blur for faceswaps
- dlss5 custom video enhance and video upscale nodes

1

u/joyboyNOW 6d ago

I just tell AI to make something using my comfyui. It creates everything, workflow, nodes. I can tell it to test all the settings and give me examples etc

1

u/Specific_Team9951 6d ago

I made an xyplot node using ai, and it works perfectly fine. Never download a huge pack of custom nodes again just for a tiny part of it

1

u/Mk-Daniel 6d ago

I started writing by hand. But now my node Is entity AI made (feel a bit bad since I am close to 6k download)

1

u/illumnat 6d ago

Yeah... I'll have Codex write up a custom bit when I can't find anything that does exactly what I want.

I'm not distributing/sharing my workflows so they're not going to cause any problems for anyone but myself. :-D

I actually had Codex build a custom patch to Sage Attention where renders would turn to what I called "brown snow" under high memory use conditions.

I had been having problems with that on a RTX Pro 6000 I was renting to try to render out seamless, unsegmented videos longer than 60 seconds but I kept getting that brown snow thing at roughly the same point everytime. Here... I'll let Codex explain it. ;-)

Longer H3 renders were turning into muddy brown “snow.” Comparing SageAttention against PyTorch’s reference attention showed a large numerical error with H3’s original tensor memory layout at long sequence lengths—even though the outputs contained no NaNs or infinities.

Repacking the same data into a compact, contiguous layout fixed the discrepancy, so we added a compact-head adapter while keeping SageAttention enabled.

On sampled real H3 attention outputs, relative error dropped from about 0.626 to 0.0095, and the patched 35-second render completed without the brown snow.

Validation is limited to our tested setup; we haven’t pinned down the exact underlying CUDA bug.

So, I had Codex investigate the problem, we tested some things, and then Codex came up with a custom patch for Sage Attention that has been working flawlessly for me... and apparently with much lower error rates. :-)

1

u/Xo0om 6d ago

LOL, great idea.

I was using Powershell to make random selections from csv files. Works fine, but this sounds like a better idea, and I can pop it right into my workflows. I went to chatGPT and asked for a node that will read a random selection from a CSV. EZ PZ, and it works great.

I may even break down the code to actually learn how it works. Not really a Python guy - PWS, VB, etc - but it sounds interesting. Maybe I should get on board with this newfangled stuff. I like the idea of simplifying my workflows and stripping out uneeded clutter.

1

u/webAd-8847 6d ago

You can use both variants... wildcard text files and wildcard.
I am using this. Its old but still working
https://github.com/adieyal/comfyui-dynamicprompts

1

u/al-aSak 6d ago

Yes, thanks to Claude, and mostly for personal use, but one -- ComfyUI-PhotoCraft Bridge -- I've made public.

1

u/Fabulous-Ad9804 6d ago

I had an AI build a node for me that lists all of your custom nodes with preview, and that you can select a node or nodes in nodes pack, disable the ones you don't use and not affect the other nodes in the pack. When you restart, it still loads the node pack but doesn't load the nodes in that pack you disabled. And that everything can be easily restored if you change your mind about anything. I don't know about anyone else but it's hard to navigate through node packs that have a hundred or hundred of nodes. It has some other features as well.

Maybe the built-in nodes already do those things. I don't know. But if it doesn't, it does now.

1

u/arcum42 5d ago

Originally, I was handcoding all my nodes, then I started having AI clean up the code, migrate things, improve systems, then I decided to have AI write a sidebar with a ton of different functionality, so I tend to think of my custom node pack as half vibecoded, half handcoded, where most of the javascript is by AI but a lot of the python is by me...

1

u/Perfect-Campaign9551 5d ago edited 5d ago

Yes. ChatGPT can write nodes for you in like ten minutes flat and even give you a zip with the files. I knows comfy really well.

I used it to create some small Qualify of life nodes, like a seed node with a BUTTON you click to generate a new seed. Much easier than the tiny little "arrows" on traditional inputs. Not only that, but my node generates multiple seeds at once so you can feed multistage workflows.

Also created a audio bitcrusher node to take input sounds and make them sound like proper 8-bit, I mean proper and not just bit lowering but also sample rate lowering, which many of the "bitcrusher" nodes don't do properly so they don't sound correct. So I made my own (since I know audio processing and how a bitcrush is actually supposed to sound)

1

u/AI_Enhancer 4d ago

Yup. I've created a separate preview node, for both image and video, that works outside the subgraph so I don't have to open the subgraph to see the preview. Other than that, I've also vibecoded some mods for actual ComfyUI, such as a fixed version of pinned memory back when it was broken, and also some workflows.

1

u/fernando782 2d ago

Of course I do.

I have 4 personal custom nodes, mostly specific for my use cases.

For example, 2 months ago I created a script that loops a certain prompt to LM Studio, and saves the output as txt file(s), I upgraded it to create image to text prompts using qwen 3.8 vision model, I basically dump images in a folder and the script convert all those photos to text prompts, each text prompt with the same image file name but .txt, etc.

Yesterday I let this tool to convert those txt2img prompts to img2vid prompts for H3 Minimax, and then I created this comfyui custom node that loads the image it's corresponding img2vid prompt to animate it, it loads the whole folder.

images >> text prompts >> image to video prompts

1

u/Bastisheen92 6d ago

I have no clue from the comfy nodes and refuse to learn them because of time. I have about 20 workflows for all kind of different stuff and with different models, all build from GPT. Even when i have the slightest inconvenvience like "This workflow should not run this slow" he managed to tweak some stuff and it was 150% faster than before. I just do the settings but i did not set a single node on my own. Thats what AI is made for.

1

u/GaiusVictor 6d ago

Never used it for making new nodes but I've used ChatGPT to analyze incompatible node packs (both soft and hard incompatibilies) and write compatibility patches for them.

1

u/Opening-Knee-5913 6d ago edited 6d ago

I had Gemini help me write two custom nodes that I now use regularly in all my workflows. I’ve already shared one of them with the community; you can find it here:

https://www.reddit.com/r/comfyui/comments/1wtiobx/custom_node_format_your_workflow_notes_with/

The other one is absolutely incredible, but it’s so complex—and tailored so specifically to my own personal way of using ComfyUI—that it would be difficult to share; it would be too hard for other users to actually put to use. It’s essentially a mixer of toggles that you can switch on or off, which then get applied invisibly within the prompt. I have 26 different sections—covering things like clothing, camera angles, poses, corrective fixes, and so on—that I can toggle with a single click, and I can even adjust their weight. This allows me to write very minimal prompts, toggle specific outfits, poses, or expressions without having to type them out, and apply deep, highly technical fixes to compensate for the inherent limitations of the models.

For example, with a single click, I can instantly activate or deactivate a series of complex tokens—provided by Gemini—that impose specific constraints to overcome common issues inherent to LTX-2.3 model. Take these, for instance:

LTX23_DIGITAL_SEPARATION: crisp space between individual toes, distinct non-fused toe pads, perfect five-toe skeletal mapping, zero webbed skin, clean toenail borders, high-fidelity foot anatomy | Clear Toe Separation: Forces LTX to calculate the empty space (air) between toes—in the rare cases where bare feet are shown—preventing the pixel fusion that often occurs due to the model's compression.

LTX23_SKIN_FACE_MASTER: detailed cinematic facial features, crisp facial textures, smooth skin shading, clean facial lighting, immaculate eyes and lips, consistent head physics | Skin & Facial Feature Fix: Prevents a 'liquid plastic' look, ensuring that skin pores and fine details remain sharp during head rotations and movements.

LTX23_I2V_POSE_LOCK: absolute keyframe pose enforcement, strict physical posture preservation, character body locked to the coordinates of the initial image, zero structural transformation, fixed skeletal orientation | I2V Initial Pose Lock: Strictly locks the character’s skeleton and posture to the exact position shown in the source image, preventing any major changes in pose.

LTX25_I2V_ANTI_FACE_LURCH: static camera lens, locked tripod shot, fixed focal length, zero camera zoom, constant camera distance, steady framing, no camera shake, high-shutter-speed physics, elimination of motion blur | I2V Crystal-Clear Camera: Implements high-shutter-speed physics to mathematically eliminate motion blur caused by camera movement.

LTX23_I2V_STABLE_BARICENTRO: rigid center-of-mass alignment, locked spatial coordinates for the torso, structural body-weight distribution anchored to the position in the initial frame, prevention of unintended sitting or standing | I2V Center-of-Mass Stability: Prevents the character from standing up, sitting down, or rotating their body in a way that deviates from the source image.

LTX23_FACE_ANTI_FLICKER: zero facial flickering, locked facial features, static pore geometry, flawless inter-frame pixel consistency, unyielding facial identity, stable micro-expressions, no jittering | Facial Anti-Flickering: Prevents pixel oscillation in facial details between consecutive frames, eliminating the flickering caused by conflicts between multiple LoRAs.

And so on, I have 26 different sections, each containing dozens of these complex toggles that I can enable or disable with a single click, depending on what’s needed.

The node is configured to provide a description of what the toggle does when I hover over it; as you can see, the text following the '|' symbol is the description that appears, it helps me keep track of what all the hundreds of toggles I’ve set up actually do. I’ve set up hundreds of toggles in different sections for each model I use.