Nodes/ComfyUI_fsdymy/ZhiPu Ai Node (fsdymy)
ComfyUI Node

ZhiPu Ai Node (fsdymy)

A cloud LLM that rewrites your prompt while you stay in ComfyUI

By fsdymy1024·Created 2 years ago·Updated 2 years ago· 12
ZhiPu Ai Node (fsdymy)
    • text
    • messages
    • session_history
    prompt1girl
    system_content你是创意绘梦师,一个图形创意生成助手。你的任务是根据用户的提示词,生成富有创意和艺术感的图形。你的能力有: 1. 理解用户提供的提示词,分析其背后的意图和需求。 2. 运用先进的人工智能技术,结合艺术创意,生成独特的图形作品。 3. 提供多种图形风格和元素,满足用户不同的审美需求。 4. 使用英文回答。
    modelglm-4
    seed0
    context_size1

    This is the pack's most interesting node, and also the one with the most setup attached. Instead of running a local LLM on your GPU, it calls Zhipu AI's (智谱AI, bigmodel.cn) cloud chat API - the GLM family - to expand and rewrite your prompt. That's the "LLM-assisted prompting" pattern the community converged on: an LLM that understands language writes the instruction, your image model renders it. It went from a browser-tab trick to a whole node category because it fits the architecture rather than fighting it. This node is the Chinese-market, no-local-weights version of that idea: you pay Zhipu per call, you need no GPU headroom for the LLM part.

    How it works

    Read the source and the shape is clear. The node keeps a session_history list in memory on the node instance. Each run it builds a message list: your system_content first, then the last context_size turns of the conversation, then your new prompt. It sends that to Zhipu's chat.completions.create, gets the reply, and appends both your prompt and the reply to the history. context_size (0–30, default 1) crops how much memory is kept - set it to 0 and every call is stateless, which is what you want for one-shot prompt expansion.

    The inputs that matter

    • prompt - your rough idea ("1girl" is the default). Multiline.
    • system_content - the system prompt, and the real lever. The default is a Chinese "creative dream-painter" assistant instructed to answer in English. Change this to control output format: for a tag-based model like Illustrious you want it told to emit comma-separated booru tags; for an LLM-encoded model you want structured prose. This is where you do the steering.
    • model - defaults to glm-4; the list also has glm-4-flash, glm-4-air, glm-4v, and several 2024-era variants. glm-4-flash is the cheap/free-tier chat model and is the sane default for this job. Don't pick embedding-2 or charglm-3 - they're not chat-completion models and the call will fail.
    • context_size - how many prior turns of memory to keep, default 1.
    • seed - present in the schema, but here's the honest part: the code never actually uses it. It's a vestigial input left over from an earlier design. Any value does the same thing.

    Outputs

    Three strings. text is the expanded prompt - that's the one you care about; wire it into a text-to-prompt path or just copy it into your CLIP encode. messages is a JSON dump of everything sent in this call, handy for debugging. session_history is the running conversation as JSON.

    Setup, because there is setup

    You need a Zhipu account and API key from bigmodel.cn. Then edit the pack's key.json - the shipped default key is literally "xxx", so nothing works until you change it:

    { "url": "https://open.bigmodel.cn/api/paas/v4", "key": "your-real-key-here" }
    

    It lives at ComfyUI/custom_nodes/ComfyUI_fsdymy/key.json. Install the pack with ComfyUI Manager (search "ComfyUI_fsdymy") or git clone https://github.com/fsdymy1024/ComfyUI_fsdymy, and its requirements.txt installs the zhipuai SDK. Then restart.

    Where people get burned

    • No key or a bad key → the node errors on the first run. That's not a bug; there's no UI for the key, only the file.
    • It needs internet. Your prompt text leaves your machine for Zhipu's API. Fine for most people, a hard no if you work offline or under strict data policies.
    • Session memory lingers. Because history lives on the node instance, the conversation accumulates across runs until you reload the workflow. That can be a feature (multi-turn refinement) or a footgun when it quietly changes what the model thinks you meant. context_size: 0 kills it.
    • The model list is frozen in 2024. Zhipu has moved on; the node's list hasn't. glm-4 still works, but expect the bleeding edge to be missing.

    The pack itself is a single-commit, unmaintained hobby repo, and this node is the part most likely to drift as the API changes. For one-off prompt expansion it's genuinely handy. For production workflows, the key-file setup and stale model list make me reach for a more maintained LLM node - but if you're already a bigmodel.cn customer and want the Chinese-market path, this works.

    Categoryfsdymy

    Inputs (5)

    NameTypeDefaultDescription
    promptSTRING1girl
    system_contentSTRING你是创意绘梦师,一个图形创意生成助手。你的任务是根据用户的提示词,生成富有创意和艺术感的图形。你的能力有: 1. 理解用户提供的提示词,分析其背后的意图和需求。 2. 运用先进的人工智能技术,结合艺术创意,生成独特的图形作品。 3. 提供多种图形风格和元素,满足用户不同的审美需求。 4. 使用英文回答。
    modelCOMBOglm-410 options: glm-4, glm-4-0520, glm-4-alltools, glm-4v, glm-4-flash, glm-4-airx, +4
    seedINT00–18446744073709550000
    context_sizeINT10–30

    Outputs (3)

    NameTypeDescription
    textSTRING
    messagesSTRING
    session_historySTRING