Nodes/ComfyUI/Gemini Input Files
ComfyUI Node Runs on cloud

Gemini Input Files

Feeding Gemini your documents — and why its token meter is worth watching

By Comfy-Org·Created 4 years ago·Updated about an hour ago· 129,943
Gemini Input Files
  • GEMINI_INPUT_FILES
  • GEMINI_INPUT_FILES
file

Same job as the OpenAI file loader, different model family: this node takes a .txt or .pdf from your ComfyUI input folder, formats it for the Gemini API, and hands it to a Google Gemini node so the model actually reads the document instead of guessing from a pasted snippet. It exists because context is context - a spec sheet, a changelog, a research paper - and an LLM can only work with what it can see.

The mechanism

Pick a file in the file dropdown and the node reads it from ComfyUI's input directory, base64-encodes it, and emits a GEMINI_INPUT_FILES object that rides inside the Gemini request payload. Only text and PDF files are accepted, and anything over 20 MB is silently filtered out of the list. The dropdown is generated when the node list loads, so drop new files in first, then refresh the frontend or they won't appear.

The output plugs into the files input on either the current Google Gemini (V2) node or the older deprecated one. Like its OpenAI sibling, it chains: feed one node's output into the next one's GEMINI_INPUT_FILES input and you stack documents into a single message.

What to know before you use it

The tooltip says the thing you need to hear: the contents of the text file count toward the token limit. That's not just a warning about context - it's a warning about the bill. Gemini's price badge is per-token through your Comfy account, and a long file multiplies both the context and the cost on every run. The 20 MB cap sounds generous until you realize a 19 MB text file is a small fortune in tokens. For big documents, ask yourself whether the model needs all of it.

Common issues

Only .txt and .pdf - drop a .docx or .md in there and it won't even show up in the dropdown (rename or convert). Files over 20 MB are invisible too. The base64-inline approach means the whole file travels with the request, so very large files make slow, expensive calls. And if the Gemini node comes back with empty or truncated answers, the fix lives on the V2 node's max_output_tokens, not here. It's the unglamorous plumbing of the Gemini family - but without it, "ask Gemini about this document" just isn't a thing.

Categorypartner/text/Gemini

Inputs (2)

NameTypeDefaultDescription
fileCOMBOInput files to include as context for the model. Only accepts text (.txt) and PDF (.pdf) files for now.
GEMINI_INPUT_FILESoptGEMINI_INPUT_FILESAn optional additional file(s) to batch together with the file loaded from this node. Allows chaining of input files so that a single message can include multiple input files.

Outputs (1)

NameTypeDescription
GEMINI_INPUT_FILESGEMINI_INPUT_FILES