Nodes/ERPK Collection/Gemini Text Generation
ComfyUI Node

Gemini Text Generation

The workhorse LLM node of the pack

By eRepublik-Labs·Created 12 months ago·Updated 4 days ago· 2
Gemini Text Generation
  • client
  • response
◄prompt►
◄seed-1►
◄modelgemini-3.5-flash►
◄temperature0.70►
◄max_tokens8192►
◄top_p0.95►
◄top_k40►
◄stop_sequences►
◄response_mime_typedefault►
◄response_schema►
◄thinking_levelnone►

This is the node you'll actually live in. Gemini Text Generation is the pack's general-purpose LLM call: prompt in, STRING out, with a model dropdown spanning Gemini 3.5 Flash up through 3.1 Pro, plus the sampling knobs, JSON mode, and thinking-level control. Whether you're rewriting prompts, captioning, or extracting structured data, this is the default place to do it.

The model is picked right on the node (default gemini-3.5-flash - fast, cheap, plenty smart for prompt work), so you don't need a separate model selector. The client input is optional; key comes from Settings > ERPK > API Keys if you leave it unconnected.

The inputs that matter

  • prompt - required. Multiline.
  • temperature - 0.7 default, range 0–2. For deterministic extraction, drop it toward 0; for creative writing, push it up.
  • max_tokens - 8192 default, up to 65536. Generous; cut it if you want faster/cheaper calls.
  • top_p (0.95) and top_k (40) - nucleus and top-k sampling. Most people never touch them; 0.0 top_p disables, 0 top_k disables.
  • stop_sequences - one per line; stop generation at these strings. Handy for trimming boilerplate.
  • response_mime_type - default unless you set application/json to get JSON mode. That's the switch that turns this node into a structured-output node.
  • response_schema - the JSON schema for structured output, used only with application/json. Empty = free-form JSON.
  • thinking_level - none default; options up to high. This is the clever one: the node translates the same UI value into thinking_budget (an int) on Gemini 2.5 models or the thinking_level enum on 3.x, so the widget just works regardless of which model you pick.
  • seed - reproducibility/cache control, -1 randomizes.

Output: a single response STRING - straight into Preview Anything or any downstream prompt input.

Install and gotchas

Part of the ERPK Collection:

cd ComfyUI/custom_nodes
git clone https://github.com/eRepublik-Labs/comfyui-nodes-erpk.git erpk
cd erpk && pip install -r requirements.txt

Restart (or ComfyUI Manager → search erpk), add a Google AI Studio API key in Settings > ERPK > API Keys. Paid per token; Gemini Flash models are cheap enough that this rarely stings, but Pro adds up.

Two things bite people. First, JSON mode is two fields, not one: you must set response_mime_type to application/json and give a response_schema (or leave it empty for free-form JSON) - setting only one does nothing useful. Second, thinking_level "none" is genuinely none; if you expected reasoning by default, flip it on. Otherwise you'll wonder why the "smart" model is giving you shallow answers.

CategoryERPK/Gemini

Inputs (12)

NameTypeDefaultDescription
promptSTRINGText prompt for Gemini
seedINT-1-1–2147483647Seed for reproducible outputs. Randomizes by default.
clientoptGEMINI_API_CLIENTGemini API client from Gemini API Config node (optional if API key is configured in Settings)
modeloptCOMBOgemini-3.5-flashGemini model to use for generation
temperatureoptFLOAT0.700–2Creativity level (0.0=focused, 2.0=very creative)
max_tokensoptINT8192256–65536Maximum length of response
top_poptFLOAT0.950–1Nucleus sampling - cumulative probability threshold (0.0=disabled)
top_koptINT40-1–100Top-k sampling - limit token selection (0=disabled)
stop_sequencesoptSTRINGStop generation at these sequences (one per line, leave empty to disable)
response_mime_typeoptCOMBOdefaultOutput format (use application/json for JSON mode)
response_schemaoptSTRINGJSON schema for structured output (only used with application/json, leave empty for free-form JSON)
thinking_leveloptCOMBOnoneReasoning depth. 'none' sends no thinking setting, so the model thinks at its own default level (it does not turn thinking off). minimal is raised to low on models that reject it: 3.1 Pro Preview, 3.7 Flash, 3.8 Flash.

Outputs (1)

NameTypeDescription
responseSTRING—