NanoBanana - Save Embedding (.npy)
Persist an embedding to disk so you don't re-pay for it
- saved_path
Every embedding you generate costs an API call. If your pipeline embeds a thousand captions and you don't save them, that's a thousand paid calls to redo next time. This node is the save button for that pipeline: it takes the JSON vector output of the pack's Text Embeddings node and writes it to disk as a standard NumPy .npy file, ready for vector databases, similarity search, or any downstream ML step.
It's deliberately simple and does one job well. You won't build your search index inside this node - it just persists a vector - but without a persistence step, the whole embed-and-search story falls apart.
How it works
Give it an embedding_json string (the embedding_json output of NanoBanana_Embed), a filename, and optionally a subdirectory, and it parses the JSON into a float array and calls numpy.save. The file lands in your ComfyUI output directory - under output/embeddings/ by default, or wherever you point the subdirectory. It returns the absolute saved_path as a STRING.
Two details show the pack was built by someone who's been burned. The filename gets basename-sanitized and the subdirectory does too, so a ../../-style path can't escape the output dir - useful if you ever feed filenames from an untrusted source. And it appends the .npy extension for you if you forgot it, because everyone forgets it. It's also flagged as an output node, so it shows up properly in the UI as something that writes a file.
Inputs:
- embedding_json - the JSON list of floats from the Embed node.
- filename -
embedding.npyby default; with or without the extension. - subdirectory -
embeddingsby default.
Output: saved_path - the absolute path to the written file.
Installation
Part of the NanoBanana2 pack:
cd ComfyUI/custom_nodes
git clone https://github.com/IxMxAMAR/ComfyUI-NanoBanana2
pip install google-genai
ComfyUI Manager: search NanoBanana2. Needs NumPy (ComfyUI already ships it). Note this node doesn't need an API key itself - it's pure file I/O - so you can save previously-generated vectors without touching Google.
Gotchas
The one real trap is feeding it something that isn't a vector. If embedding_json isn't a JSON list of numbers - say you wired the wrong node's output into it - it raises a clear error, so the failure is loud rather than silent. And remember .npy is a binary format, not human-readable JSON; if you need the vector in a portable text format, save the JSON from the Embed node instead. Finally, the path it returns is absolute and machine-specific - don't hardcode it into a workflow you'll share; re-derive it on the target machine.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| embedding_json | STRING | JSON list of floats (output of NanoBanana Text Embeddings node). | |
| filename | STRING | embedding.npy | Filename (with or without .npy extension). Written to ComfyUI output dir. |
| subdirectoryopt | STRING | embeddings | Subdirectory under ComfyUI's output dir. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| saved_path | STRING | — |