How to Run ComfyUI on Vast.ai and Generate AI Images

Published: July 12, 2026 | Last Updated: July 12, 2026

ComfyUI is a powerful, node-based graphical user interface (GUI) designed for building complex generative-AI workflows. Unlike simpler interfaces, ComfyUI allows you to visualize and control every step of the image generation process. It is highly versatile, supporting everything from basic text-to-image and image-to-image to advanced inpainting, upscaling, animation, and video generation.

While ComfyUI is exceptionally efficient, running modern AI models like Stable Diffusion XL (SDXL) or Flux requires significant GPU power and VRAM. For many developers and enthusiasts, renting a cloud GPU is more practical than investing thousands in local hardware. Using ComfyUI on Vast.ai offers several key benefits:

Want to follow along?
Browse available GPUs on Vast.ai and launch a ComfyUI-ready instance.

DevOps Depo may receive a referral credit if you create an account through this link, at no additional cost to you.

What you need

Before you begin, ensure you have the following:

The Vast.ai template system simplifies the process by providing prebuilt configurations that include ComfyUI and its dependencies.

Step 1: Choose the right GPU

Selecting the right GPU is primarily a balance between VRAM (Video RAM) requirements and hourly cost. AI models are loaded entirely into VRAM during generation, so if your model is larger than your GPU's memory, the workflow will fail.

Intended Workload Suggested VRAM Starting Point
Basic SD 1.5 workflows 8–12 GB
SDXL workflows 12–16 GB
Larger Flux-style workflows 24 GB or more
Video, large batches or advanced workflows 24–48 GB or more

Note: These are general starting points. Actual requirements vary based on resolution, custom nodes, and specific model quantization.

When browsing the Vast.ai marketplace, look beyond the hourly price. Consider the Reliability rating, Download/Upload speeds (important for fetching large models), and the Total cost (which includes storage and bandwidth).

Step 2: Find a ComfyUI template

Instead of installing everything manually, use a pre-configured Docker template. This ensures that CUDA drivers and Python dependencies are correctly set up for the GPU.

  1. Sign in to your Vast.ai account.
  2. Go to the Templates section in the sidebar.
  3. Search for ComfyUI.
  4. Look for a reputable template (often from the Vast.ai team or a well-known community member).
  5. Review the template description: Pay attention to the default ports, login credentials (if any), and where the models are stored.
  6. Click the template to use it as your search filter, then compare the available machines.

Step 3: Allocate storage

AI models are massive. A single SDXL checkpoint can be 6GB, and a full set of Flux models can easily exceed 20GB. When you rent an instance, you must specify the Disk Space allocation.

Remember to leave room for:

Warning: The storage size you select at launch often cannot be increased later without destroying and recreating the instance. For a beginner using SDXL, 50GB to 100GB is a safe starting range, but always adjust based on your specific needs.

Step 4: Start and open ComfyUI

Once you click RENT, Vast.ai will begin pulling the Docker image. This can take several minutes depending on the host's internet speed. Wait until the instance status changes to "Running".

To access the interface, find your instance in the "Instances" tab and click the OPEN or CONNECT button. Most templates are configured to redirect you automatically to the ComfyUI web interface.

Security Tip: Never expose an unauthenticated ComfyUI interface to the open internet. Most Vast.ai templates use a secure proxy or SSH tunneling to keep your instance safe. Treat ComfyUI custom nodes like any other executable software—only install what you trust.

Step 5: Understand the ComfyUI interface

ComfyUI works by connecting "Nodes" together. Here are the core concepts you'll see in almost every workflow:

Step 6: Install or locate a model

Some templates come with models pre-installed, but usually, you'll need to download your own. ComfyUI expects files in specific subfolders under models/:

ComfyUI/
└── models/
    ├── checkpoints/        <-- Main models (e.g., .safetensors)
    ├── loras/              <-- Style/character modifiers
    ├── controlnet/         <-- Composition tools
    └── vae/                <-- Color/detail decoders

To install a model, you can use the terminal (via SSH) to wget or curl the file directly from a source like Hugging Face or CivitAI into the correct folder. After adding a file, click Refresh in the ComfyUI menu (or press r) to make it appear in the loader nodes.

Step 7: Load a basic workflow

The easiest way to start is by loading a default workflow. You can:

  1. Click Load Default in the ComfyUI menu.
  2. Drag and drop a ComfyUI-generated PNG into the window (it will automatically load the workflow used to create that image).
  3. Click Load and select a JSON workflow file you've downloaded.

Ensure your workflow has the basic connections: Model -> CLIP -> Sampler -> VAE -> Save Image.

Step 8: Generate the first image

Let's try a test prompt to ensure everything is working correctly:

Positive Prompt:
A detailed cinematic photograph of a futuristic research station on a mountain at sunrise, dramatic clouds, natural lighting, high detail

Settings:

Click Queue Prompt. You will see the nodes highlight in green as they process. Once finished, your image will appear in the "Save Image" node.

Step 9: Save outputs and workflows

Because cloud instances are temporary, you must download what you want to keep:

Pro Tip: Save your JSON workflows separately. While ComfyUI embeds metadata in PNGs, that data is often stripped if you upload the image to social media or Discord.

Step 10: Stop or delete the instance

To manage your budget, you must understand the difference between stopping and deleting:

Always download your outputs and save your JSON workflows before clicking the trash icon!

Installing Custom Nodes Safely

Custom nodes add incredible functionality like video generation (AnimateDiff) or advanced upscalers. Most users install the ComfyUI Manager to handle this. If your template doesn't include it, you can usually enable it by running:

python main.py --enable-manager

Safety Warning: Custom nodes can execute code on your instance. Only install nodes from trusted, active repositories. Installing too many nodes at once can lead to dependency conflicts and prevent ComfyUI from starting. Install one at a time and test your workflow before adding more.

Troubleshooting

ComfyUI does not open

Check the "Logs" button in Vast.ai. If the Docker image is still downloading or the startup script is installing dependencies, the interface won't be ready. Wait a few more minutes.

CUDA Out of Memory (OOM)

Your GPU has run out of VRAM. Try reducing your image resolution, lowering the batch size, or using a "quantized" version of the model which uses less memory.

Red Nodes or Missing Nodes

This happens when you load a workflow that requires custom nodes you haven't installed yet. Use the ComfyUI Manager's "Install Missing Custom Nodes" feature to fix this.

Cost Optimization

Final Thoughts

Deploying ComfyUI on Vast.ai gives you the power of a professional AI workstation without the high price tag. By following this guide, you can jump from basic image generation to building complex, high-performance AI tools in the cloud.

Build your first cloud ComfyUI workstation:
Compare available GPU offers on Vast.ai and select the VRAM, storage, and reliability level that fits your workflow.