Help Creating a Custom “Grok Chat Model” Node in n8n

< Describe the problem/error/question in one brief sentence:
I want to use the Grok 3 language model in my AI Agent (Tools Agent) as the chat model, but there isn’t a built-in node—how can I create a custom one?

What is the error message (if any)?
No error message yet, just need guidance on how to build and configure a new node from scratch.

Please share your workflow:

Purpose:
Creates an AI agent that processes natural language requests (e.g., “chat about xAI and scrape related posts, then email me”) to dynamically build and execute workflows using xAI’s Grok for chat functionality and n8n’s tools.

Components:

  • Triggers: Captures inputs from multiple sources:
    • Phone Trigger (Webhook): For SMS or app inputs.
    • Twitter Trigger: For X posts (e.g., about “xAI”).
    • Form Trigger (Webhook): For web form submissions.
    • Gmail Trigger: For email inputs.
  • Merge Inputs: Combines outputs from all triggers into a single stream.
  • Normalize Input: Uses a Function node (shown as “Code”) to standardize inputs (e.g., extracting {$json.idea} from different sources).
  • Agent Switch: Routes requests to specific agents based on keywords (e.g., “scrape” → Tools Agent, “chat” → Conversational Agent).
  • Agents:
    • Tools Agent: Uses xAI’s Grok (via Chat Model or HTTP Request) to interpret requests and execute tasks with tools like httpRequest (for scraping X posts) and emailSend (for emailing results).
    • Conversational Agent, OpenAI Functions Agent, Plan and Execute Agent: Handle interactive, structured, or planned tasks, but currently face configuration warnings.

Additional Details / What I’ve Tried:

  • Looked for existing custom nodes or templates but couldn’t find anything specific to Grok 3.
  • Reviewed the n8n documentation for creating custom nodes, but I’d appreciate any practical examples or best practices.
  • Hoping to set up a node that mimics the standard language model nodes’ functionality (e.g., input prompt, output text).

Questions for the Community:

  1. API Integration – Has anyone integrated a similar AI model with a custom node? Any tips or pitfalls?
  2. Node Setup – How do I define input fields for prompts and output fields for responses in the Node Editor?
  3. Best Practices – Any recommended structure for handling conversation context or error handling?

I’d really appreciate any guidance or examples you can share. Thanks in advance for your help!

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:
  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

to focus on your question about Grok 3 – this post shows you that you can just add an OpenAI Chat node and change the server URL and it worked fine for me.

note that Grok 3 isn’t available yet (for me at least) so I was only able to set the model to grok-2-1212 for now.

1 Like

There is a community node for Grok.

  1. Open your n8n instance
  2. Go to “Settings” > “Community Nodes”
  3. Select “Install”
  4. Enter n8n-nodes-grok in the “Enter npm package name” field
  5. Agree to the risks of using community nodes (if prompted)
  6. Click “Install”