GLM-5.1
Z.ai's newest model, tool-calling enabled, with a bigger token budget
- messages
- text
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 -
nonedefault; flip tohighfor deliberate reasoning. - settings.temperature (1) - randomness.
- settings.systemPrompt - set behavior without an extra message node.
- toolChoice - enable to force tool calls; pair with
toolChoice.typeandtoolChoice.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.
Inputs (19)
| Name | Type | Default | Description |
|---|---|---|---|
| messages | RUNWARE_MESSAGES | — | |
| seedopt | INT | 00–9223372036854776000 | Random seed for reproducible generation. When not provided, a random seed is generated in the unsigned 32-bit range. |
| numberResultsopt | INT | 11–4 | Number of results to generate. Each result uses a different seed, producing variations of the same parameters. |
| includeUsageopt | BOOLEAN | false | Include token usage statistics in the response. |
| settings.frequencyPenaltyopt | BOOLEAN | false | Enable to set settings.frequencyPenalty. Off uses the model's default. |
| settings.frequencyPenalty_valueopt | FLOAT | -2.00-2–2 | Penalizes tokens based on their frequency in the output so far. A value of 0.0 disables the penalty. |
| settings.maxTokensopt | INT | 655361–131072 | Maximum number of tokens to generate in the response. |
| settings.presencePenaltyopt | BOOLEAN | false | Enable to set settings.presencePenalty. Off uses the model's default. |
| settings.presencePenalty_valueopt | FLOAT | -2.00-2–2 | Encourages the model to introduce new topics. A value of 0.0 disables the penalty. |
| settings.systemPromptopt | STRING | System-level instruction that guides the model's behavior and output style across the entire generation. | |
| settings.temperatureopt | FLOAT | 1.000–1 | Controls randomness in generation. Lower values produce more deterministic outputs, higher values increase variation and creativity. |
| settings.thinkingLevelopt | COMBO | none | Controls the depth of internal reasoning the model performs before generating a response. |
| toolChoiceopt | BOOLEAN | false | Enable to set toolChoice. Off uses the model's default. |
| toolChoice.nameopt | STRING | Name of the specific tool the model must call. Required when type is `tool`. | |
| toolChoice.typeopt | COMBO | (default) | Strategy the model uses to decide when and which tools to call. |
| settings.topPopt | BOOLEAN | false | Enable to set settings.topP. Off uses the model's default. |
| settings.topP_valueopt | FLOAT | 0.000–1 | Nucleus sampling parameter that controls diversity by limiting the probability mass. Lower values make outputs more focused, higher values increase diversity. |
| outputFormatopt | COMBO | TEXT | Output format for the generated text. |
| advanced_jsonopt | STRING | Optional JSON merged into the request. For: settings.stopSequences, tools |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |