sglang serve process over HTTP. ComfyUI sends prompts and receives images or video. This is the same path as the OpenAI-compatible API.
Integrated mode keeps ComfyUI’s CLIP, VAE, and sampler loop. SGLang loads only the DiT and runs one forward per sampler step. The worker starts the native Flux / Qwen-Image / Z-Image / MiniMax-H3 pipeline under --comfyui-mode. A single-file ComfyUI .safetensors (or a GGUF overlay) is loaded through a checkpoint spec. Each apply_model call is translated by a per-model adapter.
Integrated mode does not ship a separate comfyui_* pipeline class per model.
Install the plugin
- Install
sglang[diffusion]. See Installation. - Copy
python/sglang/multimodal_gen/apps/ComfyUI_SGLDiffusioninto ComfyUI’scustom_nodes/directory. - Restart ComfyUI.
workflows/.
Integrated mode
- Load the DiT with
SGLDiffusion UNET Loader. - Set
num_gpus,tp_size,model_type, or compile flags withSGLDiffusion Options. - Connect the loaded model to a standard ComfyUI sampler.
How a sampler step reaches the worker
The plugin README has the architecture diagram. The hop is:- A model adapter packs ComfyUI tensors into an SGLang
Req. - Local ZMQ replaces CUDA tensors with IPC handles so latents stay on GPU.
- Rank 0 materializes the handles. Multi-rank
--comfyui-modethen detaches CUDA tensors and broadcasts them over NCCL. The general SP / CFG / TP path is still the originalbroadcast_pyobj. - The worker pipeline keeps
transformerplus a pass-through scheduler. After the first step, conditioning stays in a worker session; later steps send latents and the timestep.
MiniMax-H3 example graphs:
minimax_h3_t2v_sgld.json (T2V / I2VA / FL2VA on the FL2VA DiT), minimax_h3_r2v_sgld.json (reference-to-video; use a ref2va file), minimax_h3_t2v_sgld_upscaler.json (two-pass 3D ×2). Set SGLDOptions.model_type to minimax_h3. On 24 GB, keep the 32B CLIP on CPU and prefer pruned BF16, GGUF, or kitchen_int8 with DiT layerwise offload. See the MiniMax-H3 cookbook.
To add a model, register a checkpoint spec under runtime/loader/comfyui_checkpoints/ and a ComfyUIModelAdapter. Do not add another ComfyUI pipeline class.