Nodes/m10i/Load Safetensors from Multiple URLs
ComfyUI Node

Load Safetensors from Multiple URLs

Download a batch of safetensors and get back the JSON to load them

By 0nyx-networks·Created 7 months ago·Updated 4 months ago· 0
Load Safetensors from Multiple URLs
    • results_json
    entries_json[{"url": "", "strength_model": 1.0, "strength_clip": 1.0}]
    model_type
    raise_error_on_failurefalse

    Downloading one model from a URL is a chore; downloading five is a session. Load Safetensors from Multiple URLs is the batch version of the pack's single-URL node: you hand it a JSON list of URLs (plus strengths, if these are LoRAs), it downloads, validates, and saves each one into the right models folder, then hands back a JSON result list that's already shaped for the next node in the pipeline. It's the "fetch the ingredients, then cook" node.

    How it works

    Same engine as LoadSafetensorsFromUrl, looped: each entry is streamed over httpx, checked against the real safetensors header structure (8-byte little-endian header size + JSON header), named by SHA3-512 hash (download_<hash>_<size>.safetensors), saved into the first folder of the chosen model_type, and remembered in a diskcache (10GB cap) so re-runs are instant. If a cached file is still on disk, no download happens.

    The entries_json input is a JSON array, and each entry can be either:

    • a dict - {"url": "...", "strength_model": 1.0, "strength_clip": 1.0} (all three keys required, or the entry is skipped), or
    • a plain string URL - accepted for backward compatibility, treated as strength 1.0/1.0.

    Bad strengths fall back to 1.0 with a warning; bad URLs are skipped (or raise, if raise_error_on_failure is on). One URL at a time fails is a skip, not a batch abort.

    Inputs and outputs

    • entries_json - the recipe, multiline. The default [{"url": "", "strength_model": 1.0, "strength_clip": 1.0}] shows the shape.
    • model_type - checkpoints / clip_vision / controlnet / loras / text_encoders (plus the broken option below).
    • raise_error_on_failure (optional) - default false.

    Output is a single results_json string - an array of objects with file_name, strength_model, strength_clip, and original_url per successfully downloaded file.

    The killer pipeline

    The results JSON is designed to flow straight into the pack's LoadLoRAFromMultipleFiles, which expects exactly file_name, strength_model, and strength_clip per entry (it ignores the extra original_url). So: wire this node's output into that node's lora_params_json input, pick loras as the type, and you have "download three LoRAs from URLs and apply them all" as a single dynamic pipeline - no manual file moving, no fixed dropdowns.

    Two caveats. First, the same diffustion_models misspelling as the single-URL node lives in this pack's source - that dropdown option raises a KeyError (silent with raise_error_on_failure off) because ComfyUI's folder key is spelled diffusion_models. Stick to the other types. Second, remember the first run downloads everything - a batch of several-hundred-MB files takes a while, so don't mistake it for a hang; the caching means it only happens once.

    Install

    ComfyUI Manager → search "comfy-nekonote-extensions", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/0nyx-networks/comfy-nekonote-extensions
    

    Restart ComfyUI; it's under NEKONOTE → Load. Part of the MIT-licensed pack by MINETA "m10i" Hiroki (v0.4.7) with no model files of its own; it needs httpx and diskcache (let Manager install requirements if needed). Uses the newer comfy_api.latest backend API - a current ComfyUI is the main requirement.

    CategoryNEKONOTE/Load

    Inputs (3)

    NameTypeDefaultDescription
    entries_jsonSTRING[{"url": "", "strength_model": 1.0, "strength_clip": 1.0}]
    model_typeCOMBO6 options: checkpoints, clip_vision, controlnet, diffustion_models, loras, text_encoders
    raise_error_on_failureoptBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    results_jsonSTRING