Nodes/ComfyUI-Minitools/Translate to English 👻
ComfyUI Node

Translate to English 👻

A Prompt Translator That Makes You Edit the Source Code

By lepiai·Created 2 years ago·Updated 3 days ago· 8
Translate to English 👻
    • STRING
    prompt_text杰作,高清画质

    Because most models still reward English prompts

    Almost every checkpoint and template works better with an English prompt, but if you think in Chinese, hand-translating every idea gets old fast. Translate to English converts a prompt through Baidu's free translation API and hands you the English result, ready to wire into your CLIP or text encoder. The default input is even 杰作,高清画质 - "masterpiece, high quality" - so the first time you open it, it's already showing you what it's for.

    The concept is genuinely handy. The execution, however, has a catch that you need to know about before you add it to a workflow, because this is the single most likely reason the node appears to "not work."

    The catch: the API key lives in the source file

    There's no key field in the node UI. The Baidu Translate appid and secretKey are hardcoded as placeholder values at the top of the pack's promptsTranslateEN.py:

    appid = 'xxxxxx'      # appid
    secretKey = 'xxxxx'   # 密钥
    

    Until you replace those with your own credentials, every translation call fails. You have to open ComfyUI/custom_nodes/ComfyUI-Minitools/promptsTranslateEN.py, paste in your own appid and secret (you can get both free at api.fanyi.baidu.com), save, and restart ComfyUI. That's the setup. It's not hard, but it's also not discoverable - which is why this node confuses people.

    How it works

    Once the credentials are in, the mechanism is a standard Baidu API call: it builds an md5 signature from appid + text + salt + secret, POSTs to api.fanyi.baidu.com/api/trans/vip/translate with from=zh and to=en, and returns the first translation from the response. If you're familiar with the Baidu translate API, this is textbook.

    The interface

    • prompt_text (STRING, multiline) - the Chinese prompt to translate.
    • Output: STRING - the English translation.

    Gotchas beyond the key

    • It's hardcoded zh→en. The from language is zh in the source, so only Chinese input is supported. Other languages won't translate correctly.
    • It's a cloud call. Free tier works but has rate limits, and it needs internet plus the requests package (which is in the pack's requirements).
    • It's a text-only translation - no glossing, no enhancement, no prompt-style awareness. It translates, it doesn't optimize. If you want the prompt improved, that's the other node in this pack (Prompt Optimizer), not this one.

    Installing it

    Part of the ComfyUI-Minitools pack from lepi ai - seven small utilities under "MiniTools" (ghost 👻 in the names). No models to download.

    cd ComfyUI/custom_nodes
    git clone https://github.com/lepiai/ComfyUI-Minitools
    

    then restart ComfyUI, or ComfyUI Manager → search "ComfyUI-Minitools" → Install → Restart.

    Pack-wide reminder: this pack imports its LLM node at startup and needs the openai package to load at all. Manager handles that via requirements.txt; if you cloned manually, run pip install -r requirements.txt in ComfyUI's environment before you go hunting for a missing node.

    CategoryMiniTools

    Inputs (1)

    NameTypeDefaultDescription
    prompt_textSTRING杰作,高清画质

    Outputs (1)

    NameTypeDescription
    STRINGSTRING