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

πŸ”± Gemini Translate

Translate your prompts without leaving the canvas

By CyrostarΒ·Created about a year agoΒ·Updated about a year agoΒ· 1
πŸ”± Gemini Translate
    • response
    β—„textβ–Ί
    β—„lang_fromChineseβ–Ί
    β—„lang_toEnglishβ–Ί
    β—„api_keyβ–Ί
    β—„modelgemini-2.5-flashβ–Ί
    β—„max_tokens5000β–Ί
    β—„temperature0.7β–Ί

    Gemini Translate is the pack's translation node: you give it text, pick a source and target language from two dropdowns, and it returns the translation as a string you can drop anywhere in your workflow. It's the pack's most international-feeling node, and its real use case is one you'll hit more often than you'd expect: models and prompt libraries don't speak your language, and neither does your training data.

    It's part of the Artha-Gemini pack (the πŸ”± Gemini nodes), the family of cloud-LLM nodes that outsource their thinking to Google's Gemini API. Translate is text-only - no image, no audio, no GPU load - and it always makes a live API call.

    How it works

    Straightforward. You provide text, choose lang_from and lang_to, and the node builds a system instruction that reads "Translate the given text from [lang_from] to [lang_to]. Begin your output directly without any introductory sentence or summary phrase." That last clause is the important bit: it stops Gemini from adding "Here is your translation:" and other preamble, so you get clean text out - ready to feed into a CLIP encoder or a text file without post-processing.

    The language lists are fixed dropdowns covering the world's major languages: English, Chinese, Spanish, Hindi, Portuguese, Russian, Japanese, Turkish, German, French, Italian, and Bengali. Defaults are Chinese β†’ English, which hints at where the author's user base skews, but every pair is one click.

    Inputs and outputs

    • text - the source text.
    • lang_from / lang_to - the two dropdowns.
    • api_key, model, max_tokens, temperature - the shared API block, gemini-2.5-flash by default.

    Output: response (STRING), the translation. Wire it into a text encoder, a Save Text node, or the pack's Gemini Response display.

    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.

    Where people get burned

    The main trap is translation drift on prompt-specific text. This node is a general translator, not a prompt translator, so technical terms, artist names, and prompt vocabulary can come back literally rather than idiomatically - "photorealistic, 8k, intricate details" can flatten into something generic in the target language. If you're translating a prompt you care about, check the output; the KB's prompt-engineering notes on how much exact wording matters to modern models make this a genuine concern, not pedantry.

    Second, the dropdowns are the interface, and it's easy to set them backwards - there's no auto-detect, so if lang_from is wrong, you get garbage that looks perfectly grammatical. Keep the pair straight.

    And the pack's usual gotchas: keep the key in api.json (gemini_api_key) or the GEMINI_API_KEY env var rather than the plain-text workflow field; remember every run is a billable API call; and a failed call returns a response starting with Error: with the real message in the ComfyUI console. For a node this simple, that's about all that can go wrong - and most of it is the API key.

    CategoryArtha/LLM/GEMINI

    Inputs (7)

    NameTypeDefaultDescription
    textSTRINGβ€”
    lang_fromCOMBOChinese12 options: Chinese, Spanish, English, Hindi, Portuguese, Bengali, +6
    lang_toCOMBOEnglish12 options: Chinese, Spanish, English, Hindi, Portuguese, Bengali, +6
    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, 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)

    NameTypeDescription
    responseSTRINGβ€”