Nodes/ComfyUI-UniversalToolkit/Text Translator API (UTK)
ComfyUI Node

Text Translator API (UTK)

Translate prompts in-graph, no model download

By whmc76·Created about a year ago·Updated 2 months ago· 72
Text Translator API (UTK)
    • translated_text
    • provider_used
    • status_message
    textHello, world!
    target_language中文
    source_languageauto
    providerauto
    api_key

    Prompting across languages is a recurring ComfyUI pain: your LoRA trigger words are English, the checkpoint tags you're cribbing from are Japanese, the model you want to steer was trained on Chinese prompts. This node translates a string inside the graph, so you can convert a prompt mid-pipeline without downloading a translation model or leaving ComfyUI. It's a utility for the multilingual prompting problem, and for most people the one use case that matters is "auto mode with no API key."

    How it works

    The node is a thin dispatcher over a bunch of provider classes. Set provider to auto (the default) and it walks providers in priority order, skipping any that need an API key you didn't supply, and returns the first successful translation. Google's free endpoint sits at the top of that order and needs no key at all - so with defaults, it just works. Every other entry in the list (GLM-4 Flash, Silicon Flow, Baidu, Youdao, Bing, Microsoft) is labeled "(Free)" because the service has a free tier, but each one still expects an API key in the optional api_key field. DeepL and Azure are the straight-up paid ones.

    It also tracks what happened: alongside the translation you get provider_used (which service actually answered) and status_message (a human-readable success or error, including the "requires API key, get it here" URLs when a key is missing).

    The inputs that matter

    • text - the string to translate, multiline.
    • target_language - 69 languages including auto, listed in their native names (中文, 日本語, 한국어, Français…). Default is 中文, which is a tell about this pack's author but easy to change.
    • source_language - defaults to auto, which is what you want 99% of the time.
    • provider - auto or a specific service. The dropdown includes --- separator rows that are menu headers, not providers; if you pick one by accident you get a clean error, not a crash.
    • api_key - optional, only needed for anything other than Google.

    Installing it

    Same shared pack install - ComfyUI Manager (search "ComfyUI-UniversalToolkit") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/whmc76/ComfyUI-UniversalToolkit
    pip install -r requirements.txt
    

    The node uses requests, which is in the pack's requirements.

    Where people get burned

    • "Free" doesn't mean "no key." Only Google works keyless in auto mode. If you're staring at a status_message about API keys, read the label again - "(Free)" refers to the service tier, not the authentication.
    • The Google endpoint is unofficial and rate-limited. It's the same translate.googleapis.com trick every scraper uses, fine for translating a few prompts, fragile if you point a 10,000-image caption pipeline at it. Don't build a production dependency on it.
    • The key is a plain STRING widget. If you share workflows, remember ComfyUI bakes workflow JSON into the saved PNGs - don't share a workflow with a real key embedded unless you're fine with the key being public.
    • provider_used is your friend when auto silently falls back to a different service than you expected. Check it before you trust a translation.

    For occasional "translate this prompt so the model understands it" work it's genuinely handy, and the no-key default means zero setup. Just keep your expectations about the free endpoint realistic.

    CategoryUniversalToolkit/Tools

    Inputs (5)

    NameTypeDefaultDescription
    textSTRINGHello, world!
    target_languageCOMBO中文69 options: auto, English, 中文, 日本語, 한국어, Français, +63
    source_languageCOMBOauto69 options: auto, English, 中文, 日本語, 한국어, Français, +63
    providerCOMBOauto12 options: auto, --- Free Services ---, Google Translate (Free), --- Require API Key ---, Bing Translator (Free), GLM-4 Flash (Free), +6
    api_keyoptSTRING

    Outputs (3)

    NameTypeDescription
    translated_textSTRING
    provider_usedSTRING
    status_messageSTRING