NanoBanana - Files Upload
Upload a big file once, reuse the handle instead of re-sending it
- network
- file_uri
- file_name
Gemini accepts PDFs, video, audio, and images as context - but pasting a 200-page PDF or a big video into a prompt body is a mess and a waste of tokens. Google has a Files API for exactly this: you upload the file once, get back a reusable URI, and reference that URI in any number of calls. This node is the upload half of that flow, and it's the piece the pack was missing before v2.1.
Where you'd use it: the classic PDF-QA workflow (upload a document, then ask questions against it with the pack's file-based vision/chat nodes), or captioning a video without re-encoding it into every prompt. Upload once, reuse everywhere, and when the file expires you re-upload. It's the "stop re-encoding your big inputs" node.
How it works
You give it an absolute file_path and it calls client.files.upload(), returning a handle. Two optional fields smooth the edges: display_name for a human-readable label, and mime_type to override auto-detection when the extension is ambiguous. The response gives you two outputs:
- file_uri - the reusable
files/...URI that goes into downstream nodes' file inputs. - file_name - the name Google assigned on the server.
One important caveat baked into the API: uploaded files live for roughly 48 hours server-side, then expire. That's a Google policy, not a pack quirk - plan your workflows around it (upload, process, done), and don't build a pipeline that expects a file uploaded last week to still be there.
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 a Gemini API key from aistudio.google.com.
Gotchas
The obvious one: the file path is a local absolute path on the machine running ComfyUI, so it works on your box but breaks the moment you share the workflow - you'll see "File not found: ..." with your local path in the error. Also, size limits are real - the pack's docs mention PDFs up to ~1000 pages and video/audio up to ~1 GiB for the paired "ask uploaded file" node, so don't point it at a 5 GB render and expect a miracle. And because the 48-hour expiry is silent until a URI 404s, a workflow that was fine last week can mysteriously fail today - re-running the upload node fixes it, which is the standard rhythm.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| api_key | STRING | — | |
| file_path | STRING | Absolute path to the file (PDF, video, audio, image). | |
| display_nameopt | STRING | Optional human-readable name for the upload. | |
| mime_typeopt | STRING | Override the MIME type if auto-detection fails. | |
| networkopt | NB_NETWORK | Optional. Wire a NanoBanana - Network Route node here to route this request through that proxy (e.g. US egress). |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| file_uri | STRING | — |
| file_name | STRING | — |