Get Gemini Keys JNK
Keep your API keys out of the workflow file
- key_1
- key_2
- key_3
- key_4
- key_5
The single best reason to use this node is the thing it stops you from doing: pasting a Gemini API key directly into Ask Google Gemini. Do that and the key rides along in your workflow JSON and into the metadata of every saved image - which is fine until you share that workflow or post that PNG, at which point you've handed someone your key. Get Gemini Keys exists to make that mistake unnecessary. It reads API keys from a plain text file, one per line, and hands them out as up to five separate string outputs you can wire into your Gemini nodes.
It also quietly enables the pack's real intended setup: key rotation. The free Gemini tier rate-limits you hard (roughly 15 requests per minute on flash-class models), and one key will hit that ceiling in a busy batch. Load five keys, have Get Gemini Models define per-model RPM budgets, and rotate between keys to multiply your throughput without paying anything.
Inputs and outputs
file_path- absolute path to a.txtfile with your keys, one per line.
Outputs: key_1 through key_5 (all STRING). If your file has fewer than five lines, the unused outputs are empty strings. The order is just line order, top to bottom.
How it works
Under the hood it's barely more than open(file_path).readlines() - it reads up to the first five lines, strips whitespace, and returns them. That's it. No encryption, no validation, no checking that a key is even real. The security benefit is positional: the keys live in a file outside the graph, so they never get serialized into your workflow.
Installing it
Pack install: search JNK in ComfyUI Manager, or
cd ComfyUI/custom_nodes/
git clone https://github.com/Aljnk/ComfyUI-JNK-Tiny-Nodes.git
No extra dependencies for this node - just make sure google-genai is installed for the Ask Google Gemini node you'll be feeding.
Where people get burned
The failure mode is silent. If the file path is wrong or the file is missing, the node doesn't error - it catches the exception, logs a line to the console, and returns five empty strings. Your Ask Google Gemini node then runs with an empty key and fails with a confusing API error. So the debugging path is: empty strings from this node β check the path and the console. Also, note the filename field wants a raw filesystem path - it does not look in ComfyUI's input folder, so C:\Users\you\keys.txt or /home/you/keys.txt, not keys.txt. Keep keys in a file, keep that file out of your workflow, and rotate - that's the whole job, and it does it.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| file_path | STRING | β |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| key_1 | STRING | β |
| key_2 | STRING | β |
| key_3 | STRING | β |
| key_4 | STRING | β |
| key_5 | STRING | β |