{"skill":{"slug":"xai-search","displayName":"xAI Search","summary":"Search X/Twitter and the web in real-time using xAI's Grok API with agentic search tools.","description":"---\nname: xai-search\ndescription: Search X/Twitter and the web in real-time using xAI's Grok API with agentic search tools.\nmetadata: {\"clawdbot\":{\"emoji\":\"🔍\"}}\n---\n\n# xAI Search (Grok API)\n\nUse xAI's agentic search to query X/Twitter and the web in real-time. This leverages Grok's `web_search` and `x_search` tools.\n\n**Docs:** https://docs.x.ai/docs/\n\n## Requirements\n\n- `XAI_API_KEY` environment variable\n- Python 3 + xai-sdk: `pip install xai-sdk`\n\n## Quick Usage (curl)\n\n### Web Search\n```bash\ncurl -s https://api.x.ai/v1/chat/completions \\\n  -H \"Authorization: Bearer $XAI_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"grok-3-fast\",\n    \"messages\": [{\"role\": \"user\", \"content\": \"YOUR QUERY HERE\"}],\n    \"tools\": [{\"type\": \"function\", \"function\": {\"name\": \"web_search\"}}]\n  }' | jq -r '.choices[0].message.content'\n```\n\n### X/Twitter Search\n```bash\ncurl -s https://api.x.ai/v1/chat/completions \\\n  -H \"Authorization: Bearer $XAI_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"grok-3-fast\",\n    \"messages\": [{\"role\": \"user\", \"content\": \"YOUR QUERY HERE\"}],\n    \"tools\": [{\"type\": \"function\", \"function\": {\"name\": \"x_search\"}}]\n  }' | jq -r '.choices[0].message.content'\n```\n\n### Combined (Web + X)\n```bash\ncurl -s https://api.x.ai/v1/chat/completions \\\n  -H \"Authorization: Bearer $XAI_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"grok-3-fast\",\n    \"messages\": [{\"role\": \"user\", \"content\": \"YOUR QUERY HERE\"}],\n    \"tools\": [\n      {\"type\": \"function\", \"function\": {\"name\": \"web_search\"}},\n      {\"type\": \"function\", \"function\": {\"name\": \"x_search\"}}\n    ]\n  }' | jq -r '.choices[0].message.content'\n```\n\n## Helper Script\n\nFor convenience, use the `xai-search.py` script in the `scripts/` folder:\n\n```bash\n# Web search (adjust path to your skill location)\npython ~/.clawdbot/skills/xai-search/scripts/xai-search.py web \"latest news about AI\"\n\n# X/Twitter search  \npython ~/.clawdbot/skills/xai-search/scripts/xai-search.py x \"what are people saying about Clawdbot\"\n\n# Both\npython ~/.clawdbot/skills/xai-search/scripts/xai-search.py both \"current events today\"\n```\n\n## Models\n\n- `grok-3-fast` — fast, good for quick searches\n- `grok-4-1-fast` — reasoning model, better for complex queries\n\n## X Search Filters\n\nYou can filter X searches by:\n- `allowed_x_handles` / `excluded_x_handles` — limit to specific accounts\n- `from_date` / `to_date` — date range (ISO8601 format)\n- `enable_image_understanding` — analyze images in posts\n- `enable_video_understanding` — analyze videos in posts\n\n## Web Search Filters\n\n- `allowed_domains` / `excluded_domains` — limit to specific sites\n- `enable_image_understanding` — analyze images on pages\n\n## Tips\n\n- For breaking news: use X search\n- For factual/research queries: use web search or both\n- For sentiment/opinions: use X search\n- The model will make multiple search calls if needed (agentic)\n","tags":{"latest":"1.0.4"},"stats":{"comments":0,"downloads":3349,"installsAllTime":9,"installsCurrent":9,"stars":1,"versions":5},"createdAt":1769555436185,"updatedAt":1778485863829},"latestVersion":{"version":"1.0.4","createdAt":1769575005647,"changelog":"Fixed script extension for ClawdHub packaging (.py)","license":null},"metadata":{"setup":[],"os":null,"systems":null},"owner":{"handle":"aydencook03","userId":"s17f7c2e1tb6nkd30s0c5ddsqx88532k","displayName":"aydencook03","image":"https://avatars.githubusercontent.com/u/63018272?v=4"},"moderation":null}