NanoBanana - Text Generation
Gemini text generation with every knob exposed — no GPU required
- network
- text
NanoBanana2 is the ComfyUI pack that turned Google's Gemini API into node-graph form, and this is its workhorse. TextGen drops the full generate_content call onto your canvas: 35 model options, temperature, top_p, top_k, thinking level and budget, seed, system instructions, max output tokens. If Gemini's API exposes a knob, it's here. Nothing runs locally - the "model file" you download is an API key from aistudio.google.com.
You reach for this anywhere you'd otherwise hand an LLM a job inside a workflow. Generate image prompts, clean up a caption that a Vision node just spat out, summarize, reformat tags, or act as the "brain" that decides what your next node does. It's not the pack's only text node - there are dedicated Prompt Refiner, Multi-Turn Chat, and Structured Output nodes - but this is the general-purpose one with the full parameter surface.
How it works
Behind the scenes it's the google-genai SDK talking to Gemini's generateContent endpoint, wrapped in a few deliberate choices worth knowing. Every NanoBanana2 node re-executes on every run even with identical inputs (IS_CHANGED is on by design - generative nodes should be generative), so a queued run is a billed run. Transient API errors get retried with jittered exponential backoff so a 429 wave doesn't turn into a thundering herd. Your key is redacted from every error string, and the client cache is keyed by a hash of the key rather than the key itself. That security posture matters in a category with a real history of sketchy API-key nodes - worth knowing before you trust any of these with a key.
The inputs that matter
You'll set a handful of these; the rest have sane defaults.
- api_key - leave blank and it reads
GEMINI_API_KEYfrom your environment. - model + custom_model - pick from 35 presets, or paste whatever Google released last Tuesday into the override. This is how you use a brand-new model without waiting for a pack update.
- prompt / system_instruction - the user message and the behavior guide, both multiline.
- temperature, top_p, top_k - the usual sampling trio. Lower temperature, more deterministic.
- thinking_level (NONE / MINIMAL / LOW / MEDIUM / HIGH) and thinking_budget - opt-in, because thinking costs more and you probably don't need it for a caption node.
- seed -
-1means random; set it for reproducible runs. - safety_settings_json - feed this the output of the pack's Safety Settings node if the defaults are too strict or not strict enough.
Output: one text STRING. Wire it into a ShowText node or any downstream text input.
Installing it
ComfyUI Manager is the easy path - search NanoBanana2 and install. Or, from the command line:
cd ComfyUI/custom_nodes
git clone https://github.com/IxMxAMAR/ComfyUI-NanoBanana2
pip install google-genai
You need Python 3.10+, google-genai >= 0.8.0, and an API key. No model files, no VRAM, no weights.
Where people get burned
The classic install failure is a missing google-genai - if you get an ImportError at startup, you pip-installed into the wrong Python. Use the same venv ComfyUI runs in (on the Windows portable build that's C:/ComfyUI/venv/Scripts/python -m pip install google-genai). Then the key: GEMINI_API_KEY="AIza..." in a .env file works - the pack strips quotes - but a preview model you don't have access to will still error, which is what the List Available Models node is for. And remember thinking is opt-in and billed: leave it NONE for routine work.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| api_key | STRING | NanoBanana - API key. Leave blank to use GEMINI_API_KEY env var. | |
| model | COMBO | gemini-2.5-flash | NanoBanana - model for text generation. |
| custom_model | STRING | Override with a custom model ID. | |
| prompt | STRING | The user prompt to send to the model. | |
| system_instructionopt | STRING | System instruction to guide model behavior. | |
| temperatureopt | FLOAT | 0.700–2 | Controls randomness. Lower = more deterministic. |
| top_popt | FLOAT | 0.950–1 | Nucleus sampling probability cutoff. |
| top_kopt | INT | 00–1000 | Top-K sampling (0 = disabled). |
| max_output_tokensopt | INT | 00–65536 | Max tokens in response (0 = model default). |
| thinking_levelopt | COMBO | NONE | How much the model should reason before answering. |
| thinking_budgetopt | INT | 00–100000 | Max thinking tokens (0 = model default). |
| seedopt | INT | -1-1–2147483647 | Random seed for reproducibility (-1 = random). |
| safety_settings_jsonopt | STRING | JSON safety settings from Safety Settings node. | |
| networkopt | NB_NETWORK | Optional. Wire a NanoBanana - Network Route node here to route this request through that proxy (e.g. US egress). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |