π± Gemini Condense
Squeeze a bloated prompt down to a word budget without losing the idea
- response
Gemini Condense does one thing: takes a prompt of any length and rewrites it to fit a target word count while keeping the core concept intact. If you've ever written a prompt that read like a novella, then watched the sampler ignore half of it, you know exactly why this node exists.
It's part of the Artha-Gemini pack (the π± Gemini nodes), a family of cloud-LLM nodes that do their work via Google's Gemini API. Condense is a text-only node - no image, no video, just words in and fewer words out. It's the sibling of Gemini Prompter (which enriches) and Gemini Operation (which edits); Condense is the one that trims.
How it works
The mechanism is a single carefully-worded system instruction. The node loads a "master of conciseness" agent into the system prompt, tells it the exact word ceiling, and asks it to re-engineer the prompt rather than just truncate it. The language matters: it's instructed to optimize for current text-to-image models, keep the most impactful descriptive language, and skip any introductory fluff.
That last bit is why it beats just running your prompt through a generic "make this shorter" prompt. A generic LLM will happily summarize into a sterile one-liner. This agent is tuned to preserve the descriptive texture that image models actually respond to - lighting words, style references, compositional cues - while cutting the filler.
The node also nudges you toward the practical: if you're sending the result to a model with a token budget, note that roughly 100 tokens is about 60β80 words, so a 400-word cap fits comfortably in most contexts.
Inputs and outputs
- text_prompt - the prompt to condense.
- max_words - the ceiling, default 400. This is the dial you'll actually turn. Want a short tag-style prompt? Drop it to 50. Keeping a rich scene description? Leave it high.
Shared API block: api_key, model, max_tokens, temperature, defaulting to gemini-2.5-flash. Output is a single response string - wire it into your CLIP encoder, a Prompter node for further enrichment, or a text display to eyeball it first.
Installing it
Via ComfyUI Manager (search Artha-Gemini) or:
cd ComfyUI/custom_nodes
git clone https://github.com/Cyrostar/ComfyUI-Artha-Gemini
cd ComfyUI-Artha-Gemini
pip install -r requirements.txt
No model downloads; dependencies are google-genai, Pillow, numpy, torch, and soundfile. You need a Gemini API key from Google AI Studio - this node always makes an API call.
Where people get burned
The obvious trap is treating max_words as a hard promise. It's a target - Gemini usually lands under it, but occasionally a word or two over, and if you have a strict downstream limit, leave a little headroom in your ceiling.
The subtler issue is the same one that hits all LLM-prompt tooling: every condensation pass is a chance for the model to improve or drift the concept, and it does both. The node explicitly preserves the core idea, but check the output before you trust it with something specific - a character name or a precise composition can quietly get smoothed into something generic. Given the KB's note that modern models treat your prompt as an instruction rather than a token bag, a well-condensed prompt is usually a better prompt - just give it a read first.
The pack's standard key hygiene applies too: api.json (gemini_api_key) or the GEMINI_API_KEY env var, never the plain-text workflow field.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| text_prompt | STRING | β | |
| max_words | INT | 4001β10000 | For Gemini models, a token is equivalent to about 4 characters. 100 tokens is equal to about 60-80 English words. |
| api_key | STRING | API key will be visible in plain text. Consider adding your api to the api.json located inside this custom node folder. | |
| model | COMBO | gemini-2.5-flash | 5 options: gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite, gemini-2.0-flash, gemini-2.0-flash-lite |
| max_tokens | INT | 50001β8192 | For Gemini models, a token is equivalent to about 4 characters. 100 tokens is equal to about 60-80 English words. |
| temperature | FLOAT | 0.70β2 | A temperature of 0 means only the most likely tokens are selected, and there's no randomness. Conversely, a high temperature injects a high degree of randomness into the tokens selected by the model, leading to more unexpected, surprising model responses. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| response | STRING | β |