Civitai LoRAs To Hash Metadata
Make Civitai Actually See the LoRA You Used
- loras
- api_config
- additional_hashes
- civitai_resources
- resolved
- missing
- resources_json
You upload a ComfyUI generation to Civitai, and the site shrugs: it detects the checkpoint but not the LoRA you clearly used. That's the exact gap this node plugs. Civitai's upload process identifies resources by hash, and the CIVITAI_LORAS stack from its own Civitai LoRA Selector doesn't get written into the saved image in that hash format. So you get the picture right and the provenance wrong - which genuinely matters if you're entering a Civitai Challenge that requires a specific resource to be detected.
The name is a lie, sort of: nothing is "bridged" over the network at generation time. Sampling stays local. The only network call is a small lookup to Civitai's public API to resolve a model version into its AutoV2 hash.
How it works
The Civitai LoRA Selector hands you a stack of entries, each carrying an air identifier that looks like urn:air:...:civitai:12345@678. This node parses that, pulls out the version ID, and asks Civitai's lightweight model-versions/mini endpoint for that version's hashes. It takes the AutoV2 hash, or falls back to the first ten characters of the SHA-256, and emits a line in the format alexopus's Image Saver understands:
My LoRA [Version Name]:1182CD0705:0.7
That's Name:Hash:Weight, comma-joined, ready for Image Saver Metadata's additional_hashes. Successful lookups are cached in memory for the session, so the same LoRA only costs one API call. The node ships zero third-party Python dependencies - it's pure standard library.
The inputs and outputs that matter
You'll actually touch two inputs:
loras- the stack. Connect from Civitai LoRA Selector'slorasoutput. Without it, nothing happens.include_weight- on by default, and you want it on: it emitsName:HASH:Weightinstead of bareName:HASH, and the weight is what lets the saver write an accurate resource entry.
The rest you can leave alone: site_base_url defaults to https://civitai.com (settable if you're pointed at a mirror), timeout_seconds caps the lookup, and dedupe_by_version keeps only the last copy if a version appears twice. api_config is optional - and if a token is present, the node only forwards it to civitai.com or *.civitai.com hosts, never to a random URL from an untrusted workflow.
The output you wire up is additional_hashes → Image Saver Metadata's additional_hashes socket. The other four outputs (civitai_resources, resolved, missing, resources_json) are diagnostics. If a version can't be resolved it lands in missing - that's your troubleshooting view.
Installation
Search Civitai Metadata Bridge in ComfyUI-Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Mikaelosa/ComfyUI-Civitai-Metadata-Bridge
Restart ComfyUI. You also need the two peers this is built around: Civitai Comfy Nodes (supplies the LoRA Selector) and ComfyUI-Image-Saver (the save nodes). No extra dependencies.
Troubleshooting
- Everything shows up in
missing. Check the API - a blocked network or a tighttimeout_secondswill do it. Entries are cached per session, so a failed lookup won't retry until you reload the workflow. - The sidecar trap. At the time of the 1.0.1 release, Civitai Model Selector could mistake Image Saver's
.civitai.info/.sha256sidecar files for the cached checkpoint on a later run, throwing_pickle.UnpicklingErrorat Load Checkpoint. It's an upstream bug, not corruption - update Civitai Comfy Nodes, or temporarily move those two sidecars aside. additional_hashesshows as a text box, not a socket. Right-click Image Saver Metadata and convert that widget to an input.
One honest caveat from the author: this improves resource detection, it can't guarantee Challenge acceptance. Civitai changes its upload parsing and challenge rules, so upload once and confirm the LoRA/version actually shows in the detected resources before relying on it.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| site_base_url | STRING | https://civitai.com | Base Civitai site URL used for public API lookup. |
| include_weight | BOOLEAN | true | Emit Name:HASH:Weight instead of just Name:HASH. |
| timeout_seconds | INT | 203–120 | HTTP timeout for Civitai API lookups. |
| dedupe_by_version | BOOLEAN | true | If the same LoRA version appears multiple times, keep the last one. |
| lorasopt | CIVITAI_LORAS | Connect from Civitai LoRA Selector.loras | |
| api_configopt | CIVITAI_CONFIG | Optional Civitai Auth config; token is used only if needed. |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| additional_hashes | STRING | Comma-separated Name:AutoV2:Weight entries for Image Saver Metadata.additional_hashes. |
| civitai_resources | STRING | Newline-separated AIR and weight entries for diagnostics or fallback use. |
| resolved | STRING | Comma-separated names of successfully resolved LoRA versions. |
| missing | STRING | Comma-separated AIR identifiers that could not be resolved. |
| resources_json | STRING | JSON diagnostic details for every input LoRA entry. |