Gemini Thinking Config
One slider that controls how hard Gemini thinks — and how big your bill gets
- thinking_config_json
Here's a config node that's easy to underestimate because it looks like a form with one field. It builds a JSON blob that tells a Gemini model how much to think before it answers - NONE, LOW, NORMAL, or HIGH - and optionally caps the token budget for that thinking. Then it outputs the settings as JSON for the pack's Text Generation and Prompt Refiner nodes to consume.
The deeper point: on modern Gemini models, "thinking" isn't a side feature, it's a paid dial. Reasoning tokens are billed separately from the answer. NONE is a fast, cheap direct answer; HIGH is a model that deliberates over structure, edge cases, and wording before producing output. For most prompt-refinement and text-generation jobs in a ComfyUI pipeline - where the LLM's job is short structured rewriting - NONE or LOW is genuinely enough, and the KB's llm-in-comfyui.md makes the sharper version of this argument: the job selects for small and obedient, not large and clever. But when you do want the reasoned take (a complex multi-step instruction, a tricky composition prompt), this node is how you ask for it consistently.
How it works
Two inputs, one JSON output. thinking_level selects from the four levels and thinking_budget caps the maximum tokens the model may spend reasoning (0 = the model's own default). The node serializes both into a JSON string and returns it as thinking_config_json.
Here's the honest bit: the Text Generation node carries its own thinking_level and thinking_budget fields (Prompt Refiner has just thinking_level) rather than consuming this JSON directly. So the real job of this node is to be the reusable, centralized version of that setting - build the config once here, keep it as a documented artifact in your workflow, and pass the JSON along to anything that accepts a thinking config string (your own custom tooling, an API call, or a node added later that does wire it in). It's the same "one shared setting, many consumers" pattern as the Safety Settings node, applied to reasoning.
Inputs and outputs
thinking_level- NONE / LOW / NORMAL / HIGH. The main dial. Default NONE.thinking_budget- max thinking tokens, 0 to 100,000. 0 = model default.- Output:
thinking_config_json(STRING).
How to install it
Pack-level, same as every Gemini node:
cd ComfyUI/custom_nodes
git clone https://github.com/IxMxAMAR/ComfyUI-API-Toolkit
cd ComfyUI-API-Toolkit
pip install -r requirements.txt
or "API Toolkit" from ComfyUI Manager. Needs google-genai>=0.8.0. No key needed here - it only builds JSON.
Common issues
The trap is assuming HIGH is always better. It's not - it's slower and more expensive, and for routine rewriting the extra deliberation rarely lands in the output. If you set HIGH on every node and your pipeline got 3x slower, this is why.
Second gotcha: since it outputs plain JSON text, make sure the node you wire it into actually accepts a config string - if a consumer node only has its own thinking_level dropdown, passing JSON won't help it. Match the format to the consumer. And worth repeating from the pack-wide rules: API nodes re-run every queue, so if this feeds a thinking-enabled TextGen, each run bills the thinking tokens - budget your reasoning like the paid resource it is.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| thinking_level | COMBO | NONE | How much the model should 'think' before answering. |
| thinking_budgetopt | INT | 00–100000 | Max thinking tokens (0 = model default). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| thinking_config_json | STRING | — |