Gemini Text Generation
The workhorse LLM node of the pack
- client
- response
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 -
defaultunless you setapplication/jsonto 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 -
nonedefault; options up to high. This is the clever one: the node translates the same UI value intothinking_budget(an int) on Gemini 2.5 models or thethinking_levelenum 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.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | Text prompt for Gemini | |
| seed | INT | -1-1–2147483647 | Seed for reproducible outputs. Randomizes by default. |
| clientopt | GEMINI_API_CLIENT | Gemini API client from Gemini API Config node (optional if API key is configured in Settings) | |
| modelopt | COMBO | gemini-3.5-flash | Gemini model to use for generation |
| temperatureopt | FLOAT | 0.700–2 | Creativity level (0.0=focused, 2.0=very creative) |
| max_tokensopt | INT | 8192256–65536 | Maximum length of response |
| top_popt | FLOAT | 0.950–1 | Nucleus sampling - cumulative probability threshold (0.0=disabled) |
| top_kopt | INT | 40-1–100 | Top-k sampling - limit token selection (0=disabled) |
| stop_sequencesopt | STRING | Stop generation at these sequences (one per line, leave empty to disable) | |
| response_mime_typeopt | COMBO | default | Output format (use application/json for JSON mode) |
| response_schemaopt | STRING | JSON schema for structured output (only used with application/json, leave empty for free-form JSON) | |
| thinking_levelopt | COMBO | none | Reasoning depth. Works on Gemini 2.5 and 3.x; the node translates to thinking_budget (2.5) or thinking_level enum (3.x) automatically. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| response | STRING | — |