ChatGLM-4 Translate CLIP Text Encode Node
LLM translation fused straight into conditioning
- clip
- CONDITIONING
- STRING
Same idea as ChatGLM4TranslateTextNode - an LLM (one of Z.ai's GLM models) doing your prompt translation instead of a dictionary-style translator - but fused with a CLIP Text Encode so you get conditioning directly, without a separate encode node downstream.
Why you'd reach for it
The case for LLM translation over googletrans or deep-translator is context: an LLM reads your whole sentence before restating it, so it handles idiom, slang, and word-order differences better than statistical machine translation. This node gets you that quality plus a tidier graph - one node instead of translate-then-encode. It costs an API call per generation where the free translators don't, so it's the one to reach for when a specific phrase keeps coming out wrong through the free options, not your default for every prompt.
How it works
Your text and language settings go to a GLM model hosted on Z.ai's API (the same lab behind CogVideoX and SCAIL, though its LLM business is the larger side of the company). The translated result then runs through a standard CLIP encode against the CLIP model you supply, producing conditioning in one call.
The inputs and outputs that matter
text- your prompt, multiline.clip(CLIP, required) - from your checkpoint loader.from_translate(defaultru) /to_translate(defaulten) - 133 language codes each; set your actual source language explicitly, there's noauto.model(defaultglm-4.5-flash) - 16 GLM model choices. Stick with a-flashmodel for routine translation; step up only if you're seeing quality issues.max_tokens(default 1024),temperature(default 0.95),top_p(default 0.7) - for translation, dialingtemperaturedown from the chat-tuned default of 0.95 will get you more consistent, literal output.- Outputs:
CONDITIONING(into your sampler) andSTRING(the translated text - wire to aPreviewTextNodeso you can actually see what the model produced, since LLM translation is more prone to paraphrasing than a literal dictionary lookup).
How to install it
Via ComfyUI Manager: search "ComfyUI Custom Nodes AlekPet" and install. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/AlekPet/ComfyUI_Custom_Nodes_AlekPet
Restart ComfyUI. You'll need a Z.ai (Zhipu) API key from their hosted platform before this node does anything - the top-level README doesn't document per-node API setup, so check the ChatGLMNode subfolder in the repo for exactly where the key goes.
Common issues & troubleshooting
Authentication errors on first run. Expected until you've configured an API key - this is a paid hosted API call, not a local model or a free scraper like the Google/Argos translators.
The translated conditioning produces unexpected image results. Since you can't directly inspect conditioning tensors, use the STRING output to see the actual translated text the model sent to CLIP - this is the fastest way to tell whether an odd result is a bad translation or something else in your graph. LLM translation paraphrases more than literal translators, so this check matters more here than on GoogleTranslateCLIPTextEncodeNode.
Per-call API cost adds up in batch workflows. Unlike the Google/Deep Translator/Argos-backed CLIP encode nodes, every run of this node is a billed API call. For high-volume batch translation where nuance doesn't matter much, one of the free translators is the more economical default; save this one for prompts where translation quality is worth paying for.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| from_translate | COMBO | ru | Translation from |
| to_translate | COMBO | en | Translation to |
| model | COMBO | glm-4.5-flash | The model code to be called. Models with text 'flash' should be free! |
| max_tokens | INT | 1024 | The maximum number of tokens for model output, maximum output is 4095, default value is 1024. |
| temperature | FLOAT | 0.950–1 | Sampling temperature, controls the randomness of the output, must be a positive number within the range: [0.0, 1.0], default value is 0.95. |
| top_p | FLOAT | 0.700–1 | Another method of temperature sampling, value range is: [0.0, 1.0], default value is 0.7. |
| text | STRING | — | |
| clip | CLIP | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| CONDITIONING | CONDITIONING | — |
| STRING | STRING | — |