GLM扩写高质量提示词
Free image-to-prompt expansion via Zhipu's GLM-4V-Flash
- expanded_prompt
The most interesting thing about this node isn't the node - it's the model it defaults to. glm-4v-flash is Zhipu's (智谱AI) free vision model, and this node wraps it as an image-to-prompt expander: feed it an image, get back a polished English prompt. If you're tired of paying per call for prompt expansion, the free GLM flash tier is a legit reason to reach for this one. It's the "GLM扩写高质量提示词" node, part of ComfyUI_LLM_Banana, and it's the sibling of the Comfly expander - same job, different provider.
One catch that's easy to miss: this node does not take an IMAGE wire. Its required input is image_base64, a STRING containing a base64-encoded image. The image input is optional and may not be wired the way you expect - check the brief carefully. You'll often want to base64-encode your image upstream, or pass an image_url instead. That's the kind of quirk that makes people bounce off this node on their first attempt.
How it works
It posts the image (base64 or URL) to Zhipu's OpenAI-compatible API (open.bigmodel.cn), with a system prompt chosen by the image_prompt_preset dropdown - the same six presets as the Comfly expander: generic English description, Flux, video, Flux Kontext, poster design, meme/sticker design. The model writes the comma-separated prompt, quality words appended, and hands it back as a string.
The inputs that matter
model_name- defaults toglm-4v-flash(free). 21 options in the dropdown:glm-4v-plus,glm-4.5v,glm-4,glm-4-air, the dated flash variants, and more. Only the vision ones (glm-4v*) can describe an image.api_key- your Zhipu key from bigmodel.cn. It also readsZHIPUAI_API_KEYfrom the environment orGlm_Config.json.image_prompt_preset- shapes the output dialect for your target model.image_base64- the actual image, as base64 text. This is the required path.image_url(optional) - skip base64 and hand it a URL instead.user_prompt/user_requirement- content to include, and constraints to obey.temperature,seed- sampling knobs.
Output is expanded_prompt (STRING). Feed it into your text encoder.
Install
ComfyUI Manager, search ComfyUI_LLM_Banana, or:
cd ComfyUI/custom_nodes
git clone https://github.com/xuchenxu168/ComfyUI_LLM_Banana
cd ComfyUI_LLM_Banana
pip install -r requirements.txt
The pack's requirements include zhipuai, so the SDK comes along automatically. Restart, find the node under Ken-Chen.
Gotchas
The base64 requirement is the number one stumble - if the node produces nothing, check you're actually feeding base64 text, not an image tensor. Free flash tier has rate limits, so batch your expansion carefully if you're processing a dataset. And like every node in this pack, a real API key is involved: don't share workflows with your key embedded.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| image_prompt_preset | COMBO | 通用高质量英文描述 | 6 options: 通用高质量英文描述, Flux描述, 视频描述, Flux Kontext, 海报设计提示词, 表情包设计绘图提示词 |
| api_key | STRING | — | |
| model_name | COMBO | glm-4v-flash | 21 options: glm-4.5v, glm-4, glm-4v, glm-4v-plus, glm-4v-flash, glm-4-air, +15 |
| image_base64 | STRING | — | |
| system_prompt | STRING | ## 角色设定 (System Role): 你是一名专业的图像描述专家。你的任务是将图片内容转化为高质量的英文提示词,用于文本到图像的生成模型。 ## 任务说明 (User Instruction): 请仔细观察提供的图片,并生成一段详细、具体、富有创造性的英文短语,描述图片中的主体对象、场景、动作、光线、材质、色彩、构图和艺术风格。 ## 输出要求 (Output Requirements): ** **语言**: 严格使用英文。 ** **细节**: 尽可能多地描绘图片细节,包括但不限于物体、人物、背景、前景、纹理、表情、动作、服装、道具等。 ** **角度**: 尽可能从多个角度丰富描述,例如特写、广角、俯视、仰视等,但不要直接写“角度”。 ** **连接**: 使用逗号(,)连接不同的短语,形成一个连贯的提示词。 ** **人物**: 描绘人物时,使用第三人称(如 'a woman', 'the man')。 ** **质量词**: 在生成的提示词末尾,务必添加以下质量增强词:`, best quality, high resolution, 4k, high quality`。 ## 只生成提示词,不需要描述过程及其他,并且一定要在质量词 | — |
| user_prompt | STRING | — | |
| user_requirement | STRING | — | |
| temperature | FLOAT | 0.700–1 | — |
| seed | INT | 00–18446744073709550000 | — |
| image_urlopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| expanded_prompt | STRING | — |