Nodes/ComfyUI_SGLDiffusion_Fix/SGLDiffusion Generate Image
ComfyUI Node

SGLDiffusion Generate Image

It really generates the image — just not on your machine

By endman100·Created 5 months ago·Updated 5 months ago· 0
SGLDiffusion Generate Image
  • sgld_client
  • image
  • image
positive_prompt
negative_prompt
seed1024
steps6
cfg7.0
width1024
height1024
enable_teacachefalse

Your ComfyUI is just the remote control here

SGLDiffusion Generate Image is the one node in this pack that actually makes pixels - it just doesn't do it on your machine. This is the workhorse of the pack's Server Mode: you point it at a connection from the SGLDiffusion Server Model node, give it a prompt, and it hands the whole job to a standalone SGLang Diffusion server over HTTP. ComfyUI becomes the front-end; the server (often a multi-GPU box, or a RunPod instance you rented for an afternoon) does the sampling.

That split is the entire point of the pack. SGLang is the serving stack that powers the fastest local diffusion benchmarks on FLUX, Z-Image and Qwen-Image - tensor parallelism, sequence parallelism, TeaCache - and this pack is the community's bridge that lets ComfyUI drive it. Official ComfyUI integration was still "on our radar" for the SGLang team as of late 2025, so forks like this one (endman100's ComfyUI_SGLDiffusion_Fix) are how people actually use it. If you've already got an SGLang Diffusion server running, this is the node you'll reach for a hundred times a day.

How it works

Behind the scenes it's a thin wrapper over the server's OpenAI-style image endpoint. The node packs your settings into a request - prompt, size as WIDTHxHEIGHT, num_inference_steps, guidance_scale, seed, optional negative prompt - sends it, and decodes the base64 JSON that comes back into a normal ComfyUI IMAGE tensor you can wire into a Save Image or any preview node. Nothing fancy, which is why it's reliable.

The image input is the sneaky part. Wire in a real photo and the node treats it as an image edit request (the server runs its edit pipeline, which is how Qwen-Image-Edit support works). Wire in an "empty" image - the solid-color default from an Empty Latent node - and it quietly adopts that image's dimensions as the generation size instead. Clever, but it can surprise you if you forget which you connected.

The inputs that matter

You mostly set three things:

  • positive_prompt - required. Empty prompt is an outright error here.
  • steps - defaults to 6, which suits distilled models (Z-Image Turbo runs in that 6–8 step zone) but is way too few for FLUX.1-dev, which wants 20–30.
  • cfg - defaults to 7.0, and this is the trap. Guidance-distilled models like Z-Image Turbo are meant to run at CFG 1, and modern architectures each have their own sweet spot. The default is a generic value, not a recommendation.

Also worth knowing: seed (‑1 means randomize), width/height (256–4096, steps of 64), negative_prompt, and enable_teacache - SGLang's TeaCache acceleration, which skips redundant transformer blocks during denoising. It's a genuinely free speedup on most models but can nudge quality on some; flip it on and A/B a couple of runs.

Install and the one thing that breaks

The pack installs like any custom node - via ComfyUI Manager (search "SGLDiffusion") or:

cd ComfyUI/custom_nodes
git clone https://github.com/endman100/ComfyUI_SGLDiffusion_Fix

Restart ComfyUI and you're done with the pack. The real install is the server: this node is useless until an SGLang Diffusion server is up, so install sglang[diffusion] (it needs CUDA - this is not a weekend CPU project) and launch your model of choice.

Troubleshooting is mostly server-side. Failed to generate image from this node almost always means the server is down, unreachable, or serving a model that doesn't match what you asked for - the model_info string from the SGLDiffusion Server Model node is your first diagnostic. And if images come out over-saturated, drop the cfg before you blame the model.

CategorySGLDiffusion

Inputs (10)

NameTypeDefaultDescription
sgld_clientSGLD_CLIENT
positive_promptSTRINGText prompt for image generation
negative_promptoptSTRINGNegative prompt to avoid certain elements
imageoptIMAGEinput image to use for editing
seedoptINT1024-1–4294967295
stepsoptINT61–100
cfgoptFLOAT7.01–20
widthoptINT1024256–4096
heightoptINT1024256–4096
enable_teacacheoptBOOLEANfalse

Outputs (1)

NameTypeDescription
imageIMAGE