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

API Gemini Text Gen

Google's cheapest chat model as a ComfyUI text worker

By billwuhao·Created about a year ago·Updated about a year ago· 56
API Gemini Text Gen
    • text
    api_key
    prompt
    modelgemini-2.0-flash-lite
    proxyhttp://127.0.0.1:None
    temperature0.90
    top_p0.90
    top_k40
    max_output_tokens2048
    seed0

    API Gemini Text Gen is the plain-text member of the pack's Gemini family: a no-frills call to Google's Gemini chat models that turns your prompt into a string you can pipe anywhere in the graph. No images, no audio, no file reading - just text in, text out. When you need an LLM for prompt enhancement and you already have a Google AI Studio key, this is the node you reach for, and the gemini-2.0-flash-lite default is about the cheapest frontier-tier chat call you can make.

    It fills the same slot as the DeepSeek V3 node in this pack: the prompt enhancer. Type a rough idea, get a structured prompt back, wire it to your sampler. Where it's interesting is the quality-per-penny math - flash-lite is aggressively cheap and surprisingly capable at format-following, so if you're doing high-volume prompt rewriting and you want the answer fast, Gemini's lite tier is a strong contender against the Qwen and DeepSeek options. The three-model dropdown also lets you jump up to gemini-1.5-pro for the jobs that need a bigger brain.

    How it works

    The node uses Google's google-genai SDK (genai.Client) with the generate_content call. The model name from the dropdown is sent as-is; the response text is returned directly. Sampling knobs (temperature, top_p, top_k, max_output_tokens) go into the generation config, and - unlike the DeepSeek and Qwen nodes - the seed is actually passed to the API, so you get some repeatability across retries. Key resolution is the pack standard: GOOGLE_API_KEY env var wins, otherwise the api_key field. The same shared proxy handling as the other Gemini nodes applies (and has the same quirk, below).

    The inputs that matter

    • prompt (multiline) - your request/idea. This is the field you'll be editing constantly.
    • model - gemini-2.0-flash-lite (default), gemini-1.5-pro, or gemini-1.5-flash-8b. Lite for volume, pro for quality.
    • temperature - lower (0.3–0.5) for strict prompt-format work, higher for creative writing. Default is 0.9.
    • max_output_tokens - cap on the reply (2048 default; plenty for prompts, raise it for long-form).
    • seed - actually honored, unlike the pack's non-Gemini text nodes.
    • proxy - the gotcha; see below.
    • api_key - env var or field.

    Output: a single text STRING, ready for a prompt box, a text viewer, or a concat node.

    Installing it

    Part of ComfyUI_Prompt-All-In-One (billwuhao). ComfyUI Manager → search Prompt-All-In-One, or clone + pip install -r requirements.txt from the repo, then restart. Under 🎤MW/MW-Prompt-All-In-One.

    Where people get burned

    Same two Gemini-family gotchas. The proxy field sets http_proxy/https_proxy on every run thanks to an or-where-it-should-be-and bug, and its default http://127.0.0.1:None is not a real proxy - proxy-flavored connection errors when you never configured one trace back here. And the key: set GOOGLE_API_KEY from Google AI Studio, reboot Windows after, and prefer the env var over pasting the key into the node (a pasted key rides along in the workflow JSON). One content note: this is a Google endpoint, so it filters - anything the API refuses, this node refuses, which is exactly why the community's uncensored prompt-enhancement jobs tend to stay local (llm-in-comfyui.md covers that trade). For clean SFW prompt work it's a genuinely great value.

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

    Inputs (9)

    NameTypeDefaultDescription
    api_keySTRING
    promptSTRING
    modelCOMBOgemini-2.0-flash-lite3 options: gemini-2.0-flash-lite, gemini-1.5-pro, gemini-1.5-flash-8b
    proxySTRINGhttp://127.0.0.1:None
    temperatureFLOAT0.900–1.5
    top_pFLOAT0.900–1
    top_kINT400–100
    max_output_tokensINT20480–8192
    seedINT00–268435455

    Outputs (1)

    NameTypeDescription
    textSTRING