← 返回 Skills 市场
147
总下载
0
收藏
2
当前安装
1
版本数
在 OpenClaw 中安装
/install grok-api
功能描述
通过 LeonAI 代理调用 xAI Grok API,支持多模型文本对话、深度推理及图片视频生成与编辑,兼容 OpenAI 格式。
使用说明 (SKILL.md)
Grok API Skill
Description
通过 LeonAI 代理调用 xAI Grok API,支持文本对话、推理、图片生成/编辑、视频生成。兼容 OpenAI Chat Completions 格式。
触发场景
- 用户说"用 Grok 聊天/问问题/分析"
- 用户说"用 Grok 生成图片/画图"
- 用户说"用 Grok 生成视频"
- 用户提到 Grok 模型名(grok-3, grok-4, grok-4.1 等)
环境变量要求
GROK_API_KEY— LeonAI 代理的 API Key(存入 personal-secrets.json)GROK_BASE_URL— 默认https://apileon.leonai.top/grok/v1
可用模型
文本模型
| 模型 | 特点 | Tier | Cost |
|---|---|---|---|
| grok-3 | 基础文本 | basic | low |
| grok-3-mini | 轻量推理 | basic | low |
| grok-3-thinking | 深度推理 | basic | low |
| grok-4 | 进阶文本 | basic | low |
| grok-4-mini | 快速回复 | basic | low |
| grok-4-thinking | 进阶推理 | basic | low |
| grok-4-heavy | 重量级 | super | high |
| grok-4.1-mini | 最新快速 | basic | low |
| grok-4.1-fast | 极速 | basic | low |
| grok-4.1-expert | 专家级 | basic | high |
| grok-4.1-thinking | 最新推理 | basic | high |
| grok-4.20-beta | Beta测试 | basic | low |
图片/视频模型
| 模型 | 功能 |
|---|---|
| grok-imagine-1.0 | 图片生成 |
| grok-imagine-1.0-fast | 快速图片生成 |
| grok-imagine-1.0-edit | 图片编辑 |
| grok-imagine-1.0-video | 视频生成 |
使用方式
1. 文本对话
curl -s -X POST "$GROK_BASE_URL/chat/completions" \
-H "Authorization: Bearer $GROK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-4.1-mini",
"stream": false,
"messages": [{"role": "user", "content": "你好"}]
}'
2. 推理模式
curl -s -X POST "$GROK_BASE_URL/chat/completions" \
-H "Authorization: Bearer $GROK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-4.1-thinking",
"stream": false,
"reasoning_effort": "high",
"messages": [{"role": "user", "content": "分析量子计算的前景"}]
}'
3. 图片生成
curl -s -X POST "$GROK_BASE_URL/images/generations" \
-H "Authorization: Bearer $GROK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "描述文本",
"model": "grok-imagine-1.0",
"n": 1,
"size": "1024x1024",
"response_format": "url",
"enable_nsfw": true
}'
可选 size: 1024x1024 / 1280x720 / 720x1280 / 1792x1024 / 1024x1792
4. 视频生成
curl -s -X POST "$GROK_BASE_URL/videos" \
-H "Authorization: Bearer $GROK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "视频描述",
"model": "grok-imagine-1.0-video",
"size": "1792x1024",
"seconds": 6,
"quality": "standard"
}'
seconds: 6-30 | quality: standard(480p) / high(720p)
5. 脚本调用
# 文本
python3 scripts/grok_chat.py "你好Grok"
python3 scripts/grok_chat.py --model grok-4.1-thinking --reasoning high "分析问题"
# 图片
python3 scripts/grok_chat.py --image "描述"
# 视频
python3 scripts/grok_chat.py --video "描述"
# 列出模型
python3 scripts/grok_chat.py --list-models
推荐模型选择
- 日常对话/快速问答 →
grok-4.1-mini或grok-4.1-fast - 深度分析/推理 →
grok-4.1-thinking+reasoning_effort: high - 图片生成 →
grok-imagine-1.0(高质量)或grok-imagine-1.0-fast(快速) - 视频生成 →
grok-imagine-1.0-video
注意事项
- API 通过 LeonAI 代理转发,非 xAI 直连
- 额度:Basic tier 80次/20h,Super tier 140次/2h
- 图片/视频生成为异步,URL 有时效性,建议及时下载
enable_nsfw: true可开启 NSFW 内容生成
安全使用建议
This skill appears to do what it says (calls Grok via a LeonAI proxy) and the Python script is small and readable. Before installing or providing keys: (1) verify who operates the default proxy URL (apileon.leonai.top) — if you don't trust it, change GROK_BASE_URL to an endpoint you trust or use an account/key dedicated to the proxy; (2) do not reuse high-privilege keys — create a scoped/test key if possible and avoid sending secrets or sensitive data through the proxy; (3) note the registry metadata omission: the skill requires GROK_API_KEY and GROK_BASE_URL even though the registry lists none, so make sure your environment/set-up matches the SKILL.md; (4) review the small grok_chat.py yourself (it only does HTTP calls) and test with non-sensitive inputs first. If you cannot verify the proxy operator, consider using an official xAI endpoint or another vetted integration instead.
功能分析
Type: OpenClaw Skill
Name: grok-api
Version: 1.0.0
The grok-api skill is a functional integration for accessing xAI Grok models via a third-party proxy service (apileon.leonai.top). The Python script (grok_chat.py) uses standard libraries to perform API requests and lacks any indicators of malicious intent, such as unauthorized data exfiltration, shell execution, or persistence mechanisms. While the use of a third-party proxy requires trusting the service provider with API keys and prompt content, the skill is transparent about this architecture and its code logic is straightforward and safe.
能力评估
Purpose & Capability
The name/description (call Grok via LeonAI proxy) aligns with the included code and SKILL.md: both show HTTP calls to a Grok API proxy and support chat/image/video endpoints. However the registry metadata lists no required environment variables while SKILL.md and the script expect GROK_API_KEY and GROK_BASE_URL, which is inconsistent and could lead to user confusion.
Instruction Scope
Instructions only direct the agent/user to call the proxy API endpoints (chat, images, videos) and to store GROK_API_KEY in personal-secrets.json; they do not instruct reading unrelated files or accessing other credentials. They do instruct sending potentially sensitive content to the configured BASE_URL, so the trustworthiness of that endpoint matters.
Install Mechanism
No install spec or remote downloads; the skill is instruction-only with a small pure-Python script that uses only the standard library. Nothing is written to disk beyond the included script when you install the skill.
Credentials
Only an API key and a base URL are required by the script, which is proportionate to the task. The concern is twofold: (1) the registry metadata does not declare these required env vars, and (2) the default BASE_URL points to a third-party proxy (https://apileon.leonai.top). Supplying an API key to an unverified proxy can expose your requests and data to that operator.
Persistence & Privilege
The skill does not request always:true, does not modify other skills or system config, and has no persistent/install-time privileged behavior. Agent autonomy remains at the platform default.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install grok-api - 安装完成后,直接呼叫该 Skill 的名称或使用
/grok-api触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- 首次发布 Grok API Skill,支持通过 LeonAI 代理调用 xAI Grok API。
- 支持文本对话、推理、图片生成/编辑、视频生成,兼容 OpenAI Chat Completions 格式。
- 丰富的模型选择,包括 grok-4/4.1 系列及图片/视频相关模型。
- 提供详细的 API 使用方法及推荐使用场景。
- 支持脚本化调用及模型列表查询。
元数据
常见问题
Grok Api 是什么?
通过 LeonAI 代理调用 xAI Grok API,支持多模型文本对话、深度推理及图片视频生成与编辑,兼容 OpenAI 格式。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 147 次。
如何安装 Grok Api?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install grok-api」即可一键安装,无需额外配置。
Grok Api 是免费的吗?
是的,Grok Api 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Grok Api 支持哪些平台?
Grok Api 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Grok Api?
由 lygjoey(@lygjoey)开发并维护,当前版本 v1.0.0。
推荐 Skills