A ComfyUI Node that uses the power of LLMs to do anything with your input to make any type of output.
comfy/custom_nodes
or Just search for AnyNode
on ComfyUI ManagerAnyNode
or you can find it in Nodes > utilsopenai
module installed through pip: pip install openai
OPENAI_API_KEY
variable to your Environment Variables. How to get your OpenAI API keyAnyNode 🍄
Is the node that directly uses OpenAI with the latest ChatGPT (whichever that may be at the time)
GOOGLE_API_KEY
variable to your Environment Variables. How to get your Google API keyAnyNode 🍄 (Gemini)
is still being tested so it probably contains bugs. I will update this today.
We now have an AnyNode 🍄 (Gemini)
Node and our big star: The AnyNode 🍄 (Local LLM)
Node.
This was the most requested feature since Day 1. The classic AnyNode 🍄
will still use OpenAI directly.
The way that AnyNode works, is that it executes code which happens externally from python that is coming back from the server
on a ChatCompletions endpoint. To put that into perspective, wherever you point it, you are giving some sort of control in python to that place. BE CAREFUL that if you are not pointing it to localhost
that you absolutely trust the address that you put into server
.
Queue Prompt
in ComfyUIAnyNode codes a python function based on your request and whatever input you connect to it to generate the output you requested which you can then connect to compatible nodes.
Courtesy of synthetic ape
Warning: Because of the ability to link ANY node, you can crash ComfyUI if you are not careful.
You shouldn't trust an LLM with your computer, and we don't either.
Code Sanizitzer Every piece of code that the LLM outputs goes through a sanitizer before being allowed to be loaded into the environment or executed. You will see errors about dangerous code... that's the sanitizer.
No Internet, No Files, No Command Line As a safety feature, AnyNode does not have the ability to generate functions that browse the internet or touch the files on your computer. If you need to load something into comfy or get stuff from the internet, there are plenty of loader nodes available in popular node packs on Manager.
Curated Imports We only let AnyNode use libraries from the list of Allowed Imports. Anything else will not even be within the function's runtime environment and will give you an error. This is a feature. If you want libraries you don't see in that list to be added to AnyNode, let us know on the Discord or open an Issue.
Note: AnyNode can use the openai and google generativeAI libraries in the functions it generates, so you can ask it to use the latest from OpenAI by pasting an example from their API and get it to stream a TTS audio file to your computer, that is a supported library and it's fine.
AnyNode 🍄
, Local LLMs AnyNode 🍄 (Local LLM)
, Gemini AnyNode 🍄 (Gemini)
Queue Prompt
again)json
to output/anynode
so you can bundle it with workflowAs with any LLMs or text generating language model, when it comes to coding, it can sometimes make mistakes that it can't fix by itself even if you show it the error of it's ways. A lot of these can be mitigated by modifying your prompt. If you encounter some of the known ones, we have some prompt engineering solutions here for you.
For this I recommend that you Join our Discord and report the bug there. Often times AnyNode will fix the bug if it happened within your generated function if you just click Queue Prompt
again.
Let's enjoy some stuff I made while up all night!
This one, well... the prompts explain it all, but TLDR; It takes an image as input and outputs only the red channel of that image.
Here I use three AnyNodes: One to load a file, one to summarize the text in that file, and the other to just do some parsing of that text. No coding needed.
I took that Ant example a bit further and added in the normal nodes to do img2img with my color transforms from AnyNode
Here I ask for an instagram-like sepia tone filter for my AnyNode ... I titled the node Image Filter just so I can remember what it's supposed to be doing in the workflow
Let's try a much more complex description of an HSV transform, but still in plain english. And we get a node that will randomly filter HSV every time it's run! Here's that workflow
Then I ask for a more legacy instagram filter (normally it would pop the saturation and warm the light up, which it did!)
How about a psychedelic filter?
Here I ask it to make a "sota edge detector" for the output image, and it makes me a pretty cool Sobel filter. And I pretend that I'm on the moon. Here's that workflow