Nodes/ComfyUI_RH_API/πŸ“€ RH Upload Latent
ComfyUI Node

πŸ“€ RH Upload Latent

Ship a latent tensor to the cloud without a JPEG in sight

By xuchenxu168Β·Created 9 months agoΒ·Updated 9 months agoΒ· 7
πŸ“€ RH Upload Latent
  • config
  • latent
  • RH_PARAM
β—„node_idβ–Ί
β—„field_nameβ–Ί

RH Upload Latent is the geeky one, and it's the most interesting node in the pack. Most cloud bridges round-trip images as PNGs - you decode to pixels, send pixels, and the cloud re-encodes. This node instead takes a raw ComfyUI LATENT tensor, saves it to a temporary .safetensors file, uploads that to RunningHub, and hands the filename to a cloud workflow as a parameter. The latent - the compressed diffusion representation - crosses the wire intact. No decode, no re-encode, no generation drift.

This matters for the same reason latent-space workflows exist locally: if you're doing img2img-style work where the latent is the input (inpainting with an existing mask, multi-stage sampling, an upscale pass that continues from a latent rather than an image), sending pixels loses precision and forces the cloud workflow to VAE-encode again with whatever settings it has. Sending the latent means the cloud continues from your exact tensor. The pack's own latent_transport.json example demonstrates the round trip: upload a latent, process on RunningHub, and get a .safetensors latent back out of RH Execute.

Inputs

All four required:

  • config - from RH Config.
  • latent - any LATENT tensor, e.g. from a VAE Encode or KSampler output.
  • node_id - target node inside the RunningHub workflow.
  • field_name - the input name on that remote node that expects the latent file. This one's a plain text field, not a dropdown, because the remote field is whatever the workflow author called it.

How it works

It writes the latent dict to a temp file via safetensors.torch.save_file, uploads it to /task/openapi/upload with fileType: latent, deletes the temp file in a finally block (so no litter), and returns a single-element param list - {nodeId, fieldName, fieldValue: <server filename>} - to feed into RH Execute. There's a matching .safetensors reader on the download side, which is why a full latent round trip works at all.

Gotchas

The whole trick depends on the remote workflow having a node that accepts a latent/safetensors input. Most public RunningHub workflows are image-in/image-out; if yours expects an image, this node's output won't plug in and you want RH Upload Image instead. This is a "build the workflow around the latent" tool, not a drop-in. And it's all-or-nothing: every field is required, so you can't use it as a bare file drop like the image uploader.

Install: ComfyUI Manager (search ComfyUI_RH_API) or git clone https://github.com/xuchenxu168/ComfyUI_RH_API.git into custom_nodes + pip install -r requirements.txt, restart.

CategoryKen-Chen/RH-API

Inputs (4)

NameTypeDefaultDescription
configRH_CONFIGβ€”
latentLATENTβ€”
node_idSTRINGβ€”
field_nameSTRINGβ€”

Outputs (1)

NameTypeDescription
RH_PARAMRH_PARAMβ€”