Self-hosted AI image generator: hardware wey work
See wetin CPU VPS fit do, why SDXL need 6.94 GB GPU memory, ComfyUI install commands, and how much disk budget you need before you rent server.
Wetin self-hosted AI image generator really need
Self-hosted AI image generator na one web app plus one model file. The app na ComfyUI, and e fit run for any Linux box. Na the model dey decide the hardware wey you need. SDXL-class checkpoint na one 6.94 GB file, and e need stay for GPU memory. Na this one fact set the whole budget, so read the hardware ladder below before you rent anything.
The honest summary be say: CPU-only VPS fit install and serve the software, and e fit generate images for 512x512 with older Stable Diffusion 1.5 model in one or two minutes per image. The same box wey dey run SDXL for 1024x1024 fit take ten to twenty minutes per image. This no mean say the setup spoil. Na arithmetic, and this guide go explain am.
Why model size dey decide the machine
Image generation dey run denoising loop. 30-step render dey run the denoiser, SDXL's UNet, over the image 30 times, and every pass dey read all the UNet weights. The two text encoders dey run once before the loop, and the VAE dey decode once after am, so dem no dey part of the cost for each step. SDXL's UNet for half precision na 5.14 GB of weights. So for this simplified view, 30-step render dey move roughly 154 GB of weights through memory before you see picture, and the intermediate tensors add more on top.
GPU wey get 24 GB of video memory (VRAM, the memory wey dey solder next to the graphics chip) dey read at hundreds of gigabytes per second, and e fit hold all 6.9 GB at once. CPU VPS dey read system RAM at tens of gigabytes per second, and e no get matrix hardware for the convolutions. So the same loop dey run one to two orders of magnitude slower. Na this same memory-bandwidth argument dey control text models, and e good make you read am together with when VPS with GPU really worth the money.
Image generation different from text generation for one important way. Chat model dey stream tokens, so even slow machine still dey feel usable because words dey show as you dey read. Image no go show until the last step finish. Slow mean say you go dey look progress bar.
Hardware ladder, wey get real numbers
The block below get typical figures for one SDXL image for 1024x1024, 30 steps, and Euler sampler, as of July 2026. Treat dem as order of magnitude. Your sampler, step count, and resolution fit change dem.
Di data wey dey behind dis chart
[
{
"label": "8 vCPU VPS, no GPU",
"seconds_per_image": 780
},
{
"label": "8GB VRAM GPU",
"seconds_per_image": 32
},
{
"label": "12GB VRAM GPU",
"seconds_per_image": 18
},
{
"label": "24GB VRAM GPU",
"seconds_per_image": 9
}
]The CPU row na 780 seconds, about thirteen minutes. The 24 GB card na 9 seconds. Na this gap you dey pay for.
Read the ladder like this. Below 8 GB of VRAM, SDXL still dey run because ComfyUI dey manage VRAM and system RAM together, and e dey offload model weights automatically. As of October 2026, the project README puts the minimum at 4 GB of VRAM plus 8 GB of system RAM, using its asynchronous weight streaming. Offloading dey add time for every step, so a 6 GB card dey closer to one minute per image than thirty seconds. For 8 GB, the base model fit enter and render dey comfortable. For 12 GB, you fit keep one or two ControlNet models alongside the checkpoint without offloading. For 24 GB, you fit run SDXL plus the refiner plus upscaling inside one workflow, and train LoRA adapters with plenty memory remaining. Training fit work with less than that: the SDXL training guide for the kohya-ss sd-scripts trainer say you fit do LoRA training with 8 GB of GPU memory, while e recommend 10 GB. To reach this, e tell you to train only the U-Net, enable gradient checkpointing, cache the text encoder outputs and latents, use an 8-bit optimizer or Adafactor, and reduce the LoRA dim to 4 to 8 for an 8 GB card. The LoRA guide for the kohya_ss GUI, wey wrap those scripts, dey more careful: e say make you use GPU wey get at least 12 GB of memory for LoRA training.
CPU VPS fit do wetin, and wetin e no fit do
E fit do pass wetin people expect, and e fit do less than marketing dey claim. Make you understand the exact limit.
CPU VPS fit install ComfyUI, serve the web interface, keep your model library, run the queue, and generate images without any GPU at all. With Stable Diffusion 1.5 for 512x512 and 20 steps, expect around 60 to 150 seconds for each image on 8 modern vCPUs with 16 GB of RAM. For batch job wey go run overnight, or low-volume image endpoint behind queue, this one genuinely dey okay.
CPU VPS no fit give you interactive work. Prompt iteration mean twenty renders for one hour, and if each one take thirteen minutes, you go get four. E also no fit train. LoRA fine-tuning for CPU dey take days, no be hours, so treat am as unavailable.
Memory rule for CPU-only different from GPU rule. The weights go load into system RAM, so you need the model size plus working space: around 16 GB of RAM for SDXL, and around 8 GB for SD 1.5. 4 GB box go start ComfyUI, then out-of-memory killer go kill am halfway through the first render. You go see the process disappear with Killed for dmesg, and no Python traceback.
Install ComfyUI for GPU machine
Na be the upstream commands be these. Start with clean Ubuntu 24.04 installation wey NVIDIA driver don already dey inside. Confirm the driver first, because without this check, every later failure go look the same.
nvidia-smiThis one must print table wey show your card and CUDA version. command not found, or NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver, mean say driver no dey or kernel module no load after upgrade. Fix am before you continue, because ComfyUI go quietly fall back to CPU and you go blame the software.
sudo apt update
sudo apt install -y git python3-venv python3-pip wget
git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI
python3 -m venv venv
. venv/bin/activate
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu130
pip install -r requirements.txtVirtual environment no be optional advice. PyTorch dey pull plenty dependencies, and if you install am system-wide for machine wey dey run other things, na so you go break the other thing. Verify say PyTorch fit see the card before you continue.
python -c "import torch; print(torch.cuda.is_available(), torch.cuda.get_device_name(0))"True plus your card name mean say the stack dey work. False mean say the wheel wey you install no match the driver, usually because CPU-only torch wheel don already dey cache. Reinstall am with the index URL above.
Get model, and plan for disk
ComfyUI no dey come with weights. Put checkpoints for models/checkpoints, VAE files for models/vae, and LoRA adapters for models/loras.
cd ~/ComfyUI/models/checkpoints
wget https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensorsAlways prefer .safetensors instead of .ckpt. A .ckpt file na pickled Python object, and when you load am, e go execute code from whoever build am. safetensors format only hold tensors, so hostile file no fit run anything.
Storage na cost wey people dey forget. One SDXL base checkpoint na 6.94 GB. The refiner na another 6 GB. SDXL ControlNet model dey start from 320 MB for the small Canny model reach 2.5 GB for the full one with half precision. Upscaler small: the standard Real-ESRGAN x4plus model na 67 MB, the anime model na 17.9 MB, and the anime video model na 2.5 MB. LoRA fit range from tens of megabytes reach 787 MB for ByteDance's Hyper-SDXL adapters. Person wey dey enjoy this go download second and third base model within one week. Plan 100 GB disk space for working install, and monitor the outputs directory too: 1024x1024 PNG files dey between 1 and 2 MB each, and unattended batch fit quietly fill small disk. Put models/ and output/ for volume wey you fit expand, and back up your workflow JSON files with something like encrypted incremental backups to object storage. You fit download the weights again. But the workflows wey you tune no be so.
Run am, then reach am safely
cd ~/ComfyUI
. venv/bin/activate
python main.py --listen 127.0.0.1 --port 8188ComfyUI dey serve for port 8188. For box wey na CPU-only, add --cpu. E go force CPU path instead of failing because CUDA device no dey.
Bind am to 127.0.0.1, no be 0.0.0.0. ComfyUI get accounts now, but none of dem dey lock your server. The login under Settings, for User section, na to sign you in to Comfy account, and e dey work from local install: Comfy docs list email, Google, GitHub and API key sign-in. The docs describe that account as your access to partner nodes and Comfy Cloud subscriptions. Nothing for the docs show am as way to password-protect your own server. The --multi-user flag only enables per-user storage. As of October 2026, the server dey take user name from a comfy-user request header and e no check any password. Anything wey reach the port fit queue jobs, read every image wey you don generate, and, if you start am with --enable-manager, install custom nodes. That one mean arbitrary code execution for your server. Reach am through SSH tunnel from your laptop instead.
ssh -N -L 8188:127.0.0.1:8188 you@your-serverThen open http://127.0.0.1:8188 locally. If you need real multi-user access, put reverse proxy with authentication in front of am and keep the app bound to localhost. The same reasoning apply to any unauthenticated self-hosted service, and na the standard pattern for Docker Compose deployment for VPS.
Make e keep running under systemd
Render queue wey dey die once your SSH session close no be service. Run am as a comfy user wey no get login, no be as yourself: custom nodes na code, and that code no suppose get access to your home directory. Create the user and move the install go inside im home:
sudo useradd --system --create-home --home-dir /home/comfy --shell /usr/sbin/nologin comfy
sudo mv ~/ComfyUI /home/comfy/
sudo chown -R comfy:comfy /home/comfy/ComfyUIVirtual environment still dey work after you move am, because the unit dey call im python directly. Then write /etc/systemd/system/comfyui.service.
[Unit]
Description=ComfyUI
After=network-online.target
[Service]
User=comfy
WorkingDirectory=/home/comfy/ComfyUI
ExecStart=/home/comfy/ComfyUI/venv/bin/python main.py --listen 127.0.0.1 --port 8188
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.targetsudo systemctl daemon-reload
sudo systemctl enable --now comfyui
systemctl status comfyuiactive (running) and log line wey read To see the GUI go to: http://127.0.0.1:8188 mean say e don dey up. Note say ExecStart dey name the interpreter inside virtual environment directly, because systemd no dey run your shell profile and activate no dey happen.
The pragmatic recommendation per budget
If you wan try image generation and cost matter pass speed, take CPU VPS wey get 16 GB RAM, run SD 1.5 for 512x512, and accept say each image fit take one or two minutes. This na the honest entry point, and e cost small part of anything wey get GPU attached. Na also the correct place to host model library and workflows while you dey decide.
If you dey iterate on prompts every day, rent GPU wey get at least 12 GB VRAM by the hour from GPU cloud, and shut am down when you stop. Image generation na bursty work, and idle GPU wey dem dey bill monthly na the commonest way people dey overspend for here. Keep the checkpoints for cheap block storage and mount dem.
If you dey serve other people, or you dey train LoRA adapters regularly, plan for 24 GB VRAM and machine wey you go keep. The sd-scripts SDXL guide talk say LoRA training fit work with 8 GB, with 10 GB recommended, when you use the memory-saving settings, while the kohya_ss GUI LoRA guide ask for at least 12 GB. The 24 GB figure for sd-scripts guide na for full SDXL fine-tuning with batch size 1, so 24 GB card cover LoRA work and still leave fine-tuning within reach. For that stage, the same box usually dey useful to run local language model too, and na this setup dem describe for self-hosting LLM with Ollama.
Any rung wey you choose, measure your own machine before you believe any published figure. Queue the same prompt five times and read the seconds-per-iteration wey ComfyUI print for im console. That number na your real position for the ladder.
FAQ
I fit run Stable Diffusion without GPU?
Yes. ComfyUI dey run with python main.py --cpu and e dey generate real images even when graphics card no dey. For Stable Diffusion 1.5 at 512x512, expect around 60 to 150 seconds for each image. For SDXL at 1024x1024, expect ten to twenty minutes on 8 modern vCPUs. This one work for overnight batches and endpoints wey no get plenty traffic. E no work for prompt iteration, and training no dey practical at all.
How much VRAM I need for SDXL?
8 GB fit run SDXL well at 1024x1024. If e dey below that, ComfyUI go automatically offload model weights to system RAM and e go still work. As of October 2026, the README talk say the minimum na 4 GB VRAM plus 8 GB system RAM, and every offloaded step dey add time. 12 GB let you keep ControlNet together with the checkpoint, while 24 GB cover base model, refiner, and upscaling inside one workflow. The kohya-ss sd-scripts guide say SDXL LoRA training fit work with 8 GB, but e recommend 10 GB, if you use the memory-saving settings. The kohya_ss GUI LoRA guide ask for at least 12 GB. Full SDXL fine-tuning need 24 GB with batch size 1.
How much disk space the models need?
The SDXL base checkpoint alone na 6.94 GB, and the refiner add about 6 GB more. SDXL ControlNet models dey range from 320 MB to 2.5 GB each at half precision. LoRA adapters dey range from tens of megabytes to 787 MB. Real-ESRGAN upscalers dey range from 2.5 MB to 67 MB. Plan 100 GB for working installation with some base models. Monitor the output directory separately, because 1024x1024 PNG files dey take 1 to 2 MB each.
E safe to expose ComfyUI on public internet?
No. The Comfy account login for ComfyUI settings dey work from local installation, but e give you access to Comfy partner nodes and cloud subscriptions. Nothing for Comfy documentation present am as protection for your server. The --multi-user flag only separate storage for each user; e no check any password. When ComfyUI-Manager dey enabled, the interface go install custom nodes. Those ones na Python code wey dey run for your server, so open port fit allow remote code execution. Bind am to 127.0.0.1. Reach am through SSH tunnel with ssh -N -L 8188:127.0.0.1:8188 you@your-server. If more than one person need access, put authenticating reverse proxy in front of am.
Why render kill with no error message?
If the process disappear with Killed inside dmesg and no Python traceback, na Linux out-of-memory killer cause am, no be ComfyUI bug. For CPU-only machine, the weights dey live inside system RAM. Because of this, SDXL need about 16 GB and SD 1.5 about 8 GB, plus working space. Add more RAM, add swap, or change to smaller model and lower resolution.