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.
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
- 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
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
- Open ComfyUI Manager
- Search for "Civitai URL Resolver"
- Click Install
-
Navigate to your ComfyUI custom nodes directory:
cd ComfyUI/custom_nodes/ -
Clone this repository:
git clone https://github.com/Randy420Marsh/civitai-api-url-resolver.git
-
Restart ComfyUI
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/civitai-api-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.
-
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
[Civitai Share → Direct URL] → [Download Model Node] → [Load Checkpoint]
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
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.
- 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
- The model requires authentication
- Add your Civitai API token to
.config(see Configuration section)
- Restart ComfyUI completely
- Check
ComfyUI/custom_nodes/contains this folder - Look for errors in the ComfyUI console
- ComfyUI (any recent version)
- Python 3.8+
- No additional dependencies (uses Python standard library only)
The node respects Civitai's API rate limits. For heavy usage, ensure you're using an API token to get higher rate limits.
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Submit a pull request
[MIT]
Created for the ComfyUI community to simplify Civitai model integration.
- 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.