SwarmUI Documentation
repository·master·Indexed 26 days ago
https://github.com/mcmonkeyprojects/swarmuiA multi-backend image generation interface featuring deep ComfyUI integration. Documentation covers installation via Google Colab, ComfyUI backend configuration (Self-Start and API-By-URL), and advanced tools including the Grid Generator, Image Batch Editor, and Dynamic Thresholding. Includes guides on custom ComfyUI workflows, prompt syntax, and network configuration for LAN or Cloudflare access.
What's inside SwarmUI
- The Image Batch Editor Tool is a built-in extension that operates within the SwarmUI "Tools" interface. It allows you to edit batches of input images directly and quickly within the application.
Scale with Multi-GPU and Multi-Machine support
masterSwarm (the name implies its ability to act as a 'swarm' of resources) allows you to connect multiple GPUs, multiple machines, or even remote machines over a network.
- Automatic Queuing: Generations are automatically queued across connected backends.
- Workflow Splitting: You can split a single custom ComfyUI workflow across multiple backend GPUs (subject to certain limitations).
For specific details on how to implement this, refer to the
Using More GPUsdocumentation.Explore SwarmUI Features and Documentation
masterSwarmUI provides a variety of advanced features for image generation. Detailed documentation for specific features is organized into individual files within the
/docs/Features/directory. Key feature areas include:- Presets: Configuration sets for generation.
- Prompt Syntax: Advanced text input features.
- Autocompletions: Prompt engine assistance.
- Image Prompting: Using IP-Adapter, ReVision, etc.
- ControlNet: Controlling image structure.
- Custom Comfy Workflows: Integrating custom ComfyUI workflows.
- Webhooks: Triggering external actions via SwarmUI.
- UISounds: Audio feedback for UI events.
- AutoScalingBackend: Advanced usage for Slurm/Kubernetes.
- Upscaling: Increasing resolution and quality for images and videos.
Understand SwarmUI API Basics
masterSwarmUI provides a full-capability network API for external programs to use Swarm features (like generating images) and manage the Swarm instance (like modifying backends).
Key Concepts:
- Request Format: Most API routes use
POSTrequests sent to(your server)/API/(route)containing JSON inputs and receiving JSON outputs. - Websockets: Routes with a
WSsuffix (e.g.,GenerateText2ImageWS) use WebSocket connections. These typically take one initial input and provide multiple outputs over time, such as progress updates or preview images. - Discovery: You can observe API calls by opening the SwarmUI web interface and using your browser's developer tools to inspect network traffic.
- Request Format: Most API routes use
Install ComfyUI via API-By-URL
masterUse this method if you want to manage the ComfyUI instance independently of SwarmUI. Note that configuration is more complex and misbehavior may occur.
Requirements:
- A working ComfyUI installation.
- Model Path Parity: ComfyUI must use the exact same model paths as your SwarmUI instance. For example, if Swarm uses
OfficialStableDiffusion/sd_xl_base_1.0.safetensors, ComfyUI must have that exact file in the same relative path. (Swarm handles Windows\vs/conversions automatically). - Custom Nodes: Swarm provides extra Comfy nodes in the extension folder (including
DLNodesandExtraNodes). You should copy these to your remote ComfyUIcustom_nodespath or point to them using anextra_model_pathsfile. - Model Paths: If you used a Self-Start backend previously, you can find a valid
extra_model_pathsfile generated in the SwarmDatafolder to use for your API instance.
Configure LAN access for SwarmUI backends
masterIf an 'Other Machine' is intended to act as a backend for a Main Machine, it must be configured to accept LAN connections.
During Installation: Select the
Just Yourself, with LAN accessoption in the installer UI.Post-Installation Fix: If the server reports it is only accessible from the local computer, navigate to:
Server Configuration->Network->Hostand set the value to0.0.0.0.Click
Saveand restart SwarmUI.Use Zeta Chroma Model
masterZeta Chroma is a pixel-space variant of Z-Image. Note that it is under active development and results may be poor; Z-Image LORAs are not compatible.
Setup:
- Download model files from lodestones/Zeta-Chroma.
- Save files in
diffusion_models. - This model does not use a VAE.
Recommended Parameters:
- CFG Scale: Normal ranges (e.g.,
4or7). - Steps: Normal counts (e.g.,
20), but higher values may help compensate for the early pretrain. - Sampler/Scheduler: Defaults are fine.
- Resolution: Standard is
1024. Supports a range from roughly512to2048.
Clear image areas to transparency
masterUse the
<clear:texthere>tag to automatically remove parts of an image to make them transparent. This requires a PNG file format.Example:
<clear:background>will attempt to clear the background area.<clear:background>Install ComfyUI as a Self-Starting Backend
masterThe Self-Start method allows SwarmUI to configure, launch, and manage the ComfyUI backend automatically. This is the highly recommended installation method.
- Ensure you have a valid ComfyUI installation. If you used the SwarmUI installer, it is located at
dlbackend/comfy/ComfyUI/main.py. - In SwarmUI, navigate to
Server->Backends. - Click
ComfyUI Self-Starting. - Set the
StartScriptpath to your ComfyUI entry point (e.g.,dlbackend/comfy/ComfyUI/main.py). - Save the backend configuration.
- Ensure you have a valid ComfyUI installation. If you used the SwarmUI installer, it is located at
Use Image Metadata in Webhook JSON
masterFor webhooks that support image metadata (such as the
Every Genwebhook), you can inject dynamic values into your JSON body using%tag%syntax. These values are JSON-escaped to ensure valid string formatting.Common tags include:
%prompt%: The prompt used for the generation.%image%: The URL to the generated image (formatted via theExternal URLsetting inServer Configuration).
Warning: If using
%image%withDoNotSaveenabled, the URL may be a very large Base64 blob. Additionally, if your server is not externally accessible, external services like Discord will not be able to resolve the image URL.{ "username": "SwarmUI", "content": "Generated your image! Prompt was `%prompt%`, link is [here!](%image%)" }Configure backend priority for generation queuing
masterSwarmUI distributes tasks to backends based on their order in the backend list. The system follows a sequential queueing pattern:
- The first backend in the list receives the first generation in the queue.
- The second backend is only utilized if there are at least 2 generations queued simultaneously.
- The third backend is only used if there are at least 3 generations queued, and so on.
Best Practice: Arrange your backends in the list from fastest/best to slowest to ensure optimal performance.
Use Refiner and Upscaling features
masterTo refine or upscale images:
- Locate the
Refine / Upscaleparameter group (belowInit Image) and toggle the checkbox to enable it. - For Refiners: Enable the
Refiner Modelparameter and select your model. - For Upscaling: Set the
Refiner Upscalevalue (e.g.,1.5or2). - For DiT models (SD3/Flux): Enable
Refiner Do Tiling. - Click Generate.
- Locate the