Gemini Text/Vision (own API key)
The Gemini Node That Writes Your Prompts Instead of Drawing Them
- images
- text
The pack this ships in is all about Nano Banana Pro with your own key, so GeminiTextOwnKey is easy to overlook - it doesn't draw anything. It's the plain-text sibling: a straight call to a Gemini language model from inside your graph, returning text you can wire anywhere. Which is exactly what makes it useful, because prompt-rewriting and captioning are the two jobs every serious workflow needs done by a model that's not a diffusion model.
Think of the loop people actually run: rough idea in, Gemini rewrites it into a structured, model-appropriate prompt, and that text feeds your image node's prompt. Chaining a cheap text call into an expensive image call beats hand-tuning prompts every time, and since it shares its API key and config.json with the Nano Banana node in the same pack, adding it costs nothing but a few cents of text tokens.
How it works
Under the hood it's the same plumbing as its sibling: your prompt (and any attached images, converted to PNG base64) gets POSTed to generativelanguage.googleapis.com/v1beta/models/<model>:generateContent with your key, and the model's text comes back on the single output. No seed widget - an LLM isn't seeded that way, so if you want variety you vary the prompt. Notably there's no backend dropdown here: text runs on the plain AI Studio key, not the Vertex path, which is fine because it doesn't need the trial-credit trick - the image node is the expensive half.
Inputs and output
The node is almost embarrassingly thin, which is the right call:
- prompt - what you're asking. For enhancement, give it your rough idea plus an instruction like "rewrite this as a detailed prompt for an image model."
- model - defaults to
gemini-2.5-flash, and honestly that's usually the one you want. Prompt rewriting wants small and obedient, not a reasoning model that leaks its thinking into your output. Reach forgemini-3-pro-previeworgemini-2.5-proonly when the job is genuinely hard. - images - connect this and it becomes a vision node: point it at a loaded image and ask for a caption, a detailed description, or structured tags. Feed it back into your prompt chain and you've got a quick img2img seeder.
- system_prompt - set the persona or output format, like "reply with JSON only."
- api_key - leave it blank if your key is in
config.jsonor theGEMINI_API_KEYenv var. Fill it in and it wins over both, which is also why the security section below says don't. - timeout - 180s default, which is plenty for flash and comfortable for pro.
The one output, text, is a plain STRING. Wire it into any prompt input downstream, or a text-preview/save node to eyeball it before it goes anywhere.
Install and gotchas
Installing is the same as the pack's image node - it's the same repo:
cd ComfyUI/custom_nodes
git clone https://github.com/haristahir1/comfyui-gemini-ownkey
then restart, or search the pack in ComfyUI Manager. No extra dependencies for the text path - it only needs requests. Verify your key free with check_key.py --list-only before you blame the node for a 401.
Two things bite people. First, the key: this is a credential-carrying API node from a brand-new author, so use config.json (gitignored, never saved into workflow JSON) rather than pasting the key into the widget - widget values ride along in every workflow you share or paste into error reports. Second, Google's moderation: this model refuses at the source, the node can't bypass it, and a reseller's "looser" endpoint still hits Google's own filter. If your use case needs something Google won't do, an API wrapper isn't the fix - this node is for the prompt-engineering half of the graph, and it does that job cleanly. A 429 prepayment credits depleted means your AI Studio balance is empty; top up, because text may be cheap but it's not free.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | — | |
| model | COMBO | gemini-2.5-flash | 3 options: gemini-3-pro-preview, gemini-2.5-pro, gemini-2.5-flash |
| imagesopt | IMAGE | — | |
| system_promptopt | STRING | — | |
| api_keyopt | STRING | — | |
| timeoutopt | INT | 18015–1800 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |