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

Chinese English Translate 👻

Chinese ⇄ English prompt translation that also knows which way you typed it

By lepiai·Created 2 years ago·Updated 13 days ago· 10
Chinese English Translate 👻
    • en
    • cn
    prompt_text杰作,高清画质

    If your prompts live in one language and your sampler wants another, you have two options: keep a browser tab of DeepL open, or let a node do it inside the graph. Chinese English Translate 👻 is the node. Paste a Chinese prompt, get the English out on the en port, and the original Chinese back on cn - all in the same pass, wired straight into your CLIP text encode.

    It's from the ComfyUI-Minitools pack, and it's the modern reincarnation of what the README calls promptsTranslateEN - the "translate prompts to English" node the author has shipped for a while. Same idea, more outputs.

    What it does

    One required input:

    • prompt_text - a multiline text box. Defaults to "杰作,高清画质" (roughly "masterpiece, high definition"), which tells you who this is aimed at.

    Two outputs:

    • en (STRING) - the prompt in English.
    • cn (STRING) - the prompt in Chinese.

    The nice touch is auto-detection: the node scans the text for CJK characters and figures out which direction you're going. Chinese in → English out. English in → Chinese out. You don't pick a language pair, it just does the sensible thing. It even preserves line breaks, which matters when you're translating a multi-shot video prompt.

    How it works (read this before you trust it)

    This is an API-wrapper node - the classic "your data leaves the machine" category from the KB. It calls the Baidu Translate API (the free-tier translation service from the Chinese search giant) over plain HTTP with a signed request, no heavy local model involved.

    Here's the catch that matters: the appid and secret key are hardcoded in the source file, not exposed as inputs. Out of the box, the node runs on the author's free Baidu Translate account. It works - I've seen the pattern, it's the standard way these translate nodes ship - but you're sharing the author's daily quota, and if their key gets rate-limited or revoked, the node silently fails. The author's comment in the code literally says "需要修改成自己的appid和密钥" - change it to your own appid and key.

    If you're going to run this regularly:

    1. Get a free Baidu Translate key at https://api.fanyi.baidu.com/ (it's genuinely free for light use).
    2. Open ComfyUI/custom_nodes/ComfyUI-Minitools/toen.py.
    3. Replace the two hardcoded values near the top:
    appid = 'YOUR_APPID'
    secretKey = 'YOUR_SECRET'
    
    1. Restart ComfyUI.

    Install

    # ComfyUI Manager: search "ComfyUI-Minitools"
    # or manually:
    cd ComfyUI/custom_nodes
    git clone https://github.com/lepiai/ComfyUI-Minitools
    # restart ComfyUI
    

    The node needs the requests library, which ComfyUI already pulls in. No model downloads.

    When it goes wrong

    • Empty outputs. If en or cn come back blank, the API call failed - check your network, and remember that on a Chinese service reachability from outside China can be spotty. The node retries twice and then gives up gracefully.
    • Quota exhaustion. Because you're on the author's key until you change it, a shared quota can die mid-workflow. If translation suddenly stops working after working fine, this is the first thing to suspect. Same if Baidu rotates their secret.
    • Prompt weights. Whatever it returns, remember this is a natural language translation. If you feed it booru-tag soup with (word:1.2) syntax, the translation service doesn't understand those tokens either - it'll mangle them the same way any LLM-adjacent tool does. Translate the plain-language skeleton, add weights after.

    It's a small, genuinely useful utility for Chinese speakers building English-language prompts, with one sharp edge (the embedded key) you should fix before you depend on it. For everyone else, it's still the fastest way to flip a prompt into the language your model was trained on.

    CategoryMiniTools

    Inputs (1)

    NameTypeDefaultDescription
    prompt_textSTRING杰作,高清画质

    Outputs (2)

    NameTypeDescription
    enSTRING
    cnSTRING