ComfyUI Node

GLM-5.1

Z.ai's newest model, tool-calling enabled, with a bigger token budget

By Runware·Created 2 years ago·Updated about a month ago· 140
GLM-5.1
  • messages
  • text
seed0
numberResults1
includeUsagefalse
settings.frequencyPenaltyfalse
settings.frequencyPenalty_value-2.00
settings.maxTokens65536
settings.presencePenaltyfalse
settings.presencePenalty_value-2.00
settings.systemPrompt
settings.temperature1.00
settings.thinkingLevelnone
toolChoicefalse
toolChoice.name
toolChoice.type(default)
settings.topPfalse
settings.topP_value0.00
outputFormatTEXT
advanced_json

GLM-5.1 is Z.ai's newest-generation LLM in Runware's catalog, and compared to its 4.7 sibling, this node is where the company's roadmap shows up in the details: a doubled token budget, a proper tool-calling surface, and a tighter set of gates. If you want the current state of the GLM line inside a ComfyUI graph - for prompt engineering, captioning, agent-style workflows - this is the node. It's the same shape as every text node in the pack, but it reads like the model Z.ai actually ships to people who build things, not just to chat.

The structural difference you'll feel first: where GLM-4.7 exposes a big open menu of sampling knobs, GLM-5.1 gates them. settings.frequencyPenalty, settings.presencePenalty, and settings.topP are all on/off toggles, each revealing its value field only when you flip it. That's the pack's signature design, and here it's doing you a favor - the model's defaults are good, and the gates keep the surface honest. settings.thinkingLevel is back (off by default, "high" available for deep reasoning), and the toolChoice block from the Grok node is here too: type strategy plus a specific tool name, with advanced_json carrying settings.stopSequences and tools schemas when you go agent-mode.

How it works

Standard pack machinery: messages (required RUNWARE_MESSAGES socket, built with Runware/Params → Messages builders), request over REST via the runware-sdk, STRING output. The dials that matter on first contact:

  • settings.maxTokens (65536) - twice the 4.7 budget; enough headroom for reasoning output plus a long answer.
  • settings.thinkingLevel - none default; flip to high for deliberate reasoning.
  • settings.temperature (1) - randomness.
  • settings.systemPrompt - set behavior without an extra message node.
  • toolChoice - enable to force tool calls; pair with toolChoice.type and toolChoice.name.
  • settings.frequencyPenalty / presencePenalty / topP - gated toggles; the model's defaults apply until you open them.

Plus seed, numberResults, includeUsage, outputFormat (TEXT).

The inputs that matter

For most runs: one user Messages node into messages, maybe a settings.systemPrompt, and hit queue. The 65536-token ceiling means you can actually lean on settings.thinkingLevel at high without immediately truncating - that's the intended combo, and it's the reason to pick 5.1 over 4.7. Enable toolChoice only when you have tools schemas in advanced_json; turning it on with no tools defined will frustrate you.

Install and API key

Install once for the whole pack:

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

Restart ComfyUI (or install Runware from ComfyUI Manager). API key from runware.ai/api-keys, set in ComfyUI Settings → Runware API key, exported as RUNWARE_API_KEY, or via runware auth login.

Gotchas

The gated toggles are the main thing that will confuse you for five minutes: set settings.topP's switch on before you expect settings.topP_value to appear - the value widget is literally invisible until the gate is open, and a value you set "earlier" while it was gated may not stick. Watch token math with thinking on: 65536 is big but "high" reasoning plus a long answer can still meet it, so keep includeUsage on if you care. And if a knob doesn't behave, update the pack first (this is the newest GLM in the catalog, and the schema keeps moving), then blame the model.

CategoryRunware/Text/zai

Inputs (19)

NameTypeDefaultDescription
messagesRUNWARE_MESSAGES
seedoptINT00–9223372036854776000Random seed for reproducible generation. When not provided, a random seed is generated in the unsigned 32-bit range.
numberResultsoptINT11–4Number of results to generate. Each result uses a different seed, producing variations of the same parameters.
includeUsageoptBOOLEANfalseInclude token usage statistics in the response.
settings.frequencyPenaltyoptBOOLEANfalseEnable to set settings.frequencyPenalty. Off uses the model's default.
settings.frequencyPenalty_valueoptFLOAT-2.00-2–2Penalizes tokens based on their frequency in the output so far. A value of 0.0 disables the penalty.
settings.maxTokensoptINT655361–131072Maximum number of tokens to generate in the response.
settings.presencePenaltyoptBOOLEANfalseEnable to set settings.presencePenalty. Off uses the model's default.
settings.presencePenalty_valueoptFLOAT-2.00-2–2Encourages the model to introduce new topics. A value of 0.0 disables the penalty.
settings.systemPromptoptSTRINGSystem-level instruction that guides the model's behavior and output style across the entire generation.
settings.temperatureoptFLOAT1.000–1Controls randomness in generation. Lower values produce more deterministic outputs, higher values increase variation and creativity.
settings.thinkingLeveloptCOMBOnoneControls the depth of internal reasoning the model performs before generating a response.
toolChoiceoptBOOLEANfalseEnable to set toolChoice. Off uses the model's default.
toolChoice.nameoptSTRINGName of the specific tool the model must call. Required when type is `tool`.
toolChoice.typeoptCOMBO(default)Strategy the model uses to decide when and which tools to call.
settings.topPoptBOOLEANfalseEnable to set settings.topP. Off uses the model's default.
settings.topP_valueoptFLOAT0.000–1Nucleus sampling parameter that controls diversity by limiting the probability mass. Lower values make outputs more focused, higher values increase diversity.
outputFormatoptCOMBOTEXTOutput format for the generated text.
advanced_jsonoptSTRINGOptional JSON merged into the request. For: settings.stopSequences, tools

Outputs (1)

NameTypeDescription
textSTRING