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.
Nodes (114)
Turn tags, lyrics, and a target BPM into conditioning
Fine-tuning knobs for Ace Step 1.5 audio, tucked out of the way
The advanced sampler knobs ComfyUI hides, pulled out onto their own node
The universal converter for when a node wants text and you have a number, list, or latent
Blend prompts' embeddings, not their text
Find out if a creator quietly shipped a better version
Pick a model for metadata without loading it into VRAM
The CLIP loader with Chroma's tokenizer fix baked in
The whitespace-and-comma tidy-up your prompts keep needing
The plain-vanilla CLIP loader from Sage's metadata bundle
Choose the text encoder for your metadata without loading it
Your trigger words, ready to paste into the prompt
One text box, one line per idea, encoded separately
Stack as many text boxes as you need, encoded and merged
Merge existing conditionings with a choice of how
Turn your image-generation ask into a prompt an LLM will actually obey
The detail toggles that make an LLM describe like a photographer
The node that stamps A1111/Civitai-ready params onto your images
Crop by margins, not absolute coordinates, and never blow the bounds
The ComfyUI_essentials resize, rehomed — with width/height handed back for metadata
Document both SDXL text encoders without loading either
One node instead of two, with the prompts handed back for metadata
Positive and negative in one node, for Lumina2's odd system prompt
Pos, neg, and reference images in one node for Qwen image-edit models
Slam any number of strings together with a separator, then feed the result onward
The starting canvas for an ACE-Step track
An empty latent that also tells you its own dimensions
The 'Enhancer Prompt' Node That Doesn't Enhance Anything (Yet)
It doesn't enhance your prompt — it builds the envelope for a model that does
One node that picks one to four CLIPs, so you stop wiring loaders by hand
The panic button for your VRAM, wired right into the graph
A free quality boost — if your model still likes FreeU
The lazy way to snap any image size to a model-friendly bucket
Formatting the two-line prompt HiDream E1's editor actually wants
The boring two-string join — deprecated, but it still gets the job done
One settings node, wired to as many samplers as you want
The ACE-Step sibling of Sage's sample-and-decode nodes
Sample and VAE-decode in one node, with optional tiling
One text-generation node that talks to Ollama, LM Studio, OpenAI, or a local GGUF
Hand it an image, get back a prompt worth prompting with
Caption it, then make the caption prettier — in one node
Turn a folder of images and captions into a batch ComfyUI can chew on
Load Image, but with the alpha, the dimensions, and the metadata all handed to you
The node that turns Sage's model bundles into an actual model, CLIP, and VAE
A true/false fork that only runs the branch you actually picked
The stackable LoRA brick — chain these and load ten at once
Every trigger word and weight in your stack, rendered as one readable block
Apply a whole LoRA stack to a model/clip pair you already have
Pull the Civitai page details out of the model you already loaded
Your model's Civitai card, rendered right inside the graph
Checkpoint, LoRA stack, and trigger words in one node
The shift knob, without any of the FreeU baggage
Shift and FreeU together, from one dropdown instead of two nodes
Pick one model bundle out of a pile — by number
The volume knob for a conditioning branch — no prompt rewriting required
Pick a UNet, two CLIPs, and a VAE — all in one bundle
Pick 1–4 text encoders for your Flux-era stack, in one node
Four text encoders, one bundle — for models with too many CLIPs
The one-CLIP multi-selector that stops you guessing loader types
Three text encoders in one dropdown set — the sweet spot of the multi-selectors
Make your conditioning strengths actually add up
Turn a number into text so it can live in a prompt or a filename
Reverse-engineer any A1111 PNG's settings back into a working workflow
Your 0–100 dial, converted to the 0.0–1.0 the nodes actually want
Builds the score_9 incantation so you don't have to memorize it
The rating tag for Pony v6, without the typos
Pony v7's rating tags, without you mixing up safe and general
The score_9, score_8_up incantation, generated instead of memorized
Source_anime or source_furry, chosen from a dropdown
Pony v6's three-letter style codes, a whole dropdown of them
Style_cluster_N, for when you want Pony v7's baked-in art styles
The <Prompt Start> sandwich Lumina 2 needs
Four text encoders, one model_info — no UNET, no VAE, just CLIPs
The LoRA stack with fewer knobs, same stack
Nine LoRAs at once, on/off each, zero clip-weight fiddling
Resolution from aspect ratio, without the calculator
Six LoRAs, one node, each with its own on/off switch
The node that hands your edit model a reference image
One node to stop your sampler settings and your metadata from lying to each other
KSampler Info for the distilled models that hate CFG
A dropdown that hands your sampler's name to anything that needs it
Bake A1111-style parameters into your PNGs
Save any text to a file without a code node
Pick a scheduler and hand it over as a string (steps included)
The least surprising text node in the pack
Text plus a number at the end, with the type switching to match
Paste config text into ComfyUI without the comment lines
Wildcard prompts inside the Sage ecosystem
The same encoder you already know, plus a text wire for metadata
Encode prompt + reference image in one node, and zero the parts you skip
Six LoRAs in one node, with per-slot toggles and separate weights
Merge LoRA stacks like it's a join operation
Your style presets live in a JSON file you can edit
Lumina 2's system prompt, selected instead of memorized
A random pick from a list, seeded so you can reproduce it
Pick a line by number, and let it be clamped for you
Template text with placeholders, filled in from wired inputs
A boolean switch for text, which is harder than it sounds
Wrap your text in parentheses, with a knob for the weight
The 4 numbers that stop your VAE decode from blowing up VRAM
Turn a folder of captions into training conditioning, no copy-paste
Picking the three text encoders your model actually needs
The 40-line text joiner that's quietly marked legacy
Three LoRAs in one node, and a stack format other packs respect
The LoRA stack node for people who don't touch clip weights
Assemble a virtual checkpoint from parts you picked separately
The other half of 'pick first, load later'
Load a UNET and slap your LoRA stack on, model-only
Pick a UNET now, let it actually load later
Pull the VAE component out of Sage's metadata bundle
The one-dropdown VAE picker that doesn't load anything
The debugging node that prints whatever you throw at it
Your cheat-sheet files, right inside the workflow
A true-zero negative, without typing an empty string
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
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 forparam_metadataandextra_metadata, allowing you to embed custom metadata underparameters(A1111 style) andextra. 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 outputsmodel_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
- Choose your LLM provider (LM Studio or Ollama)
- 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
- Select provider in LLM tab dropdown
- Select a model from the available models list
- Start chatting or use vision features by uploading images
See the LLM Tab Guide for detailed setup instructions for each provider.
Using Prompt Builder
- Open the Prompt Builder tab in the sidebar
- Select tag categories (character, style, quality, etc.)
- Choose specific tags from each category
- Generate prompt - tags are combined intelligently
- Optional: Send to LLM for creative enhancement
- 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
-
Model Loading and Metadata
Use Load Checkpoint w/ Metadata (or Load Diffusion Model w/ Metadata) to load your model and outputmodel_info.
Themodel_infooutput can be connected to Construct Metadata or Model + LoRA Stack Loader. -
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). -
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. -
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 theparam_metadatainput of Save Image w/ Added Metadata, and any other text you want in the metadata can be hooked up toextra_metadata. -
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
-
Navigate to your ComfyUI custom nodes directory:
cd ComfyUI/custom_nodes/ -
Clone this repository:
git clone https://github.com/arcum42/ComfyUI_SageUtils.git -
Install Python dependencies:
cd ComfyUI_SageUtils pip install -r requirements.txt -
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
- 📖 LLM Tab Guide - Complete guide to using the LLM chat interface
- 📖 Prompt Builder Guide - Tag-based prompt construction
- 📖 API Documentation - Backend API endpoints and integration
- 📖 Architecture - System design and technical details
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.