← Back to Skills Marketplace
lygjoey

Grok Api

by lygjoey · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
147
Downloads
0
Stars
2
Active Installs
1
Versions
Install in OpenClaw
/install grok-api
Description
通过 LeonAI 代理调用 xAI Grok API,支持多模型文本对话、深度推理及图片视频生成与编辑,兼容 OpenAI 格式。
README (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-minigrok-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 内容生成
Usage Guidance
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.
Capability Analysis
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install grok-api
  3. After installation, invoke the skill by name or use /grok-api
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
- 首次发布 Grok API Skill,支持通过 LeonAI 代理调用 xAI Grok API。 - 支持文本对话、推理、图片生成/编辑、视频生成,兼容 OpenAI Chat Completions 格式。 - 丰富的模型选择,包括 grok-4/4.1 系列及图片/视频相关模型。 - 提供详细的 API 使用方法及推荐使用场景。 - 支持脚本化调用及模型列表查询。
Metadata
Slug grok-api
Version 1.0.0
License MIT-0
All-time Installs 2
Active Installs 2
Total Versions 1
Frequently Asked Questions

What is Grok Api?

通过 LeonAI 代理调用 xAI Grok API,支持多模型文本对话、深度推理及图片视频生成与编辑,兼容 OpenAI 格式。 It is an AI Agent Skill for Claude Code / OpenClaw, with 147 downloads so far.

How do I install Grok Api?

Run "/install grok-api" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Grok Api free?

Yes, Grok Api is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Grok Api support?

Grok Api is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Grok Api?

It is built and maintained by lygjoey (@lygjoey); the current version is v1.0.0.

💬 Comments