SwarmUI Documentation

repository·master·Indexed 26 days ago

https://github.com/mcmonkeyprojects/swarmui

A 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.

Tokens
37.9K
Snippets
40
Records
241
Agent score
88%

What's inside SwarmUI

  1. Scale with Multi-GPU and Multi-Machine support

    master

    Swarm (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 GPUs documentation.

  2. Explore SwarmUI Features and Documentation

    master

    SwarmUI 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.
  3. Understand SwarmUI API Basics

    master

    SwarmUI 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 POST requests sent to (your server)/API/(route) containing JSON inputs and receiving JSON outputs.
    • Websockets: Routes with a WS suffix (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.
  4. Install ComfyUI via API-By-URL

    master

    Use 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 DLNodes and ExtraNodes). You should copy these to your remote ComfyUI custom_nodes path or point to them using an extra_model_paths file.
    • Model Paths: If you used a Self-Start backend previously, you can find a valid extra_model_paths file generated in the Swarm Data folder to use for your API instance.
  5. Configure LAN access for SwarmUI backends

    master

    If 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 access option in the installer UI.

    Post-Installation Fix: If the server reports it is only accessible from the local computer, navigate to: Server Configuration -> Network -> Host and set the value to 0.0.0.0.

    Click Save and restart SwarmUI.

  6. Use Zeta Chroma Model

    master

    Zeta 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., 4 or 7).
    • 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 roughly 512 to 2048.
  7. Install ComfyUI as a Self-Starting Backend

    master

    The Self-Start method allows SwarmUI to configure, launch, and manage the ComfyUI backend automatically. This is the highly recommended installation method.

    1. Ensure you have a valid ComfyUI installation. If you used the SwarmUI installer, it is located at dlbackend/comfy/ComfyUI/main.py.
    2. In SwarmUI, navigate to Server -> Backends.
    3. Click ComfyUI Self-Starting.
    4. Set the StartScript path to your ComfyUI entry point (e.g., dlbackend/comfy/ComfyUI/main.py).
    5. Save the backend configuration.
  8. Use Image Metadata in Webhook JSON

    master

    For webhooks that support image metadata (such as the Every Gen webhook), 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 the External URL setting in Server Configuration).

    Warning: If using %image% with DoNotSave enabled, 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%)"
    }
  9. Configure backend priority for generation queuing

    master

    SwarmUI 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.

  10. Use Refiner and Upscaling features

    master

    To refine or upscale images:

    1. Locate the Refine / Upscale parameter group (below Init Image) and toggle the checkbox to enable it.
    2. For Refiners: Enable the Refiner Model parameter and select your model.
    3. For Upscaling: Set the Refiner Upscale value (e.g., 1.5 or 2).
    4. For DiT models (SD3/Flux): Enable Refiner Do Tiling.
    5. Click Generate.