Gemma 4 31B
A 31B reasoning model inside your ComfyUI graph — with no GPU of your own
- messages
- images
- text
ComfyUI isn't just for images anymore, and this node is a good demonstration of why. Gemma 4 31B is Google's open-weights reasoning model, and the Runware pack serves it as a text node: you build a conversation, it thinks, and out comes a string. Why would you want a 31B LLM inside a ComfyUI canvas? Because text nodes have become the plumbing of complex workflows - prompt rewriting, captioning, workflow logic, a helper agent that decides which branch to take. If you'd rather not run a 31B model locally (which on most home GPUs means slow or out-of-memory), this gives you the capability on demand, billed per request.
The thing to understand up front is that this is a cloud inference node, not a local loader. There's no GGUF to download, no KV-cache to manage. You hand the API a chat log and it returns text. The node's job is to turn that round-trip into something ComfyUI-friendly.
How it works
Text nodes in this pack work via a Runware Messages builder. The node's required messages socket takes a chain of message objects (role: user or assistant, plus content) - you stack them to build a conversation, then the node sends a textInference request and joins the results into a single text output. Note the advanced_json escape hatch on this node: it's merged raw into the request, and the tooltip names inputs.videos and settings.stopSequences as the things you can't reach any other way. So if you need a video fed to the model, or want to stop generation at a specific token sequence, that's where it goes.
The inputs that matter
messages(required) - the conversation, via Runware Messages.settings.systemPrompt(a plain multiline string, separate from the builder) is where you set the model's overall behavior - style, role, constraints. For a prompt-rewriting workflow this is the most important widget on the node.settings.thinkingLevel-offorhigh(defaulthigh). This is a reasoning model;highgives it room to think before answering. Drop tooffwhen you need fast, cheap, straight answers - for many pipeline tasks you don't want the reasoning overhead.images- anIMAGEinput, so this is a vision-capable model too. Wire a generated image in and ask it to describe or critique it.settings.maxTokens- an off-by-default gate with a pairedsettings.maxTokens_value. Leave the gate off to use the model default; toggle it on if you need to cap output length.settings.temperature- likewise a gate (withtemperature_value, 0–2). Off = model default, which is the sane choice for deterministic workflow logic. On = you're doing creative writing.settings.topK/settings.topP/settings.minP/ the penalty sliders - sampler tuning for the brave. For pipeline use, leave them.numberResults(1–4) - multiple answers with different seeds. Handy when you want to pick the best of a few caption drafts.includeUsage- returns token-usage stats in the response if you want to keep an eye on spend.
The single output is text (a STRING). Wire it into any text-input socket in your graph - a prompt field, a filename builder, a switch.
Installing
ComfyUI Manager → search Runware → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Runware/ComfyUI-Runware
pip install -r ComfyUI-Runware/requirements.txt
Then set your API key in ComfyUI Settings → Runware API key, via the RUNWARE_API_KEY env var, or runware auth login. Nothing to download - the model lives on Runware's side.
Where people trip up
The most common gotcha is expecting a ComfyUI-native image or hidden state out of a text node - it's a plain string, so if you're feeding it into an image pipeline you need an intermediate node that parses text. Second, remember the maxTokens gate is off by default: if the model's output is getting truncated for you and you need longer answers, flip the gate and raise the value, don't assume you have to live with it. And cost - every call is metered, and the title bar shows each run's price. A 31B reasoning model with thinkingLevel: high can chew through tokens; the includeUsage toggle is there so you can actually see it.
Inputs (21)
| Name | Type | Default | Description |
|---|---|---|---|
| messages | RUNWARE_MESSAGES | — | |
| imagesopt | IMAGE | — | |
| 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 | FLOAT | 0.000–2 | Penalizes tokens based on their frequency in the output so far. A value of 0.0 disables the penalty. |
| settings.maxTokensopt | BOOLEAN | false | Enable to set settings.maxTokens. Off uses the model's default. |
| settings.maxTokens_valueopt | INT | 1 | Maximum number of tokens to generate in the response. |
| settings.minPopt | FLOAT | 0.000–1 | Minimum probability threshold. Tokens with probability below this value are excluded from sampling. |
| settings.presencePenaltyopt | FLOAT | 0.00-2–2 | Encourages the model to introduce new topics. A value of 0.0 disables the penalty. |
| settings.repetitionPenaltyopt | FLOAT | 1.000–2 | Penalizes tokens that have already appeared in the output. A value of 1.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 | BOOLEAN | false | Enable to set settings.temperature. Off uses the model's default. |
| settings.temperature_valueopt | FLOAT | 0.000–2 | Controls randomness in generation. Lower values produce more deterministic outputs, higher values increase variation and creativity. |
| settings.thinkingLevelopt | COMBO | high | Controls the depth of internal reasoning the model performs before generating a response. |
| settings.topKopt | BOOLEAN | false | Enable to set settings.topK. Off uses the model's default. |
| settings.topK_valueopt | INT | 11–100 | Top-K sampling parameter that limits the number of highest-probability tokens considered at each step. |
| 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: inputs.videos, settings.stopSequences |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |