xai

TotalClaw 作者 totalclaw

通过 xAI API 与 Grok 模型聊天。支持 Grok-3、Grok-3-mini、vision 等。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw skills install shop:totalclaw:totalclaw~blueberrywoodsym-x-ai
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~blueberrywoodsym-x-ai/file -o blueberrywoodsym-x-ai.md
# xAI / Grok

Chat with xAI's Grok models. Supports text and vision.

## Setup

[INSTALLATION AND USE INSTRUCTIONS](https://claude.ai/public/artifacts/5bb1d4ca-68ef-4d74-900c-d14fefa5c094)

```bash
export XAI_API_KEY="xai-YOUR-KEY"
```

Get your API key at: https://console.x.ai

## Commands

### Chat with Grok
```bash
node {baseDir}/scripts/chat.js "What is the meaning of life?"
```

### Use a specific model
```bash
node {baseDir}/scripts/chat.js --model grok-3-mini "Quick question: 2+2?"
```

### Vision (analyze images)
```bash
node {baseDir}/scripts/chat.js --image /path/to/image.jpg "What's in this image?"
```

### 🔍 Search X/Twitter (Real-time!)
```bash
node {baseDir}/scripts/search-x.js "Remotion video framework"
node {baseDir}/scripts/search-x.js --days 7 "Claude AI tips"
node {baseDir}/scripts/search-x.js --handles @remotion_dev "updates"
```

Uses xAI Responses API with x_search tool for real X posts with citations.

### List available models
```bash
node {baseDir}/scripts/models.js
```

## Available Models

- `grok-3` - Most capable, best for complex tasks
- `grok-3-mini` - Fast and efficient
- `grok-3-fast` - Optimized for speed
- `grok-2-vision-1212` - Vision model for image understanding

## Example Usage

**User:** "Ask Grok what it thinks about AI safety"
**Action:** Run chat.js with the prompt

**User:** "Use Grok to analyze this image" (with attached image)
**Action:** Run chat.js with --image flag

**User:** "What Grok models are available?"
**Action:** Run models.js

## API Reference

xAI API Docs: https://docs.x.ai/api

## Environment Variables

- `XAI_API_KEY` - Your xAI API key (required)
- `XAI_MODEL` - Default model (optional, defaults to grok-3)

## Security & Permissions

**What this skill does:**
- Sends chat prompts to xAI's API at `api.x.ai`
- Vision mode sends images to xAI for analysis
- `scripts/models.js` lists available models (read-only)

**What this skill does NOT do:**
- Does not read arbitrary local files — `--image` only accepts files with image extensions (`.jpg`, `.jpeg`, `.png`, `.gif`, `.webp`)
- Does not read config files or access the filesystem beyond the specified image path
- Does not store conversation history or logs
- Does not send credentials to any endpoint other than `api.x.ai`
- Cannot be invoked autonomously by the agent (`disable-model-invocation: true`)

**Bundled scripts:** `scripts/chat.js` (chat), `scripts/models.js` (list models), `scripts/search-x.js` (X search)

Review scripts before first use to verify behavior.

---

## 中文说明

# xAI / Grok

与 xAI 的 Grok 模型聊天。支持文本和 vision。

## 设置

[INSTALLATION AND USE INSTRUCTIONS](https://claude.ai/public/artifacts/5bb1d4ca-68ef-4d74-900c-d14fefa5c094)

```bash
export XAI_API_KEY="xai-YOUR-KEY"
```

在以下地址获取你的 API key:https://console.x.ai

## 命令

### 与 Grok 聊天
```bash
node {baseDir}/scripts/chat.js "What is the meaning of life?"
```

### 使用特定模型
```bash
node {baseDir}/scripts/chat.js --model grok-3-mini "Quick question: 2+2?"
```

### Vision(分析图像)
```bash
node {baseDir}/scripts/chat.js --image /path/to/image.jpg "What's in this image?"
```

### 🔍 搜索 X/Twitter(实时!)
```bash
node {baseDir}/scripts/search-x.js "Remotion video framework"
node {baseDir}/scripts/search-x.js --days 7 "Claude AI tips"
node {baseDir}/scripts/search-x.js --handles @remotion_dev "updates"
```

使用 xAI Responses API 配合 x_search 工具,获取带引用的真实 X 帖子。

### 列出可用模型
```bash
node {baseDir}/scripts/models.js
```

## 可用模型

- `grok-3` - 最强能力,最适合复杂任务
- `grok-3-mini` - 快速高效
- `grok-3-fast` - 针对速度优化
- `grok-2-vision-1212` - 用于图像理解的 vision 模型

## 用法示例

**用户:** "Ask Grok what it thinks about AI safety"
**操作:** 用该提示运行 chat.js

**用户:** "Use Grok to analyze this image"(附带图像)
**操作:** 带 --image 标志运行 chat.js

**用户:** "What Grok models are available?"
**操作:** 运行 models.js

## API 参考

xAI API 文档:https://docs.x.ai/api

## 环境变量

- `XAI_API_KEY` - 你的 xAI API key(必填)
- `XAI_MODEL` - 默认模型(可选,默认为 grok-3)

## 安全与权限

**本技能做什么:**
- 将聊天提示发送至 xAI 位于 `api.x.ai` 的 API
- Vision 模式将图像发送至 xAI 进行分析
- `scripts/models.js` 列出可用模型(只读)

**本技能不做什么:**
- 不读取任意本地文件——`--image` 仅接受带图像扩展名的文件(`.jpg`、`.jpeg`、`.png`、`.gif`、`.webp`)
- 不读取配置文件,也不访问指定图像路径之外的文件系统
- 不存储对话历史或日志
- 除 `api.x.ai` 外不向任何端点发送凭证
- 无法被代理自主调用(`disable-model-invocation: true`)

**捆绑脚本:** `scripts/chat.js`(聊天)、`scripts/models.js`(列出模型)、`scripts/search-x.js`(X 搜索)

首次使用前请审阅脚本以核实其行为。