BaiduTrans(v2Trans)
The Baidu translator node that needs no API key — and why it's flaky
- STRING
The name is a bit of a lie. There is no official "v2Trans API" - BaiduTrans(v2Trans) scrapes the public translation endpoint that the fanyi.baidu.com website itself uses. No key, no signup, no quota. That's the whole appeal: if you want a Chinese prompt turned into English right now and can't be bothered registering for an API key, this is the fastest translation you'll get inside ComfyUI. Same pack as BaiduTrans(DevApi) - chflame163's ComfyUI_BaiduTranslate - but this node needs zero credentials from you.
How it works
This is where it gets fun. The node runs Baidu's own page JavaScript - a 45-line obfuscated "sign" function bundled in js/BaiduTranslate_sign.js - through PyExecJS to compute the same signature the website computes, then POSTs to https://fanyi.baidu.com/v2transapi with a hardcoded token and cookie. It's the browser doing the talking, minus the browser. That's why it needs no key: it's impersonating an anonymous page visitor.
The author also built in a safety net you can see in the source: if the target language is English but the "translation" still contains Chinese, the node returns your original text instead; mirror that for Chinese. Bad scrapes degrade to "here's your prompt back, unchanged" rather than feeding garbage into your encoder.
Inputs and output
Same two inputs as its sibling, both required:
text- your Chinese or English text, multiline.Translate_to_language-enorzh, defaulten.
Output is a single STRING, and unlike BaiduTrans(DevApi) this node is marked as an output node, so it slots in as the end of a workflow line. Wire the STRING into a prompt concatenator or a preview node to see what you got.
Installing
Manager search "ComfyUI_BaiduTranslate" and you're done, or the manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/chflame163/ComfyUI_BaiduTranslate
cd ComfyUI_BaiduTranslate
pip install -r requirements.txt
Here's the catch the README won't tell you up front: pyexecjs (imported as execjs in the code) needs a JavaScript runtime on your system. If Node.js isn't installed, the node dies at execjs.compile(...) with a "could not find any JavaScript runtime" error. On most ComfyUI installs - especially portable Windows ones - Node is not there by default. Install Node.js and restart ComfyUI.
Why it's flaky, and when to avoid it
Because it's scraping, it's fragile by design. Baidu can change the signing scheme, the hardcoded token and cookie go stale, and the endpoint starts refusing or returning junk. The author's own README is refreshingly honest about it: the interface is unstable, it handles mixed Chinese-English text poorly, and long English-to-Chinese sentences occasionally come back empty. Not a bug in the plugin, per the author - just the nature of scraping a moving target.
So treat this as the "quick and dirty" option. For a one-off translation or a draft workflow, it's perfect - zero setup, zero keys. For anything you're going to run repeatedly, or anything where a silently-returned original prompt would confuse you, use the keyed BaiduTrans(DevApi) or the newer TextTranslate node instead. Also note both old nodes are officially superseded: the author now points everyone at TextTranslate and says these won't be updated.
One more thing to watch: when it "works" by handing your English prompt back to you, that's the fallback logic doing its job - it detected Chinese in a scrape that was supposed to be English and bailed. Don't spend an hour debugging it as if you broke something.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| Translate_to_language | COMBO | en | 2 options: en, zh |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |