Resources · n8n integration

n8n xAI Grok Chat Model nodeConfigure xAI Grok Chat Model in n8n.

The n8n xAI Grok Chat Model node never runs on its own. It is a sub-node, a small node you attach to a bigger one, and it answers every prompt the root node sends. Nine parameters shape that answer, from model choice down to Top P, and one xAI credential covers all of them.

Verified Trustpilot reviews · AI, automation & growth agency

Why automate

What does the n8n xAI Grok Chat Model node actually do?

It gives a root node its brain. In n8n, a root node such as an AI Agent or a chain receives the items flowing through the workflow, and sub-nodes hang off its ports to supply what it lacks: a chat model, a memory, a tool. This node fills the model slot with xAI Grok. It has no main input of its own, so dropping it on an empty canvas does nothing until you wire it to a root node.

Three shapes cover most of what people build with it. A conversational agent: an AI Agent handles the reasoning and the tool calls, Grok writes the replies, and Sampling Temperature stays low so answers do not drift between two runs of the same question. A one-shot classifier: a Basic LLM Chain reads an incoming message and returns a label, with Response Format set to JSON so the next node can parse the output instead of scraping text out of a paragraph. A long summary: a Summarization Chain walks through a batch of documents, and Maximum Number of Tokens is raised because the default completion length cuts a summary mid-sentence.

Swapping providers is the everyday move here. The Model port accepts one sub-node at a time, so replacing Grok with OpenAI or Anthropic means deleting one node and attaching another. Nothing else in the workflow changes: the agent keeps its prompt, its memory and its tools, and the nodes downstream, a Slack message or a row appended to a sheet, keep reading the same field.

When to reach for something else. If the job is a plain API call to xAI with no reasoning loop around it, a root node plus this sub-node is two nodes where an HTTP Request would be one. If the workflow needs no model at all, and plenty of them only need a rule, the If node settles it faster and costs nothing. This node earns its place the moment a root node is already in play.

The limits are worth knowing before you build. The node ships at version 1 and exposes nine parameters, no more: no system prompt field, no streaming toggle, no per-call cost readout. The system prompt lives on the root node, not here. n8n charges nothing for the node itself, but xAI bills its own API calls under its own terms, which is the part to watch when an agent loops. And the model list is loaded from the xAI API, so an expired key shows up as an empty dropdown rather than a clear error.

If you are weighing the platform rather than the node, the n8n review goes through the hosting and pricing questions in detail.

Connect

What do you need to connect it?

  1. 01

    Create the xAI account

    The node authenticates against xAI, not against n8n, so the starting point is an xAI account. Sign up first, then open the xAI Console API Keys page, where you create a new key for this workspace. Keep that key in a password manager on the way out: xAI shows it once, and a lost key means generating a fresh one rather than reading the old one back.

  2. 02

    Store the API key in n8n

    In n8n, open the Credentials menu and add an xAI credential. API key is the only supported authentication method for this node, so there is a single field to fill: paste the key into API Key and save. The credential is stored once and reused by every workflow on the instance, which matters when the key rotates: you change it in one place, not in twelve nodes.

  3. 03

    Attach the node and pick a model

    Drag the xAI Grok Chat Model onto the canvas and drop it on the Model port of a root node. Select the credential you just saved, then open the Model dropdown. n8n calls the xAI API to fill that list, so seeing real model names is the fastest proof the key works. Pick one, run the root node once, and read the output before wiring anything downstream.

Connections

Where does this node plug in?

n8n splits AI work between a root node, which sits in the main flow and receives items, and sub-nodes, which attach to its ports and do one job each. This node is a sub-node with a single output port, so the only question is which root node it feeds.

Output (what it plugs into)

  • Modelai_languageModel
01ModelThis port carries the language model a root node calls whenever it needs text generated. One model per port, and the root node stays idle without it.

This port carries the language model a root node calls whenever it needs text generated. One model per port, and the root node stays idle without it.

Key parameters

  • Required: the root node has no fallback model of its own, so an unconnected Model port stops the run.
  • AI Agent and AI Agent Tool: the reasoning nodes, where Grok both plans the tool calls and writes the final answer.
  • Basic LLM Chain and Summarization Chain: straight-line nodes with no tool loop, for a single completion or a document digest.
  • Text Classifier and Information Extractor: nodes that expect a structured answer, where Response Format and a low temperature do most of the work.
Use cases
a support workflow runs an agent on Grok for replies and an AI Agent Tool on the same model for lookups.
Parameters

What does each parameter change?

The xAI Grok 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

The dropdown at the top of the node decides which Grok model answers. n8n loads that list from the xAI API every time you open it, so a model released after your n8n version still appears without any update.

Key parameters

  • Model: the model that generates the completion. Pick it from the list rather than typing a name, and change it in one click when a workflow turns out slower or heavier than planned on the xAI side.
Use cases
a triage agent runs a lighter model for sorting incoming tickets, while the weekly digest chain switches to a larger one because its prompt carries far more text.
02

Frequency Penalty

options.frequencyPenalty

What you see in n8n

Notes & use cases

Hidden under Options until you add it, this one fights repetition. It looks at how often a token has already appeared, a token being the chunk of text a model reads and writes, and makes the frequent ones less likely to come back.

Key parameters

  • Frequency Penalty: a number. Positive values penalize new tokens based on their existing frequency in the text so far, which lowers the odds of the model repeating the same line verbatim.
Use cases
a product description generator that kept opening every paragraph with the same clause stops doing it once a small positive value is set.
03

Maximum Number of Tokens

options.maxTokens

What you see in n8n

Notes & use cases

Here you cap how long the answer can get. The value sets the completion length, and the model stops when it hits the ceiling, mid-sentence if the ceiling is too low.

Key parameters

  • Maximum Number of Tokens: a number. Most models carry a context length of 2048 tokens, with the newest ones supporting considerably more, so the ceiling you can set depends on the model chosen above.
Use cases
a chain that summarizes a long thread needs room to finish; a node that only returns a category label is better kept short, so a truncated reply never reaches the next step.
04

Response Format

options.responseFormat

What you see in n8n

Notes & use cases

Two choices, and the second one changes what the rest of the workflow can do with the answer.

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 that feeds a spreadsheet picks JSON so the fields land in columns, then the workflow references them downstream with an expression such as {{ $json.output }} instead of a text search.
05

Presence Penalty

options.presencePenalty

What you see in n8n

Notes & use cases

Close cousin of the frequency setting, different trigger. This one does not count how many times a token showed up, only whether it showed up at all, and nudges the model toward subjects it has not raised 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
a brainstorming chain that keeps circling the same two angles opens up with a positive value; a factual answer node is usually better left at the default.
06

Sampling Temperature

options.temperature

What you see in n8n

Notes & use cases

Randomness, in one number. Lowering it results in less random completions, and as the temperature approaches zero the model becomes deterministic and repetitive.

Key parameters

  • Sampling Temperature: a number controlling how much variation the model allows itself between two runs of the very same prompt.
Use cases
anything parsed by a later node, a classification or an extraction, wants a value near zero so two identical inputs give two identical outputs. Copywriting wants the opposite, at the price of answers you cannot reproduce exactly.
07

Timeout

options.timeout

What you see in n8n

Notes & use cases

How long n8n waits on xAI before giving up on a single request. The unit trips people up: it is milliseconds, not seconds, so a value that looks generous can be under a second.

Key parameters

  • Timeout: a number, the maximum amount of time a request is allowed to take in milliseconds.
Use cases
a long summarization run over a big document needs a higher ceiling than a one-line classification, and raising it is the first thing to try when a workflow fails only on the largest items.
08

Max Retries

options.maxRetries

What you see in n8n

Notes & use cases

When a call to xAI fails, this decides whether n8n tries again before the node errors out. It applies per execution of the node, so an agent that calls the model several times in one run can retry several times over.

Key parameters

  • Max Retries: a number, the maximum number of retries to attempt.
Use cases
a nightly batch benefits from a retry or two, since a transient failure would otherwise kill the whole run. A chatbot answering in front of a user is better off failing fast and saying so.
09

Top P

options.topP

What you see in n8n

Notes & use cases

The other lever on variety, working by cutting the tail rather than flattening the curve. Lower it and the model only considers the most probable continuations.

Key parameters

  • Top P: a number controlling diversity via nucleus sampling. A value of 0.5 means half of all likelihood-weighted options are considered.
Use cases
tightening a model that wanders off into odd word choices. Change this one or Sampling Temperature, not both at once, or you lose track of which setting caused the change you are seeing.
Need help

Need help automating xAI Grok Chat Model with n8n?

A person reads every message.

FAQ

Questions people ask next

01Is the xAI Grok Chat Model node included in n8n?
Yes. It belongs to the n8n AI package, shipped with n8n itself, on n8n Cloud and on a self-hosted instance alike. There is nothing to install, no community node to add, and no extra fee on the n8n side for using it. Self-hosting runs on the Community Edition under the Sustainable Use license, and a workflow built on one behaves the same on the other. The cost that does exist sits with xAI: the provider bills its own API calls under its own terms, which is worth keeping in mind when an agent calls the model repeatedly inside a single run.
02What do you need for the n8n xAI Grok Chat Model node to work?
An xAI account and an API key, plus a root node to attach to. Create the account first, generate a key on the xAI Console API Keys page, then add an xAI credential in n8n and paste the key into the API Key field. API key is the only supported authentication method here, so there is no OAuth flow and no scope to pick. The credential is saved once and reused everywhere on the instance. On its own the node still does nothing: it has no main input, so it has to sit on the Model port of a root node such as an AI Agent or a chain.
03What are the limits of this node?
It exposes nine parameters at version 1, and that is the whole surface. There is no system prompt field here, because the instructions belong to the root node; no streaming option; no token counter in the output. Completion length is bounded by the model you select, most carrying a context length of 2048 tokens while the newest ones go well beyond. The Model list comes from the xAI API rather than from n8n, so a revoked key leaves you with an empty dropdown instead of a readable error. And because the node is a sub-node, it cannot be tested alone.
04What is the minimum to plug in, and where should a beginner start?
The minimum is one root node plus this node on its Model port, with a valid credential. Start with a Basic LLM Chain rather than an AI Agent: the chain sends your prompt, returns one answer, and lets you see what the model produces without a tool loop in the way. Once that works, swap the chain for an AI Agent, add a memory sub-node so the conversation holds context between messages, then attach tools one at a time. Building it in that order means every failure has one obvious cause, instead of four candidates.
05n8n or Make for running Grok in a workflow?
It depends on where you want the data to live and how you want to pay. Make is hosted only, with no self-hosting option, and bills per operation, which makes budgeting predictable and heavy loops expensive. n8n runs on your own server through Docker or npm, or on n8n Cloud if you would rather not maintain it, and keeps prompts and responses on infrastructure you control when self-hosted. The sub-node model is the other difference: an agent, its model, its memory and its tools are separate blocks you rewire individually. Pick on hosting, data control and cost model, not on feature lists.
Hack'celeration Lab

Get our weekly integration tips.

No spam. Unsubscribe anytime.