Nodes/Prompt Assistant/✨Prompt Translate
ComfyUI Node

✨Prompt Translate

Stop hand-editing prompts between languages

By yawiii·Created about a year ago·Updated 4 months ago· 2,288
✨Prompt Translate
    • translated_text
    source_text
    target_languageEnglish
    translate_service百度翻译
    ollama_auto_unloadtrue
    seed0

    If you think in one language and generate with another, you've felt the pain of trying to write good English prompts from memory when English isn't your thing. ✨Prompt Translate is the pack's answer: a node that auto-detects what language your text is in and translates it to English or Chinese. It's one of the quieter nodes in ✨Prompt Assistant, and honestly one of the most used - every prompt you feed a model has to survive the translation, and prompt syntax is exactly where machine translation chokes.

    So the interesting design choice is that this node has two translation paths, and you pick per-use.

    How it works

    The node sniffs the source language first - it scans for CJK characters and plain ASCII, then decides whether it's Chinese, English, or "auto." If the source is already the target language, it returns your text untouched instead of pointlessly round-tripping it. That's a small thing that saves you from watching a queue slot get wasted on a no-op.

    Then it routes to one of two services:

    • 百度翻译 (Baidu) - the machine-translation path. Fast, free tier of around 5 million characters a month, but the README is honest that the quality is "一般" (mediocre). Fine for a quick prompt; the pack's own description says it well.
    • An LLM service - Zhipu (智谱) free GLM flash models by default, or Ollama, or any configured service. This is the quality path: the pack has dedicated ZH/EN translation system rules that tell the model to preserve prompt syntax, weights, and structure rather than translate them like prose.

    Which one you reach for depends on whether you want speed or fidelity. For a prompt you're actually about to generate with, the LLM path wins - machine translation has a habit of mangling tag syntax and (weight:1.3) style markup. For bulk translating node docs or notes, Baidu is plenty and costs nothing.

    The inputs that matter

    • source_text - the text to translate.
    • target_language - English or Chinese, that's the whole dropdown. Defaults to English, which is the direction most people want: write in your native language, generate with English prompts.
    • translate_service - 百度翻译 by default, or any 服务名/模型名 LLM option from your configured services.

    Output is a single translated_text string, ready to wire into a prompt encode or another node.

    The README also mentions a built-in translation cache to avoid re-translating the same text and drifting the wording on re-runs - so repeat executions with unchanged input shouldn't churn the API.

    Install

    Same pack, same drill. ComfyUI Manager → search Prompt Assistant → install → restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/yawiii/ComfyUI-Prompt-Assistant.git
    

    Baidu requires an app ID and secret key in the pack's configuration (apply via Baidu's translation API portal). LLM services need their API key as usual.

    Where people get burned

    Baidu's free tier is generous but the README warns that using it behind a VPN/proxy can cause requests to fail - the API doesn't like being routed oddly. And remember the content-review gotcha that applies to the whole pack: Zhipu's free models return empty results for content that trips their filters, which can look exactly like a broken translation. It's not. The seed widget works the same as the other nodes here - fixed seed plus unchanged input won't re-fire the call, so toggle randomize when you want a fresh translation pass.

    Category✨Prompt Assistant

    Inputs (5)

    NameTypeDefaultDescription
    source_textSTRINGText to translate
    target_languageCOMBOEnglish2 options: English, Chinese
    translate_serviceCOMBO百度翻译Select translation service and model
    ollama_auto_unloadBOOLEANtrueAuto unload Ollama model after generation
    seedINT00–18446744073709550000

    Outputs (1)

    NameTypeDescription
    translated_textSTRING