Nodes/ComfyUI-Civitai-Metadata-Bridge/Civitai LoRAs To Hash Metadata
ComfyUI Node

Civitai LoRAs To Hash Metadata

Make Civitai Actually See the LoRA You Used

By Mikaelosa·Created a day ago·Updated about 23 hours ago· 0
Civitai LoRAs To Hash Metadata
  • loras
  • api_config
  • additional_hashes
  • civitai_resources
  • resolved
  • missing
  • resources_json
site_base_urlhttps://civitai.com
include_weighttrue
timeout_seconds20
dedupe_by_versiontrue

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's loras output. Without it, nothing happens.
  • include_weight - on by default, and you want it on: it emits Name:HASH:Weight instead of bare Name: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_hashesImage 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 tight timeout_seconds will 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 / .sha256 sidecar files for the cached checkpoint on a later run, throwing _pickle.UnpicklingError at Load Checkpoint. It's an upstream bug, not corruption - update Civitai Comfy Nodes, or temporarily move those two sidecars aside.
  • additional_hashes shows 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.

Categoryutils/metadata

Inputs (6)

NameTypeDefaultDescription
site_base_urlSTRINGhttps://civitai.comBase Civitai site URL used for public API lookup.
include_weightBOOLEANtrueEmit Name:HASH:Weight instead of just Name:HASH.
timeout_secondsINT203–120HTTP timeout for Civitai API lookups.
dedupe_by_versionBOOLEANtrueIf the same LoRA version appears multiple times, keep the last one.
lorasoptCIVITAI_LORASConnect from Civitai LoRA Selector.loras
api_configoptCIVITAI_CONFIGOptional Civitai Auth config; token is used only if needed.

Outputs (5)

NameTypeDescription
additional_hashesSTRINGComma-separated Name:AutoV2:Weight entries for Image Saver Metadata.additional_hashes.
civitai_resourcesSTRINGNewline-separated AIR and weight entries for diagnostics or fallback use.
resolvedSTRINGComma-separated names of successfully resolved LoRA versions.
missingSTRINGComma-separated AIR identifiers that could not be resolved.
resources_jsonSTRINGJSON diagnostic details for every input LoRA entry.