Extensions/Sage Utils
ComfyUI Extension

Sage Utils

A collection of custom nodes by arcum42. Currently focused on saving metadata in images so that Civitai picks it up, pulling Civitai information, and misc helper nodes.

By arcum42·Created 2 years ago·Updated 17 days ago· 33
arcum42/ComfyUI_SageUtils
Nodes114
On cloudLocal install
CategorySage Utils/audio, Sage Utils/sampler
Stars33
Updated17 days ago

Nodes (114)

Ace Step 1.5 Audio Encode

Turn tags, lyrics, and a target BPM into conditioning

Sage Utils/audio
Ace Advanced Options

Fine-tuning knobs for Ace Step 1.5 audio, tucked out of the way

Sage Utils/audio
Adv KSampler Info

The advanced sampler knobs ComfyUI hides, pulled out onto their own node

Sage Utils/sampler
Anything to String

The universal converter for when a node wants text and you have a number, list, or latent

Sage Utils/text/conversion
Average Conditioning

Blend prompts' embeddings, not their text

Sage Utils/clip/conditioning
Check LoRAs For Updates

Find out if a creator quietly shipped a better version

Sage Utils/lora
Checkpoint Selector

Pick a model for metadata without loading it into VRAM

Sage Utils/selector
Load CLIP (w/ Chroma T5 Options)

The CLIP loader with Chroma's tokenizer fix baked in

Sage Utils/loader
Clean Text

The whitespace-and-comma tidy-up your prompts keep needing

Sage Utils/text/helper
Load CLIP

The plain-vanilla CLIP loader from Sage's metadata bundle

Sage Utils/loader
CLIP Selector

Choose the text encoder for your metadata without loading it

Sage Utils/selector
Collect Keywords From LoRA Stack

Your trigger words, ready to paste into the prompt

Sage Utils/lora
Combine CLIP Multiline Text Encode

One text box, one line per idea, encoded separately

Sage Utils/clip/helpers
Combine CLIP Text Encode

Stack as many text boxes as you need, encoded and merged

Sage Utils/clip/helpers
Combine Conditioning

Merge existing conditionings with a choice of how

Sage Utils/clip/conditioning
Construct LLM Prompt

Turn your image-generation ask into a prompt an LLM will actually obey

Sage Utils/LLM
Construct LLM Prompt Extra

The detail toggles that make an LLM describe like a photographer

Sage Utils/LLM
Construct Metadata Flexible

The node that stamps A1111/Civitai-ready params onto your images

Sage Utils/metadata
Crop Image

Crop by margins, not absolute coordinates, and never blow the bounds

Sage Utils/image/manipulation
Cubiq Image Resize

The ComfyUI_essentials resize, rehomed — with width/height handed back for metadata

Sage Utils/image/manipulation
Dual CLIP Selector

Document both SDXL text encoders without loading either

Sage Utils/selector
Dual CLIP Text Encode

One node instead of two, with the prompts handed back for metadata

Sage Utils/clip/encode/text
Dual CLIP Text Encode Lumina 2

Positive and negative in one node, for Lumina2's odd system prompt

Sage Utils/clip/encode/text
Dual CLIP Text Encode Qwen

Pos, neg, and reference images in one node for Qwen image-edit models

Sage Utils/clip/encode/image
Join Text

Slam any number of strings together with a separator, then feed the result onward

Sage Utils/text/helper
Empty Ace Step 1.5 Audio Passthrough

The starting canvas for an ACE-Step track

Sage Utils/audio
Empty Latent Image Passthrough

An empty latent that also tells you its own dimensions

Sage Utils/image
Enhancer Prompt

The 'Enhancer Prompt' Node That Doesn't Enhance Anything (Yet)

Sage Utils/text/prompt/
Ernie Prompt Enhancer Prompt

It doesn't enhance your prompt — it builds the envelope for a model that does

Sage Utils/text/prompt/ernie
Flexible CLIP Selector

One node that picks one to four CLIPs, so you stop wiring loaders by hand

Sage Utils/selector
Free Memory

The panic button for your VRAM, wired right into the graph

Sage Utils/util
FreeU v2

A free quality boost — if your model still likes FreeU

Sage Utils/model
Guess Resolution By Ratio

The lazy way to snap any image size to a model-friendly bucket

Sage Utils/image/res
HiDream E1 Instruction

Formatting the two-line prompt HiDream E1's editor actually wants

Sage Utils/text/prompt/hidream
Join Text (Legacy)

The boring two-string join — deprecated, but it still gets the job done

Sage Utils/text/helper
KSampler w/ Sampler Info

One settings node, wired to as many samplers as you want

Sage Utils/sampler
KSampler + Audio Decoder

The ACE-Step sibling of Sage's sample-and-decode nodes

Sage Utils/sampler
KSampler + Tiled Decoder

Sample and VAE-decode in one node, with optional tiling

Sage Utils/sampler
LLM Prompt (Text)

One text-generation node that talks to Ollama, LM Studio, OpenAI, or a local GGUF

Sage Utils/LLM
LLM Prompt (Vision)

Hand it an image, get back a prompt worth prompting with

Sage Utils/LLM
LLM Prompt (Vision) Refined

Caption it, then make the caption prettier — in one node

Sage Utils/LLM
Load Dataset From Folder

Turn a folder of images and captions into a batch ComfyUI can chew on

Sage Utils/train
Load Image

Load Image, but with the alpha, the dimensions, and the metadata all handed to you

Sage Utils/image/file
Load Models

The node that turns Sage's model bundles into an actual model, CLIP, and VAE

Sage Utils/loader
Logical Switch

A true/false fork that only runs the branch you actually picked

Sage Utils/util
Lora Stack

The stackable LoRA brick — chain these and load ten at once

Sage Utils/lora
LoRA Stack Info Display

Every trigger word and weight in your stack, rendered as one readable block

Sage Utils/info
Lora Stack Loader

Apply a whole LoRA stack to a model/clip pair you already have

Sage Utils/loader
Model Info

Pull the Civitai page details out of the model you already loaded

Sage Utils/info
Model Info Display

Your model's Civitai card, rendered right inside the graph

Sage Utils/model/info
Load Models + Loras

Checkpoint, LoRA stack, and trigger words in one node

Sage Utils/loader
Model Shift Only

The shift knob, without any of the FreeU baggage

Sage Utils/model
Model Shifts

Shift and FreeU together, from one dropdown instead of two nodes

Sage Utils/model
Multi Model Picker

Pick one model bundle out of a pile — by number

Sage Utils/util
Multiply Conditioning Strength

The volume knob for a conditioning branch — no prompt rewriting required

Sage Utils/clip/conditioning
Multi Selector Double CLIP

Pick a UNet, two CLIPs, and a VAE — all in one bundle

Sage Utils/selector
Multi Selector Flexible CLIP

Pick 1–4 text encoders for your Flux-era stack, in one node

Sage Utils/selector
Multi Selector Quad CLIP

Four text encoders, one bundle — for models with too many CLIPs

Sage Utils/selector
Multi Selector Single CLIP

The one-CLIP multi-selector that stops you guessing loader types

Sage Utils/selector
Multi Selector Triple CLIP

Three text encoders in one dropdown set — the sweet spot of the multi-selectors

Sage Utils/selector
Normalize Conditioning Strength

Make your conditioning strengths actually add up

Sage Utils/clip/conditioning
Number to String

Turn a number into text so it can live in a prompt or a filename

Sage Utils/text/conversion
Parse Metadata Flexible

Reverse-engineer any A1111 PNG's settings back into a working workflow

Sage Utils/metadata
Percentage To Float

Your 0–100 dial, converted to the 0.0–1.0 the nodes actually want

Sage Utils/util
Pony Prefix

Builds the score_9 incantation so you don't have to memorize it

Sage Utils/text/prompt/pony
Pony Rating (v6)

The rating tag for Pony v6, without the typos

Sage Utils/text/prompt/pony
Pony Rating (v7)

Pony v7's rating tags, without you mixing up safe and general

Sage Utils/text/prompt/pony
Pony Score

The score_9, score_8_up incantation, generated instead of memorized

Sage Utils/text/prompt/pony
Pony Source

Source_anime or source_furry, chosen from a dropdown

Sage Utils/text/prompt/pony
Pony Style

Pony v6's three-letter style codes, a whole dropdown of them

Sage Utils/text/prompt/pony
Pony Style Cluster

Style_cluster_N, for when you want Pony v7's baked-in art styles

Sage Utils/text/prompt/pony
Prompt Text (Lumina 2)

The <Prompt Start> sandwich Lumina 2 needs

Sage Utils/text/prompt/lumina2
Quad CLIP Selector

Four text encoders, one model_info — no UNET, no VAE, just CLIPs

Sage Utils/selector
Quick Lora Stack

The LoRA stack with fewer knobs, same stack

Sage Utils/lora
Quick Lora Stack (x9)

Nine LoRAs at once, on/off each, zero clip-weight fiddling

Sage Utils/lora
Quick Resolution Picker

Resolution from aspect ratio, without the calculator

Sage Utils/image/res
Quick Lora Stack (x6)

Six LoRAs, one node, each with its own on/off switch

Sage Utils/lora
Reference Image

The node that hands your edit model a reference image

Sage Utils/clip/encode/image
KSampler Info

One node to stop your sampler settings and your metadata from lying to each other

Sage Utils/sampler
KSampler Info (No CFG)

KSampler Info for the distilled models that hate CFG

Sage Utils/sampler
Sampler Selector

A dropdown that hands your sampler's name to anything that needs it

Sage Utils/sampler
Save Image With Metadata

Bake A1111-style parameters into your PNGs

Sage Utils/image/file
Save Text

Save any text to a file without a code node

Sage Utils/text/output
Scheduler Selector

Pick a scheduler and hand it over as a string (steps included)

Sage Utils/sampler
Set Text

The least surprising text node in the pack

Sage Utils/text/input
Set Text With Number

Text plus a number at the end, with the type switching to match

Sage Utils/text/helper
Set Text Without Comments

Paste config text into ComfyUI without the comment lines

Sage Utils/text/input
Text w/ Dynamic Prompts

Wildcard prompts inside the Sage ecosystem

Sage Utils/text/input
Single CLIP Text Encode

The same encoder you already know, plus a text wire for metadata

Sage Utils/clip/encode/text
Single CLIP Text Image Encode

Encode prompt + reference image in one node, and zero the parts you skip

Sage Utils/clip/encode/image
Lora Stack (x6)

Six LoRAs in one node, with per-slot toggles and separate weights

Sage Utils/lora
Combine Lora Stacks

Merge LoRA stacks like it's a join operation

Sage Utils/lora
Style Prompt From Config

Your style presets live in a JSON file you can edit

Sage Utils/text/prompt/style
System Prompt (Lumina 2)

Lumina 2's system prompt, selected instead of memorized

Sage Utils/text/prompt/lumina2
Text Random Line

A random pick from a list, seeded so you can reproduce it

Sage Utils/text/line
Text Select Line

Pick a line by number, and let it be clamped for you

Sage Utils/text/line
Text Substitution

Template text with placeholders, filled in from wired inputs

Sage Utils/text/input
Text Switch

A boolean switch for text, which is harder than it sounds

Sage Utils/text/helper
Text Weight

Wrap your text in parentheses, with a knob for the weight

Sage Utils/text/helper
Tiling Info

The 4 numbers that stop your VAE decode from blowing up VRAM

Sage Utils/sampler
Training Captions To Conditioning

Turn a folder of captions into training conditioning, no copy-paste

Sage Utils/train
Triple CLIP Selector

Picking the three text encoders your model actually needs

Sage Utils/selector
Triple Join Text (Legacy)

The 40-line text joiner that's quietly marked legacy

Sage Utils/text/helper
Lora Stack (x3)

Three LoRAs in one node, and a stack format other packs respect

Sage Utils/lora
Quick Lora Stack (x3)

The LoRA stack node for people who don't touch clip weights

Sage Utils/lora
UNET CLIP VAE To Model Info

Assemble a virtual checkpoint from parts you picked separately

Sage Utils/model
Load UNET

The other half of 'pick first, load later'

Sage Utils/loader
Load UNET + LoRA (Model Only)

Load a UNET and slap your LoRA stack on, model-only

Sage Utils/loader
UNET Selector

Pick a UNET now, let it actually load later

Sage Utils/selector
Load VAE

Pull the VAE component out of Sage's metadata bundle

Sage Utils/loader
VAE Selector

The one-dropdown VAE picker that doesn't load anything

Sage Utils/selector
View Anything

The debugging node that prints whatever you throw at it

Sage Utils/text/output
View Notes

Your cheat-sheet files, right inside the workflow

Sage Utils/text/output
Zero Conditioning

A true-zero negative, without typing an empty string

Sage Utils/clip/conditioning
Readme

Sage Utils for ComfyUI

Sage Utils is a comprehensive suite of custom nodes and integrated UI features for ComfyUI. It provides:

  • Custom Nodes: Simplify metadata creation, model and LoRA management, and other frequent tasks
  • LLM Integration: Built-in LLM chat interface with vision support for generating and refining prompts
  • Prompt Builder: Tag-based prompt construction system with LLM enhancement capabilities
  • Cross-Tab Integration: Seamless data flow between workflows, LLM chat, and prompt builder

The node suite supports A1111/Civitai metadata formats, while the UI features provide modern, accessible interfaces for AI-assisted workflow creation.

Model information downloaded from Civitai is cached locally in sage_cache_hash.json and sage_cache_info.json for fast access and reporting. These are located in comfyui/user/default/SageUtils/.

UI Features

LLM Chat Tab

Access AI language models directly within ComfyUI for prompt generation, refinement, and creative assistance:

  • Multi-Provider Support: LM Studio and Ollama (local providers for privacy and unlimited usage)
  • Vision Capabilities: Upload up to 10 images for vision-enabled models with drag-and-drop support
  • Streaming Responses: Real-time text generation with SSE (Server-Sent Events)
  • Conversation History: Maintain context across multiple exchanges
  • Preset System: Save and reuse complete LLM configurations (model, settings, system prompts)
  • System Prompt Management: Create, save, and manage custom system prompts
  • Advanced Options: Temperature, top-p, max tokens, presence/frequency penalties, keep-alive, system prompts
  • Keyboard Shortcuts: Ctrl+Enter to send, Escape to blur textareas
  • Accessibility: Full screen reader support with ARIA labels

📖 Complete LLM Tab Guide

Prompt Builder Tab

Wildcard and tag-based system for constructing complex prompts with LLM enhancement:

  • Wildcard System: Use __category__ syntax for dynamic, randomized prompt generation
  • Tag Library: Pre-organized tag collections across multiple categories for quick insertion
  • Saved Prompts: Save and manage complete prompt collections with descriptions
  • Seed-Based Generation: Control randomization with fixed or random seeds for reproducibility
  • LLM Integration: Send prompts to LLM for expansion, refinement, or creative variations
  • Cross-Tab Messaging: Receive enhanced prompts back from LLM tab automatically
  • Positive/Negative Prompts: Separate construction for better control
  • Keyboard Shortcuts: Ctrl+Enter to generate, Escape to blur fields
  • Performance Optimized: Debounced updates and rate-limited cross-tab messaging

📖 Complete Prompt Builder Guide

Cross-Tab Integration

Seamless data flow between all components:

  • Gallery to LLM: Send images from gallery to LLM for vision analysis
  • LLM to Prompt Builder: Enhanced prompts flow automatically to prompt builder
  • Prompt Builder to LLM: Send constructed prompts for AI refinement
  • Rate Limited: Intelligent throttling prevents system overload
  • Visual Feedback: Clear notifications for all transfers

Key Nodes

  • Save Image w/ Added Metadata
    An enhanced Save Image node with extra inputs for param_metadata and extra_metadata, allowing you to embed custom metadata under parameters (A1111 style) and extra. Includes switches to control inclusion of standard ComfyUI metadata.

  • Construct Metadata / Construct Metadata Lite
    Nodes for assembling metadata strings from various workflow inputs. The "Lite" version writes a more minimal set of metadata.

  • Load Checkpoint w/ Metadata
    Loads a checkpoint and outputs model_info, including hash and Civitai data. Model info is cached for quick access and reporting.

  • Load Diffusion Model w/ Metadata
    For loading UNET models with metadata support.

  • Simple Lora Stack
    Build and manage Lora stacks with toggles and weights. Chain these together for multiple LoRAs.

  • Triple Lora Stack
    Same as above, except with spots for three loras instead of one, and switches to toggle them on and off.

  • Lora Stack Loader
    Loads all Loras in a stack for use in your workflow.

  • Model + Lora Stack Loader
    Loads both a checkpoint and a LoRA stack in one node.

  • LoRA Stack → Keywords
    Extracts Civitai keywords from a LoRA stack.

  • Last LoRA Info
    Retrieves Civitai info, URLs, and sample images for the last LoRA in a stack.

  • Sampler Info
    Outputs sampler settings for use in metadata or workflow logic.

  • KSampler w/ Sampler Info
    A KSampler with a good deal of the settings broken off into a separate node, both for streamlining and so that you can hook the Sampler Info node up to one of the metadata nodes. You can also hook Sampler Info to more than one KSampler.

  • KSampler + Tiled Decoder
    Same as above, with two differences. First off, it has a VAE Decode node built in, and outputs both a latent and an image. Second, if you hook up a Tiling Info node to it, it will do a tiled vae decode instead. This input is optional.

  • KSampler + Audio Decoder
    KSampler with an audio decoder varient of the above nodes.

  • Prompts to CLIP
    Accepts a CLIP model and positive/negative prompts, returning both conditionings and the input text. Automatically zeros conditioning if no text is provided. Can also clean up the prompts.

  • Zero Conditioning
    Outputs zeroed conditioning for advanced prompt control.

  • Load Image w/ Size & Metadata
    Loads an image and outputs its size and embedded metadata.

  • Empty Latent Passthrough
    Like an Empty Latent Image node, but passes width/height for easier wiring. Includes a switch for SD3 compatibility.

  • Switch
    Simple logic node to select between two inputs based on a boolean.

  • Get Sha256 Hash
    Computes the SHA256 hash of a file or input.

  • Cache Maintenance
    Checks for missing or duplicate entries in the model cache, with options to clean up ghost entries and identify duplicates.

  • Model Scan & Report
    Scans and hashes all Loras and checkpoints, queries Civitai, and generates sorted model and LoRA lists for reporting and organization.


Quick Start

Setting Up LLM Integration

  1. Choose your LLM provider (LM Studio or Ollama)
  2. Install and configure:
    • LM Studio: Download from lmstudio.ai, load a model, start local server
    • Ollama: Install from ollama.ai, pull a model with ollama pull llama3.2
  3. Select provider in LLM tab dropdown
  4. Select a model from the available models list
  5. Start chatting or use vision features by uploading images

See the LLM Tab Guide for detailed setup instructions for each provider.

Using Prompt Builder

  1. Open the Prompt Builder tab in the sidebar
  2. Select tag categories (character, style, quality, etc.)
  3. Choose specific tags from each category
  4. Generate prompt - tags are combined intelligently
  5. Optional: Send to LLM for creative enhancement
  6. Use in workflows - copy to clipboard or send to nodes

See the Prompt Builder Guide for advanced usage and best practices.

How to Use and Connect the Nodes

  1. Model Loading and Metadata
    Use Load Checkpoint w/ Metadata (or Load Diffusion Model w/ Metadata) to load your model and output model_info.
    The model_info output can be connected to Construct Metadata or Model + LoRA Stack Loader.

  2. LoRA Stacks
    Build your LoRA stack by chaining Simple LoRA Stack nodes.
    Connect the output to LoRA Stack Loader (to load LoRAs) and/or to Construct Metadata (to include LoRA info in metadata).

  3. Sampler and Conditioning
    Use Sampler Info to output sampler settings.
    Connect Sampler Info to both your sampler node (e.g., KSampler w/ Sampler Info or KSampler + Tiled Decoder) and to Construct Metadata for metadata inclusion.

  4. Image and Metadata Output
    Use Empty Latent Passthrough to generate and pass image dimensions.
    Connect all relevant metadata outputs (model info, LoRA stack, sampler info, image size, etc.) to Construct Metadata or Construct Metadata Lite.
    Feed the resulting metadata string into the param_metadata input of Save Image w/ Added Metadata, and any other text you want in the metadata can be hooked up to extra_metadata.

  5. Additional Utilities
    Use Load Image w/ Size & Metadata to inspect images.
    Use LoRA Stack → Keywords and Last LoRA Info for keyword extraction and LoRA details.
    Use Cache Maintenance and Model Scan & Report for cache management and reporting.


Example Workflows

Example workflows are available in the example_workflows/ folder. In ComfyUI, you can also access these directly: open the workflow menu, choose Browse Templates, and select comfyui_sageutils on the left. All the example workflows are there and can be easily used as templates for your own workflows.

Requirements

  • ComfyUI: Latest version recommended
  • Python: 3.9+ (included with ComfyUI)
  • Optional LLM Providers:
    • Local: LM Studio, Ollama (free, run locally)

Installation

  1. Navigate to your ComfyUI custom nodes directory:

    cd ComfyUI/custom_nodes/
    
  2. Clone this repository:

    git clone https://github.com/arcum42/ComfyUI_SageUtils.git
    
  3. Install Python dependencies:

    cd ComfyUI_SageUtils
    pip install -r requirements.txt
    
  4. Restart ComfyUI

The sidebar tabs (LLM Chat, Prompt Builder) will appear automatically in the ComfyUI interface.

Logging Configuration

SageUtils uses a dedicated logging system that is separate from ComfyUI's logging. You can control log verbosity using the SAGEUTILS_LOG_LEVEL environment variable:

# Show detailed debug information
SAGEUTILS_LOG_LEVEL=DEBUG python main.py

# Show only warnings and errors (quieter)
SAGEUTILS_LOG_LEVEL=WARNING python main.py

# Default level is INFO (normal operation messages)
python main.py

Available log levels: DEBUG, INFO, WARNING, ERROR, CRITICAL

All SageUtils logs are prefixed with [SageUtils.*] for easy identification.

For developers, see the Logging Guide for information on using the logger in your code.

Documentation

Features & Capabilities

Accessibility

  • WCAG 2.1 Level AA Compliant: Full screen reader support
  • Keyboard Navigation: Complete keyboard control with shortcuts
  • ARIA Labels: Comprehensive labeling for assistive technologies
  • Live Regions: Dynamic content updates announced to screen readers

Performance

  • Optimized Updates: Debounced text inputs (300ms)
  • Rate Limiting: Intelligent throttling for cross-tab messaging
  • Memory Management: Automatic cleanup to prevent leaks
  • Efficient Streaming: SSE-based real-time responses

User Experience

  • Drag & Drop: Image uploads with visual feedback
  • Real-time Validation: Immediate feedback on image format/size
  • Visual Polish: Modern UI with smooth animations
  • Smart Defaults: Sensible presets for all options

If you have ideas, find bugs, or want to contribute, feel free to open issues or pull requests. If you find this project useful, consider supporting via Ko-fi.