Nodes/Civitai URL Resolver for ComfyUI/Civitai Share → Direct URL
ComfyUI Node

Civitai Share → Direct URL

Turn a Civitai share link into a direct download URL

By Randy420Marsh·Created 9 months ago·Updated 8 months ago· 2
Civitai Share → Direct URL
    • direct_url
    civitai_share_url

    Ever right-clicked the download button on a Civitai model page and found there's no "copy link" anymore? Civitai deliberately hides the real file URL behind JavaScript, so the share link you paste around - https://civitai.com/models/123456?modelVersionId=789 - isn't the URL your downloader can fetch. The URL that works looks like https://civitai.com/api/download/models/789. This node is just that conversion: paste a Civitai link in, get a real download URL out. That's the whole job, and it does it without calling any third-party service or asking you to fiddle with an API key by hand.

    It lives in ComfyUI-Civitai-API-Url-Resolver, a one-node pack by Randy420Marsh (category utils/url), and it's aimed at the automation crowd: workflows that fetch a model on the fly - download node → load checkpoint → generate - instead of you dragging files into models/ yourself. If you've ever watched a shared workflow die on a "can't download this URL" error, this is the missing link in the middle.

    How it works

    The name says "API Url Resolver," and for once the name isn't a lie - it really does call Civitai's REST API, but only when it has to. The logic, straight from the source:

    • Not a civitai.com URL? Returned unchanged.
    • Already a direct https://civitai.com/api/download/models/123 URL? Passed straight through.
    • Has a modelVersionId? It asks https://civitai.com/api/v1/model-versions/{id} for that version's downloadUrl and hands it back. If the API call fails, it falls back to constructing https://civitai.com/api/download/models/{id} itself.
    • Just a bare model page? It queries https://civitai.com/api/v1/models/{id} and grabs the first version's download URL.

    The one input, civitai_share_url, is a single-line string - paste anything and it normalizes it. The direct_url output wires into any download node, or an HTTP request node if you're building something custom. No API token is required for public models.

    Install

    Via ComfyUI Manager, search Civitai URL Resolver and hit install. Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Randy420Marsh/ComfyUI-Civitai-API-Url-Resolver
    

    Then restart ComfyUI. That's genuinely it - there's no requirements.txt, the whole thing runs on Python's standard library, so there's no dependency-conflict drama to inherit. (One tiny lie in the README: it claims Python 3.8+, but the code uses str | None type syntax, which needs 3.10+. Any recent ComfyUI is fine.)

    Do you need a token?

    For free, public models: no. For early-access or gated ones, yes. Grab a key from your Civitai account, then:

    cd ComfyUI/custom_nodes/ComfyUI-Civitai-API-Url-Resolver
    cp .config.example .config
    # edit .config, set civitai_token = your_32_char_key
    chmod 600 .config
    

    The token never ends up in your workflow JSON or the output URL - it's only sent as a Bearer header on the resolution call, which is the right way to do it.

    Where people get burned

    • civitai.red URLs are ignored. The node only handles civitai.com; after Civitai's April 2026 split, a .red model link comes back to you unchanged. Plenty of tools broke that way - this is one more. Resolve the .com version first.
    • It needs a network round-trip at execution time. It hits Civitai live (10s timeout), so an offline run just echoes your input back.
    • If you get your own URL back, check whether it's a non-Civitai host, a .red link, or a bare model page where the API call failed. The README calls this out and so does the code: "return url" is the universal fallback.
    • The fallback download URL carries no auth, so for truly gated models the happy path (the API-returned, signed URL) is the one that actually works - the token doesn't travel with the fallback URL, no matter how valid it is.

    It's a small, honest utility. If you hand-build Civitai URLs more than twice a month, this saves you the tedium; if you don't, it's still worth having in the pack for when a workflow insists on a direct link.

    Categoryutils/url

    Inputs (1)

    NameTypeDefaultDescription
    civitai_share_urlSTRING

    Outputs (1)

    NameTypeDescription
    direct_urlSTRING