ComfyUI Extension: ComfyUI-Civitai-API-Url-Resolver
A ComfyUI custom node that converts Civitai share/model page URLs into direct download URLs, making it easier to integrate Civitai models into your workflows.
Custom Nodes (0)
README
Civitai URL Resolver for ComfyUI
A ComfyUI custom node that converts Civitai share/model page URLs into direct download URLs, making it easier to integrate Civitai models into your workflows.
What It Does
This node solves a common problem: Civitai share links and model page URLs can't be used directly for downloading. This node automatically resolves them to direct download URLs that can be used with download nodes or external tools.
Input: https://civitai.com/models/123456?modelVersionId=789
Output: https://civitai.com/api/download/models/789
Why Use This Node?
The Problem
- Civitai share URLs are designed for browsing, not downloading
- Model page URLs don't point directly to the file
- Manually finding download links is tedious and breaks workflow automation
- Some models require API authentication to access
The Solution
This node:
- ✅ Automatically extracts model/version IDs from URLs
- ✅ Queries Civitai's API to get the correct download URL
- ✅ Handles authentication securely using API tokens
- ✅ Works with share links, model pages, and direct download URLs
- ✅ Integrates seamlessly into ComfyUI workflows
Installation
Method 1: ComfyUI Manager (Recommended)
- Open ComfyUI Manager
- Search for "Civitai URL Resolver"
- Click Install
Method 2: Manual Installation
-
Navigate to your ComfyUI custom nodes directory:
cd ComfyUI/custom_nodes/ -
Clone this repository:
git clone https://github.com/Randy420Marsh/ComfyUI-Civitai-API-Url-Resolver.git -
Restart ComfyUI
Configuration
Setting Up Your Civitai API Token (Optional but Recommended)
Some Civitai models require authentication. To enable full functionality:
-
Get your Civitai API token:
- Go to https://civitai.com/user/account
- Navigate to API Keys section
- Generate a new API key
- Copy the token (it should be 32 characters long)
-
Configure the node:
- Navigate to
ComfyUI/custom_nodes/comfyui-civitai-url-resolver/ - Copy
.config.exampleto.config:cp .config.example .config - Edit
.configand replaceYOUR_TOKEN_HEREwith your actual token:[API] civitai_token = your_actual_32_character_token_here
- Navigate to
-
Secure your config file (Linux/Mac):
chmod 600 .config
Important: The .config file is ignored by git and stays on your local machine. Your token is never exposed in URLs, workflows, or generated images.
Usage
In ComfyUI
-
Add the node to your workflow:
- Right-click → Add Node → utils/url → Civitai Share → Direct URL
-
Paste any Civitai URL into the input:
- Share links:
https://civitai.com/models/123456?modelVersionId=789 - Model pages:
https://civitai.com/models/123456 - Already direct URLs:
https://civitai.com/api/download/models/789
- Share links:
-
The node outputs a direct download URL that you can use with:
- Download nodes
- External download managers
- Automation scripts
- Any tool that needs a direct file URL
Example Workflow
[Civitai Share → Direct URL] → [Download Model Node] → [Load Checkpoint]
Security
This node is designed with security as a priority:
- ✅ API tokens stay local - stored in
.configfile on your machine only - ✅ Tokens never exposed - used only in HTTP headers, never in URLs or outputs
- ✅ Git-safe -
.configis in.gitignoreand won't be committed - ✅ No data collection - no telemetry, no external logging
- ✅ Open source - audit the code yourself
Supported URL Formats
The node handles these Civitai URL types:
- ✅ Share links with modelVersionId:
/models/12345?modelVersionId=67890 - ✅ Model page URLs:
/models/12345 - ✅ Direct download URLs:
/api/download/models/67890(passes through) - ✅ Full URLs with domain:
https://civitai.com/models/... - ✅ Relative URLs:
/models/...
Non-Civitai URLs are returned unchanged.
Troubleshooting
"The node returns the same URL I put in"
- Check if you need authentication for that model
- Verify your
.configfile exists and has a valid token - Ensure the token is valid 32 characters with no spaces
"Downloads fail with 401/403 errors"
- The model requires authentication
- Add your Civitai API token to
.config(see Configuration section)
"Node not appearing in ComfyUI"
- Restart ComfyUI completely
- Check
ComfyUI/custom_nodes/contains this folder - Look for errors in the ComfyUI console
Requirements
- ComfyUI (any recent version)
- Python 3.8+
- No additional dependencies (uses Python standard library only)
API Rate Limits
The node respects Civitai's API rate limits. For heavy usage, ensure you're using an API token to get higher rate limits.
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Submit a pull request
License
[MIT]
Credits
Created for the ComfyUI community to simplify Civitai model integration.
Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Civitai API Docs: https://github.com/civitai/civitai/wiki/REST-API-Reference
Note: This is an unofficial tool and is not affiliated with or endorsed by Civitai.