Skills xai-search
Search X/Twitter and the web in real-time using xAI's Grok API with agentic search tools.
install
source · Clone the upstream repo
git clone https://github.com/openclaw/skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/openclaw/skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/aydencook03/xai-search" ~/.claude/skills/openclaw-skills-xai-search && rm -rf "$T"
OpenClaw · Install into ~/.openclaw/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/openclaw/skills "$T" && mkdir -p ~/.openclaw/skills && cp -r "$T/skills/aydencook03/xai-search" ~/.openclaw/skills/openclaw-skills-xai-search && rm -rf "$T"
manifest:
skills/aydencook03/xai-search/SKILL.mdsource content
xAI Search (Grok API)
Use xAI's agentic search to query X/Twitter and the web in real-time. This leverages Grok's
web_search and x_search tools.
Docs: https://docs.x.ai/docs/
Requirements
environment variableXAI_API_KEY- Python 3 + xai-sdk:
pip install xai-sdk
Quick Usage (curl)
Web Search
curl -s https://api.x.ai/v1/chat/completions \ -H "Authorization: Bearer $XAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "grok-3-fast", "messages": [{"role": "user", "content": "YOUR QUERY HERE"}], "tools": [{"type": "function", "function": {"name": "web_search"}}] }' | jq -r '.choices[0].message.content'
X/Twitter Search
curl -s https://api.x.ai/v1/chat/completions \ -H "Authorization: Bearer $XAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "grok-3-fast", "messages": [{"role": "user", "content": "YOUR QUERY HERE"}], "tools": [{"type": "function", "function": {"name": "x_search"}}] }' | jq -r '.choices[0].message.content'
Combined (Web + X)
curl -s https://api.x.ai/v1/chat/completions \ -H "Authorization: Bearer $XAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "grok-3-fast", "messages": [{"role": "user", "content": "YOUR QUERY HERE"}], "tools": [ {"type": "function", "function": {"name": "web_search"}}, {"type": "function", "function": {"name": "x_search"}} ] }' | jq -r '.choices[0].message.content'
Helper Script
For convenience, use the
xai-search.py script in the scripts/ folder:
# Web search (adjust path to your skill location) python ~/.clawdbot/skills/xai-search/scripts/xai-search.py web "latest news about AI" # X/Twitter search python ~/.clawdbot/skills/xai-search/scripts/xai-search.py x "what are people saying about Clawdbot" # Both python ~/.clawdbot/skills/xai-search/scripts/xai-search.py both "current events today"
Models
— fast, good for quick searchesgrok-3-fast
— reasoning model, better for complex queriesgrok-4-1-fast
X Search Filters
You can filter X searches by:
/allowed_x_handles
— limit to specific accountsexcluded_x_handles
/from_date
— date range (ISO8601 format)to_date
— analyze images in postsenable_image_understanding
— analyze videos in postsenable_video_understanding
Web Search Filters
/allowed_domains
— limit to specific sitesexcluded_domains
— analyze images on pagesenable_image_understanding
Tips
- For breaking news: use X search
- For factual/research queries: use web search or both
- For sentiment/opinions: use X search
- The model will make multiple search calls if needed (agentic)