ComfyUI Node

Gemma 4 31B

A 31B reasoning model inside your ComfyUI graph — with no GPU of your own

By Runware·Created 2 years ago·Updated about a month ago· 140
Gemma 4 31B
  • messages
  • images
  • text
seed0
numberResults1
includeUsagefalse
settings.frequencyPenalty0.00
settings.maxTokensfalse
settings.maxTokens_value1
settings.minP0.00
settings.presencePenalty0.00
settings.repetitionPenalty1.00
settings.systemPrompt
settings.temperaturefalse
settings.temperature_value0.00
settings.thinkingLevelhigh
settings.topKfalse
settings.topK_value1
settings.topPfalse
settings.topP_value0.00
outputFormatTEXT
advanced_json

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 - off or high (default high). This is a reasoning model; high gives it room to think before answering. Drop to off when you need fast, cheap, straight answers - for many pipeline tasks you don't want the reasoning overhead.
  • images - an IMAGE input, 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 paired settings.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 (with temperature_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.

CategoryRunware/Text/google

Inputs (21)

NameTypeDefaultDescription
messagesRUNWARE_MESSAGES
imagesoptIMAGE
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.frequencyPenaltyoptFLOAT0.000–2Penalizes tokens based on their frequency in the output so far. A value of 0.0 disables the penalty.
settings.maxTokensoptBOOLEANfalseEnable to set settings.maxTokens. Off uses the model's default.
settings.maxTokens_valueoptINT1Maximum number of tokens to generate in the response.
settings.minPoptFLOAT0.000–1Minimum probability threshold. Tokens with probability below this value are excluded from sampling.
settings.presencePenaltyoptFLOAT0.00-2–2Encourages the model to introduce new topics. A value of 0.0 disables the penalty.
settings.repetitionPenaltyoptFLOAT1.000–2Penalizes tokens that have already appeared in the output. A value of 1.0 disables the penalty.
settings.systemPromptoptSTRINGSystem-level instruction that guides the model's behavior and output style across the entire generation.
settings.temperatureoptBOOLEANfalseEnable to set settings.temperature. Off uses the model's default.
settings.temperature_valueoptFLOAT0.000–2Controls randomness in generation. Lower values produce more deterministic outputs, higher values increase variation and creativity.
settings.thinkingLeveloptCOMBOhighControls the depth of internal reasoning the model performs before generating a response.
settings.topKoptBOOLEANfalseEnable to set settings.topK. Off uses the model's default.
settings.topK_valueoptINT11–100Top-K sampling parameter that limits the number of highest-probability tokens considered at each step.
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: inputs.videos, settings.stopSequences

Outputs (1)

NameTypeDescription
textSTRING