AIHub Action New Latent
Exporting the raw latent, not the pixels — for workflows that need to resume later
- samples
AIHub Action New Latent doesn't hand the client a picture - it hands over the raw latent tensor as a .safetensors file. That sounds like a downgrade until you remember that most of the interesting work in diffusion happens before the VAE decode. If a workflow needs to continue from a state - think multi-stage video generation where each step's latent is the input to the next - then decoding to pixels and re-encoding later is a lossy detour. Storing the latent is the honest way to carry state, and this node is the "save" half of that loop.
That's precisely the scenario the pack's author had in mind. The README calls out LTXV-style step-by-step video generation as the motivation for project-based latent storage: latents must be persisted because working from images isn't reasonable when each stage feeds the next. This node is where that latent leaves ComfyUI. It's part of otavanopisto's ComfyUI-aihub-workflow-exposer, the pack that bridges ComfyUI to external apps over its own websocket (port 8111) - expose nodes pull data in, action nodes push it out, and this one is outbound.
How it works
It takes the LATENT dict, saves samples["samples"] with safetensors (including the workflow's own prompt and metadata as the file's metadata block, unless ComfyUI was launched with --disable-metadata), and streams the file to the client under a NEW_LATENT event. Nothing gets decoded, nothing gets downsampled - the file is the exact tensor the sampler produced, ready to be reloaded by the matching expose-latent node on a later run.
The inputs that matter
- samples (required) - the LATENT to export. Wire it straight off your KSampler or the tail of your sampling chain.
- file_name - this one has no "name" field; the filename is the input directly (default
new_latent.safetensors). Whatever you put here is what the client stores. - action -
APPENDnumbers the file if it already exists;REPLACEoverwrites. For a rolling "save latest state" workflow, replace.
No outputs - pure side-effect node.
Installing it
ComfyUI Manager (search "ComfyUI-aihub-workflow-exposer"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/otavanopisto/ComfyUI-aihub-workflow-exposer
# restart ComfyUI
No extra dependencies - safetensors and torch are already part of ComfyUI.
Where people get burned
The main trap is expecting a picture and getting a file. This node deliberately produces no image; if your client is a person rather than a pipeline, they'll see a .safetensors blob they can't preview. That's correct behavior, not a bug - use AIHub Action New Image if you need pixels for eyeballs. Also note the latent won't carry a VAE, so the reloading workflow has to supply its own VAE at decode time. And as with every action here, no client connected to the aihub websocket means the export silently goes nowhere.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| samples | LATENT | — | |
| action | COMBO | APPEND | If append is selected, the latents will be added a number to the name to make it unique, if replace is selected, the latents will be replaced with the new one |
| file_name | STRING | new_latent.safetensors | The name of the latents this is used for the filename value directly |
Outputs (0)
No outputs