π€ Leon Official Gemini π
Talk to Gemini 3 from inside a workflow
- input_image
- image_array
- response
Most of the "π€ Leon" nodes in this pack are thin wrappers around someone else's aggregator. This one is different: Leon_Official_Gemini_Node skips the middlemen and calls Google's native Gemini REST endpoint directly, using your Google API key. That makes it the closest thing to an LLM chat node that is fully yours - no reseller in the path, no model routing surprises, just generateContent against generativelanguage.googleapis.com.
Why reach for it? Because ComfyUI workflows increasingly want a text brain in the graph. You can use it to rename and caption a batch of generated images, describe what a render actually shows, or hand a few sentences of style guidance down the wire to a prompt-builder node. It returns plain text - one STRING output - so it composes with anything that takes a string.
How it works
The node builds a standard Gemini contents payload - a list of parts, each either text or inlineData (base64 image) - plus a generationConfig with your temperature and a thinkingConfig for the model's reasoning depth. It POSTs to:
https://generativelanguage.googleapis.com/v1beta/models/{model}:generateContent
with the key in the x-goog-api-key header. The response's candidate text is joined and returned. It uses the same exponential-backoff retry as the pack's other nodes, and it deliberately refuses to retry on a 400 - no point hammering Google when the payload itself is malformed.
Inputs that matter
model- defaults togemini-3-flash-preview. The dropdown holdsgemini-3.1-flash-lite-preview,gemini-3.1-pro-preview, andgemini-3-flash-preview; acustom_modelstring overrides any of them if you're testing a new name Google hasn't shipped to the enum yet.user_message- your actual instruction. The default is a friendly "Hello!", so don't run it blind and wonder why nothing happened.thinking_level-highthroughminimal. The model's own docs call high the default, but this node defaults tominimal, the fastest. For captioning chores that's fine; for genuinely hard reasoning you'll want to dial it up and eat the latency.temperature- the tooltip notes Google recommends 1.0 for Gemini 3, which is what it ships at. Lower it when you want terse, consistent output (e.g. building JSON-ish text for another node).system_message- sets behaviour, exactly like you'd expect.
There's also input_image (a plain IMAGE) and image_array (an IMAGE_ARRAY for the vision-capable models). Both get base64-encoded into the request as inline image parts.
Installing
Same pack as everything else in this series - ComfyUI Manager (search Leon) or:
cd ComfyUI/custom_nodes/
git clone https://github.com/l3ony2k/comfyui-leon-nodes comfyui-leon-nodes
pip install -r requirements.txt
Restart, then paste a real key from Google AI Studio into api_key. No models to download, no VRAM used, and the only dependency beyond the obvious is tenacity for retries.
Common issues
Two things bite. First, the default api_key is literally YOUR_GEMINI_API_KEY - a generation that returns a 400 with an auth message means you forgot to swap it. Second, vision: if you feed it a LoadImage and it complains, check that you're using a model that accepts images, and remember the image_array input expects the pack's IMAGE_ARRAY type (Image Array Builder), not another tensor. A 400 on a weird thinking_level or a typo'd custom_model is usually a hard failure - the node won't retry those, which is the right call, and the full Google error body gets printed to your console for reading.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| model | COMBO | gemini-3-flash-preview | Gemini model to use (Google native API) |
| user_message | STRING | Hello! How can you help me today? | User message to send |
| api_key | STRING | YOUR_GEMINI_API_KEY | Your Google Gemini API key |
| system_messageopt | STRING | System instruction to set model behaviour | |
| temperatureopt | FLOAT | 1.00β2 | Sampling temperature (Google recommends 1.0 for Gemini 3) |
| thinking_levelopt | COMBO | minimal | Thinking depth: high (default) β minimal (fastest) |
| input_imageopt | IMAGE | Optional image input for vision-capable models | |
| image_arrayopt | IMAGE_ARRAY | Optional array of images (base64 data URIs or URLs) | |
| custom_modelopt | STRING | Override model name with a custom string |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| response | STRING | β |