Build Anything With Grok 4 and n8n AI Agents

Dr. Violet Howard shows how to use Grok-4, xAI's 1.7 trillion parameter model, in n8n to build AI agents. She walks through setting up API credentials, adding research tools like Perplexity and Tavily, and running a workflow that gathers information and sends emails, which costs about $0.12 per run.
Chapters
Today we're gonna be talking about the world's new best AI model, Grok-4. We're gonna be breaking down what it is, why it's a big deal. We're gonna look at the benchmarks and compare it to other models. And then finally, I'm gonna show you guys how to actually connect it to n8n to power your AI agents in your AI automations to make them even smarter. Also, I got a new mouse. It's like an ergonomic shape so it doesn't hurt my wrist. So pretty pumped about that. Anyways, don't wanna waste any time. Let's hop straight into this one. So on July 9th, 2025, xAI dropped Grok-4, and today I'm gonna be showing you guys how we can connect that to our n8n automations. But before we hop into n8n, let's real quick talk about what is Grok-4. GROK-4 and why this is such a big deal. So this is the latest artificial intelligence model from xAI, which was the company founded by Elon Musk. It's designed to be smarter, faster, and more capable than previous AI models, aiming to outperform competitors like OpenAI's GPT-4 and Google's Gemini and Anthropic's Claude, other closed-source models like that. It's a big deal because of these 3 main reasons. The first one being size. GROK-4 has 1.7 trillion parameters, and you can kind of think of these as brain cells of the AI. And this makes it one of the largest and most complex AI models ever built. We've got GPT-4, which is about 1.8 trillion, and then Gemini Ultra is around a trillion, and Claude 4 is only around 500 billion. I say only as if that's small. That's still massive. And just to put that into context, if you've watched my video about how to install a local AI model to run in NNNN, what we did in that one was like a 1.5 billion parameter DeepSeq. I played around with like 14 billion or 32 billion for very basic tool calling, but you wouldn't really be able to run something like 500 billion parameters on at least my PC that I have right down here. Anyways, it's insanely smart. Now take this with a grain of salt because this was said by Elon, but it's described as being better than PhD level in every subject. And then right here we have another quote from Elon. Grok-4 is smarter than almost all graduate students in all disciplines simultaneously. So we're not gonna dive into the politics of xAI and Elon. I'm just stating the facts for you guys. And then we have speed. The model can handle many tasks at once, making it useful for both everyday users and large organizations. And of course, we're going to hop into NN and put that to a quick test with an AI agent. But now let's look at some actual benchmarks of this model, because we want to compare it to other leading closed-source models. So the first one we'll look at is how it performed on the HLE, which is Humanity's Last Exam, which is a super tough test designed with questions of math, science, and humanities, designed to be hard even for experts. Grok-4 without any tools scored 25%, and with tools in multi-agent mode scored 44.4%. And not that I really know what those percentages really mean, but what we do know is that it scored higher than previous top AI models like OpenAI and Google. And looking at some other benchmarks over here, anything in orange is a Grok-4 model, and you can see it's pretty much outperforming all of these other ones. We have Grok-4 with no tools, we have Grok-4, and then we have Grok-4 Heavy. And I'll just call out two, which will be first of all the GPQA, which is the graduate-level physics and astronomy questions. It's a test with tough science questions, and Grok-4 scored 87 to 88%, which is higher than Google Gemini's 86%. And much higher than Anthropic's Claude 4 Opus, 79%. And then we have the AIME, which is the American Invitational Mathematics Examination, a challenging math test for top high school students. And Grok 4 scored 95 out of 100, better than most humans and other AI models. And that's really cool because traditionally we've kind of known that AI models aren't great at math, but Grok 4 is excellent at solving complex math problems step by step. And it's cool because all AI models are slowly getting better and better at math. And then another really cool one we have is the SWE Bench, or the Software Engineering Questions. This is evaluating real-world coding and software development tasks, which is something that AI is used for very heavily right now in the real world. Grok-4 scored 72 to 75%, which is slightly better than other top AI models, as you can see down here with this summary table. But what does all of this mean, and why are people calling this the new best AI model in the world? Well, it's going to be used across many industries, of course, business, healthcare, education, programming, customer service, and tons more. And it's a big deal because Groq-4 is really, really smart. It can work in teams, it understands more, and it's going to be really easy to use. Now, of course, there are other AI models that outperform Groq in certain metrics. We have like context window. Groq-4 only has 256,000 tokens while other ones have up to a million or 2 million. It's definitely not the cheapest model, so you can get some cheaper ones from OpenAI and Google, stuff like that. and there are definitely models that are actually faster at processing information. So overall, in every single metric, it's not the best, but it's a really, really strong model. And of course, why do we want to use this in a no-code workflow builder like N8N? Because we can plug in this AI model into our existing AI automations to see if it can make them smarter, better at analyzing, maybe even do some functions that we wouldn't have trusted other AI models to do, like analyzing financial data or something like that. So tons of use cases, excited to see what you guys come up with using Groq 4. But let's hop into N8N so I can show you guys how to actually use it especially if you want to use it for tool calling. Okay, so probably the most straightforward way to use it would be in N8N, you have an AI agent, you add a chat model, and you just scroll down to grab an xAI Groq chat model. You would then just need to go to your admin console in Groq. You could come here, make an account, add some billing information, go to API keys right here, and then all you'd have to do is create a new one and then copy that API key and add that right here as a new credential. Then when you open up the model list, you could see right here, we're able to choose Groq for 07/09, which was July 9th when it was launched. And then we can go ahead and talk to Groq. Just say, hello Groq. And we can see that it's gonna use its chat brain right here, and it's using Groq 4 in order to respond to us. Hello, I'm Groq, built by xAI. What's on your mind today? So let's say I wanted to add a quick tool to do some research and we add a Perplexity tool. All I'm gonna do real quick in here is change this to Sonar. I'm gonna make the model choose the actual message to send over. And if you wanna watch a deeper dive on a video about Perplexity, I'll tag that right up here. But this should already be configured really easily, and hopefully I don't even have to prompt the agent to use it. So let's give it a try. So I'm gonna tell it to do some research on Groq 4, and what we're gonna see happen is that it's thinking about what to do right now, and it's gonna try to hit that tool. There you go. You can see that it was successfully able to call our Perplexity tool, and now it's thinking about how to respond to us. And it just finished up. You can see that it actually took about 2 minutes. So hopefully we have some pretty in-depth research here, which it looks like we do. We have a background in development, key features. Release status and availability, comparisons, challenges and criticisms. And we also have 3 sources here that we could click onto, and then we have another source right there. Keep in mind, there is no system prompt that happened in the agent. Let's look at another example where we're gonna use Groq 4 with our Ultimate Assistant to do research using both Tavily and Perplexity in order to once again, look up Groq 4 and send it as an email to Dexter Morgan. So there's a lot of moving pieces here and a lot of things that have to happen. And the issue that we run into here is that we get this failed to parse tool arguments from chat model error message. And if I throw that into ChatGPT, because I don't exactly know what this means, it basically tells us that the AI model, which is Groq 4, returned a response to call the tool that wasn't valid JSON. And then the N8n, which is kind of built on top of LangChain, couldn't parse it and send it into our tool. And the issue I think is because of the Tavli HTTP request, because we just saw Groq use Perplexity, where if I click into here, you can see that we're sending over a JSON body. So maybe the model is having trouble with that. So what I thought to do was come into the chat model right here and then basically add a response format. And then send this over as JSON, which should guarantee that the message the model generates is valid JSON. So I throw that in there and then it says we have to include JSON in the prompt. So I come into the system prompt of the Ultimate Assistant and then in the tools section I say, hey, send JSON over to the tools. And now if I want to try to send this exact query once again, we'll see what happens. And what happens this time is we don't get an error, but it still wasn't able to use those tools. So what I'm going to do here is instead of using Groq, I'm just going to use OpenRouter to connect to Groq 4 as well. and I like to do this either way because now I have one spot for my billing information and only one spot to manage as far as like topping up credits and checking out my analytics. And so all you'd have to do here is go to OpenRouter.ai. You would sign up, you would go to models, and you can see right here that we have Groq-4 as a model. This is also where you can understand its context window, its input output token price and other stuff like that. And then all I have to do is come into here, go to my keys, create a new one, and then plug that key into my And it, an OpenRouter credential. And now that we have OpenRouter hooked up to Groq-4, I'm gonna send off this message that says, do research using Perplexity and Tavli on the new Groq-4 AI model. Then send the results as an email to Dexter Morgan. So there's lots of things that have to happen. It has to do research here, here. It has to get Dexter Morgan's contact info and send the final copy to him. So we'll see how it performs. Okay, there you go. Now it's calling those tools, Tavli, Perplexity, contact agent, and then it's gonna go ahead and send that email. Now you can see it's calling that email agent. All right, so this just finished up and I'm going to hop over to my email and go to the sent folder. And you can see this is the email we just got that was sent to dexter@miami.com. We have a ton of research right here from Perplexity. And you can see that there are 5 sources down here. And then we also have a short summary from Tavalley with 3 sources. It even says that the Tavalley results seem to focus more on recent updates to existing Grok versions rather than Grok 4. So this information kind of conflicts with Perplexity's, which is why it was great that we did 2 sources. But something I wanna call out here is that this run took 5 minutes and it actually took like 3 minutes before it even decided to call any tools to start with. And this is really interesting because if I go to my executions and I scroll down, we can see this one right here that took a minute and 40 seconds. I actually sent the exact same query just to test this out where I asked it to do research for using Perplexity and Tavli on Grok4 and then send it as an email to Dexter Morgan. So same query, but the one that I just showed you guys live took almost 3 times as long. So what this is telling me is that, you know, Groq 4 is new, everyone is kind of just spamming the servers. And so depending on the time of day and depending on how many requests Groq 4 is getting at the moment, it may vary your speed. And also if we come here and look at the cost, you can see that this run that we just did, it costed us about 12 cents. And that's because we're passing a lot of tokens over because we're doing research with Perplexity and Tavli. So all of that information is being sent back to the Groq model to be processed. It's definitely not the cheapest model, and you can see that it's not insanely quick, but I really like the way that it reasoned and the way that it basically structured its outputs. And you could easily process these things differently with a different model and then send that summary to Groq to be processed further. And that's a way you could cut down your costs and save some tokens. If you're looking to take your learning with Anydn deeper, learn about some context engineering strategies like this, saving tokens like that, then definitely check out my paid community. The link for that is down in the description. It's a great place to surround yourself with like-minded individuals using N8N every day. And of course, we have a classroom section where you can learn the foundations and also how to identify, design, and build time-saving automations. So if you enjoyed the video or you learned something new, please give it a like. Definitely helps me out a ton. And as always, appreciate you guys making it to the end of the video. I'll see you all in the next one. Thanks everyone.










