There are many situations where you need to create a node in the middle of testing various ComfyUI workflows. What if there a there is a way by which you can create a custom node for any type of calculation or functional based task in real-time by just typing it.
Here comes the Any Node that sorts your problem. This uses LLMs(Large Language Models) at the background to understand what text your are typing. You can use any LLMs like OpenAi's ChatGPT, Google's Gemini or any third party LLMs(Mistral, LLAMA2, LLAMA3, etc) using OOLAMA.
This process helps you to work more professionally without managing all those hectic coding.
Table of Contents:
Installation:
1. Make sure you did the ComfyUI installation.
2. Move inside "ComfyUI/custom_nodes" folder. Open command prompt using "cmd" on folder address path. Clone the Any nodes repository using following commands:
git clone https://github.com/lks-ai/anynode.git
Alternative:
Move to ComfyUI manager and search for "anynode" and click "Install" button.
3. Install and setup any LLMs. For this there are multiple alternatives you can choose from:
(a) Create your OpenAI's API key from their official page. You also need to install dependencies on command prompt using "cmd". Install OpenAI python library using following command:
pip install openai
After creating you API , you need to use any editor(like Notepad++ or Sublime text) and create a ".env" file. Save the file inside "comfyui/custom_nodes/anymode" folder.
Then, put the key to your new file like this:
OPENAI_API_KEY="<<your-api-key>>"
Here, replace <<your-api-key>> with your OpenAI's API key.
(b) Create and setup Gemini API key from their relevant page. After API creation and setup, you need to use any editor(Notepad++ or Sublime text ) and create a ".env" file. Save the file inside "ComfyUI/custom_nodes/anymode" folder.
Then, put your API key to your new file like this:
GOOGLE_API_KEY="<<your-api-key>>"
Here, replace <<your-api-key>> with your Gemini's API key.
(c) Download and setup third party LLMS using OOLAMA. This the best option when you don't want to pay for API and rely on your own robust setup.