Skip to main content

Model URLs

cmfy.cloud downloads models on-demand from external sources. This guide explains which providers are supported and how to format model URLs correctly.

Why External Model URLs?

Unlike running ComfyUI locally, you don't pre-install models on cmfy.cloud. Instead, you specify URLs to models in your workflow, and nodes download them as needed.

This approach offers several benefits:

  • No storage limits: Access any model, any size
  • Always up-to-date: Use the latest model versions
  • Cache optimization: Popular models are cached across nodes
  • Private model support: Use credentials to access gated or private models

Supported Providers

Hugging Face

The most common source for open-source models.

URL Format:

https://huggingface.co/{org}/{repo}/resolve/{branch}/{path}

Examples:

https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors

https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned.safetensors

https://huggingface.co/TheBloke/Llama-2-7B-GGUF/resolve/main/llama-2-7b.Q4_K_M.gguf
Using Specific Versions

Replace main with a commit hash for reproducible results:

https://huggingface.co/stabilityai/sdxl/resolve/abc123def/model.safetensors
Gated Models

Some models on Hugging Face require authentication (e.g., Flux, Llama). To use these:

  1. Accept the model's license on its Hugging Face page
  2. Create a Hugging Face credential with your access token
  3. Link it to your API key

Your jobs will then automatically authenticate when downloading gated models.

Civitai

Popular platform for community-created models, LoRAs, and embeddings.

URL Format:

https://civitai.com/api/download/models/{version_id}

Examples:

https://civitai.com/api/download/models/128713

https://civitai.com/api/download/models/351306?type=Model&format=SafeTensor
Finding Version IDs
  1. Go to the model page on Civitai
  2. Click on the version you want
  3. The version ID is in the URL: civitai.com/models/12345?modelVersionId=128713
  4. Use 128713 in your download URL

Amazon S3

For self-hosted models on AWS.

URL Format:

https://{bucket}.s3.{region}.amazonaws.com/{key}
https://s3.{region}.amazonaws.com/{bucket}/{key}

Examples:

https://my-models.s3.us-east-1.amazonaws.com/checkpoints/sdxl.safetensors

https://s3.eu-west-1.amazonaws.com/my-models/loras/detail_enhancer.safetensors
Private Buckets

For private S3 buckets, you have two options:

  1. Credentials (recommended): Create an S3 credential with your AWS access keys. Your jobs will automatically sign requests.
  2. Presigned URLs: Generate presigned URLs with sufficient expiration time for each model.

Credentials are recommended because they work with any URL to your bucket and don't expire per-request.

Google Cloud Storage

For models on GCP.

URL Format:

https://storage.googleapis.com/{bucket}/{path}

Examples:

https://storage.googleapis.com/my-models/checkpoints/sdxl.safetensors

https://storage.googleapis.com/my-company-ml/loras/style.safetensors

Azure Blob Storage

For models on Azure.

URL Format:

https://{account}.blob.core.windows.net/{container}/{path}

Examples:

https://mymodels.blob.core.windows.net/checkpoints/sdxl.safetensors

https://mlassets.blob.core.windows.net/loras/anime.safetensors
Private Containers

For private Azure containers, create an Azure credential with a SAS token. Your jobs will automatically authenticate when downloading from your storage account.

Cloudflare R2

For models on Cloudflare R2.

URL Format:

https://{bucket}.{account_id}.r2.cloudflarestorage.com/{path}

Examples:

https://models.abc123.r2.cloudflarestorage.com/sdxl/base.safetensors

https://assets.xyz789.r2.cloudflarestorage.com/loras/detail.safetensors

Custom URLs

You can use model URLs from any publicly accessible HTTPS source. This includes:

  • Your own cloud storage (S3, GCS, Azure, R2)
  • Self-hosted model servers
  • Any custom domain you control

For private storage, set up credentials to authenticate requests.

URL Requirements

All model URLs must meet these requirements:

RequirementDetails
HTTPS onlyHTTP URLs are rejected
Direct downloadURL must return the file, not HTML
AccessibleMust be publicly accessible or use credentials/presigned URLs
Valid pathNo path traversal (../) or suspicious patterns

Invalid URL Examples

// HTTP (insecure)
"http://huggingface.co/model.safetensors" // ❌

// Local file
"file:///models/sdxl.safetensors" // ❌

// Path traversal
"https://huggingface.co/../../../etc/passwd" // ❌

Using Model URLs in Workflows

Checkpoint Loader

{
"1": {
"class_type": "CheckpointLoaderSimple",
"inputs": {
"ckpt_name": "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors"
}
}
}

LoRA Loader

{
"2": {
"class_type": "LoraLoader",
"inputs": {
"model": ["1", 0],
"clip": ["1", 1],
"lora_name": "https://civitai.com/api/download/models/128713",
"strength_model": 0.8,
"strength_clip": 0.8
}
}
}

VAE Loader

{
"3": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "https://huggingface.co/stabilityai/sdxl-vae/resolve/main/sdxl_vae.safetensors"
}
}
}

ControlNet Loader

{
"4": {
"class_type": "ControlNetLoader",
"inputs": {
"control_net_name": "https://huggingface.co/diffusers/controlnet-canny-sdxl-1.0/resolve/main/diffusion_pytorch_model.safetensors"
}
}
}

Best Practices

1. Use Consistent URLs

Using the same URL for the same model improves cache hit rates:

// Good: Consistent URL
const SDXL_BASE = "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors";

// Bad: Different URLs for same model
// "https://huggingface.co/stabilityai/sdxl/..."
// "https://huggingface.co/stabilityai/stable-diffusion-xl/..."

2. Pin Versions for Production

Use commit hashes instead of main for reproducible results:

// Development: Use main branch
const model = "https://huggingface.co/model/resolve/main/file.safetensors";

// Production: Pin to specific version
const model = "https://huggingface.co/model/resolve/abc123def456/file.safetensors";

3. Store URLs as Constants

Centralize model URLs for easier updates:

class ModelURLs:
# Checkpoints
SDXL_BASE = "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors"
SDXL_REFINER = "https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/resolve/main/sd_xl_refiner_1.0.safetensors"

# LoRAs
DETAIL_ENHANCER = "https://civitai.com/api/download/models/128713"

# VAE
SDXL_VAE = "https://huggingface.co/stabilityai/sdxl-vae/resolve/main/sdxl_vae.safetensors"

4. Validate URLs Before Submitting

Check URLs are valid before sending to the API:

from urllib.parse import urlparse

def validate_model_url(url):
if not url.startswith('https://'):
raise ValueError("URL must use HTTPS")

parsed = urlparse(url)
if not parsed.netloc:
raise ValueError("Invalid URL format")

return True

5. Handle Large Models

Large models (>5GB) may take longer to download. Consider:

  • Using webhooks instead of polling
  • Setting appropriate timeouts
  • Caching workflows that use the same large models

Troubleshooting

"Only HTTPS URLs are allowed"

You're using an HTTP URL.

Solution: Change http:// to https://

"Model download failed"

The model couldn't be downloaded from the URL.

Common causes:

  • Model was removed or moved
  • URL requires authentication
  • Temporary server issues at the provider

Solutions:

  1. Verify the URL works in a browser
  2. Check if the model is still available
  3. For private/gated models, set up credentials for your API key

Model Downloads Slowly

Large models or high-demand models may download slowly.

Tips:

  • Use popular models (more likely to be cached)
  • Consider smaller model variants
  • Use consistent URLs to improve cache hits

What's Next?

Was this page helpful?