Nodes/Kw_Json_Lora_CivitAIDownloader/Kw_Json_Lora_CivitAIDownloader
ComfyUI Node

Kw_Json_Lora_CivitAIDownloader

Let your workflow download its own LoRAs from a JSON manifest

By kycg·Created 2 years ago·Updated 12 months ago· 3
Kw_Json_Lora_CivitAIDownloader
    • Json Lora
    • checkpoint
    • Positive
    • Nagative
    save_dir_lora
    save_dir_checkpoint
    save_dir_embedding
    Json_Lora
    ignorefalse
    ignore_down_checkpointfalse
    model_id
    token_id
    full_url
    enable_r2_cachefalse
    r2_endpoint
    r2_bucket
    r2_access_key
    r2_secret_key
    r2_prefix
    r2_region
    auto_install_depstrue
    return_path_mode
    r2_backfill_on_local_hittrue
    r2_backfill_syncfalse
    r2_backfill_retries1

    The name is the whole pitch: you paste in a JSON list of CivitAI models and this node goes and downloads them into your ComfyUI models folder. That's useful on its own, but the interesting part is that it's one half of a pair. The same JSON flows out the other side, enriched with paths, straight into the pack's companion node Kw_JsonLoraLoader. Hand someone a workflow and one JSON string and they don't have to hunt down five LoRA pages and guess which folders to drop files in - the workflow fetches its own models.

    That's a real itch. The eternal ComfyUI complaint is that you spend most of your time "downloading models and installing missing nodes" instead of generating. ComfyUI Manager solved the nodes half; this pack takes a swing at the models half. It's young, rough around the edges, and genuinely handy for the specific job.

    How it works

    You write a manifest with lora, embedding, and checkpoint arrays. Each entry needs a name and a modelVersionId - that's the number in the model version URL (civitai.com/models/<model>/<slug>?modelVersionId=97207), not the model's main id. Optional extras: a strength per LoRA, and positive / negative prompt strings that travel along for the ride.

    {
      "lora": [
        { "name": "A-Mecha_Musume_A_", "modelVersionId": "97207", "strength": "1.5" }
      ],
      "checkpoint": [
        { "name": "WAI-REAL_CN", "modelVersionId": "655516" }
      ],
      "positive": "solo, spine, translucent, transparent, scars,",
      "negative": "score_6, score_5, score_4, pony,"
    }
    

    For every entry it resolves in the same order: local first (it looks for a file named {name}_{modelVersionId}.safetensors in the target folder), then R2 if you've enabled that cache, then CivitAI - hitting https://civitai.com/api/download/models/{modelVersionId} with your token appended if you gave one. Files land as {name}_{modelVersionId}.safetensors and existing files are skipped rather than re-downloaded. Every entry in the output JSON gets a local_path and a source (local / r2 / civitai / miss), so you can see exactly where each model came from.

    The inputs that matter

    • save_dir_lora / save_dir_checkpoint / save_dir_embedding - which subfolder of ComfyUI/models each type goes into. They're dropdowns built from your actual models directory.
    • Json_Lora - the manifest, multiline.
    • token_id - your CivitAI API token. Public models download fine without it, but some gated files and heavier rate limits want it.
    • ignore and ignore_down_checkpoint - set these to skip downloading entirely for LoRAs/embeddings or for checkpoints respectively. Handy when you only want the LoRAs and already run a local base model.

    The whole R2 cluster (enable_r2_cache, r2_endpoint, …), return_path_mode, and the backfill toggles are an optional Cloudflare R2 object-store cache for people syncing many machines. Ignore them unless you know why you need them.

    Outputs: "Json Lora" (the enriched manifest - wire it into Kw_JsonLoraLoader), "checkpoint" (the first checkpoint's path), Positive, and… "Nagative". Yes, that's a real output name, misspelled in the source. That's the socket you'll see in your graph; wire it into your negative CLIPTextEncode and move on.

    Install

    ComfyUI Manager - search "comfyui-Lora-auto-downloader" - or the manual route:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kycg/comfyui-Lora-auto-downloader
    

    Then restart ComfyUI. It's light: the only real dependency is requests (os, json, re are stdlib). boto3 gets auto-installed if you flip on R2; auto_install_deps defaults to true so you'll see a pip install in the console on first run if something's missing.

    Where people get burned

    • The README says to "set your token and model id" - the code ignores model_id entirely. It's a leftover compat field. Token is optional, so if downloads work without one, don't sweat it.
    • Malformed JSON won't crash hard; the node logs the parse error and returns the raw string with empty paths. Watch the console.
    • Checkpoints are multi-gigabyte. If you only want LoRAs, set ignore_down_checkpoint and keep your own base.
    • The whole thing keys on modelVersionId. CivitAI removals are a real thing - the community has measured roughly 20% of older download links rotting. When a version id 404s, that entry just fails.
    • Don't rename downloaded files. The loader downstream will fuzzy-match, but the naming convention is the contract.
    Categoryloaders

    Inputs (21)

    NameTypeDefaultDescription
    save_dir_loraCOMBO26 options: model_patches, gligen, latent_upscale_models, vae, unet, clip_vision, +20
    save_dir_checkpointCOMBO26 options: model_patches, gligen, latent_upscale_models, vae, unet, clip_vision, +20
    save_dir_embeddingCOMBO26 options: model_patches, gligen, latent_upscale_models, vae, unet, clip_vision, +20
    Json_LoraoptSTRING
    ignoreoptBOOLEANfalse
    ignore_down_checkpointoptBOOLEANfalse
    model_idoptSTRING
    token_idoptSTRING
    full_urloptSTRING
    enable_r2_cacheoptBOOLEANfalse
    r2_endpointoptSTRING
    r2_bucketoptSTRING
    r2_access_keyoptSTRING
    r2_secret_keyoptSTRING
    r2_prefixoptSTRING
    r2_regionoptSTRING
    auto_install_depsoptBOOLEANtrue
    return_path_modeoptCOMBO3 options: name, relative, absolute
    r2_backfill_on_local_hitoptBOOLEANtrue
    r2_backfill_syncoptBOOLEANfalse
    r2_backfill_retriesoptINT10–5

    Outputs (4)

    NameTypeDescription
    Json LoraSTRING
    checkpointSTRING
    PositiveSTRING
    NagativeSTRING