Skip to main content

ComfyUI on a Cloud GPU: Run Stable Diffusion and FLUX Remotely (2026)

· 7 min read
Yassine El Haddad
Software Developer & Automation Specialist

I build production AI agents, web scrapers, and automation pipelines. Most of what I publish here comes from the actual problems they run into: proxies that get banned, anti-bot stacks that fingerprint your client, RAG that drifts when the underlying data moves. Stack: Python, TypeScript, Go, FastAPI, LangChain, Crawlee, Playwright, deployed on AWS, GCP, and Cloudflare.

ComfyUI is a node-based workflow editor for Stable Diffusion and FLUX. It is more powerful and flexible than AUTOMATIC1111, with a steeper learning curve. The catch: SDXL wants 12GB+ VRAM, and FLUX wants 24GB+. Most consumer GPUs fall short. The solution: run ComfyUI on a cloud GPU server and access it via SSH tunnel or reverse proxy. This guide covers setup on a fresh GPU server, model management, essential workflows, and remote access. For hosting, Liquid Web offers GPU VPS with RTX 4090, A100, and H100 options.

What is ComfyUI? A node-based Stable Diffusion interface where you wire loaders, samplers, and output nodes into custom pipelines. You can build multi-step workflows (inpaint → upscale → refine) that AUTOMATIC1111 cannot express. Perfect for production image pipelines and automation. See ComfyUI + n8n to trigger generation from workflows.

Get a Liquid Web GPU server → | Apify for image data pipelines →

What Is ComfyUI and Why Cloud GPU?

ComfyUI uses a node-based graph instead of a single form. You connect nodes for loading models, setting samplers, applying LoRAs, and saving outputs. This enables complex workflows that would require scripting in AUTOMATIC1111.

Why cloud GPU?

  • SDXL needs ~12 GB VRAM. FLUX.1 needs ~24 GB for comfortable generation.
  • Consumer GPUs (RTX 3060, 3070) often lack enough VRAM or slow down with large batch sizes.
  • A rented GPU server gives you RTX 4090, A100, or A10G on demand — no upfront hardware cost.

Liquid Web GPU VPS provides these tiers with hourly or monthly billing.


Setup on a Fresh GPU Server

Prerequisites: Ubuntu 22.04, NVIDIA driver installed, nvidia-smi working.

# Verify GPU
nvidia-smi

1. Clone ComfyUI

git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI

2. Create virtual environment

python3 -m venv venv
source venv/bin/activate

3. Install dependencies

pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
pip install -r requirements.txt

For FLUX and SDXL, the default requirements are usually sufficient. ComfyUI Manager adds extra nodes — we'll cover that next.

4. Run ComfyUI with remote access

python main.py --listen

--listen binds to 0.0.0.0, so ComfyUI is reachable from outside localhost. Default port is 8188.


SSH Tunnel for Secure Access

Exposing ComfyUI directly to the internet can be risky. Use an SSH tunnel:

ssh -L 8188:localhost:8188 user@YOUR_SERVER_IP

Keep this SSH session open. On your local machine, open http://localhost:8188. All traffic goes through the encrypted SSH tunnel.


Essential Nodes and ComfyUI Manager

ComfyUI Manager lets you install custom nodes from a catalog. It's the first add-on to install:

  1. Open ComfyUI in the browser.
  2. Click Manager (or install via git: cd custom_nodes && git clone https://github.com/ltdrdata/ComfyUI-Manager.git).
  3. Restart ComfyUI.
  4. Use Manager to search and install nodes (e.g. ControlNet, upscalers).

Common nodes: Load Checkpoint, KSampler, VAE Decode, Save Image, Load LoRA.


FLUX.1 Workflow Example

A minimal FLUX workflow:

  1. Load Checkpoint — Point to your FLUX checkpoint (flux1-dev.safetensors or similar) in models/checkpoints.
  2. CLIP Text Encode (Prompt) — Your positive prompt.
  3. CLIP Text Encode (Negative) — Negative prompt (optional).
  4. Empty Latent Image — Width 1024, height 1024 (or 768 for SD 1.5).
  5. KSampler — Steps 28–35, cfg 3.5–5, sampler euler or dpmpp_2m.
  6. VAE Decode — Connect KSampler output.
  7. Save Image — Output directory and filename.

Wire: Checkpoint → KSampler; Prompt → KSampler; Empty Latent → KSampler → VAE Decode → Save Image.


SDXL Workflow with LoRA

  1. Load Checkpoint — SDXL base (e.g. sd_xl_base_1.0.safetensors).
  2. Load LoRA — Select LoRA file from models/loras. Set strength (0.7–0.9 typical).
  3. CLIP Text Encode — Prompt. SDXL supports longer prompts.
  4. Empty Latent Image — 1024×1024 for SDXL.
  5. KSampler — Steps 25–30, cfg 7–8.
  6. VAE DecodeSave Image.

Place LoRA files (.safetensors) in ComfyUI/models/loras/. For API-driven automation, ComfyUI + n8n lets you trigger workflows from webhooks without touching the UI.


Port Forwarding and Reverse Proxy

For team access without SSH tunnels, expose ComfyUI via a reverse proxy:

  1. Nginx — Proxy https://your-domain.com to http://localhost:8188. Add Basic Auth or OAuth if needed.
  2. Traefik — Use Traefik v3 for automatic HTTPS and routing.
  3. Cloudflare Tunnel — Free HTTPS tunnel without opening ports; useful for quick sharing.

Never expose ComfyUI directly to the internet without authentication — generation can consume significant GPU time and attract abuse. The same Liquid Web server that runs ComfyUI can also host vLLM for text generation if you need both modalities.


Model Management

TypeDirectorySource
Checkpointsmodels/checkpoints/HuggingFace, CivitAI
LoRAsmodels/loras/CivitAI
VAEmodels/vae/Often bundled with checkpoint
ControlNetmodels/controlnet/HuggingFace

Download from HuggingFace:

cd ComfyUI/models/checkpoints
wget https://huggingface.co/.../model.safetensors

ComfyUI Manager can download from CivitAI and HuggingFace via the UI. Keep checkpoints organized by use case: one folder for SDXL base models, another for FLUX, and separate LoRAs for styles (portrait, landscape, anime). This speeds up workflow switching when you automate with n8n.


ComfyUI vs AUTOMATIC1111 vs InvokeAI

FeatureComfyUIAUTOMATIC1111InvokeAI
InterfaceNode-based graphForm-basedForm + canvas
Workflow flexibilityHigh (custom pipelines)LowMedium
Learning curveSteepGentleMedium
API modeYes (/prompt endpoint)LimitedYes
FLUX supportYesPartialYes
Production automationBestLimitedGood

Choose ComfyUI when you need reproducible workflows, API-driven generation, or complex multi-step pipelines. The same Liquid Web GPU server can run vLLM for LLMs (see Serve LLaMA 3 with vLLM) and ComfyUI for images. To automate generation, connect ComfyUI with n8n; for custom models, fine-tune LLaMA 3 with QLoRA before serving.

Apify Affiliate Banner 728x90Apify Affiliate Banner 728x90Apify Affiliate Banner 300x50Apify Affiliate Banner 300x50
Start with SDXL

FLUX produces higher quality but needs 24GB VRAM. If you have a 12GB GPU, start with SDXL. Once you're comfortable with nodes, add FLUX when you upgrade. Liquid Web offers both 12GB and 24GB+ options.

Frequently Asked Questions

SDXL: 12GB VRAM minimum (RTX 3060 12GB, 4060 Ti 16GB). FLUX: 24GB recommended (RTX 4090, A100 40GB). For batch generation, more VRAM helps.

SSH tunnel: ssh -L 8188:localhost:8188 user@server. Then open http://localhost:8188. For production, use a reverse proxy (Nginx/Caddy) with HTTPS and optionally auth.

Yes. Run headless on a server. Use --listen for network access. No X11 or display needed.

In ComfyUI/models/checkpoints/. Download flux1-dev.safetensors or similar from HuggingFace. ComfyUI Manager can also fetch models.

ComfyUI: node-based, more powerful, API-friendly, steeper curve. AUTOMATIC1111: simpler, form-based, easier for beginners. ComfyUI is better for automation and production pipelines.

Common mistakes and fixes

ComfyUI loads but generation fails with CUDA error.

Verify nvidia-smi shows the GPU. Install PyTorch with CUDA: pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121. Restart ComfyUI.

Cannot access ComfyUI from browser (connection refused).

Run with --listen 0.0.0.0 to bind all interfaces. Use SSH tunnel: ssh -L 8188:localhost:8188 user@server. Access http://localhost:8188 locally.

Models not found or wrong directory.

Place checkpoints in ComfyUI/models/checkpoints. LoRAs in models/loras. ComfyUI Manager can download from CivitAI/HuggingFace.