Nodes/ComfyUI Gemini Pro Node/gemini-pro-文件处理
ComfyUI Node

gemini-pro-文件处理

Point Gemini at Any File and Get an Answer

By penposs·Created about a year ago·Updated 9 months ago· 12
gemini-pro-文件处理
  • file
  • response
prompt分析这个文件内容并提供摘要。
user_prompt你是一个专业的文件分析助手,请以专业、清晰的方式分析文件内容。
modelgemini-2.5-flash-preview-09-2025
streamfalse
max_output_tokens65536
temperature0.6
proxy

Gemini File Processing is the payoff of this pack. Feed it a GEMINI_FILE handle - the kind the companion Gemini File Upload node produces - plus a prompt, and it runs Google's Gemini model over that file and hands back the response as text. It's how you get a real language model to summarize an audio file, extract the transcript of a long video, or answer questions about a document that was too big to inline into a normal API call.

It's the only node in the pack that is genuinely an output node, meaning it can stand alone at the end of a workflow and render its result. That's fitting: it's the last step. Upload on one side, questions here, answers out.

How it works

The mechanism is straightforward. It loads your API key from the pack's config.json (there's no api_key input here - you set the key once via the main Gemini Pro node, or hand-edit the config file), constructs a combined prompt of the form System: <user_prompt>\nUser: <prompt>, and calls generate_content with your uploaded file attached.

Two behaviors worth knowing:

  • stream is a real toggle. With it off (default), the model answers in one shot. With it on, the node streams chunks and stitches them together - slightly faster first-token feel on long outputs.
  • Retries are baked in. ResourceExhausted (i.e. rate-limited) responses trigger exponential backoff up to five attempts. This pack clearly spent its early life fighting Google's free-tier quotas.

The inputs that matter

  • file - the GEMINI_FILE from Gemini File Upload. Required, and it has to be a handle the node recognizes.
  • prompt - your actual question ("summarize this audio", "what's being said at 10:30?"). Default is a Chinese "analyze and summarize this file" prompt.
  • user_prompt - the system-style instruction that gets prepended, defaulting to a "you are a professional file analysis assistant" persona.
  • model - same family as the main node, default gemini-2.5-flash-preview-09-2025, with gemini-3-pro-preview, gemini-2.5-flash-preview-05-20, and an older gemini-2.0-flash-exp available.
  • max_output_tokens - defaults to the full 65536 ceiling. For a summary you can dial this way down and save money; for a full transcript you want it maxed.
  • temperature, proxy - as you'd expect from the rest of the pack.

Output is a single STRING named response. Wire it into a Show Text node, or pipe it into anything else that takes text.

Install

Same pack as the other two nodes - install once, get all three:

cd ComfyUI/custom_nodes
git clone https://github.com/penposs/ComfyUI_Gemini_Pro.git

Or search "ComfyUI Gemini Pro" in ComfyUI Manager, then restart ComfyUI. Dependencies are whatever the pack's requirements.txt pulls in (google-generativeai and friends); if the SDK conflicts with other packages, the README's advice is to uninstall and reinstall google-generativeai fresh.

Common issues

  • "File not in an ACTIVE state." The most useful error message in the whole pack. Files API objects go stale - they expire, or the handle was already consumed. The node even ships a dedicated hint telling you to re-upload the file. That's the fix: re-run the upload node and feed the fresh handle.
  • No key in config.json. You'll get a Chinese error about the missing API key before anything else runs. Set the key on the main Gemini Pro node first - it persists to config.json - and this node picks it up.
  • Empty output. If the model returns nothing, the code checks prompt_feedback.block_reason - Gemini's safety filters can silently swallow a request, especially on audio/video with speech. The generic "no valid output" message usually means that.
  • Slow. Every call starts with a deliberate delay and retries add more. Long files plus a flash model is the responsive combo; Pro models on huge inputs will test your patience.

It's a niche little node, but if you need Gemini to actually read the big media files in your ComfyUI workflow, it's the missing half of the equation.

CategoryGemini Pro

Inputs (8)

NameTypeDefaultDescription
fileGEMINI_FILE
promptSTRING分析这个文件内容并提供摘要。
user_promptSTRING你是一个专业的文件分析助手,请以专业、清晰的方式分析文件内容。
modelCOMBOgemini-2.5-flash-preview-09-20254 options: gemini-2.5-flash-preview-09-2025, gemini-3-pro-preview, gemini-2.0-flash-exp, gemini-2.5-flash-preview-05-20
streamBOOLEANfalse
max_output_tokensINT655361–65536
temperatureFLOAT0.60–1
proxySTRING

Outputs (1)

NameTypeDescription
responseSTRING