Adding Model Sources¶
Register download URLs for your models to enable re-downloads, environment sharing, and team collaboration.
Overview¶
Model sources are download URLs that tell ComfyDock where to get a model file. When you add sources:
- Re-download capability - Retrieve deleted models easily
- Environment portability - Share environments with automatic model downloads
- Team collaboration - Team members can download models from shared sources
- Fallback URLs - Multiple sources provide redundancy
What are model sources?¶
A model source is a URL that points to a downloadable model file. ComfyDock stores sources in the model index:
Model: sd_xl_base_1.0.safetensors
Sources:
• HuggingFace: https://huggingface.co/.../sd_xl_base_1.0.safetensors
• CivitAI: https://civitai.com/api/download/models/128078
Sources enable:
- Automatic downloads -
cfd importcan download models from sources - Manual re-downloads - Copy URL and run
cfd model download <url> - Export validation -
cfd exportwarns if models lack sources
When to add sources¶
Add sources when:
- Preparing to export - Before sharing an environment
- Team collaboration - So others can download models
- Backup strategy - Register multiple mirrors
- After manual downloads - Browser downloads don't auto-register sources
Downloads auto-register sources
Models downloaded with cfd model download automatically have their source URL registered. Manual source addition is only needed for models added other ways.
Adding sources interactively¶
The easiest way to add sources is interactively:
ComfyDock guides you through all models without sources.
Example session:
📦 Add Model Sources
Found 3 model(s) without download sources
[1/3] realistic_vision_v5.safetensors
Hash: f6e5d4c3b2a1...
Path: checkpoints/realistic_vision_v5.safetensors
Status: ✓ Available locally
URL (or 's' to skip, 'q' to quit): https://civitai.com/api/download/models/128078
✓ Added source
[2/3] anime_style_lora.safetensors
Hash: 9876543210ab...
Path: loras/anime_style_lora.safetensors
Status: ✓ Available locally
URL (or 's' to skip, 'q' to quit): s
→ Skipped
[3/3] detail_enhancer.safetensors
Hash: abcdef123456...
Path: loras/detail_enhancer.safetensors
Status: ✓ Available locally
URL (or 's' to skip, 'q' to quit): q
⊗ Cancelled
✅ Complete: 1/3 source(s) added
Your environment is now more shareable!
Run 'cfd export' to bundle and distribute
Interactive commands¶
During interactive mode:
- Enter URL - Paste download URL and press Enter
- s - Skip this model
- q - Quit and exit
Finding download URLs¶
Where to get URLs for interactive mode:
CivitAI:
- Visit model page (e.g.,
civitai.com/models/4201/realistic-vision) - Click "Download" button
- Right-click and copy link address
- URL format:
https://civitai.com/api/download/models/XXXXX
HuggingFace:
- Visit model repository
- Click on file (e.g.,
sd_xl_base_1.0.safetensors) - Right-click "download" link
- URL format:
https://huggingface.co/USER/REPO/resolve/main/file.safetensors
Direct URLs:
Any direct download link works.
Adding sources directly¶
Add a source to a specific model without interaction:
Examples:
# By exact filename
cfd model add-source realistic_vision_v5.safetensors https://civitai.com/api/download/models/128078
# By hash prefix
cfd model add-source f6e5d4c3 https://civitai.com/api/download/models/128078
# By full hash
cfd model add-source f6e5d4c3b2a1e9876543210abcdef123456789 https://civitai.com/api/download/models/128078
Output:
When to use direct mode¶
Direct mode is useful for:
- Scripting - Batch adding sources
- Automation - CI/CD pipelines
- Single model - Quick one-off source addition
- Known identifiers - When you already know the hash/filename
Source types¶
ComfyDock tracks the type of each source:
CivitAI sources¶
Detected as civitai type. Used for:
- Community models
- LoRAs and checkpoints
- Trained on specific styles/characters
HuggingFace sources¶
cfd model add-source model.safetensors https://huggingface.co/stabilityai/sdxl/resolve/main/model.safetensors
Detected as huggingface type. Used for:
- Official models (Stability AI, etc.)
- Research models
- Open source releases
Custom sources¶
Detected as custom type. Used for:
- Private model hosting
- Self-hosted mirrors
- Organization-internal repositories
Multiple sources per model¶
Models can have multiple download sources for redundancy:
# Add primary source
cfd model add-source sd_xl_base_1.0.safetensors https://huggingface.co/.../sd_xl_base_1.0.safetensors
# Add backup source
cfd model add-source sd_xl_base_1.0.safetensors https://civitai.com/api/download/models/128078
View all sources:
Sources (2):
• HuggingFace
URL: https://huggingface.co/.../sd_xl_base_1.0.safetensors
Added: 2025-01-10 09:15:00
• CivitAI
URL: https://civitai.com/api/download/models/128078
Added: 2025-01-12 16:42:31
Benefits of multiple sources:
- Redundancy - If one source goes down, use another
- Flexibility - Choose fastest source per user
- Availability - Some users prefer CivitAI, others HuggingFace
Source priority
When importing environments, ComfyDock tries sources in the order they were added. Add most reliable source first.
Integration with export/import¶
Export validation¶
When exporting an environment:
ComfyDock checks if all models have sources:
📦 Exporting environment: my-project
⚠️ Export validation:
3 model(s) have no source URLs.
• realistic_vision_v5.safetensors
Used by: portrait_workflow, character_workflow
• anime_style_lora.safetensors
Used by: anime_workflow
• detail_enhancer.safetensors
Used by: portrait_workflow
⚠️ Recipients won't be able to download these models automatically.
Add sources: cfd model add-source
Continue export? (y/N):
Options:
- y - Export anyway (models without sources won't be downloadable)
- N - Cancel and add sources first
Adding sources before export¶
Add sources to all models:
# Interactive mode
cfd model add-source
# Or direct mode for each model
cfd model add-source model1.safetensors <url>
cfd model add-source model2.safetensors <url>
# Then export
cfd export
Import behavior¶
When importing an environment:
ComfyDock offers model download strategy:
Model download strategy:
1. all - Download all models with sources
2. required - Download only required models
3. skip - Skip all downloads (can resolve later)
Choice (1-3) [1]:
Strategies:
- all - Downloads every model that has a source URL
- required - Downloads only models marked as "required" importance
- skip - Doesn't download anything (models become unresolved)
Models without sources cannot be downloaded automatically - user must download manually.
Model importance and sources¶
Model importance affects download behavior during import:
Default importance by category¶
ComfyDock assigns default importance based on model category:
| Category | Default Importance | Import Behavior |
|---|---|---|
| checkpoints | flexible | Downloaded with "all" strategy |
| vae | flexible | Downloaded with "all" strategy |
| loras | flexible | Downloaded with "all" strategy |
| controlnet | required | Downloaded with "required" or "all" |
| clip_vision | required | Downloaded with "required" or "all" |
| embeddings | flexible | Downloaded with "all" strategy |
| upscale_models | flexible | Downloaded with "all" strategy |
| style_models | flexible | Downloaded with "all" strategy |
Per-workflow importance¶
Users can override importance per workflow:
This makes model.safetensors required for my_workflow even if its category defaults to "flexible".
See Workflow Model Importance for details.
Common patterns¶
Adding sources before sharing¶
Prepare environment for export:
# 1. Check which models need sources
cfd model add-source # Lists models without sources
# 2. Add sources interactively
# (Paste URLs for each model)
# 3. Verify all models have sources
cfd export # Should not show source warnings
# 4. Export and share
cfd export
Batch adding sources¶
Add sources to multiple models:
# Create a mapping file
cat > model_sources.txt << EOF
realistic_vision_v5.safetensors https://civitai.com/api/download/models/128078
anime_style_lora.safetensors https://civitai.com/api/download/models/128079
detail_enhancer.safetensors https://civitai.com/api/download/models/128080
EOF
# Add all sources
while read filename url; do
cfd model add-source "$filename" "$url"
done < model_sources.txt
Adding backup sources¶
Register fallback URLs:
# Add primary source
cfd model add-source sd_xl_base_1.0.safetensors https://huggingface.co/.../sd_xl_base_1.0.safetensors
# Add backup CivitAI mirror
cfd model add-source sd_xl_base_1.0.safetensors https://civitai.com/api/download/models/128078
# Add private backup
cfd model add-source sd_xl_base_1.0.safetensors https://internal-server.company.com/models/sd_xl_base_1.0.safetensors
Organization model repositories¶
For teams with internal model repositories:
# Add sources pointing to internal server
cfd model add-source company_lora.safetensors https://models.company.com/loras/company_lora.safetensors
cfd model add-source company_checkpoint.safetensors https://models.company.com/checkpoints/company_checkpoint.safetensors
# Team members can import and download from internal sources
cfd import team_environment.tar.gz
Troubleshooting¶
"Model not found"¶
Problem: Direct mode can't find model
Solutions:
# Check exact filename
cfd model index list | grep model_name
# Use exact filename or hash
cfd model index show model_name
cfd model add-source exact_filename.safetensors <url>
# Or use interactive mode
cfd model add-source
"Multiple models match"¶
Problem: Filename is ambiguous
✗ Multiple models match 'anime':
• anime_v2.safetensors (f6e5d4c3...)
• anime_style_lora.safetensors (98765432...)
• anime_character.safetensors (abcdef12...)
Use full hash: cfd model add-source <hash> <url>
Solution:
Use full hash instead of filename:
"URL already exists"¶
Problem: Source already registered
Solution:
This is fine - source is already tracked. No action needed.
To verify:
Interactive mode shows no models¶
Problem: Interactive mode says no models need sources
Meaning:
All models in your index already have at least one source URL registered. This is the desired state.
To verify:
# Check a few models
cfd model index show model1.safetensors
cfd model index show model2.safetensors
Models without sources still in export warning¶
Problem: Added sources but export still warns
Solution:
Make sure you added sources to all models mentioned in the warning:
# Run export again
cfd export
# Note which models are listed
# Add sources for each
cfd model add-source model1.safetensors <url>
cfd model add-source model2.safetensors <url>
# Try export again
cfd export
Invalid URL format¶
Problem: URL doesn't work
Solutions:
# Ensure URL is direct download link, not webpage
# Wrong: https://civitai.com/models/4201/realistic-vision
# Right: https://civitai.com/api/download/models/128078
# For CivitAI, use API URLs
cfd model add-source model.safetensors https://civitai.com/api/download/models/XXXXX
# For HuggingFace, use resolve URLs
cfd model add-source model.safetensors https://huggingface.co/USER/REPO/resolve/main/file.safetensors
Advanced usage¶
Viewing all models with sources¶
List models and check for sources:
# Show all models
cfd model index list
# Check each for sources
cfd model index show model1.safetensors
cfd model index show model2.safetensors
Models with sources show:
Models without sources show:
Exporting source list¶
Create a backup of all model sources:
# List all models
cfd model index list > models.txt
# For each model, export sources
for model in $(cat models.txt | grep ".safetensors" | awk '{print $1}'); do
echo "Model: $model"
cfd model index show "$model" | grep -A 10 "Sources"
echo "---"
done > model_sources.txt
Verifying sources work¶
Test that URLs are accessible:
# Get source URL
cfd model index show model.safetensors | grep "URL:"
# Test with wget or curl
wget --spider <url>
curl -I <url>
If URL returns 200 OK, source is valid.
Managing source metadata¶
Sources include metadata from API responses (CivitAI, HuggingFace):
Sources (1):
• CivitAI
URL: https://civitai.com/api/download/models/128078
model_name: Realistic Vision V5.0
creator: SG_161222
Added: 2025-01-10 09:15:00
This metadata helps identify model versions and creators.
Future enhancements¶
Currently, ComfyDock only has cfd model add-source. Future versions may add:
cfd model list-sources- List all models and their sourcescfd model remove-source- Remove a source URLcfd model update-source- Update a source URL
For now, use:
cfd model index show <model>to view sourcescfd model add-sourceto add sources- Manual database editing to remove sources (advanced)
Next steps¶
-
Understand how the model index works
-
Download models from URLs with automatic source registration
-
Share environments with automatic model downloads