- Home
- Resources
- Integrations
- OpenRouter Chat Model
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
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.
How do you connect OpenRouter to n8n?
- 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.
- 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.
- 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.
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)
- Model
ai_languageModel
01Model
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.
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.
Parameters index
Model
modelWhat 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.
Frequency Penalty
options.frequencyPenaltyWhat 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.
Maximum Number of Tokens
options.maxTokensWhat 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
2048tokens, except for the newest models, which support32,768.
Response Format
options.responseFormatWhat 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.
Presence Penalty
options.presencePenaltyWhat 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.
Sampling Temperature
options.temperatureWhat 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.
Timeout
options.timeoutWhat 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.
Max Retries
options.maxRetriesWhat 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.
Top P
options.topPWhat 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.
Need help automating OpenRouter Chat Model with n8n?
A person reads every message.
OpenRouter Chat Model in n8n: common questions
01Is the n8n OpenRouter Chat Model node free?
02What do you need to make the node work?
03What are the limits of the node?
04What should you plug in to get started?
05n8n or Make for AI models?
Get our weekly integration tips.
No spam. Unsubscribe anytime.
