Nodes/ComfyUI-YogurtNodes/Gemini Generate Text
ComfyUI Node

Gemini Generate Text

Gemini 2.5 in your graph — with chat history and the thinking shown

By yogurt7771·Created 2 years ago·Updated 4 days ago· 1
Gemini Generate Text
  • history
  • text
  • history
  • thought
api_key
vertexfalse
base_url
model_namegemini-2.5-flash
system_prompt
prompt
temperature1.00
top_p0.00
top_k0
max_output_tokens65535
retry_count1
disable_safety_settingsfalse
disable_system_promptfalse
safety_levelBLOCK_NONE
thinking_budget0
chat_template<-system-> {{system_instruction}} <-/system-> <-user-> {{prompt}} <-/user->
proxy_url
seed-1
thinking_levelOFF
timeout0
extra{}

If you've been gluing LLM calls into ComfyUI with a requests node, this is the upgrade. Yogurt Gemini Generate Text is a real Gemini client inside the graph: it calls Google's Gemini API, keeps conversation history alive across executions, and even hands you the model's chain-of-thought as a separate output. No image generation here - the pack has a sibling node for that - this one is text in, text out, history for free.

What it is and why you'd reach for it

The Yogurt Nodes pack is a kitchen-sink collection, and this is its flagship LLM node. You wire it anywhere you'd otherwise put a hand-rolled HTTP call: rewriting a prompt for a second pass, generating captions to feed a captioning workflow, classifying an image description before it goes to a text-to-image node, or just asking questions mid-graph. Because it outputs a HISTORY type, it slots into the pack's other LLM nodes too - the same history object feeds its Image Understand siblings, so you can build a genuinely multi-turn pipeline without storing state yourself.

The inputs that matter

The list is long, but you mostly touch a handful:

  • api_key - paste a Gemini key here, or leave it blank and let the node pick it up from config (see install).
  • model_name - defaults to gemini-2.5-flash, which is the right call for most workflow use. Swap in pro when you need more reasoning.
  • system_prompt and prompt - the system prompt sets the overall style; the prompt is your actual request. Both are multiline.
  • temperature - higher = more random. Start at 1, dial down for deterministic labeling tasks.
  • thinking_budget - this one's interesting: -1 means no cap on thinking, 0 disables thinking entirely. Pair it with the thought output below.
  • seed - -1 for random, or pin a number to get reproducible-ish output. Handy when you're iterating on a prompt template.
  • chat_template - the default is a {{system_instruction}} / {{prompt}} template with <‑system-> markers. If you use the history input, this is how each turn gets formatted, so it's the first place to look when a multi-turn conversation comes back garbled.

Also on the schema: top_p, top_k, max_output_tokens, retry_count, safety_level, disable_safety_settings, vertex (route through Vertex AI), base_url, proxy_url, timeout, and an extra JSON field for anything the client doesn't expose.

The outputs and what they wire into

  • text - the model's reply (STRING). This is the one you save or feed forward.
  • history - the updated conversation, ready to loop back into the same node's history input for the next turn.
  • thought - the model's chain-of-thought as a separate string, when thinking is enabled. Great for debugging why a generation went sideways; don't ship it to a prompt that wants only the answer.

Install

The pack installs like any custom node. Fastest path is ComfyUI Manager - search "ComfyUI-YogurtNodes" and hit install. Or do it by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/yogurt7771/ComfyUI-YogurtNodes.git
cd ComfyUI-YogurtNodes
pip install -r requirements.txt

Then restart ComfyUI. The LLM nodes need google-genai, which the requirements file pulls in.

For the key, the README gives you three options in priority order: paste one directly in the node's api_key field, drop it in custom_nodes/ComfyUI-YogurtNodes/yogurt_nodes/llm/api_key.json as {"gemini": "YOUR_API_KEY"}, or set GEMINI_API_KEY as an environment variable. Get a key from Google AI Studio. The file/env approach is better than hardcoding a key into every workflow - the key travels inside the workflow JSON otherwise, which is a bad habit to start.

Gotchas

Two things bite people. First, api_key is a required field, and if the file/env var isn't set, the node fails with an auth error - the README's priority order (node field > json file > env var) decides which key wins, so a blank field is fine only if the file or env var is configured. Second, remember this is a paid API: with max_output_tokens defaulting to 65,535 and thinking enabled, a long chain of workflow runs can quietly burn tokens. Set a sane token cap and a timeout so a hung request doesn't stall your whole batch.

CategoryYogurtNodes/LLM

Inputs (22)

NameTypeDefaultDescription
api_keySTRINGAPI key for accessing Gemini API
vertexBOOLEANfalseUse Vertex AI for Gemini API
base_urlSTRINGBase URL for Gemini API
model_nameSTRINGgemini-2.5-flashGemini model name, default is gemini-2.5-flash
system_promptSTRINGSystem-level prompt that affects the overall conversation style
promptSTRINGMain prompt content input by the user
temperatureFLOAT1.00Sampling temperature, higher values produce more random outputs
top_pFLOAT0.000–1Sampling probability threshold, controls output diversity
top_kINT0Number of highest probability tokens to consider during sampling
max_output_tokensINT655350–2147483647Maximum number of tokens in the generated text
retry_countINT1Number of retries when request fails
disable_safety_settingsBOOLEANfalseWhether to disable safety settings, if true, the safety settings will not be set
disable_system_promptBOOLEANfalseWhether to disable the system prompt, if true, the system prompt will sent as a user prompt
safety_levelCOMBOBLOCK_NONESafety level for the generated text
thinking_budgetINT0-1–2147483647Thinking budget for the model, if set to -1, the model will not limit thinking budget, if set to 0, the model will disable thinking
chat_templateSTRING<-system-> {{system_instruction}} <-/system-> <-user-> {{prompt}} <-/user->Content template for the generated text
proxy_urlSTRING代理URL,格式: protocol://user:pass@addr:port,支持http,https,socks5,socks5h
seedINT-1-1–2147483647随机种子,设置为-1时随机种子
thinking_levelCOMBOOFFThinking level for the model, if thinking budget is not 0, this parameter will be ignored
timeoutINT00–2147483647Timeout for the request in seconds, 0 means no timeout
historyoptHISTORY
extraoptSTRING{}Extra parameters for the request, in JSON format

Outputs (3)

NameTypeDescription
textSTRING
historyHISTORY
thoughtSTRING