---
title: "Self-host ComfyUI on Edge | Stable Diffusion workflows"
description: "Run ComfyUI on Edge CPU VMs for workflow building and batch jobs, with checkpoints in storage and outputs served by the CDN. GPU instances are coming soon."
url: https://edge.network/solutions/comfyui
---

For ComfyUI

# ComfyUI on Edge, your workflows on your servers

Build and run node-based diffusion workflows on a CPU VM, with checkpoints in your bucket and finished images served from the CDN. Slow on CPU, but private, scriptable and ready to move to GPU instances when they land.

[Deploy a VM](/console/access/new?product=compute)[See AI infrastructure](/solutions/ai)

CPU mode today, at minutes per image. GPU instances are coming soon.

Why ComfyUI on Edge

## The most flexible diffusion runtime, on infrastructure you own

ComfyUI turns image generation into graphs you can save, version and call over HTTP. On Edge today it runs in CPU mode, suited to building workflows and running batches overnight.

**GPU instances are coming soon**

Diffusion models are GPU workloads, and Edge GPU instances aren't available yet. On CPU, ComfyUI is practical for building workflows, SD 1.5-class models and overnight batches, not for interactive SDXL or FLUX. Join the waitlist to move to GPU when it launches. [Join the GPU waitlist](/compute/gpus)

-   ### Any workflow, as a graph
    
    Checkpoints, LoRAs, ControlNets, upscalers and custom samplers wired together visually, then saved as JSON.
    
-   ### CPU mode for builds and batches
    
    \--cpu runs workflows without a GPU. SD 1.5 at 512 px takes minutes per image: fine for prototyping and overnight jobs.
    
-   ### Models in Edge Storage
    
    Keep checkpoints, LoRAs and VAEs in a bucket and sync them into models/. Every VM starts from the same set.
    
-   ### A headless API
    
    POST workflow JSON to /prompt, get a prompt\_id back, then poll /history or listen on the WebSocket.
    
-   ### Outputs on the CDN
    
    Upload finished images to a bucket and serve them through the CDN, resized and converted to WebP or AVIF on request.
    
-   ### Custom nodes welcome
    
    Install community nodes with git clone into custom\_nodes/, or use ComfyUI-Manager. It's your VM.
    

Reference architecture

## Headless ComfyUI between two buckets

ComfyUI runs headless on a VM behind Nginx basic auth. Models sync from one bucket, outputs go to another, and the CDN serves finished images at any size.

-   [Compute](/compute)
    
    Runs ComfyUI in CPU mode on 8 vCPU and 16 GiB, behind Nginx basic auth.
    
-   [GPU Compute](/compute/gpus)
    
    Coming soon. GPU instances for SDXL, FLUX and video models; join the waitlist.
    
-   [Storage](/storage)
    
    Two buckets: shared model files, and the images your workflows produce.
    
-   [CDN](/cdn)
    
    TLS for the editor and API, plus worldwide delivery of finished images.
    
-   [Image optimisation](/docs/cdn/image-optimization)
    
    Resizes and converts outputs on request, so one PNG serves every size.
    
-   [DNS](/dns)
    
    Anycast DNS for comfy.acme.com and img.acme.com.
    

Deploy

## ComfyUI on CPU in five steps

A CPU build of PyTorch, models from your bucket, and a proxy with authentication in front. ComfyUI has none of its own.

1.  01
    
    ### Write a bootstrap script
    
    Installs ComfyUI with CPU-only PyTorch wheels, Nginx for auth, and the Edge CLI for model syncs.
    
    comfy-setup.sh
    
    ```
    #!/bin/bash
    set -e
    apt-get update
    apt-get install -y python3-venv git nginx apache2-utils
    curl -fsSL https://edge.network/install.sh | sh
    git clone https://github.com/comfyanonymous/ComfyUI /opt/comfy
    cd /opt/comfy && python3 -m venv .venv && . .venv/bin/activate
    pip install torch torchvision torchaudio \
      --index-url https://download.pytorch.org/whl/cpu
    pip install -r requirements.txt
    ```
    
2.  02
    
    ### Create the VM and the buckets
    
    16 GiB of memory is the practical floor for diffusion on CPU. --disk 160 leaves room for a few checkpoints.
    
    shell
    
    ```
    $ edge compute scripts create --name comfy-setup --file comfy-setup.sh
    $ edge compute create --name comfy --size s-8vcpu-16gb --disk 160 \
        --image ubuntu-24 --region london --script comfy-setup
    $ edge storage create comfy-models
    $ edge storage create comfy-outputs
    ```
    
3.  03
    
    ### Run it as a service
    
    Models sync from the bucket before each start, so every VM has the same set. ComfyUI stays on localhost.
    
    /etc/systemd/system/comfy.service
    
    ```
    [Service]
    WorkingDirectory=/opt/comfy
    EnvironmentFile=/etc/comfy.env   # EDGE_API_KEY
    ExecStartPre=/usr/local/bin/edge storage sync \
      comfy-models/ /opt/comfy/models/
    ExecStart=/opt/comfy/.venv/bin/python main.py --cpu \
      --listen 127.0.0.1 --port 8188
    Restart=always
    
    [Install]
    WantedBy=multi-user.target
    ```
    
4.  04
    
    ### Put basic auth in front
    
    Create the password file with htpasswd. The WebSocket headers keep the editor's live progress working.
    
    /etc/nginx/sites-enabled/comfy
    
    ```
    server {
      listen 443 ssl;
      server_name comfy.acme.com;
      ssl_certificate     /etc/ssl/origin.pem;   # origin certificate
      ssl_certificate_key /etc/ssl/origin.key;
    
      auth_basic "ComfyUI";
      auth_basic_user_file /etc/nginx/.htpasswd;
    
      location / {
        proxy_pass http://127.0.0.1:8188;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
      }
    }
    ```
    
5.  05
    
    ### Add the CDN and queue a workflow
    
    One domain for the editor and API, one serving outputs from the bucket with image transforms on.
    
    shell
    
    ```
    $ edge cdn create --name comfy
    $ edge cdn domains add cdn-a1b2c3 \
        --domain comfy.acme.com --origin https://<vm-ip>
    $ edge cdn domains add cdn-a1b2c3 --domain img.acme.com \
        --origin-type storage --storage-bucket comfy-outputs --jit-image
    
    # payload.json = { "prompt": <workflow exported in API format> }
    $ curl -u artist:$PASS https://comfy.acme.com/prompt \
        -H "Content-Type: application/json" -d @payload.json
    ```
    

Prefer to hand it off? [Give the job to your AI agent](/solutions/agentic-development) or [have our engineers do it](/solutions/expert-services).

What it costs

## Your own image pipeline, at a fixed price

No GPU instance is priced here because none is available yet. This is an 8 vCPU VM from the published per-resource rates, plus storage and CDN delivery.

-   No per-image charges from a hosted API
-   Image resizing included with the CDN
-   Models and outputs move with zero egress

[See compute pricing](/compute/pricing)

Estimated monthly bill on Edge

Workflow development and overnight batches, SD 1.5 on CPU

USD

-   Compute (vCPU)$23.368 vCPU × $0.004/hr × 730 hrs
-   Compute (memory)$29.9016 GiB × $0.00256/GiB-hr × 730 hrs
-   Compute (disk)$11.84160 GiB NVMe × $0.074/GiB-mo
-   Storage$0.6045 GB of models and outputs, first 5 GB free
-   CDN$0.00~300k image requests, inside the 500k free tier
-   DNS$0.00Zone, editor and image subdomains
-   Egress$0.00

Total$65.70

FAQ

## Running ComfyUI before the GPUs land

Something else? [Ask an engineer](/contact).

Can ComfyUI run without a GPU?

Yes, with --cpu. SD 1.5-class models at 512 px take minutes per image on 8 vCPU. SDXL and FLUX run far slower, which rules them out for interactive use until GPU instances arrive.

When will GPU instances be available?

GPU instances are coming soon. Join the waitlist at /compute/gpus to hear first. If you need GPU capacity now, contact us: we may be able to arrange early access or an interim option.

How do I call it from my app?

Export a workflow in API format, POST it to /prompt and keep the prompt\_id. Poll /history/<prompt\_id> or listen on /ws for completion, then fetch the image with /view or pick it up from the outputs bucket.

How do I secure it?

ComfyUI has no built-in authentication, so never expose port 8188. Keep it on 127.0.0.1 and put Nginx basic auth, or your own SSO proxy, in front, as in step four.

What about safety filters?

ComfyUI doesn't filter prompts or outputs by default; that's your call as the operator. For a public product, add a moderation step to the workflow or check outputs before publishing them.

How do I share models between VMs?

Every VM syncs comfy-models/ from the same bucket before ComfyUI starts, so adding a VM is just creating it from the same bootstrap script. No manual copying.

Drop-in services

## Keep the queue for real users

-   [
    
    Edge ShieldBot protection`POST /siteverify → score: 94`
    
    Score prompt submissions from your public app before they're queued, so bots can't flood the VM with jobs.
    
    Free forever, with unlimited widgets. No puzzles for visitors.Explore
    
    ](/shield)
-   [
    
    Edge AssistAI answers`<script src="…/assist.js">`
    
    Give your users answers about your image product from your own docs, with one script tag.
    
    Free tier: 250 answered questions a monthExplore
    
    ](/assist)

Related stacks

## Pairs well with ComfyUI

[All 38 stacks](/solutions/stacks)

-   [OllamaRun open LLMs on your own infrastructure](/solutions/ollama)
-   [llama.cppQuantised LLM inference, CPU or GPU](/solutions/llama-cpp)
-   [DockerRun any container on global VMs](/solutions/docker)
-   [Next.jsSelf-host Next.js without the lock-in](/solutions/nextjs)

## Generate images on your terms

Build your workflows on a CPU VM today, and join the GPU waitlist for production volume.

[Deploy a VM](/console/access/new?product=compute)[Talk to an engineer](/contact)

Billed hourly from a prepaid balance. Egress is free on every product.
