百度翻译
Pipe Chinese prompts through Baidu Translate, mid-graph
- 翻译结果
PromptTranslator ("百度翻译") is a cloud translation node built for one workflow: you write prompts in Chinese, it translates them to English, and the English goes into your CLIP encoding. It's an output node - a terminal point in your graph that both shows you the translation and passes it on. If you've ever maintained a Chinese prompt in a note file and hand-translated it into every text encoder, this is the automation of that chore.
The catch, and it's a real one: this is a cloud API call, not a local model. It needs Baidu's machine-translation API credentials - an API key and secret key from Baidu's cloud platform. No key, no translation; the node is a paperweight until you register. That's the whole trade here: you trade a free-tier cloud quota for not maintaining a local translation model.
How it works
Standard Baidu MT flow: it calls Baidu's OAuth endpoint to swap your key/secret for an access token, then posts the text to the translation endpoint. The token is cached to disk in the pack's config/baidu.json, so it doesn't re-authenticate every single queue - only when the cached token ages out (~30 days). It supports auto, en, and zh as source languages, and en/zh as targets.
The output is the translated string, and because it's an output node, the result also renders in the UI - you can see what it produced without hunting in the console. On a translation error it returns the original text rather than crashing the whole queue, which is a friendlier failure mode than most of this pack's nodes.
The inputs and outputs
apiKey,secretKey- Baidu MT API credentials.fromLang-auto,en, orzh.toLang-enorzh.text- the prompt (or anything) to translate.- Output:
翻译结果(the translated string).
Installing it
From ComfyUI_Lam: Manager → "ComfyUI_Lam", or:
cd ComfyUI/custom_nodes
git clone https://github.com/yanlang0123/ComfyUI_Lam
Restart, lam category. Dependencies are just requests (plus the standard library) - no pack model downloads. The setup that matters is the Baidu API credentials, done in Baidu's cloud console, not in ComfyUI.
Common issues
Authentication is the whole game. Wrong or expired keys give you a 翻译失败 message (the error text is shown in the UI, which helps). Free-tier Baidu MT has daily character quotas - a long loop of translated prompts can eat a month's quota in one session, and quota exhaustion reads as a generic failure. Translation quality on technical/prompt vocabulary is fine-to-good, but it's a general MT engine, not prompt-tuned: model names, style tokens, and booru-style tags can get mangled, so keep an eye on the first few outputs before trusting it at scale.
It's also worth knowing this is a niche pack with a Chinese-first audience - the display names throughout are Chinese, the README's heavy install targets other nodes, and on uninstall you should delete ComfyUI/web/extensions/lam to clear the leftover frontend popup. For pure English-native prompters this node is irrelevant; for Chinese-native ones it's genuinely the closest thing to "just write it in Chinese."
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| apiKey | STRING | — | |
| secretKey | STRING | — | |
| fromLang | COMBO | 3 options: auto, en, zh | |
| toLang | COMBO | 2 options: en, zh | |
| text | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| 翻译结果 | STRING | — |