Gemini 2.5 Flash (openai)
The cheap brain in your graph
- text
- raw_json
- credits_consumed
- usage_json
- credits_left
The most common use of an LLM inside a ComfyUI graph isn't chat - it's the step between your rough idea and your prompt. You type "a lighthouse in a storm, moody," the LLM turns it into something a diffusion model can actually use, and that string feeds your encoder. The community's preferred way to do that is a small local model, ideally abliterated, because it's free and unbothered. The reason an API node still earns a slot is the job the local model can't do: a longer rewrite, a structured JSON output, a second opinion from a much bigger model than your GPU can hold.
This node is Gemini 2.5 Flash through KIE's OpenAI-compatible endpoint. It's the cheap end of the Gemini range, and the sane first LLM node to wire up while you're working out what you're actually going to use an LLM for.
How it works
It's a plain chat-completion call, not a diffusion job. Your prompt goes to KIE's /gemini-2.5-flash/v1/chat/completions in an OpenAI-style messages array, and the response comes back parsed into a single text string. The (openai) in the display name is exactly that: KIE serves this model through an OpenAI-compatible shim rather than the native Gemini format - useful when you're pasting a request body or a tool definition you found in an OpenAI example.
There's no media socket on this node. It's text in, text out, plus accounting outputs.
Inputs
prompt is required - the user message.
system_prompt is the one you'll actually use. This is where you put the job description: "You rewrite short film ideas into single-paragraph image prompts. British spelling. No preamble." An enhancer that isn't told to skip the preamble will hand you "Here is your enhanced prompt:" as the first tokens of your conditioning, which is worse than no enhancer at all.
stream is a boolean, off by default. Worth being honest about what it does here: the pack normalises a server-sent-event response back into a full text result, so turning streaming on changes the transport, not whether you see tokens appear in the UI. Leave it off.
tools_json takes OpenAI-style function definitions - a JSON array with type: function entries. It's the same shape as the examples on KIE's docs page, including their built-in googleSearch tool. If you're not calling tools, [] is correct.
history_json is a prior messages array, passed straight through. That's how you do multi-turn work in a graph: keep the previous exchange in a string, feed it back next run, and the model remembers context. It's also the escape hatch for anything the widgets don't cover, since the pack doesn't validate what you put in it.
expert_override_json is the last-resort override for request fields the docs didn't declare. Its tooltip says normal use doesn't require it, and that's true.
Outputs
text is what you wire into a prompt field, a save-text node, or another LLM node. raw_json is the full provider response. usage_json is the token accounting - the output to glance at when a batch costs more than you expected. credits_consumed and credits_left are floats, and the node shows both on itself after each run.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/felipederosilva/ComfyUI-KIE-Nodes-Next
Or via ComfyUI Manager ("KIE.ai Nodes Next"), then restart. Requirements are requests, Pillow, numpy, PyYAML - no local model, no VRAM. Set your KIE key once under Settings → KIE.ai Nodes Next → Connection: it's validated against KIE before replacing a saved key, kept in Comfy's user config instead of the workflow, and the frontend only sees a masked fingerprint. KIE_API_KEY overrides it for headless installs.
Things worth knowing
- Everything on this node costs money per call, including the flops. A prompt-enhancer that runs on every generation is a subscription in disguise. Wire it to a toggle or run it once and paste the result.
- This is a closed model with a filter you can't remove. There are no weights to abliterate, so a refusal is a refusal. Local models win exactly here - and that's why the KB's LLM-in-ComfyUI doc treats "uncensored" as the feature that drives people local in the first place.
- It's an API node holding a key and calling the network by design. Keep that in mind when installing any pack of this shape: read the source or stick to ones with visible usage. The ecosystem's worst incident was precisely an LLM-vision node that shipped credential-stealing code.
- A model newer than this one already exists in the pack. The catalog indexes sibling Gemini Flash versions as their own nodes, so switching tiers is a node swap, not a reinstall.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | User prompt / message. | |
| system_promptopt | STRING | — | |
| streamopt | BOOLEAN | false | — |
| tools_jsonopt | STRING | [] | Optional function/tool definitions supported by this model endpoint. |
| history_jsonopt | STRING | [] | Optional prior message/input array as JSON. |
| expert_override_jsonopt | STRING | {} | Expert-only request overrides. Normal use does not require this. |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| raw_json | STRING | — |
| credits_consumed | FLOAT | — |
| usage_json | STRING | — |
| credits_left | FLOAT | — |