How to use Grok AI with "live search" feature

I’m trying to figure out how to create a node that uses the Grok AI that uses their new “live search” which is documented here: https://docs.x.ai/docs/guides/live-search

Specifically X/Grok requires you to pass search_parameters but I’m not sure how to do this with n8n.

their python example is as follows, notice the search_paramters:

import os
import requests

url = "https://api.x.ai/v1/chat/completions"
headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {os.getenv('XAI_API_KEY')}"
}
payload = {
    "messages": [
        {
            "role": "user",
            "content": "Provide me a digest of world news in the last 24 hours."
        }
    ],
    "search_parameters": {
        "mode": "auto",
        "return_citations": True
    },
    "model": "grok-3-latest"
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())

It seems in the existing Grok nodes, I’m able to set the content which is the chat prompt as well as the model of course, but I’m not able to add in more into the payload like search_parameters with the mode and return_citations sub props.

1 Like

Hey,

Sometimes the nodes don;t have latest features, but you can use a http request node, or even use python here a quick guide I done on another post which show roughly how to achieve this.

Hope it helps,

Hope this helps,

Samuel