Nodes/AlekPet/ComfyUI_Custom_Nodes_AlekPet/ChatGLM-4 Translate CLIP Text Encode Node
ComfyUI Node

ChatGLM-4 Translate CLIP Text Encode Node

LLM translation fused straight into conditioning

By AlekPet·Created 3 years ago·Updated 5 days ago· 1,519
ChatGLM-4 Translate CLIP Text Encode Node
  • clip
  • CONDITIONING
  • STRING
from_translateru
to_translateen
modelglm-4.5-flash
max_tokens1024
temperature0.95
top_p0.70
text

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 (default ru) / to_translate (default en) - 133 language codes each; set your actual source language explicitly, there's no auto.
  • model (default glm-4.5-flash) - 16 GLM model choices. Stick with a -flash model 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, dialing temperature down from the chat-tuned default of 0.95 will get you more consistent, literal output.
  • Outputs: CONDITIONING (into your sampler) and STRING (the translated text - wire to a PreviewTextNode so 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.

CategoryAlekPet Nodes/conditioning

Inputs (8)

NameTypeDefaultDescription
from_translateCOMBOruTranslation from
to_translateCOMBOenTranslation to
modelCOMBOglm-4.5-flashThe model code to be called. Models with text 'flash' should be free!
max_tokensINT1024The maximum number of tokens for model output, maximum output is 4095, default value is 1024.
temperatureFLOAT0.950–1Sampling 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_pFLOAT0.700–1Another method of temperature sampling, value range is: [0.0, 1.0], default value is 0.7.
textSTRING
clipCLIP

Outputs (2)

NameTypeDescription
CONDITIONINGCONDITIONING
STRINGSTRING