网淘吧来吧,欢迎您!

xAI Plus技能使用说明

2026-04-01 新闻来源:网淘吧 围观:17
电脑广告
手机广告

xAI 技能

使用 xAI 的 API 搜索 X(Twitter)、搜索网络、与 Grok 模型(包括视觉模型)聊天,并分析 X 内容模式。

功能

  • X 搜索:使用日期/账号筛选器搜索帖子、主题串和账号
  • 网络搜索:通过 Grok 的 web_search 工具搜索网络
  • 聊天:与 Grok 模型进行文本和视觉(图像分析)对话
  • 分析:语音模式、趋势研究、帖子安全检查
  • 模型:列出可用的 xAI 模型

设置

API 密钥

console.x.ai获取您的 xAI API 密钥。

xAI Plus

# Via clawdbot config (recommended)
clawdbot config set skills.entries.xai-plus.apiKey "xai-YOUR-KEY"

# Or environment variable
export XAI_API_KEY="xai-YOUR-KEY"

脚本会按顺序检查以下位置:

  1. XAI_API_KEY环境变量
  2. ~/.clawdbot/clawdbot.json环境变量.XAI_API_KEY
  3. ~/.clawdbot/clawdbot.json技能.条目.xai-plus.API密钥
  4. ~/.clawdbot/clawdbot.json技能.条目["grok搜索"].API密钥(备用方案)

默认模型(可选)

覆盖默认模型 (grok-4-1-fast):

# Via config
clawdbot config set skills.entries.xai-plus.model "grok-3"

# Or environment variable
export XAI_MODEL="grok-3"

模型优先级:

  1. 命令行--model标志(最高优先级)
  2. XAI_MODEL环境变量
  3. ~/.clawdbot/clawdbot.json环境变量.XAI_MODEL
  4. ~/.clawdbot/clawdbot.json技能.条目.xai-plus.模型
  5. 默认grok-4-1-fast

搜索

X 搜索

搜索 X 帖子和主题,可选用过滤器。

基本搜索:

node {baseDir}/scripts/grok_search.mjs "query" --x

带日期过滤器:

# Last 7 days
node {baseDir}/scripts/grok_search.mjs "Claude AI" --x --days 7

# Specific date range
node {baseDir}/scripts/grok_search.mjs "AI agents" --x --from 2026-01-01 --to 2026-01-31

按用户句柄过滤:

# Only from specific accounts
node {baseDir}/scripts/grok_search.mjs "AI news" --x --handles @AnthropicAI,@OpenAI

# Exclude accounts
node {baseDir}/scripts/grok_search.mjs "GPT" --x --exclude @spam1,@spam2

输出格式:

# JSON (default, agent-friendly)
node {baseDir}/scripts/grok_search.mjs "query" --x

# Links only
node {baseDir}/scripts/grok_search.mjs "query" --x --links-only

# Human-readable text
node {baseDir}/scripts/grok_search.mjs "query" --x --text

JSON 输出模式:

{
  "query": "search query",
  "mode": "x",
  "results": [
    {
      "title": "@handle",
      "url": "https://x.com/handle/status/123",
      "snippet": "Post text...",
      "author": "@handle",
      "posted_at": "2026-01-15T10:30:00Z"
    }
  ],
  "citations": ["https://x.com/..."]
}

网络搜索

通过 Grok 搜索网络。

node {baseDir}/scripts/grok_search.mjs "TypeScript best practices 2026" --web

JSON 输出模式:

{
  "query": "search query",
  "mode": "web",
  "results": [
    {
      "title": "Page title",
      "url": "https://example.com/page",
      "snippet": "Description...",
      "author": null,
      "posted_at": null
    }
  ],
  "citations": ["https://example.com/..."]
}

搜索选项

标志描述示例
--x搜索 X/TwitterX 搜索必需
--web搜索网络网络搜索必需
--days N最近 N 天(仅限 X)--days 7
--from YYYY-MM-DD开始日期(仅限 X)--from 2026-01-01
--to YYYY-MM-DD结束日期(仅限 X)--to 2026-01-31
--handles a,b仅这些账户(仅限 X)--handles @user1,@user2
--exclude a,b排除账户(仅限 X)--exclude @spam
--max N最大结果数--max 20
--model ID覆盖模型--model grok-3
--jsonJSON 输出(默认)-
--links-only仅 URL-
--text人类可读-
--raw包含调试输出-

请参阅references/search-patterns.md以获取高级查询模式和优化技巧。

聊天

文本聊天

向Grok提出任何问题。

node {baseDir}/scripts/chat.mjs "What is quantum computing?"

使用模型覆盖:

node {baseDir}/scripts/chat.mjs --model grok-3 "Explain transformers in ML"

JSON输出:

node {baseDir}/scripts/chat.mjs --json "What is TypeScript?"

JSON模式:

{
  "model": "grok-4-1-fast",
  "prompt": "What is TypeScript?",
  "text": "TypeScript is...",
  "citations": ["https://..."]
}

视觉聊天

使用Grok分析图像。

node {baseDir}/scripts/chat.mjs --image ./screenshot.png "What's in this image?"

多张图像:

node {baseDir}/scripts/chat.mjs --image ./pic1.jpg --image ./pic2.jpg "Compare these"

支持的格式:JPG、PNG、WebP、GIF

聊天选项

标志描述示例
--model ID要使用的模型--model grok-2-vision-1212
--image PATH附加图片(可重复操作)--image ./pic.jpg
--jsonJSON输出-
--raw包含调试输出-

参见references/models.md以了解模型对比与功能。

分析

分析X内容中的语音模式、趋势和帖子质量。

语音分析

分析账户的语音和写作模式。

node {baseDir}/scripts/analyze.mjs voice @username

自定义日期范围:

# Last 60 days
node {baseDir}/scripts/analyze.mjs voice @username --days 60

JSON输出架构:

{
  "handle": "@username",
  "analyzed_posts": 150,
  "voice": {
    "tone": "casual, technical",
    "personality": ["curious", "direct", "helpful"],
    "perspective": "practitioner sharing lessons",
    "energy_level": "medium"
  },
  "patterns": {
    "sentence_structure": ["short declarative", "occasional fragments"],
    "vocabulary": ["technical", "accessible"],
    "formatting_quirks": ["line breaks for emphasis", "minimal punctuation"],
    "recurring_phrases": ["here's the thing", "turns out"]
  },
  "topics": ["AI", "software engineering", "startups"],
  "best_posts": [
    {
      "url": "https://x.com/username/status/123",
      "text": "Post text...",
      "why": "Authentic voice, specific example"
    }
  ],
  "anti_patterns": ["never uses em-dashes", "avoids numbered lists"]
}

趋势研究

研究关于某个主题的趋势和讨论。

node {baseDir}/scripts/analyze.mjs trends "AI agents"

JSON输出架构:

{
  "topic": "AI agents",
  "trends": [
    {
      "pattern": "Shift from chatbots to autonomous agents",
      "description": "Discussion focuses on...",
      "example_posts": ["https://x.com/..."]
    }
  ],
  "perspectives": [
    {
      "viewpoint": "Agents will replace most SaaS",
      "supporters": ["@user1", "@user2"]
    }
  ],
  "hashtags": ["#AIAgents", "#AutonomousAI"],
  "key_accounts": ["@researcher1", "@founder2"],
  "posting_angles": [
    {
      "angle": "Practical implementation challenges",
      "hook": "Everyone talks about AI agents. Nobody talks about...",
      "target_audience": "Engineers building with AI"
    }
  ]
}

帖子安全检查

检查草稿帖子或现有帖子中的AI信号和平台标记模式。

检查草稿文本:

node {baseDir}/scripts/analyze.mjs post "Your draft post text here"

检查现有帖子:

node {baseDir}/scripts/analyze.mjs post --url "https://x.com/user/status/123"

JSON输出模式:

{
  "post_text": "Your post...",
  "ai_detection_score": 3,
  "ai_signals": [
    "Contains em-dash",
    "Ends with engagement bait question"
  ],
  "platform_flag_score": 2,
  "platform_risks": [
    "Generic question could trigger spam filter"
  ],
  "quality_score": 7,
  "suggestions": [
    "Replace em-dash with period or comma",
    "Remove 'What do you think?' closer",
    "Add specific personal detail"
  ]
}

评分:

  • AI检测:0-10分(10分 = 确定是AI)
  • 平台标记风险:0-10分(10分 = 高风险垃圾信息)
  • 质量:0-10分(10分 = 优秀)

分析选项

标记描述示例
--days N分析的时间范围--days 60
--url URL分析现有帖子--url https://x.com/...
--model ID覆盖模型--model grok-3
--jsonJSON输出-
--raw包含调试输出-

请参阅references/analysis-prompts.md以获取详细的提示结构和评分标准。

模型

列出可用的xAI模型。

node {baseDir}/scripts/models.mjs

输出:

grok-2-vision-1212
grok-3
grok-4-1-fast
grok-4-fast

JSON输出:

node {baseDir}/scripts/models.mjs --json

快速模型比较:

模型速度质量视觉能力最佳适用场景
grok-4-1-fast快速良好默认(搜索、聊天、分析)
grok-4-fast快速替代快速模型
grok-3较慢最佳复杂推理,详细分析
grok-2-vision-1212中等图像分析

参见references/models.md以了解详细的模型功能和使用场景。

高级用法

引用去重

对于 X 搜索,该工具会自动对推文 URL 进行去重,优先采用规范格式/@handle/status/id而非/i/status/id格式。

自定义模型选择

覆盖任何操作的默认模型:

# Search with grok-3 for better quality
node {baseDir}/scripts/grok_search.mjs "complex query" --x --model grok-3

# Chat with vision model
node {baseDir}/scripts/chat.mjs --model grok-2-vision-1212 --image pic.jpg "Describe"

# Analysis with grok-3 for deeper insights
node {baseDir}/scripts/analyze.mjs voice @username --model grok-3

调试

添加--raw到任何命令以查看完整的API响应:

node {baseDir}/scripts/grok_search.mjs "query" --x --raw

参考文档

示例

研究一个主题

# Find recent discussions
node {baseDir}/scripts/grok_search.mjs "Claude Sonnet 4.5" --x --days 3

# Get trend analysis
node {baseDir}/scripts/analyze.mjs trends "Claude Sonnet 4.5"

起草前分析语气

# Study the target account
node {baseDir}/scripts/analyze.mjs voice @target_account --days 30

# Check your draft
node {baseDir}/scripts/analyze.mjs post "Your draft here"

多模态研究

# Search web for context
node {baseDir}/scripts/grok_search.mjs "TypeScript 5.7 features" --web

# Ask follow-up
node {baseDir}/scripts/chat.mjs "What are the key TypeScript 5.7 improvements?"

# Analyze screenshot
node {baseDir}/scripts/chat.mjs --image ./code.png "Review this code"

错误处理

常见错误和解决方案:

缺少API密钥:

Missing XAI_API_KEY

→ 设置XAI_API_KEY环境变量或添加到~/.clawdbot/clawdbot.json

无效模式:

Must specify --web or --x

→ 添加--web--x标志到搜索命令

图像格式错误:

Unsupported image type

→ 使用 JPG、PNG、WebP 或 GIF 格式

API 错误:

xAI API error: 401 Unauthorized

→ 检查 API 密钥是否有效且处于活动状态

提示

  • 默认模型 (grok-4-1-fast) 速度快,适用于大多数任务
  • 使用grok-3进行复杂分析或当质量比速度更重要时
  • X 搜索受时效性限制(xAI x_search 工具约束)
  • 网络搜索最适合具体、当前的查询
  • 语音分析需要充足的发帖历史(建议30条以上)
  • 发帖安全检查结果仅供参考,最终决策需自行判断
  • JSON输出格式最适合代理程序/脚本处理
  • 文本输出格式更便于终端/人工阅读

故障排除

X平台搜索无结果:

  • 尝试放宽搜索条件或延长日期范围
  • 确认账号存在且为公开状态
  • 移除限制性过强的筛选条件

语音分析不完整:

  • 增加--days参数值以获取更多发帖历史
  • 确认账号为公开活跃状态
  • 核实账号名称是否正确(无论是否包含@符号)

API调用频率限制:

  • xAI对每个API密钥强制执行调用频率限制
  • 若触发限制,请将请求分散在不同时间段进行
  • 可考虑升级xAI套餐以获得更高调用限额

内容创作工作流程

利用分析工具优化您的X平台内容:

# Research before writing
node {baseDir}/scripts/analyze.mjs trends "your topic"
node {baseDir}/scripts/grok_search.mjs "your topic" --x --days 7

# Study voice patterns
node {baseDir}/scripts/analyze.mjs voice @target_account

# Check draft before posting
node {baseDir}/scripts/analyze.mjs post "$(cat draft.txt)"

借助JSON输出实现:

  • 研究当前讨论热点与发布角度
  • 向细分领域成功案例学习
  • 发布前捕捉AI信号与平台标识

免责申明
部分文章来自各大搜索引擎,如有侵权,请与我联系删除。
打赏

文章底部电脑广告
手机广告位-内容正文底部

相关文章

您是本站第393794名访客 今日有1篇新文章/评论