ComfyUI Extension: ComfyUI-OnDemand-Lora-Loader
This is a custom node for ComfyUI that allows you to download and apply LoRA models directly from Civitai/HuggingFace. It simplifies your workflow by managing LoRA downloads automatically, so you don't have to manually download files and place them in the correct folder.
Custom Nodes (0)
README
ComfyUI OnDemand Loaders
This is a suite of custom nodes for ComfyUI that allows you to download and apply various models directly from Civitai or HuggingFace. It simplifies your workflow by managing model downloads automatically, so you don't have to manually download files and place them in the correct folders.
Features
- Automatic Downloading: Downloads models from Civitai/HuggingFace URLs specified in a configuration file.
- On-Demand Loading: Models are downloaded only when they are needed for a workflow.
- Centralized Configuration: Manage your list of LoRAs, Checkpoints, VAEs, and more from a single
config.jsonfile. - No Re-downloads: Checks if a model file already exists before attempting to download it.
- Console Progress Bar: Displays a tqdm progress bar in the console during download.
- Private Model Support: Access private or early-access models using your Civitai or HuggingFace API key. Environment variables (
CIVITAI_TOKEN,HUGGINGFACE_TOKEN) are also supported. - Seamless Integration: Functions as standard loader nodes within the ComfyUI interface.
Available Nodes
This package includes the following nodes:
OnDemand Lora LoaderOnDemand Civitai Liked Lora LoaderOnDemand Checkpoint LoaderOnDemand VAE LoaderOnDemand UNET LoaderOnDemand CLIP LoaderOnDemand ControlNet LoaderOnDemand GGUF Loader(Note: Requires ComfyUI-GGUF to be installed.)OnDemand DualCLIP LoaderOnDemand CLIP Vision Loader
Installation with ComfyUI-Manager
Search for "OnDemand-Loaders" in custom node list.
Manual installation
- Navigate to your ComfyUI
custom_nodesdirectory:cd ComfyUI/custom_nodes/ - Clone this repository:
git clone https://github.com/francarl/ComfyUI-OnDemand-Loaders.git - Install the required dependencies:
cd ComfyUI-OnDemand-Loaders pip install -r requirements.txt - Restart ComfyUI.
Usage
1. Configure Your Models
After installation, create and configure a config.json file to list the models you want to access.
- In the
ComfyUI/custom_nodes/ComfyUI-OnDemand-Loaders/directory, create a file namedconfig.json. You can use theexample/config.jsonfile as a template. Ifconfig.jsondoes not exist, the nodes will fall back to a default example configuration. You can specify the full path to the config file using the environment variableONDEMAND_LOADERS_CONFIG_PATH. - Add your models to
config.json, organized by type (loras,checkpoints,vae_models, etc.). Each entry requires aname(which will appear in the node's dropdown menu) and aurl(the Civitai/HuggingFace download link).
You can get the download link from a model's page on Civitai/HuggingFace by right-clicking the download button and copying the link address.
Example config.json:
{
"loras": [
{
"name": "epi_noiseoffset",
"url": "https://civitai.com/api/download/models/16576"
},
{
"name": "Studio Ghibli Style LoRA",
"url": "https://civitai.com/api/download/models/7657"
}
],
"checkpoints": [
{
"name": "v1-5-pruned-emaonly-fp16",
"url": "https://huggingface.co/Comfy-Org/stable-diffusion-v1-5-archive/resolve/main/v1-5-pruned-emaonly-fp16.safetensors"
}
],
"vae_models": [
{
"name": "SDXL VAE",
"url": "https://huggingface.co/stabilityai/sdxl-vae/resolve/main/sdxl_vae.safetensors"
}
],
"clip_models": [
{
"name": "OpenCLIP ViT-H-14",
"url": "https://huggingface.co/openai/clip-vit-large-patch14/resolve/main/pytorch_model.bin"
}
],
"gguf_models": [
{
"name": "Wan2.2-T2V-A14B-HighNoise-Q2_K",
"url": "https://huggingface.co/QuantStack/Wan2.2-T2V-A14B-GGUF/resolve/main/HighNoise/Wan2.2-T2V-A14B-HighNoise-Q2_K.gguf"
}
],
"controlnet_models": [
{
"name": "Qwen-Image-InstantX-ControlNet-Union",
"url": "https://huggingface.co/Comfy-Org/Qwen-Image-InstantX-ControlNets/resolve/main/split_files/controlnet/Qwen-Image-InstantX-ControlNet-Union.safetensors"
}
]
}
2. Add the Nodes in ComfyUI
- In ComfyUI, double-click on the canvas to open the search menu.
- Search for and add one of the
OnDemand ... Loadernodes (e.g.,OnDemand Checkpoint Loader). - Select the desired model from the dropdown. The first time you queue a workflow with a new model, it will be automatically downloaded to the corresponding directory inside
ComfyUI/models/. - Connect the node in your workflow just as you would with a standard loader. An example workflow can be found in
example/workflow_example.json.
After modifying config.json, press "R" to reload configuration and update workflow without restarting ComfyUI.
Using the OnDemand Civitai Liked Lora Loader
This special node works differently from the others. Instead of using the local config.json file, it connects directly to the Civitai API to fetch the list of LoRA models you have marked as "Favorites".
How it works:
- Set your API Key: You must set your Civitai API key as an environment variable named
CIVITAI_TOKEN. The node uses this key to securely access your private list of liked models. - Add the Node: In ComfyUI, search for and add the
OnDemand Civitai Liked Lora Loadernode. - Select a LoRA: The node's dropdown menu will be automatically populated with all the LoRA models from your Civitai favorites.
- Download and Load: When you run a workflow, the selected LoRA will be downloaded to your
ComfyUI/models/loras/directory (if it doesn't already exist) and applied to the model.
This allows you to manage your LoRA collection directly on the Civitai website without needing to manually update a local configuration file.
Note: This node requires an active internet connection each time you load or refresh ComfyUI to fetch the latest list of your favorite models.
3. Common Node Options
..._name: A dropdown menu to select the model you configured inconfig.json.api_key(optional): Your API key for Civitai or HuggingFace. Use this to download private or early-access models. Alternatively, you can set theCIVITAI_TOKENorHUGGINGFACE_TOKENenvironment variables.download_chunks(optional): The chunk size (in KB) for downloading files. The default is 4KB.
License
This project is licensed under the MIT License. See the LICENSE.txt file for details.
Credits
This project uses JavaScript and CSS code from Comfyui-Resolution-Master by Azornes.
Changelog
1.0.12
- Bug Fixes:
- Fixed CLIP Vision Loader
1.0.11
- New Nodes:
- Added
OnDemand DualCLIP Loaderfor dual clip loading - Added
OnDemand CLIP Vision Loaderfor clip vision models loading
- Added
1.0.10
- Bug Fixes:
- Fixed an issue where the
OnDemand Civitai Liked Lora Loaderwould sometimes fail to load models due to an incorrect API response parsing. - Addressed a problem where the
config.jsonfile was not being reloaded correctly after modifications, requiring a full ComfyUI restart.
- Fixed an issue where the
1.0.9
- OnDemand Civitai Liked Lora Loader Improvements:
- Enhanced LoRA information display: now includes author, trigger words, and a direct link to the model page on Civitai.
- Improved selection UI for a better user experience.