Nodes/Save Checkpoint with Metadata/Save Diffusion Model with Metadata
ComfyUI Node

Save Diffusion Model with Metadata

Just the weights, thanks — a model-only .safetensors with a header you control

By a-l-e-x-d-s-9·Created about a year ago·Updated 4 months ago· 0
Save Diffusion Model with Metadata
  • model
  • model_path
  • saved_metadata
  • saved_prompt
  • saved_extra_pnginfo
filename_prefixdiffusion_models/CustomMeta
filename_modesmart_counter
metadata_json{}
metadata_modereplace
include_extra_pnginfotrue
prompt_override

Sometimes you don't want a full checkpoint at all - no CLIP, no VAE, no text encoder, just the diffusion model weights in one file. That's what this node is for. Save Diffusion Model with Metadata is the leaner sibling of Save Checkpoint with Metadata, and it exists to do one thing: serialize a single MODEL wire into a .safetensors file with a header you choose, and nothing else attached.

Think of it as ComfyUI's built-in ModelSave node (the one that writes model-only files) but with actual control over the metadata and the filename. Same pack, same author, same everything - but it deliberately drops the clip, vae, and clip_vision inputs the checkpoint version offers, and defaults filename_prefix to diffusion_models/CustomMeta instead of checkpoints/CustomMeta.

When you'd actually reach for it

Flux and the newer single-file diffusion models are the obvious case: you merge or refine one, and the thing you want to hand to a diffusion_models/ loader is a clean model file, not a 12 GB Frankenstein with a VAE stapled on. It's also the right tool when you're about to upload a model and want the header to say exactly what you wrote - no ComfyUI-injected noise, no surprise prompt. And because it writes through the same comfy.sd.save_checkpoint path ComfyUI itself uses, the output loads in the standard model loader without ceremony.

How it works

Mechanically it's a subclass of SaveCheckpointWithMetadata that overrides the save step to pass clip=None, vae=None, clip_vision=None - so it saves the MODEL object and intentionally ignores everything else, even if you could wire it. The safetensors format is a JSON header plus raw tensor bytes, and the header is the part you own here. metadata_json is written straight into it, with non-string values JSON-encoded for you (the format wants dict[str, str]). The same metadata_mode logic applies: replace writes only your keys; merge_minimal starts from the hidden PROMPT/EXTRA_PNGINFO ComfyUI passes in and overlays your metadata_json on top, your keys winning.

The inputs that matter

Only seven, and most match the checkpoint sibling. The ones you'll actually touch:

  • metadata_json - your header, e.g. {"author":"you","model_type":"diffusion_model","modelspec.architecture":"flux"}.
  • metadata_mode - replace (default) for a header that contains only what you wrote; merge_minimal if you want to keep the workflow prompt as a prompt key.
  • filename_prefix - subfolder and base name under the output directory; defaults to diffusion_models/CustomMeta.
  • filename_mode - smart_counter writes prefix.safetensors on the first save and only adds _00001_-style suffixes when that name is taken; no_counter_overwrite always writes the plain name, overwriting whatever's there.

Outputs mirror the sibling too: model_path (where the file landed), plus saved_metadata, saved_prompt, and saved_extra_pnginfo as strings so you can verify the header before you trust it.

Installing it

Same pack, so the install is identical to Save Checkpoint with Metadata - both ship in a-l-e-x-d-s-9/ComfyUI-SaveCheckpointWithMetadata. ComfyUI Manager → Install via Git URL → paste the repo URL, restart; if Manager complains about security level (it's not in the default catalog yet), install manually:

cd ComfyUI/custom_nodes
git clone https://github.com/a-l-e-x-d-s-9/ComfyUI-SaveCheckpointWithMetadata.git

Then restart ComfyUI. No dependencies, no model downloads - requirements.txt is empty, so there's nothing to break in your environment.

Troubleshooting

  • The saved file won't load where you expected - the README flags this honestly: a model-only save is only as compatible as the loader you point it at. Load it back with the same model-only loader you normally use for diffusion_models/ files. If you need full checkpoint behavior with CLIP/VAE embedded, use Save Checkpoint with Metadata instead - that's exactly the split this pack is drawing.
  • You don't see modelspec.* keys - stock saves add them automatically; this node doesn't. Add them to metadata_json if your target tooling expects them.

The one honest caveat: model-only files are the least standardized part of the ecosystem, so before you share anything, load your own output once. If it comes back through the normal loader, you're done.

Categoryadvanced/model_merging

Inputs (7)

NameTypeDefaultDescription
modelMODELMODEL to serialize into a .safetensors diffusion model file.
filename_prefixSTRINGdiffusion_models/CustomMetaSubfolder/prefix under output directory. Example: diffusion_models/MyModel.
filename_modeCOMBOsmart_countersmart_counter: first save uses prefix.safetensors if free, later saves use prefix_00001_.safetensors. no_counter_overwrite: overwrite prefix.safetensors.
metadata_jsonSTRING{}JSON object of safetensors header keys to write.
metadata_modeCOMBOreplacereplace: write only metadata_json. merge_minimal: include prompt/extra_pnginfo, then apply metadata_json.
include_extra_pnginfoBOOLEANtrueMerge mode only. Copy hidden EXTRA_PNGINFO keys before applying metadata_json.
prompt_overrideSTRINGOptional replacement for hidden PROMPT in merge_minimal mode.

Outputs (4)

NameTypeDescription
model_pathSTRING
saved_metadataSTRING
saved_promptSTRING
saved_extra_pnginfoSTRING