Resources · n8n integration

n8n OpenRouter Chat Model nodeConfigure OpenRouter Chat Model in n8n.

One credential, one dropdown, and a root node suddenly has a brain. The n8n OpenRouter Chat Model node is a sub-node: it never runs on its own and attaches to the Model port of an agent or a chain. Its 9 parameters cover model choice, sampling, length, timeout and retries.

Verified Trustpilot reviews · AI, automation & growth agency

Why automate

What does the n8n OpenRouter Chat Model node do?

It supplies the language model that a root node uses to think. In n8n, a root node such as an AI Agent or a chain receives the workflow items through its main input, and smaller nodes called sub-nodes clip onto its ports to give it a model, a memory or tools. This one clips onto the Model port and routes every prompt through an OpenRouter account, so switching model later is a dropdown change rather than a rebuild.

The first scenario is routing. A single workflow can carry several agents, each with its own copy of the node and its own model selected in Model, so a cheap fast model answers the easy branch and a heavier one handles the branch that needs reasoning. Nothing else in the workflow changes, because the root node keeps the same prompt and the same tools.

The second is a chat assistant that has to stay readable. Drop the node on an AI Agent, set Sampling Temperature low, cap Maximum Number of Tokens, and the replies posted back to a channel stay short and stable instead of drifting. The same setup feeds a drafting workflow that reads rows from Google Sheets and drafts the reply for a human to send.

The third is structured extraction. With Response Format on JSON, the model returns valid JSON that the next node can parse directly, which is what you want when the output becomes a record rather than a paragraph.

When should you prefer something else? If you only ever call one provider, its own sub-node is the shorter path: the OpenAI and Anthropic nodes exist for exactly that, and this node earns its place when you want one account in front of many models. The list in Model is loaded live from OpenRouter, so it only ever shows what that account can call.

The limits are worth knowing before you build. This is a sub-node, version 1 of the node: no main input, no standalone execution, and testing means running the root node it is attached to. Its 9 parameters are all it exposes, and anything beyond them belongs to the root node. On the billing side, n8n adds nothing on top, while the model provider charges its own API calls under its own terms. Our n8n review covers how that compares with other platforms.

Connect

How do you connect OpenRouter to n8n?

  1. 01

    Attach the node to a root node

    Start from the root node, not from this one. Open an AI Agent or a chain on the canvas and click the Model port underneath it, then pick OpenRouter Chat Model in the list. A sub-node has no main input and never runs on its own, so it only makes sense once it hangs off a root node. Nothing happens on the canvas until that link exists.

  2. 02

    Create the OpenRouter credential once

    Open the Credentials menu in n8n and create the credential for OpenRouter, then select it in the node. A credential in n8n is a saved set of connection details: you fill it once and every workflow on the same instance reuses it, on n8n Cloud as on a self-hosted instance. If several people build on the same instance, one credential is enough for all of their workflows.

  3. 03

    Pick a model and run the root node

    Open the Model dropdown. n8n loads the list live from OpenRouter and shows only the models that the account behind the credential can actually call, so an empty or short list usually points at the credential rather than at the node. Then execute the root node: that single run exercises the sub-node too, and the answer comes back through the port.

Connections

Where does the node plug in?

n8n splits AI work in two: a root node holds the logic and the workflow items, and sub-nodes clip onto its ports to lend it a capability. This node is a sub-node with a single output port.

Output (what it plugs into)

  • Modelai_languageModel
01ModelThe node connects through the Model port, which a root node reads when it needs a language model to generate text. One port takes one chat model, so swapping providers means swapping the sub-node.

The node connects through the Model port, which a root node reads when it needs a language model to generate text. One port takes one chat model, so swapping providers means swapping the sub-node.

Key parameters

  • Required: a root node that exposes the port, since the sub-node has no main input and never executes alone.
  • AI Agent and AI Agent Tool: the two agent nodes, for workflows where the model also calls tools.
  • Basic LLM Chain and Question and Answer Chain: simpler roots, when a single prompt or a question over documents is all you need.
Use cases
a support agent where the model answers and calls tools, or a single-prompt chain that drafts a reply for a human to approve.
Parameters

What can you configure on the node?

The OpenRouter Chat Model node has 9 parameters. For each one: the node as you configure it in n8n, what the parameter changes, and our field notes.

01

Model

model

What you see in n8n

Notes & use cases

This is the one setting you always touch: it names the model that generates the completion. n8n loads the list dynamically from OpenRouter, so the dropdown mirrors the account rather than a hardcoded catalog.

Key parameters

  • Model: the model which will generate the completion, loaded live from OpenRouter, showing only the models available to your account.
Use cases
two copies of the node in the same workflow, one model for the triage branch and another for the branch that drafts a reply, so a change of model stays a change of dropdown.
02

Frequency Penalty

options.frequencyPenalty

What you see in n8n

Notes & use cases

Repetition is the usual tell of a model stuck in a groove, restating the same line with slightly different words. Positive values push against tokens by how often they already appear in the text, which lowers the chance of that verbatim repeat.

Key parameters

  • Frequency Penalty: a number; positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
Use cases
long product descriptions generated in batch, where the same selling sentence keeps coming back on every row.
03

Maximum Number of Tokens

options.maxTokens

What you see in n8n

Notes & use cases

Length control, set as a budget rather than a word count. A token is the unit models count text in, and this value caps how many of them the completion may use.

Key parameters

  • Maximum Number of Tokens: a number capping the tokens generated in the completion; most models have a context length of 2048 tokens, except for the newest models, which support 32,768.
Use cases
a reply posted into a Slack thread, where a hard cap keeps the message readable instead of burying the channel.
04

Response Format

options.responseFormat

What you see in n8n

Notes & use cases

Decides the shape of what comes back, prose or machine-readable. JSON mode is what makes the answer safe to hand to the next node without cleaning it up first.

Key parameters

  • Text (text): a regular text response, the default shape for anything a human reads.
  • JSON (json_object): enables JSON mode, which should guarantee the message the model generates is valid JSON.
Use cases
an extraction step whose output becomes a row, where a stray sentence around the braces would break the parse downstream.
05

Presence Penalty

options.presencePenalty

What you see in n8n

Notes & use cases

Where the previous penalty counts how often a token appeared, this one only cares whether it appeared at all. Raise it and the model drifts toward subjects it has not mentioned yet.

Key parameters

  • Presence Penalty: a number; positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
Use cases
an idea generator that has to propose angles rather than circle back to the first one it found.
06

Sampling Temperature

options.temperature

What you see in n8n

Notes & use cases

Randomness, in one number. Lower it and completions get less random; as it approaches zero the model becomes deterministic and repetitive, which is exactly what a workflow wants when the same input should give the same output.

Key parameters

  • Sampling Temperature: a number controlling randomness; a higher temperature creates more diverse sampling but increases the risk of hallucinations.
Use cases
a classifier that has to return the same label twice for the same ticket, versus a copy draft where a bit of variety is the point.
07

Timeout

options.timeout

What you see in n8n

Notes & use cases

A ceiling on waiting. It sets the maximum amount of time a request is allowed to take, expressed in milliseconds, so a model that stalls fails the step instead of holding the execution open.

Key parameters

  • Timeout: a number, the maximum request time in milliseconds.
Use cases
a batch of long prompts running overnight, where one slow call should be dropped rather than allowed to block the rest of the queue.
08

Max Retries

options.maxRetries

What you see in n8n

Notes & use cases

Transient failures happen, and this decides how stubborn the node is about them. It sets the maximum number of retries to attempt before the step gives up and the error surfaces in the execution.

Key parameters

  • Max Retries: a number, the maximum number of retries to attempt on a request.
Use cases
a nightly run over many items, where a couple of retries rescue the job, and too many turn one bad prompt into a long queue of paid calls.
09

Top P

options.topP

What you see in n8n

Notes & use cases

The other dial on diversity, working through nucleus sampling: a value of 0.5 means half of all likelihood-weighted options are considered. A lower value tells the model to ignore the less probable options entirely.

Key parameters

  • Top P: a number controlling diversity via nucleus sampling; the guidance attached to the parameter is to alter this or Sampling Temperature, but not both.
Use cases
a rewrite step kept tight on vocabulary, where narrowing the pool is easier to reason about than touching temperature.
Need help

Need help automating OpenRouter Chat Model with n8n?

A person reads every message.

FAQ

OpenRouter Chat Model in n8n: common questions

01Is the n8n OpenRouter Chat Model node free?
Yes, on n8n's side. The node belongs to the AI package shipped with n8n, so there is nothing to install and nothing extra to pay, on n8n Cloud as on a self-hosted instance under the Community Edition and its Sustainable Use license. A workflow behaves the same way in both setups. What does cost money is the model itself: the provider behind the call invoices its own API usage under its own terms, and n8n adds nothing on top of that. So the honest answer is that the node is free and the completions are not.
02What do you need to make the node work?
Two things. First a credential for OpenRouter, created once in the Credentials menu of n8n and reused by every workflow on the instance. Second a root node to attach to, because this is a sub-node: it has no main input and never executes on its own. Connect it to the Model port of an AI Agent, a chain or another root node, select the credential, then pick a value in Model. If the dropdown comes back empty, look at the credential before you look at the node, since n8n builds that list live from the account.
03What are the limits of the node?
It does one job and exposes 9 parameters, nothing more. There is no main input, so it cannot sit in the middle of a workflow and cannot be executed alone: you run the root node and the sub-node runs with it. The page describes version 1 of the node, the highest in the catalog, and an older workflow may show fewer options. The model list is not fixed either, since n8n loads it from OpenRouter and shows only what the account can reach. Anything about prompts, tools or memory is set on the root node, not here.
04What should you plug in to get started?
At minimum, a root node and a credential. The simplest starting point is Basic LLM Chain: one prompt in, one completion out, with this node on its Model port and nothing else to configure. Once that runs, move up to an AI Agent when the model also needs to call tools, or to Information Extractor and Text Classifier when the job is fixed and the output has to be structured. Leave the options alone on the first run, then set Sampling Temperature and Maximum Number of Tokens once you have seen what the model returns.
05n8n or Make for AI models?
It depends on where the workflow has to live. n8n can be self-hosted with Docker or npm, or used on n8n Cloud, and the workflow is identical in both, which matters when the prompts carry data you would rather keep on your own servers. Make is hosted only, with no self-hosting option, and is billed per operation, so a chatty AI workflow shows up differently on the invoice. Both give you a visual canvas. Pick on hosting, on control over the data and on the cost model, not on a feature checklist.
Hack'celeration Lab

Get our weekly integration tips.

No spam. Unsubscribe anytime.