- Home
- Resources
- Integrations
- OpenAI Chat Model
n8n OpenAI Chat Model nodeConfigure OpenAI Chat Model in n8n.
The n8n OpenAI Chat Model node is the sub-node that gives a root node its reasoning. It plugs into the Model port of an AI Agent or a chain, carries 19 parameters from Sampling Temperature to Service Tier, and runs on an OpenAI credential. Built for anyone tuning an agent that already answers.
Verified Trustpilot reviews · AI, automation & growth agency
What does the n8n OpenAI Chat Model node actually do?
It supplies the language model that a root node uses to think. In n8n, AI workflows follow a cluster pattern: a root node such as an AI Agent or a chain receives the workflow items on its main input, and sub-nodes plug into its ports, one type of sub-node per port. A sub-node, this one included, has no main input and never runs on its own. Attach it to the Model port and the root node stops being an empty shell.
The first scenario is the lead pipeline. A workflow reads rows from Google Sheets, sends each business to an AI Agent with a search tool and a Simple Memory sub-node, and this node decides what the agent writes back. The result is a sheet of qualified leads instead of a sheet of raw addresses. The published template that does exactly this is workflow 3443.
The second one is content on a schedule. A Basic LLM Chain drafts a post from a topic list, an approval email goes out through Gmail, and nothing publishes until a human clicks. Here the model never picks a tool, it just writes, so Sampling Temperature and Presence Penalty carry most of the tuning. Template 4005 is built on that shape.
The third is retrieval. In the RAG starter template 5010, a form question reaches an AI Agent, a vector store returns the matching passages, and this node turns those passages into an answer. Two sub-nodes, two ports, one root node.
Prefer the regular OpenAI node when you want a single, direct call with no agent around it: transcribe a file, generate an image, classify one text. This sub-node is for the cluster pattern only. Switching provider later is a matter of unplugging it and attaching the Anthropic chat model instead, since the port type stays the same.
Two limits are worth knowing before you build. The built-in tools of the Responses API, Web Search, File Search and Code Interpreter, only work when this node sits under an AI Agent node, not under a Basic LLM Chain. And because it is a sub-node, an expression like {{ $json.name }} always resolves to the first input item, never to each item in turn. If you are still weighing platforms, the n8n review goes through the hosting and cost questions in detail.
What do you need before the node runs?
- 01
Create the OpenAI credential
Open the Credentials menu and create an OpenAI credential. It asks for an API Key from your OpenAI account, plus an Organization ID only if you belong to more than one. A credential lives outside the workflow: create it once, reuse it everywhere. The provider bills its own calls; n8n adds nothing.
- 02
Or skip the account on n8n Cloud
On n8n Cloud there is a second route. Select Use Gateway credits in the credential field of the node and it runs without an OpenAI account at all, on Gateway credits instead of your own API key. Handy for a first test, or for a workflow you hand to someone who has no key of their own. On a self-hosted instance, the credential is the only route.
- 03
Attach the node and pick a model
Drag the node onto the canvas and connect it to the Model port of your root node. Then open Model: n8n loads the list live from OpenAI, so the dropdown shows the models your account can actually call and nothing else. An empty or short list points at the credential, not at the node. Execute the root node once to confirm the pair works.
Where does this node plug in?
A port is the small labelled connector under a root node, and each one accepts a single family of sub-nodes; this node has exactly one, its output.
Output (what it plugs into)
- Model
ai_languageModel
01Model
This is the connection the node exists for. It hands the root node a chat model, and without it the root node has nothing to reason with.
Key parameters
- Required: the node has no main input and never executes alone, so it only does something once attached here.
- AI Agent and AI Agent Tool: the two agent root nodes, and the only place where the Responses API built-in tools are available.
- Basic LLM Chain and Question and Answer Chain: simpler roots for a single prompt or a retrieval answer, with no tool calling.
Which parameter do you touch, and when?
The OpenAI Chat Model node has 19 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
Chooses which OpenAI model generates the completion. n8n loads the list dynamically from OpenAI when you open the dropdown, so what you see is what your account is allowed to call.
Key parameters
- Model: a dropdown filled at runtime from your account. A model you expected and cannot find is an account access question, not a node bug.
Base URL
options.baseURLWhat you see in n8n
Notes & use cases
Overrides the default base URL for the API. Left empty, the node calls OpenAI at its normal address; filled in, every request from this node goes to the address you type.
Key parameters
- Base URL: a full endpoint address, applied to this node only and not to other OpenAI nodes in the same workflow.
Frequency Penalty
options.frequencyPenaltyWhat you see in n8n
Notes & use cases
Controls how much the model repeats itself. Positive values penalize new tokens based on how often they already appear in the text, which lowers the odds of the model repeating the same line verbatim.
Key parameters
- Frequency Penalty: a number. Higher reduces repetition; the further you push it, the more the wording drifts away from your prompt.
Maximum Number of Tokens
options.maxTokensWhat you see in n8n
Notes & use cases
Caps the length of what comes back. A token is roughly a word fragment, and this sets how many the completion may use before it stops.
Key parameters
- Maximum Number of Tokens: a number. Most models carry a context length of 2048 tokens, so the value has to leave room for the prompt as well as the answer.
Response Format
options.responseFormatWhat you see in n8n
Notes & use cases
Decides whether the answer comes back as prose or as a JSON document. It is the simple, two-choice version of the setting, used on the Chat Completions path.
Key parameters
- Text (
text): a regular text response, the default behavior. - JSON (
json_object): enables JSON mode, which should guarantee the message the model generates is valid JSON.
json_object and the workflow stops failing on an answer that opened with a polite sentence before the braces.Response Format
options.textFormatWhat you see in n8n
Notes & use cases
The richer format control available on the Responses API path, where you describe the shape of the answer instead of just asking for JSON.
Key parameters
- Type:
text,json_schema, recommended, orjson_object. - Name: the name of the format. Letters, digits, underscores and dashes only, 64 characters at most.
- Schema: the JSON schema itself, with Description to explain it and Strict to force every answer to match it.
- Verbosity:
low,mediumorhigh.
Presence Penalty
options.presencePenaltyWhat you see in n8n
Notes & use cases
Pushes the model toward new ground. Positive values penalize tokens based on whether they have appeared in the text at all, which raises the chance of the model talking about new topics.
Key parameters
- Presence Penalty: a number. Higher opens up new subjects; too high and the answer wanders off the question you asked.
Sampling Temperature
options.temperatureWhat you see in n8n
Notes & use cases
Sets how random the sampling process is. Lower it and completions get less random; as it approaches zero the model turns deterministic and repetitive.
Key parameters
- Sampling Temperature: a number. Higher creates more diverse sampling but increases the risk of hallucinations.
Reasoning Effort
options.reasoningEffortWhat you see in n8n
Notes & use cases
Says how much thinking the model should spend before answering. More reasoning tokens means a more complete answer and a slower, heavier request.
Key parameters
- Low (
low): favors speed and economical token usage. - Medium (
medium): balance between speed and reasoning accuracy. - High (
high): favors more complete reasoning at the cost of more tokens generated and slower responses.
Timeout
options.timeoutWhat you see in n8n
Notes & use cases
Sets the maximum amount of time a single request is allowed to take, in milliseconds. Past that, the request is cut and the node reports an error instead of hanging.
Key parameters
- Timeout: a number in milliseconds, so 2000 means two seconds.
Max Retries
options.maxRetriesWhat you see in n8n
Notes & use cases
How many times the node tries again after a failed request before it gives up and fails the execution.
Key parameters
- Max Retries: a number. Each retry replays the same request, so a long batch takes proportionally longer when the provider is having a bad day.
Top P
options.topPWhat you see in n8n
Notes & use cases
Controls diversity through nucleus sampling: a value of 0.5 means half of all likelihood-weighted options are considered, and lower values simply ignore the less probable ones.
Key parameters
- Top P: a number. The general recommendation is to alter this or Sampling Temperature, not both at once.
Conversation ID
options.conversationIdWhat you see in n8n
Notes & use cases
Attaches the response to a conversation held on the provider side. Input and output items from the response are added to that conversation automatically once it completes.
Key parameters
- Conversation ID: a string, usually an expression such as
{{ $json.conversation }}carried by the item, so one thread equals one conversation.
Prompt Cache Key
options.promptCacheKeyWhat you see in n8n
Notes & use cases
A key OpenAI uses to cache responses for similar requests, so repeated calls that share the key get better cache hit rates.
Key parameters
- Prompt Cache Key: a string you choose. Requests that should share a cache get the same value, requests that should not get different ones.
Safety Identifier
options.safetyIdentifierWhat you see in n8n
Notes & use cases
A stable identifier that helps OpenAI detect users of your application who may be violating its usage policies.
Key parameters
- Safety Identifier: a string that uniquely identifies each user, stable across their requests rather than regenerated on every run.
Service Tier
options.serviceTierWhat you see in n8n
Notes & use cases
Picks the service tier the request runs under, which is how you tell the provider that this particular call matters more, or less, than the rest of your traffic.
Key parameters
- Auto (
auto) and Default (default): the standard routes. - Flex (
flex): the tier to pick for work that can wait, typically a batch nobody is watching. - Priority (
priority): the one for work that cannot.
Metadata
options.metadataWhat you see in n8n
Notes & use cases
Attaches structured information to the object, useful for storing extra context and for querying objects later through the API or the dashboard.
Key parameters
- Metadata: a JSON set of up to 16 key-value pairs. Keys are strings of 64 characters at most, values strings of 512 at most.
Top Logprobs
options.topLogprobsWhat you see in n8n
Notes & use cases
Returns the most likely tokens at each position of the answer, each with its log probability. It turns the answer into something you can inspect rather than just read.
Key parameters
- Top Logprobs: an integer between 0 and 20, the number of candidate tokens reported per position.
Prompt
options.promptConfigWhat you see in n8n
Notes & use cases
Uses a reusable prompt template configured in the OpenAI dashboard instead of a prompt written inside the workflow.
Key parameters
- Prompt ID: the unique identifier of the template to use.
- Version: an optional version of that template, so a change in the dashboard does not reach production before you ask.
- Variables: the JSON values substituted into the template, often built from
{{ $json }}fields of the incoming item.
Need help automating OpenAI Chat Model with n8n?
A person reads every message.
Questions people ask next
01Is the n8n OpenAI Chat Model node included with n8n?
02What do you need for it to work?
03What are the limits of this node?
04What do you have to plug in at minimum, and where should a beginner start?
05n8n or Make for AI workflows like this one?
Get our weekly integration tips.
No spam. Unsubscribe anytime.


