Nodes/ComfyUI_Prompt-All-In-One/API Gemini Text Understand
ComfyUI Node

API Gemini Text Understand

Hand Gemini a file path, get analysis back

By billwuhao·Created about a year ago·Updated about a year ago· 56
API Gemini Text Understand
    • text
    api_key
    text_path
    prompt
    modelgemini-2.5-pro-preview-05-06
    proxyhttp://127.0.0.1:None
    temperature0.90
    top_p0.90
    top_k40
    max_output_tokens2048
    seed0

    API Gemini Text Understand is the pack's document reader: you give it a path to a file on disk and a question, and Gemini reads the file and answers. It's the odd one out in the Gemini family because it doesn't take its content from the canvas - the content lives in a file, and the node streams those bytes straight to Google along with your prompt.

    Where this earns its keep is anything text-shaped that lives outside the graph: a subtitle file you want turned into a video prompt, a script you want summarized, a lore doc you want distilled into character descriptions, a log you want analyzed. The max_output_tokens field goes up to 65536, which tells you the author expected long, rich answers. It's a niche node - you'll use it a few times, not on every run - but when you need to turn an existing document into generation material, nothing else in this pack does it, and it does it with Gemini's best models.

    How it works

    The node takes the text_path, guesses the file's MIME type via Python's mimetypes, checks the file exists, reads it as bytes, and sends it to Gemini's generate_content as a Part.from_bytes alongside your prompt text. That means it's not limited to plain text files - any file with a recognizable MIME type goes through, including PDFs and Word documents if your environment can name them. If the MIME type is unknown the node raises Unknown file type; if the path is wrong it raises File not found. The model dropdown has the same seven Gemini choices as the multimodal node (default gemini-2.5-pro-preview-05-06), and the seed is genuinely sent.

    The inputs that matter

    • text_path - absolute path to the file on disk. This is the whole job: get the path right and the rest follows.
    • prompt (multiline) - your question or extraction instruction. "Summarize this script into a one-line video prompt" is the shape of the useful ask.
    • model - pick gemini-2.5-pro-preview-05-06 for quality analysis; the flash choices for cheaper/larger jobs.
    • max_output_tokens - up to 65536; raise it when you want a long breakdown rather than a summary.
    • temperature - lower for faithful extraction, higher for creative interpretation.
    • proxy - the shared Gemini gotcha, below.

    Output: a single text STRING.

    Installing it

    Ships in ComfyUI_Prompt-All-In-One (billwuhao). ComfyUI Manager → search Prompt-All-In-One, or clone into ComfyUI/custom_nodes, pip install -r requirements.txt, restart. Under 🎤MW/MW-Prompt-All-In-One.

    Where people get burned

    Path errors are the top failure: ComfyUI's working directory isn't where your file is, so use an absolute path and check it twice - File not found means the node never got to the API. Then there's the shared Gemini proxy field bug (it sets http_proxy/https_proxy every run, default value http://127.0.0.1:None is not a real proxy - proxy errors trace here), and the privacy reminder that matters more on this node than most: the entire file's contents are uploaded to Google with every run. Don't point it at anything you wouldn't put in an email. Finally, this node reads a path, not a canvas input - there's no IMAGE/AUDIO socket here, which confuses people coming from the multimodal node; it's strictly files-on-disk.

    Category🎤MW/MW-Prompt-All-In-One

    Inputs (10)

    NameTypeDefaultDescription
    api_keySTRING
    text_pathSTRING
    promptSTRING
    modelCOMBOgemini-2.5-pro-preview-05-067 options: gemini-2.5-pro-exp-03-25, gemini-2.5-flash-preview-04-17, gemini-2.5-pro-preview-05-06, gemini-2.0-flash, gemini-2.0-flash-exp-image-generation, gemini-2.0-flash-thinking-exp-01-21, +1
    proxySTRINGhttp://127.0.0.1:None
    temperatureFLOAT0.900–1.5
    top_pFLOAT0.900–1
    top_kINT400–100
    max_output_tokensINT20480–65536
    seedINT00–268435455

    Outputs (1)

    NameTypeDescription
    textSTRING