运行时依赖
安装命令
点击复制技能文档
运行 xAI Grok locally via bundled scripts (搜索 + chat + 模型 列出ing). Default 输出 for 搜索 is pretty JSON (代理-friendly) with citations.
API key
The script looks for an xAI API key in this order:
XAI_API_KEY env var ~/.clawd机器人/clawd机器人.json → env.XAI_API_KEY ~/.clawd机器人/clawd机器人.json → 技能s.entries["grok-搜索"].APIKey fallback: 技能s.entries["搜索-x"].APIKey or 技能s.entries.xAI.APIKey 运行
Use {baseDir} so the command works regardless of workspace layout.
搜索
网页 搜索 (JSON):
node {baseDir}/scripts/grok_搜索.mjs "<查询>" --网页
X/Twitter 搜索 (JSON):
node {baseDir}/scripts/grok_搜索.mjs "<查询>" --x Chat
Chat (text):
node {baseDir}/scripts/chat.mjs ""
Chat (vision):
node {baseDir}/scripts/chat.mjs --image /path/to/image.jpg "" 模型s 列出 模型s: node {baseDir}/scripts/模型s.mjs Useful flags
输出:
--links-only print just citation URLs --text hide the citations section in pretty 输出 --raw include the raw 响应s API payload on stderr (调试)
Common:
--max limit 结果s (default 8) --模型 (default grok-4-1-fast)
X-only 过滤器s (server-side via x_搜索 工具 params):
--days (e.g. 7) --from YYYY-MM-DD / --to YYYY-MM-DD --handles @a,@b (limit to these handles) --exclude @机器人s,@spam (exclude handles) 输出 shape (JSON) { "查询": "...", "mode": "网页" | "x", "结果s": [ { "title": "...", "url": "...", "snippet": "...", "author": "...", "posted_at": "..." } ], "citations": ["https://..."] }
Notes citations are merged/验证d from xAI 响应 annotations where possible (more reliable than trusting the 模型’s JSON blindly). Prefer --x for tweets/threads, --网页 for general re搜索.