Setting up AI Image and Video workflow using ComfyUI on Runpod
Introduction
If you're looking to build powerful AI image and video generation workflows without relying on expensive local hardware, ComfyUI on Runpod is a game-changer. In this guide, I’ll walk you through setting up a cloud-based, node-powered workflow that lets you generate high-quality visuals using tools like Stable Diffusion, ControlNet, and more—right from your browser.
What is ComfyUI?
ComfyUI is a graph-based, modular interface for creating AI-powered image and video workflows—most commonly with models like Stable Diffusion. Unlike prompt-only tools, ComfyUI gives you complete control over every stage of the generation pipeline using a node-based editor. You can chain models, tweak parameters, apply filters, and build complex workflows visually, making it ideal for power users, developers, and creatives alike.
What is RunPod?
Runpod is a cloud platform that offers on-demand GPU compute environments, perfect for running resource-intensive applications like AI model inference. Instead of investing in a high-end local GPU setup, you can spin up powerful GPU containers within minutes on Runpod, only paying for what you use. It supports custom templates, persistent storage, and easy SSH or web-based access—making it a popular choice for deploying tools like ComfyUI in the cloud.
Setup Runpod
-
Create a runpod account and put some money to your account from the billing page.
-
Next go to the storage page and create a new network volume.
-
Choose a data centre with good availability of RTX 4090. I selected
US-IL-1
-
Name the volume something, does not matter. I named
ai-content
-
Select a conservative size. I chose 40GB. Please note that runpod does not allow to reduce this later
-
Hit
Create Network Volume
and you have the network storage volume where your workflows, comfyui, other files and folders will reside -
Next, go to pods and start a pod. You need to remember to start and terminate the pod as soon as you are done with work as this gets charged by the second
-
First, select your network volume that you created, in my case I select
ai-content
-
Select a GPU, I select
RTX 4090
-
Select a pod name does not matter, I use the autogenerated one as this pod will be destroyed once we're done
-
For Pod template, select the official template named Runpod Pytorch 2.4.0 runpod/pytorch:2.4.0-py3.11-cuda12.4.1-devel-ubuntu22.04
-
Click on
Edit Template
and change theExpose HTTP Ports
value to8888,8188
. The 8888 port is used by Jupyter notebook and 8188 by ComfyUI -
Hit
Save Overrides
and thenDeploy On Demand
-
The Pod should be ready within a minute or so, at this point the status is changed to
Running
. Now expand the Pod and then hitConnect
and then openJupyter Lab -> :8888
. You should now be seeing a Jupyter interface with the directoryworkspace
opened.
Install ComfyUI
-
Open the terminal within Jupyter Lab and clone the ComfyUI from their official git repository by running the following:
git clone https://github.com/comfyanonymous/ComfyUI.git
-
If you see a message about authenticity, it is just because github is not added as a trusted source. Just say yes, this should create a folder named
ComfyUI
. -
Next, we'll create a virtual environment for ComfyUI and then install ComfyUI dependencies without changing the global config:
-
In the Jupyter lab terminal first get to the directory 'ComfyUI' by running
cd ComfyUI/
then runpython3 -m venv venv
, it takes a minute. -
Now the venv is created. Activate it by running
source venv/bin/activate
- This should add (venv) before root
- Now first upgrade pip by running
pip install --upgrade pip
- Now install the ComfyUI dependencies by running
pip install -r requirements.txt
This might take a while, so chill and get some coffee or something
-
After installation is done, close the terminal
-
Now we need to create a start script that will automatically start the virtual env and create the comfyUI instance
-
Open a new terminal window, make sure you are in the
workspace
folder and make sure that you are not in (venv) -
Create the start script by running
touch start.sh
- Open the newly created file on the left panel by double clicking,then copy paste the following:
#!/bin/bash
cd ComfyUI
source venv/bin/activate
python main.py --listen 0.0.0.0 --port 8188
- Save the file and then give the start script executable permission bu running
chmod +x start.sh
- Now start the ComfyUI instance by running
./start.sh
- Once it says the GUI is ready, go to the My pods page on Runpod, expand the running pod and then click on
HTTP Service -> :8188
- This should land you on the ComfyUI interface in a new browser tab
- After making sure this runs, go back to Jupyter lab terminal where it is running and stop the process by running ctr + c
Install a Model
-
Now you are ready with ComfyUI, but you dont have any models or checkpoints to work with. You need to install models to get started
-
You can install any model, I am installing Realistic Vision
-
Visit it's civitai page (https://civitai.com/models/4201?modelVersionId=501240) and then right click the download button to copy the download url
-
Go back to your Jupyter Lab, open a new terminal window, make sure that you are not in (venv)
-
Go to the correct folder by running
cd ComfyUI/models/checkpoints/
- Now download the checkpoint by running
wget 'ReplaceThisWithTheDownloadUrl' --content disposition
- Make sure that you use the right download URL by right clicking the download button
- This will take some time depending on the speed
All Done
- Now you are fully loaded and ready to roll. Once the checkpoint installation is completed, go to the workspace directory, open a terminal window and run
./start.sh
to start the ComfyUI instance again - Once it says the GUI is ready, go to the My pods page on Runpod, expand the running pod and then click on
HTTP Service -> :8188