Resources · n8n integration

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

Why automate

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.

Connect

What do you need before the node runs?

  1. 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.

  2. 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.

  3. 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.

Connections

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)

  • Modelai_languageModel
01ModelThis 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.

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.
Use cases
start on a Basic LLM Chain while you shape the prompt, then move the same node under an AI Agent when the task needs tools.
Parameters

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.

01

Model

model

What 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.
Use cases
ship an agent on a fast model, watch the answers for a week, then change this one field when they turn out too shallow. The rest of the workflow stays untouched.
02

Base URL

options.baseURL

What 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.
Use cases
route the traffic of one agent through an internal endpoint that speaks the same API, while the rest of the instance keeps calling OpenAI directly.
03

Frequency Penalty

options.frequencyPenalty

What 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.
Use cases
a product description generator that kept opening three rows out of four with the same clause. A small positive value breaks the pattern without rewriting the prompt.
04

Maximum Number of Tokens

options.maxTokens

What 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.
Use cases
answers that feed a Slack message or a spreadsheet cell. Cap them here and downstream nodes stop receiving three paragraphs where one line was expected.
05

Response Format

options.responseFormat

What 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.
Use cases
anything parsed by the next node. Ask for json_object and the workflow stops failing on an answer that opened with a polite sentence before the braces.
06

Response Format

options.textFormat

What 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, or json_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, medium or high.
Use cases
an extraction step whose output feeds a database insert, where a missing field breaks the row.
07

Presence Penalty

options.presencePenalty

What 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.
Use cases
brainstorming rows in a sheet where the first five ideas kept circling the same theme. Raise it a little and the list widens.
08

Sampling Temperature

options.temperature

What 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.
Use cases
two different jobs, two settings. Near zero for a classifier that has to return the same label for the same input, higher for the post writer that would otherwise produce the same paragraph every morning.
09

Reasoning Effort

options.reasoningEffort

What 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.
Use cases
keep it low on a chat agent people wait in front of, raise it on a nightly batch where nobody is watching the clock.
10

Timeout

options.timeout

What 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.
Use cases
a workflow triggered by a live form. A short timeout turns a slow answer into a clean error you can branch on, rather than a visitor staring at a spinner.
11

Max Retries

options.maxRetries

What 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.
Use cases
an overnight run over hundreds of rows, where one transient failure should not cost you the whole execution. Pair it with a Timeout so a retry cannot stack on a slow call.
12

Top P

options.topP

What 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.
Use cases
tightening a rewriting step that drifts, when you would rather narrow the pool of candidate words than flatten the whole sampling with temperature.
13

Conversation ID

options.conversationId

What 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.
Use cases
a support bot where the same customer comes back an hour later and the exchange has to pick up where it stopped.
14

Prompt Cache Key

options.promptCacheKey

What 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.
Use cases
a workflow that replays a long, stable system prompt across hundreds of rows. One key for the whole batch, and the shared part stops being re-processed from scratch.
15

Safety Identifier

options.safetyIdentifier

What 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.
Use cases
a public chat widget where anyone can type. Pass the account identifier of the visitor and a policy problem points at one user instead of at your whole workspace.
16

Service Tier

options.serviceTier

What 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.
Use cases
one instance running both a customer-facing agent and a nightly enrichment batch. Same credential, same model, two tiers, chosen per node rather than per account.
17

Metadata

options.metadata

What 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.
Use cases
tag every call with the workflow name and the client reference. When a month later someone asks which workflow generated a given answer, the dashboard can tell them.
18

Top Logprobs

options.topLogprobs

What 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.
Use cases
a classification step where you want to route uncertain answers to a human. The probabilities give you something to branch on with an If node.
19

Prompt

options.promptConfig

What 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.
Use cases
several workflows sharing one prompt, edited in one place rather than copied into each canvas.
Need help

Need help automating OpenAI Chat Model with n8n?

A person reads every message.

FAQ

Questions people ask next

01Is the n8n OpenAI Chat Model node included with n8n?
Yes. It belongs to the AI package shipped with n8n, and it is there on n8n Cloud as well as on a self-hosted instance under the Community Edition and its Sustainable Use license. Nothing to install, no extra charge on the n8n side, and a workflow behaves the same whether you run n8n on Docker, on npm or on Cloud. What does cost money sits on the other side: the model provider bills its own API calls under its own terms, exactly as it would if you called the API from your own code. n8n adds nothing to that.
02What do you need for it to work?
Two things. First a root node to attach it to, because this is a sub-node: it has no main input and never executes on its own. Second a way to authenticate. The normal route is an OpenAI credential created once from the Credentials menu and reused across every workflow. On n8n Cloud there is an alternative: select Use Gateway credits in the credential field and the node runs on Gateway credits, without an OpenAI account. Once one of the two is set, open the Model dropdown; n8n loads it live from OpenAI, so an empty list points at the credential.
03What are the limits of this node?
Three matter in practice. The built-in tools of the Responses API, Web Search, File Search and Code Interpreter, only work when the node runs under an AI Agent node; pair it with a Basic LLM Chain and they are simply not available. Expressions behave differently on a sub-node: given five input items, an expression resolves to the first one every time instead of once per item, so per-item values belong upstream. And this page describes version 1 of the node, the maximum in the catalog; an older workflow may show fewer options than what you read here.
04What do you have to plug in at minimum, and where should a beginner start?
At minimum: one root node and this node on its Model port. That pair already answers. Start with a Basic LLM Chain rather than an agent, because a chain does one thing, sends your prompt and returns the text, which makes it obvious whether a bad answer comes from the prompt or from the setup. Once that works, move the same sub-node under an AI Agent and add tools and a memory sub-node, which is what keeps a conversation going between runs. Keep Sampling Temperature and Maximum Number of Tokens as your first two dials; everything else can wait.
05n8n or Make for AI workflows like this one?
It comes down to four criteria. Hosting: n8n self-hosts on Docker or npm and also exists as n8n Cloud, while Make is hosted only. Data control follows from that, since a self-hosted instance keeps prompts and answers on infrastructure you own. Cost model: Make bills per operation, which an agent loop that calls a model several times per item can climb through quickly. And visual logic: the cluster pattern of n8n, a root node with sub-nodes plugged into its ports, shows the model, the memory and the tools as separate pieces you can swap one at a time. Both platforms work; those four points decide.
Hack'celeration Lab

Get our weekly integration tips.

No spam. Unsubscribe anytime.