Nodes/ComfyUI-Artha-Nodes/πŸ”± Artha Gemini Condense
ComfyUI Node

πŸ”± Artha Gemini Condense

Squeeze a bloated prompt down to a word budget

By CyrostarΒ·Created 10 months agoΒ·Updated 8 months agoΒ· 0
πŸ”± Artha Gemini Condense
    • response
    β—„text_promptβ–Ί
    β—„max_words400β–Ί
    β—„api_keyβ–Ί
    β—„modelgemini-2.5-flashβ–Ί
    β—„max_tokens5000β–Ί
    β—„temperature0.7β–Ί

    Artha Gemini Condense solves a problem every prompt-builder eventually hits: you've written a 900-word love letter of a prompt, and the model or the workflow you're feeding needs it in 400 words - or 150, or whatever your target is. Instead of hand-editing it down, you hand it to this node and let Gemini do the surgery. It condenses a prompt to a target word count while trying to preserve the core concept, and the result is usually tighter than what you'd write yourself, because it's not just deleting words - it's re-engineering them.

    The description in the pack calls it a "Question" node, which is a misnomer you can safely ignore. What it is: a stateless one-shot prompt summarizer.

    What you set

    • text_prompt - the prompt to condense. Feed it from anywhere upstream (a text node, another Gemini node's output, a paste).
    • max_words - the budget. Default 400, range 1 to 10,000 in steps of 10. This is the number you actually care about, so it's worth understanding: the tooltip clarifies that for Gemini a token is roughly 4 characters, and 100 tokens is about 60–80 English words - that's the conversion math if you're targeting a specific token limit.

    Then the pack's usual api_key, model (default gemini-2.5-flash), max_tokens (5000), and temperature (0.7). One response output, a plain string, ready to route into your prompt encoder.

    How it works

    The trick is entirely in the system prompt. Condense loads a built-in "master of conciseness" instruction: you're told to condense the submitted prompt to no more than max_words words, output optimized for current text-to-image models, with no introductory sentences and no preamble. Note the wording - "no more than" - so Gemini will usually land a hair under your budget rather than exactly on it. That's a feature: under is safe, over is not.

    Because it works by re-writing rather than truncating, the output reads like a compressed version of your prompt's meaning. That's what makes it more than a headless word-count tool. If your original prompt is already lean, condensation will find little to do and mostly reshuffle - don't expect magic from a five-word prompt; this shines when you're way over budget.

    When to reach for it

    Three situations come up constantly:

    • Fitting a token-limited model. Some encoders and API models have tight context windows. Condense to a word count that maps to your model's limit.
    • Prompts that have drifted bloated. You kept appending clauses and now the first concept has a fifth of the model's attention. A condensation pass refocuses the prompt on its core intent.
    • Batch consistency. Same source prompt, condensed to the same word count across a batch, gives the sampler a more consistent job to do.

    The one trap: it's a cloud call. Every execution burns a Gemini API request (key resolution is the pack standard - api_key field, then api.json, then GEMINI_API_KEY). If response comes back empty, check the ComfyUI console for the swallowed error message.

    Install

    It ships with the whole πŸ”± pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Cyrostar/ComfyUI-Artha-Nodes
    cd ComfyUI-Artha-Nodes
    pip install -r requirements.txt
    

    Restart ComfyUI, or install "Artha" via ComfyUI Manager. Grab a Gemini key from Google AI Studio and you're set. There's no offline mode - this node exists to make an API call, so the key is non-negotiable.

    CategoryArtha/LLM/Gemini

    Inputs (6)

    NameTypeDefaultDescription
    text_promptSTRINGβ€”
    max_wordsINT4001–10000For Gemini models, a token is equivalent to about 4 characters. 100 tokens is about 60–80 English words.
    api_keySTRINGAPI key will be visible in plain text. Consider adding your api to the api.json located inside this custom node folder.
    modelCOMBOgemini-2.5-flash5 options: gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite, gemini-2.0-flash, gemini-2.0-flash-lite
    max_tokensINT50001–8192For Gemini models, a token is equivalent to about 4 characters. 100 tokens is equal to about 60–80 English words.
    temperatureFLOAT0.70–2A temperature of 0 means only the most likely tokens are selected. Higher values increase randomness.

    Outputs (1)

    NameTypeDescription
    responseSTRINGβ€”