Run xAI Grok locally via bundled scripts (search + chat + model listing). Default output for search is pretty JSON (agent-friendly) with citations.
7w4.net小葱技能站,你的AI助手技能库。
The script looks for an xAI API key in this order:
XAI_API_KEY env var~/.clawdbot/clawdbot.json → env.XAI_API_KEY~/.clawdbot/clawdbot.json → skills.entries["grok-search"].apiKeyskills.entries["search-x"].apiKey or skills.entries.xai.apiKeyUse {baseDir} so the command works regardless of workspace layout.
Web search (JSON):
node {baseDir}/scripts/grok_search.mjs "<query>" --webX/Twitter search (JSON):
node {baseDir}/scripts/grok_search.mjs "<query>" --xChat (text):
node {baseDir}/scripts/chat.mjs "<prompt>"Chat (vision):
node {baseDir}/scripts/chat.mjs --image /path/to/image.jpg "<prompt>"node {baseDir}/scripts/models.mjsOutput:
--links-only print just citation URLs--text hide the citations section in pretty output--raw include the raw Responses API payload on stderr (debug)Common:
--max <n> limit results (default 8)--model <id> (default grok-4-1-fast)X-only filters (server-side via x_search tool params):
--days <n> (e.g. 7)--from YYYY-MM-DD / --to YYYY-MM-DD--handles @a,@b (limit to these handles)--exclude @bots,@spam (exclude handles){
"query": "...",
"mode": "web" | "x",
"results": [
{
"title": "...",
"url": "...",
"snippet": "...",
"author": "...",
"posted_at": "..."
}
],
"citations": ["https://..."]
}
citations are merged/validated from xAI response annotations where possible (more reliable than trusting the model’s JSON blindly).--x for tweets/threads, --web for general research.这个 Skill 质量中上,文档写得很清楚,功能也很实用——能搜网页也能搜 Twitter,还能聊天和看模型列表。输出格式整齐,会自动整理引用链接。不足的是没有处理网络异常或 API 限速的情况,偶尔会卡住或报错。另外三个脚本有些功能重复,代码可以更简洁一些。普通用户用起来基本没问题,但稳定性还有提升空间。