
ComfyUI makes it easy to design powerful image and video generation workflows, especially when you start adding custom nodes like AnimateDiff, WAN, or Stable Video Diffusion. The problem is that most deployment guides assume you’re fine running a persistent GPU instance and manually managing everything around it. That works for experimentation, but it breaks down quickly if you want reliability, scalability, or an actual backend you can integrate into an app.
I wanted ComfyUI to behave like a backend. That meant being able to send it inputs, wait for a result, and not think about GPUs when nothing was running. This is how I set that up on Runpod using their serverless endpoints.
I’ll assume you already have a working ComfyUI workflow and that you’re comfortable with Docker and GitHub. If not, get the workflow running locally first. Nothing below will work if your graph isn’t already stable.
First We need to set up Runpod pods in other to download our required checkpoints and models
First click the runpod link to setup an account. When signing up, you can use my referral code to get a chance at free credits. This matters because video workflows burn GPU time quickly, and the free credits ($5-$500) helps during setup.
Once your account is created, you need to add money to it. Runpod requires a minimum balance (usually $10) before you can spin up GPU resources. Go to the billing section and fund your account. Nothing else will work until you do this.
Runpod | The cloud built for AI
Next, create network storage. This is critical. Without it, every time your pod shuts down, you lose your models
Once logged in, Select the Manage drop down (left side bar)
Click on New Network Volume

Choose the location where you want to host the storage, A40 is a good option for image and video workflow. Hovering over the data center will show you the availability for the GPU. 40GB is a reasonable minimum for ComfyUI video workflows. This volume will later be reused by serverless endpoints as well.
Enter Storage Name and select 40GB in Size

Now in your storage you will see the list of Storage created, click on the desired storage

Click Configure Pod with Volume. Don’t go through Pods → Create Pod and manually select a datacenter. Using Configure Pod with Volume ensures the pod is created in the same datacenter as the storage volume, which avoids cross-datacenter issues and makes the setup much smoother.

Select A40

Click Change Template
A pop up appears, search and select ComfyUI Manager Permanent Disk torch2.4
Click Deploy and wait

Launch the GUI
Once the pod has finished initializing, connect to it. Open Jupyter or a terminal session and start ComfyUI using the provided startup script.


Click Terminal and run
./run_gpu.sh

Once the process starts, you’ll see the ComfyUI service come up and bind to port 8188. Open your browser and navigate to http://0.0.0.0:8188 to access the UI.
If you’re working with a custom workflow, load it through the ComfyUI Manager. At this point, you’ll likely see missing model warnings, which is expected since no checkpoints have been installed yet.
Navigate to the /workspace directory and install all required checkpoints for the workflow. Before proceeding, review your workflow to confirm which models and custom nodes it depends on, and make sure those are installed as well.
wget -O /ComfyUI/models/clip/umt5_xxl_fp8_e4m3fn_scaled.safetensors \
"https://huggingface.co/comfyanonymous/wanvideo_comfyui_and_scripts/resolve/main/umt5_xxl_fp8_e4m3fn_scaled.safetensors"
wget -O /ComfyUI/models/clip/umt5_xxl_fp8_e4m3fn_scaled.safetensors \
"https://huggingface.co/comfyanonymous/wanvideo_comfyui_and_scripts/resolve/main/umt5_xxl_fp8_e4m3fn_scaled.safetensors"
wget -O /ComfyUI/models/vae/wan_2.1_vae.safetensors \
"https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repack/resolve/main/split_files/vae/wan_2.1_vae.safetensors"
wget -O /ComfyUI/models/diffusion_models/Wan2.1/wan2.1_i2v_480p_14B_fp8_e4m3fn.safetensors \
"https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repack/resolve/main/split_files/diffusion_models/wan2.1_i2v_480p_14B_fp8_e4m3fn.safetensors"
wget -O /ComfyUI/models/clip_vision/clip_vision_h.safetensors \
"https://huggingface.co/comfyanonymous/clip_vision_gits/resolve/main/clip_vision_h.safetensors"
Before terminating the pod, move all downloaded models from the ComfyUI directory into the /workspace directory so they are accessible to the serverless endpoint. Run the following command:
mv /workspace/ComfyUI/models /workspace/
rm -rf /workspace/ComfyUI
After this step, terminate the pod. All data remains on the network volume and can be reused later. Leaving a GPU running is costly and unnecessary once the setup is complete.

Runpod provides an official ComfyUI serverless template. This template is limited: it supports a fixed model configuration and does not allow arbitrary custom nodes. If your workflow fits within those constraints, this is the fastest path.
Go to the Serverless section in Runpod
create a New Endpoint. Choose the ComfyUI template from Browse Serverless Repos then deploy/create.

Click on the Serverless Endpoint you just created -> click Manage -> click Edit Endpoint, attach the same network volume you used for the pod. This allows the serverless worker to access the models you already downloaded.
Configure the endpoint type. For API-style usage for example if you are building a react app and you connect to the comfyui via api calls, a queue-based endpoint is usually safer. Choose a GPU similar to what you used in the pod.
Deploy the endpoint. Runpod will build and test it automatically. Once it’s live, you can call it using your Runpod API key and send inputs that match the template’s expected format. I will try to cover another tutorial on how to test the api
If your workflow requires custom nodes, LoRAs, or nonstandard models, stop here. The template will not support that. You need a custom worker. Go to part 3

This is the cleanest way to deploy your exact ComfyUI workflow without hand-writing Dockerfiles.
First, export your workflow from ComfyUI using Comfy → File → Export. Do not use Export (API). Save the JSON.
Next, upload that workflow JSON to https://comfy.getrunpod.io, make sure you connect to your github account. This service analyzes your workflow, identifies required custom nodes, and generates a complete GitHub repository with:

After you upload your workflow, click analyze. Once analysis is done click next

Review your Generated Docker file and click next

Once the repository is generated, push it to your GitHub account. You don’t need to manually build the Docker image. Runpod will do that.

Now return to the Runpod console and create a new serverless endpoint. This time, choose Import Git Repository instead of a template. Select the repository that was generated from your workflow.
Configure the endpoint as before: choose GPU, endpoint type, and attach your network volume if your models are stored there. Deploy the endpoint.

Runpod will build the Docker image from the generated Dockerfile, push it to their registry, and deploy the endpoint automatically. The initial build can take some time, especially if large models are being downloaded. Once the build finishes, your ComfyUI workflow is running as a serverless API.
If you want to add additional custom nodes or models later, update the Dockerfile to include them and push the changes to GitHub. Runpod will automatically rebuild and redeploy the worker.
https://www.buymeacoffee.com/janeodum