X Search
Search X (Twitter) posts using the xAI Grok API with real-time access to X content.
Setup
- 1. Get your API key: https://console.x.ai
- Set environment variable:
export XAI_API_KEY="xai-your-key-here"
- 3. Or set
skills."x-search".apiKey / skills."x-search".env.XAI_API_KEY in INLINECODE2
Usage
CODEBLOCK1
Useful flags:
CODEBLOCK2
Notes
- - Uses the xAI Responses API with
x_search tool (Grok performs the search and summarizes results) - Cannot use
--handles and --exclude at the same time - Results include citations with links to original X posts
- Present results in a readable format with post content, authors, and citations
X 搜索
使用 xAI Grok API 搜索 X(Twitter)帖子,实时访问 X 内容。
设置
- 1. 获取您的 API 密钥:https://console.x.ai
- 设置环境变量:
bash
export XAI
APIKEY=xai-your-key-here
- 3. 或者在 ~/.openclaw/openclaw.json 中设置 skills.x-search.apiKey / skills.x-search.env.XAIAPIKEY
使用方法
bash
python3 {baseDir}/scripts/search.py 当前 AI 领域的热门话题是什么
常用参数:
bash
按用户筛选(最多 10 个)
python3 {baseDir}/scripts/search.py --handles jaaneek,OpenClaw 最新帖子
排除用户(最多 10 个)
python3 {baseDir}/scripts/search.py --exclude spambot,crypto_shill 热门 AI 话题
日期范围(YYYY-MM-DD)
python3 {baseDir}/scripts/search.py --from 2026-03-01 --to 2026-03-20 xAI Grok 更新
启用帖子中的图片/视频理解
python3 {baseDir}/scripts/search.py --images --video 产品演示
注意事项
- - 使用带有 x_search 工具的 xAI Responses API(Grok 执行搜索并汇总结果)
- 不能同时使用 --handles 和 --exclude 参数
- 结果包含指向原始 X 帖子的引用链接
- 以可读格式呈现结果,包含帖子内容、作者和引用来源