Nodes/ComfyUI-NanoBanana2/NanoBanana - Text Generation
ComfyUI Node

NanoBanana - Text Generation

Gemini text generation with every knob exposed — no GPU required

By IxMxAMAR·Created 6 months ago·Updated about a month ago· 4
NanoBanana - Text Generation
  • network
  • text
api_key
modelgemini-2.5-flash
custom_model
prompt
system_instruction
temperature0.70
top_p0.95
top_k0
max_output_tokens0
thinking_levelNONE
thinking_budget0
seed-1
safety_settings_json

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_KEY from 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 - -1 means 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.

CategoryNanoBanana2/Text

Inputs (14)

NameTypeDefaultDescription
api_keySTRINGNanoBanana - API key. Leave blank to use GEMINI_API_KEY env var.
modelCOMBOgemini-2.5-flashNanoBanana - model for text generation.
custom_modelSTRINGOverride with a custom model ID.
promptSTRINGThe user prompt to send to the model.
system_instructionoptSTRINGSystem instruction to guide model behavior.
temperatureoptFLOAT0.700–2Controls randomness. Lower = more deterministic.
top_poptFLOAT0.950–1Nucleus sampling probability cutoff.
top_koptINT00–1000Top-K sampling (0 = disabled).
max_output_tokensoptINT00–65536Max tokens in response (0 = model default).
thinking_leveloptCOMBONONEHow much the model should reason before answering.
thinking_budgetoptINT00–100000Max thinking tokens (0 = model default).
seedoptINT-1-1–2147483647Random seed for reproducibility (-1 = random).
safety_settings_jsonoptSTRINGJSON safety settings from Safety Settings node.
networkoptNB_NETWORKOptional. Wire a NanoBanana - Network Route node here to route this request through that proxy (e.g. US egress).

Outputs (1)

NameTypeDescription
textSTRING