- Home
- Resources
- Integrations
- xAI Grok Chat Model
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
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.
What do you need to connect it?
- 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.
- 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.
- 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.
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)
- Model
ai_languageModel
01Model
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.
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.
Parameters index
Model
modelWhat 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.
Frequency Penalty
options.frequencyPenaltyWhat 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.
Maximum Number of Tokens
options.maxTokensWhat 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.
Response Format
options.responseFormatWhat 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.
{{ $json.output }} instead of a text search.Presence Penalty
options.presencePenaltyWhat 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.
Sampling Temperature
options.temperatureWhat 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.
Timeout
options.timeoutWhat 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.
Max Retries
options.maxRetriesWhat 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.
Top P
options.topPWhat 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.
Need help automating xAI Grok Chat Model with n8n?
A person reads every message.
Questions people ask next
01Is the xAI Grok Chat Model node included in n8n?
02What do you need for the n8n xAI Grok Chat Model node to work?
03What are the limits of this node?
04What is the minimum to plug in, and where should a beginner start?
05n8n or Make for running Grok in a workflow?
Get our weekly integration tips.
No spam. Unsubscribe anytime.

