Wandering Giants Compute · Learn
Complete guide

How to Run Stable Diffusion on a Cloud GPU

The short answer

Rent a GPU with at least 24 GB of VRAM (an RTX 4090 runs SDXL and FLUX comfortably), SSH in, download the model from Hugging Face, then run ComfyUI through an SSH tunnel or a diffusers Python script. SDXL takes roughly 3–5 seconds per 1024×1024 image on a 4090 (estimate): about 1.25 GPU-hours per 1,000.

Minimum practical VRAM
8–12 GB for SDXL; 24 GB for FLUX.1 in FP8
Comfortable starter GPU
RTX 4090, 24 GB, $1.59/hr
SDXL speed (estimate)
≈3–5 s per 1024×1024 image on an RTX 4090
GPU time per 1,000 SDXL images (estimate)
≈1.25 GPU-hours on an RTX 4090
Interfaces
ComfyUI (node graph) or diffusers (Python)
FLUX.1 licences
[dev] non-commercial; [schnell] Apache 2.0
Billing
By the minute from prepaid credit; prices as of November 2026

Running Stable Diffusion on a cloud GPU means renting a machine with a capable NVIDIA card, installing an image-generation front end on it, and reaching it from your laptop over SSH. You skip buying a high-end graphics card, you can switch to a bigger GPU when a model outgrows the small one, and you pay only for the minutes the machine is on. This guide is the full route: which model, which GPU, how to install ComfyUI or diffusers, how to download gated models, how to turn it into an API, and what 1,000 images actually cost.

If GPU rental is new to you, start with what GPU cloud computing is and how it is billed. If you already know you want a provider shortlist, see the best GPU clouds for Stable Diffusion.

What does running Stable Diffusion in the cloud involve?

It is four jobs: rent a GPU, get the model weights onto it, run a front end (ComfyUI or Python), and get the images back. Everything else is optimisation.

"Stable Diffusion" is now a family name. In practice people mean one of these open-weight image models:

ModelMakerSize (published)LicenceNative resolutionNotes
Stable Diffusion 1.5Runway / Stability AI~0.9B (UNet 860M)CreativeML Open RAIL-M512×512Huge library of fine-tunes and LoRAs; dated quality
SDXL 1.0Stability AI3.5B base (UNet 2.6B)CreativeML Open RAIL++-M1024×1024The workhorse; vast ecosystem
Stable Diffusion 3.5 MediumStability AI2.5BStability AI Community License0.25–2 megapixelsLighter MMDiT model
Stable Diffusion 3.5 LargeStability AI8.1BStability AI Community License1024×1024Strong prompt following; gated download
FLUX.1 [schnell]Black Forest Labs12BApache 2.01024×10241–4 steps; commercial use allowed
FLUX.1 [dev]Black Forest Labs12BFLUX.1 [dev] Non-Commercial License1024×1024Top open quality; gated; non-commercial

The Stability AI Community License allows commercial use for organisations under US$1 million in annual revenue; above that you need an enterprise licence. Read each model card before you ship anything: licences are the part of image generation most teams get wrong.

FLUX.1 is not Stable Diffusion, but it is made by researchers who built the original, it runs in the same tools, and most people choosing an image model in 2027 compare the two. We cover it throughout and in depth in how to run FLUX on a cloud GPU.

Which cloud GPU do you need for Stable Diffusion?

For SDXL and SD 1.5, a 24 GB RTX 4090 is plenty. For FLUX.1 and SD 3.5 Large at full BF16 precision, step up to 48 GB or more; on 24 GB they run with FP8 weights or CPU offload. VRAM decides what loads; memory bandwidth and tensor-core throughput decide how fast.

GPU (we rent)VRAMPriceWhat it is good for in image generation
RTX 409024 GB$1.59/hrSD 1.5, SDXL, SD 3.5 Medium, FLUX.1 in FP8; best price per image for most hobby and small-studio work
L40S48 GB$1.89/hrFLUX.1 and SD 3.5 Large in full BF16 with room for LoRAs and ControlNets; bigger batches
A100 80GB80 GB$3.79/hrLarge batches, training LoRAs, video models; no FP8 support
H100 80GB PCIe80 GB$4.99/hrFastest per image of the 80 GB cards here; FP8; serving an image API
RTX PRO 6000 Blackwell96 GB$4.89/hr96 GB for big image and video models, several models loaded at once

The longer argument, with VRAM sums for every model, is in how much VRAM Stable Diffusion and FLUX need. For a buyer's view across every card, read what GPU you need for AI image generation.

Step 1: Launch a GPU with root access

You need a machine where you can install software, so pick the Root way in. On Wandering Giants Compute that gives you the whole machine with SSH and Jupyter, running Ubuntu with the NVIDIA driver, CUDA and PyTorch already installed. Choose the GPU, choose Root, launch, and copy the SSH command from the dashboard.

Any provider that gives you a Linux box with an NVIDIA GPU works the same way from here; the commands below are standard Ubuntu and Python.

Connect and check the GPU:

bash
ssh -p PORT USER@HOST          # use the exact command from your dashboard
nvidia-smi                     # shows the GPU, driver and CUDA version
python3 -c "import torch; print(torch.__version__, torch.cuda.is_available(), torch.cuda.get_device_name(0))"
df -h ~                        # check free disk before downloading models

If torch.cuda.is_available() prints True, the stack is ready. Check the disk: a FLUX.1 setup with text encoders is roughly 35 GB, SDXL about 7 GB, SD 3.5 Large about 28 GB once you count its three text encoders.

Step 2: Set up a Python environment

Make a virtual environment that can see the system PyTorch, so you do not download a second 2–3 GB copy of it:

bash
sudo apt-get update && sudo apt-get install -y git python3-venv
python3 -m venv ~/sd --system-site-packages
source ~/sd/bin/activate
pip install -U pip
pip install -U "huggingface_hub[cli]" hf_transfer

--system-site-packages lets the venv reuse the preinstalled PyTorch and CUDA libraries while keeping everything else you install isolated.

Step 3: Download models from Hugging Face

Use huggingface-cli to fetch weights. Open models download straight away; gated models (Stable Diffusion 3.5, FLUX.1 [dev]) need two things first: click to accept the licence on the model page while signed in to Hugging Face, and create an access token with read permission under Settings, Access Tokens.

bash
# Log in once (stores the token on this machine), or export HF_TOKEN instead
huggingface-cli login
# export HF_TOKEN=hf_xxx   # alternative for scripts

# Faster parallel downloads
export HF_HUB_ENABLE_HF_TRANSFER=1

# SDXL base: single-file checkpoint for ComfyUI
huggingface-cli download stabilityai/stable-diffusion-xl-base-1.0 \
  sd_xl_base_1.0.safetensors --local-dir ~/models/sdxl

# SD 3.5 Large (gated): single-file checkpoint
huggingface-cli download stabilityai/stable-diffusion-3.5-large \
  sd3.5_large.safetensors --local-dir ~/models/sd35

# FLUX.1 [schnell] (Apache 2.0)
huggingface-cli download black-forest-labs/FLUX.1-schnell \
  flux1-schnell.safetensors ae.safetensors --local-dir ~/models/flux

When you use diffusers you usually skip this step: from_pretrained() downloads the multi-file "diffusers format" repo into ~/.cache/huggingface on first run, using the same token.

Model pages worth bookmarking: SDXL base 1.0, Stable Diffusion 3.5 Large and [FLUX.1 [dev]](https://huggingface.co/black-forest-labs/FLUX.1-dev).

Step 4a: Run ComfyUI and open it through an SSH tunnel

ComfyUI is a node-based interface for diffusion models that runs as a web server on port 8188. On a cloud GPU you run it on the remote machine and view it in your local browser through an SSH tunnel.

bash
cd ~ && git clone https://github.com/comfyanonymous/ComfyUI
cd ComfyUI
pip install -r requirements.txt

# Put the checkpoints where ComfyUI looks for them
ln -s ~/models/sdxl/sd_xl_base_1.0.safetensors models/checkpoints/
ln -s ~/models/sd35/sd3.5_large.safetensors   models/checkpoints/

# Bind to localhost only; the tunnel carries your traffic
python main.py --listen 127.0.0.1 --port 8188

Then, on your laptop, in a second terminal:

bash
ssh -N -L 8188:127.0.0.1:8188 -p PORT USER@HOST

Open http://localhost:8188 in your browser. You are now driving the cloud GPU from a local tab.

About --listen: on its own (--listen with no address) ComfyUI binds to 0.0.0.0, every network interface, which makes it reachable by anyone who can reach the machine's IP. ComfyUI has no login, so only do that behind a firewall or an authenticating proxy. Binding to 127.0.0.1 and tunnelling is simpler and safer.

Keep ComfyUI running after you disconnect by starting it inside tmux (tmux new -s comfy, run the command, then Ctrl-b d to detach). The full walk-through, including ComfyUI-Manager, FLUX model folders and running ComfyUI headless as an API, is in how to run ComfyUI on a cloud GPU. The upstream docs are at docs.comfy.org.

Step 4b: Generate images with diffusers in Python

diffusers is Hugging Face's Python library for diffusion pipelines. It suits batch jobs, scripted experiments and APIs. Install it once:

bash
pip install -U diffusers transformers accelerate safetensors sentencepiece protobuf

These examples assume a recent diffusers (0.33 or newer) and PyTorch 2.x.

SDXL

python
import torch
from diffusers import StableDiffusionXLPipeline

pipe = StableDiffusionXLPipeline.from_pretrained(
    "stabilityai/stable-diffusion-xl-base-1.0",
    torch_dtype=torch.float16, variant="fp16", use_safetensors=True,
).to("cuda")

image = pipe(
    prompt="a lighthouse on a basalt cliff at dusk, 35mm photo",
    negative_prompt="blurry, low quality",
    num_inference_steps=30, guidance_scale=7.0,
    width=1024, height=1024,
    generator=torch.Generator("cuda").manual_seed(42),
).images[0]
image.save("sdxl.png")

Stable Diffusion 3.5 Large

python
import torch
from diffusers import StableDiffusion3Pipeline

pipe = StableDiffusion3Pipeline.from_pretrained(
    "stabilityai/stable-diffusion-3.5-large", torch_dtype=torch.bfloat16
).to("cuda")   # ~28 GB in BF16: use an L40S or larger, or see the 24 GB note below

image = pipe(
    "a watercolour map of an imaginary island, labelled in neat handwriting",
    num_inference_steps=28, guidance_scale=3.5,
).images[0]
image.save("sd35.png")

On a 24 GB card, replace .to("cuda") with pipe.enable_model_cpu_offload(). That keeps only the active component on the GPU and moves the rest to system RAM; it is slower but fits.

FLUX.1 [schnell] and [dev]

python
import torch
from diffusers import FluxPipeline

pipe = FluxPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16
)
pipe.enable_model_cpu_offload()   # fits 24 GB; on 48 GB+ use pipe.to("cuda")

image = pipe(
    "a neon sign reading OPEN LATE in a rainy alley",
    guidance_scale=0.0, num_inference_steps=4, max_sequence_length=256,
    generator=torch.Generator("cpu").manual_seed(0),
).images[0]
image.save("flux-schnell.png")

For FLUX.1 [dev], change the repo to black-forest-labs/FLUX.1-dev, set guidance_scale=3.5, num_inference_steps=28 to 50 and max_sequence_length=512. Remember the [dev] weights are non-commercial; [schnell] is Apache 2.0.

Batch a prompt file

Most real work is "render these 500 prompts". Load the pipeline once and loop:

python
import torch, pathlib
from diffusers import StableDiffusionXLPipeline

pipe = StableDiffusionXLPipeline.from_pretrained(
    "stabilityai/stable-diffusion-xl-base-1.0",
    torch_dtype=torch.float16, variant="fp16").to("cuda")

out = pathlib.Path("out"); out.mkdir(exist_ok=True)
prompts = [p.strip() for p in open("prompts.txt") if p.strip()]
BATCH = 4   # raise until VRAM is nearly full; 4–8 is typical at 1024px on 24 GB

for i in range(0, len(prompts), BATCH):
    chunk = prompts[i:i + BATCH]
    images = pipe(chunk, num_inference_steps=30).images
    for j, img in enumerate(images):
        img.save(out / f"{i + j:05d}.png")

Batching improves GPU utilisation; the total time per image drops a little, but the main win is that the GPU never sits idle between prompts. Copy results home with rsync -avz -e "ssh -p PORT" USER@HOST:~/out ./out.

Step 5: Turn it into an image API

Once a script works, wrapping it in an HTTP API is short. The pattern is: load the pipeline once at start-up, accept jobs over HTTP, put them on a queue, and let a single worker process the queue on the GPU so requests never fight over VRAM. We build that with FastAPI, including job status and image download, in how to build an AI image generation API.

When one GPU is not enough, you run one worker per GPU and spread jobs across them; how to generate AI images faster using multiple GPUs shows the commands, and how to build a scalable image and video generation platform covers queues, storage and burst capacity.

How fast is Stable Diffusion on a cloud GPU?

Speed depends on model, resolution, steps and GPU. The figures below are our rough estimates for one 1024×1024 image at batch size 1, built from widely published community figures and the relative compute and bandwidth of each card. They are not measurements by us; treat them as planning numbers and time your own workflow.

Model and settingsRTX 4090L40SA100 80GBH100 PCIeRTX PRO 6000
SDXL, 30 steps~4.5 s~5 s~4 s~3 s~3 s
SD 3.5 Large, 28 steps~12 s (offload/FP8)~13 s~10 s~7 s~7 s
FLUX.1 [dev], 28 steps~18 s (FP8)~20 s~14 s~9 s~9 s
FLUX.1 [schnell], 4 steps~3 s~3.5 s~2.5 s~1.5 s~1.5 s

The L40S is a data-centre card with more VRAM than the 4090 but slightly lower memory bandwidth (864 GB/s versus 1,008 GB/s), which is why it is not faster per image. You rent it for the 48 GB, not for speed.

Expect the first image after start-up to be slow: the model loads from disk into VRAM, and some kernels compile on first use. Time the second and later images.

What does it cost to generate 1,000 images?

Cost per 1,000 images = seconds per image × 1,000 ÷ 3,600 × hourly price. The first part gives GPU-hours; multiply by the price of the GPU you rent. Using the speed estimates above:

Workload (estimate)GPUSeconds per image (est.)GPU-hours per 1,000Our cost per 1,000 images
SDXL, 30 stepsRTX 40904.51.251.25 × $1.59/hr ≈ $1.99
SDXL, 30 stepsH100 PCIe30.830.83 × $4.99/hr ≈ $4.14
SD 3.5 Large, 28 stepsL40S133.613.61 × $1.89/hr ≈ $6.82
FLUX.1 [dev], 28 stepsRTX 4090 (FP8)185.005.00 × $1.59/hr ≈ $7.95
FLUX.1 [dev], 28 stepsH100 PCIe92.502.50 × $4.99/hr ≈ $12.48
FLUX.1 [schnell], 4 stepsRTX 409030.830.83 × $1.59/hr ≈ $1.32
FLUX.1 [schnell], 4 stepsH100 PCIe1.50.420.42 × $4.99/hr ≈ $2.10

For comparison at other providers' published on-demand prices (checked 25 Nov 2026): SDXL on a RunPod Secure Cloud RTX 4090 at $0.89/hr is 1.25 × 0.89 = about $1.11 per 1,000 images; on a Vast.ai marketplace 4090 at the $0.47 median it is about $0.59. Marketplaces are cheaper per hour; you trade that for variable hosts.

Two things move the real number more than the GPU choice:

  • Idle time. A machine left on overnight with nothing to do costs 12 hours of GPU time and generates zero images. Per-minute billing only helps if you stop the machine.
  • Steps and resolution. Halving steps roughly halves time. A 2048×2048 image is four times the pixels and more than four times the work in attention-heavy models.

There is a deeper version of this maths, with 10,000-image budgets, in what it costs to generate 10,000 AI images.

Can you run AI video models the same way?

Yes. Open video models such as Wan 2.1 and 2.2, HunyuanVideo, LTX-Video, Mochi 1 and CogVideoX run on the same Root setup with diffusers or their own repos and ComfyUI nodes. They need far more VRAM and time: a 5-second clip can take minutes on a 4090 and 60–80 GB for the larger models. Start with what GPU you need for AI video generation, then follow how to run open-source AI video models in the cloud.

What goes wrong, and how do you fix it?

Most problems on a fresh cloud GPU fall into five buckets.

SymptomLikely causeFix
CUDA out of memoryModel plus batch exceeds VRAMLower batch size; pipe.enable_model_cpu_offload(); FP8 weights; bigger GPU
Black or NaN images with SDXL in FP16SDXL's original VAE overflows in FP16Use the madebyollin/sdxl-vae-fp16-fix VAE, or keep the VAE in FP32
401 or 403 on downloadGated model, licence not accepted or no tokenAccept the licence on the model page; huggingface-cli login
Browser cannot reach ComfyUITunnel not running, or wrong portRe-run ssh -N -L 8188:127.0.0.1:8188 ...; check ComfyUI's log says port 8188
Disk full mid-downloadCheckpoints plus cache exceed diskdf -h; delete ~/.cache/huggingface copies you no longer need; launch with a bigger disk

Two habits save time: keep one models/ folder and symlink into ComfyUI rather than downloading twice, and write the exact library versions that worked into a requirements.txt so the next machine matches.

How do you keep the bill down?

Image generation is bursty: hours of iteration, then nothing. Price follows the minutes the machine is on.

  1. Stop when you stop. With per-minute billing, a 20-minute session costs 20 minutes. See how per-minute GPU billing works.
  2. Pause instead of deleting when you will be back tomorrow. On Wandering Giants a paused machine pays only for its disk, about 3¢ an hour per 50 GB, and your models and ComfyUI install are still there.
  3. Use the smallest model that meets the brief. FLUX.1 [schnell] at 4 steps is several times cheaper per image than [dev] at 28.
  4. Batch. Queue prompts and let the GPU run flat out, rather than generating one image, looking at it, and generating another while the GPU idles.
  5. Right-size the card. Paying for 80 GB to run SDXL buys speed, not capability. A 4090 is usually the best price per SDXL image.

When does renting from Wandering Giants Compute fit?

Renting from us fits when you want a clean Ubuntu machine with CUDA and PyTorch already working, root access to install ComfyUI or anything else, and a bill that cannot run away. You pay by the minute from prepaid credit; if credit runs out the machine stops by itself and its disk is kept free for 7 days. Prices are shown in your own currency, with VAT included for UK customers. You can choose from 24 GB on an RTX 4090 up to 96 GB on an RTX PRO 6000 Blackwell and beyond, one card or up to eight of the same card in one machine.

It fits less well if you want the absolute lowest hourly price (marketplaces such as Vast.ai list 4090s for less), a hosted image API with no machine to manage, or serverless endpoints that scale to zero by themselves; we do not offer those, and other providers do. We are also newly launched.

If the fit is right, pick a GPU and launch it with Root access, then work through the steps above. Expect the model download to be the slowest part of the first session.

Frequently asked questions

What is the cheapest GPU that can run Stable Diffusion in the cloud?

SD 1.5 runs on almost any 8 GB card and SDXL is comfortable from 12 GB. Among the GPUs we rent, the RTX 4090 with 24 GB is the entry point and handles SDXL, SD 3.5 Medium and FLUX.1 in FP8. Marketplaces such as Vast.ai list older 8–16 GB cards for less if you only need SD 1.5.

Should I use ComfyUI or diffusers on a cloud GPU?

Use ComfyUI if you want to design and tweak workflows visually; it runs on the GPU and you open it in your browser through an SSH tunnel. Use diffusers if you are writing code, batch jobs or an API. Many teams prototype in ComfyUI and ship with diffusers or ComfyUI's own API.

Do I need a Hugging Face token to download Stable Diffusion?

SDXL downloads without one. Gated models, including Stable Diffusion 3.5 and FLUX.1 [dev], require you to accept the licence on the model page and then authenticate with a Hugging Face access token, either with huggingface-cli login or the HF_TOKEN environment variable.

How much does it cost to generate 1,000 images on a cloud GPU?

Multiply the seconds per image by 1,000, divide by 3,600 to get GPU-hours, then multiply by the hourly price. SDXL on an RTX 4090 at an estimated 4.5 seconds per image is about 1.25 GPU-hours per 1,000 images; FLUX.1 [dev] at an estimated 18 seconds is about 5 GPU-hours.

Can I use FLUX.1 [dev] images commercially?

The FLUX.1 [dev] model weights are released under Black Forest Labs' non-commercial licence, so running it for a commercial service needs a separate licence from them; read the licence on the model card for the exact terms. FLUX.1 [schnell] is Apache 2.0 and can be used commercially.

Is my data private when I run Stable Diffusion on a rented GPU?

On a machine you rent whole, prompts and images stay on that machine rather than passing through a shared image API. You still need to secure it: keep ComfyUI bound to localhost, reach it through an SSH tunnel and do not expose port 8188 to the internet.

Wandering Giants Compute

Rent the GPU for this, by the minute.

Launch an RTX 4090 with Ubuntu, CUDA and PyTorch ready, run ComfyUI or diffusers over SSH, and pay by the minute only while it generates.

Prepaid credit, billed by the minute, stops itself when credit runs out. Prices in £, $, €, ¥, CA$, A$, CHF and S$; UK prices include VAT.

Keep reading

About this article. Written by the Wandering Giants Compute team, the people who run Wandering Giants Compute. Hardware figures are the manufacturers’ published specifications. Speeds and costs marked as estimates are worked out from those specifications and our current prices, with the method shown; they are not measured benchmarks. Wandering Giants prices are taken live from our price list each time this page is built.

Last reviewed 25 November 2026.