Nodes/ComfyUI-GLM4/GLM文本对话
ComfyUI Node

GLM文本对话

The free prompt-expander that needs zero VRAM

By msola-ht·Created about a year ago·Updated about a year ago· 131
GLM文本对话
    • response_text
    text_system_prompt_preset视频扩写
    system_prompt_override
    api_key
    model_nameGLM-4.5-Flash
    temperature0.90
    top_p0.70
    max_tokens1024
    seed0
    text_input请扩写关于一只小狗在草地上玩耍的视频提示词。

    What it actually does

    You type "a small dog playing on a grassy lawn" into a box, and this node hands you back a full paragraph - the dog's coat, the light, the camera angle, the mood - ready to paste into a CLIP Text Encode. That's the whole job, and it's the same prompt-expansion trick LLM-in-graph workflows have been doing for years. No model download, no VRAM, no GPU. GLM_Text_Chat is an API wrapper: it packages your text, phones home to Zhipu AI's GLM API (the Z.ai behind the open GLM and CogVideoX lines), and drops the reply back into your graph as a plain string.

    Why you'd reach for it (and the free bit)

    The usual advice for prompt enhancement is a local abliterated 8B model - offline, uncensored, free per call. But local means budgeting VRAM for a second model that has to share your card with the diffusion model. This node takes the opposite door. It's an API call, and here's the thing the README leads with: the default model, GLM-4.5-Flash, is free. Zhipu's Flash tier is the giveaway model line, and the whole pack is built around it. So you get a cloud LLM inside the graph that costs nothing per call and eats no VRAM. That's the reason this pack exists.

    The honest caveats come straight from the API-node playbook: your prompt leaves the machine, and Zhipu's model runs its own content filter. Don't wire anything through it you wouldn't paste into a cloud chatbot.

    The inputs that matter

    • text_system_prompt_preset - the instruction the model follows. Three to pick from: 视频扩写 (video prompt expansion), Flux扩写 (FLUX-style expansion), and Flux Kontext (command-style prompts for FLUX Kontext's dual-image editing). Default is video expansion.
    • system_prompt_override - fill this in and it beats the preset. That's the escape hatch when the built-ins aren't your style.
    • api_key - leave it blank and the node falls back to the ZHIPUAI_API_KEY env var, then to config.json in the pack folder.
    • model_name - defaults to GLM-4.5-Flash. Keep it on the Flash line or the "free" part of this story dies.
    • text_input - your rough idea, multiline.

    There's also temperature (0.9), top_p (0.7), max_tokens (1024) and seed. Here's the trap: the seed is cosmetic. The tooltip says it flat out - it only affects randomness inside the node, not the Zhipu model's output, because the API doesn't accept a seed. Set it to anything; nothing reproducible happens.

    The single output is response_text, a plain STRING. Wire it into a CLIP Text Encode, a text display node, or any STRING input. The common move is chaining it straight into a FLUX or video sampler.

    Installing it

    cd ComfyUI/custom_nodes
    git clone https://github.com/msola-ht/ComfyUI-GLM4.git
    cd ComfyUI-GLM4
    pip install -r requirements.txt
    

    Then restart ComfyUI. ComfyUI Manager also has it - search "ComfyUI-GLM4". Dependencies are light: zhipuai, Pillow, numpy - all pip-installable, no torch or CUDA wrangling (ComfyUI already ships those).

    Then the key: sign up at bigmodel.cn, generate an API key, and paste it into the node, set ZHIPUAI_API_KEY in your environment, or drop it into the pack's config.json.

    Troubleshooting

    • "API Key 未提供" comes out as the node's output text. The key didn't resolve anywhere. Check the node field, env var, and config.json. Note the pattern: this pack returns errors as its output string rather than crashing ComfyUI. Easy to miss, but genuinely friendlier than a hard crash.
    • The free tier stopped being free? Only if you wandered off the Flash models. The README bumped GLM-4.5-Flash to default; stick to the Flash line and you're on the free quota.
    • Chinese display names. The node shows up as "GLM文本对话" and the README is Chinese. English speakers end up navigating by class name (GLM_Text_Chat), because that's what the search and save function use.
    • Maintenance is thin. This is a one-person hobby pack. The README's own changelog admits Zhipu updated their Python library and the plugin "still works but needs a rebuild." If a future API change breaks it, don't be shocked.

    Set expectations while you're at it: it's a prompt expander, not a writer. Competent, structured detail - not GPT-4-class prose. For zero VRAM and zero dollars, that's a fair trade.

    CategoryGLM

    Inputs (9)

    NameTypeDefaultDescription
    text_system_prompt_presetCOMBO视频扩写3 options: 视频扩写, Flux扩写, Flux Kontext
    system_prompt_overrideSTRING
    api_keySTRING
    model_nameSTRINGGLM-4.5-Flash
    temperatureFLOAT0.900–1
    top_pFLOAT0.700–1
    max_tokensINT10241–4096
    seedINT00–18446744073709550000设置为0时,每次运行生成随机种子;设置为其他值时,使用固定种子。注意:此种子仅影响ComfyUI节点内部的随机数生成,不直接影响智谱AI模型的输出结果。
    text_inputSTRING请扩写关于一只小狗在草地上玩耍的视频提示词。

    Outputs (1)

    NameTypeDescription
    response_textSTRING