openrouter-thinking

OpenRouter chat model for n8n with a Reasoning Effort control (none to max), a max tokens option that reaches the request, and reasoning carried across tool calls.

Package Information

Released: this month
Downloads: 0 weekly / 0 monthly
Latest Version: 0.1.0
Author: Dr. Enes Karaaslan

Documentation

OpenRouter

n8n-nodes-openrouter-thinking

OpenRouter chat model for n8n with reasoning effort control.
The setting the built-in node never exposed.

npm MIT n8n community node


The problem

n8n's OpenRouter chat node has no way to set how hard a model reasons.
OpenRouter supports this for every reasoning model through one
reasoning parameter,
but the built-in node never sends it, so every call runs at the provider
default.

The fix

The same node with a Reasoning Effort dropdown, sent as OpenRouter's
unified reasoning object. OpenRouter maps it to each provider's own control:
OpenAI's reasoning_effort, Anthropic's and Gemini's thinking budgets, and so on.

Setting Sent as
API Default (omitted)
None reasoning: { effort: "none" } (off where the model allows it)
Minimal / Low / Medium / High reasoning: { effort: "minimal" | "low" | "medium" | "high" }
Extra High reasoning: { effort: "xhigh" }
Max reasoning: { effort: "max" }
Custom Token Budget reasoning: { max_tokens: <n> }

Exclude Reasoning From Response (under Options) adds exclude: true: the
model still reasons but the text is not returned.

In the model dropdown, models whose OpenRouter listing supports reasoning are
marked Supports reasoning effort. Models without reasoning ignore the
setting.

Maximum Number of Tokens

The option is sent as max_tokens on every request. Tests check the actual
HTTP body. The built-in node's 32,768 ceiling is gone.

max_tokens caps everything the model generates, reasoning included.
With a high effort on a small cap, the model can spend the whole budget
thinking and return a short or empty answer. OpenRouter also sizes Anthropic
and Gemini thinking budgets as a share of max_tokens. Leave room for both,
or use -1 for the model default.

If a provider behind a model ignores the limit, turn on Provider Routing →
Require Parameters
. OpenRouter then only uses providers that support every
parameter in the request.

Works inside an AI Agent with tools

With reasoning on, OpenRouter returns reasoning_details (text, summary and
encrypted blocks, some signed) and expects them back on later requests of a
tool-calling round:

  • Gemini fails the second leg with Function call is missing a thought_signature.
  • Anthropic needs its signed thinking blocks back.
  • OpenAI continues from its encrypted reasoning.

LangChain drops the field. This node carries it across turns, matched by tool
call id. It does so for plain and streamed responses (n8n streams when the
workflow uses a streaming Chat Trigger) and through long tool loops. The
reasoning is also attached to the returned message as
additional_kwargs.reasoning / reasoning_details and read back from incoming
messages. n8n's AI Agent v3 relies on that, because it rebuilds messages
from stored metadata with a fresh model instance each round.

If a provider still rejects a request over missing reasoning, the error ends
with a bracketed note listing which tool-call turns had nothing to restore.

Exclude Reasoning may also drop the blocks a tool loop needs. Leave it
off for agents that call tools on Gemini or Anthropic models.

Install

Community Nodes UI: Settings → Community nodes → Install:

n8n-nodes-openrouter-thinking

Self hosted, from source:

git clone https://github.com/pirazor/n8n-nodes-openrouter-thinking.git
cd n8n-nodes-openrouter-thinking && npm install && npm run build
cp -r . ~/.n8n/custom/n8n-nodes-openrouter-thinking   # then restart n8n

Usage

  1. Add OpenRouter Chat Model (Thinking).
  2. Select your existing OpenRouter credential. The node reuses n8n's built-in
    openRouterApi credential, so there is nothing new to configure.
  3. Pick a model and a Reasoning Effort.
  4. Connect the node to an AI Agent's Model input.

Everything else from the built-in node works as before: temperature, top P,
penalties, JSON response format, timeout, retries and the full Provider
Routing block. The model's reasoning appears next to its answer in the
sub-node's output panel.

Tip: reasoning costs latency and tokens. None or Minimal on
classification and extraction steps is often the biggest speedup in an agent
pipeline.

If the node does not appear in an Agent's Model dropdown, set
N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true and restart n8n.

License

MIT © 2026 Dr. Enes Karaaslan, Connected Wise LLC

Not affiliated with or endorsed by OpenRouter or n8n GmbH.

Discussion