Token导航 LogoToken导航

Agent Skill · 研究检索

grok-api(grok API 文档)

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。它适合让 Agent 梳理 endpoint、生成 OpenAPI 草稿、检查字段命名、整理错误码或辅助前后端联调。使用时需要确认真实业务语义、鉴权方式、分页和错误处理规则;涉及生成接口文档时,应避免凭空补字段,最好从现有代码、schema 或接口样例中提取事实。

grok-api 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描有未通过项,按安装量在研究检索类的 73,675 个 Skill 里排第 66,030。

总安装 269周安装 11GitHub Stars 公开资料未说明下载 86核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:grok-api(grok API 文档)
来源仓库:https://github.com/catfishw/grokagentskill
仓库路径:skills/grok-api
安装命令:
npx skills add https://github.com/catfishw/grokagentskill --skill grok-api
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/catfishw/grokagentskill --skill grok-api

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

grok-api 提供 OpenAI 兼容接口代理,允许通过标准 SDK 调用 Grok 大语言模型,简化集成流程。支持聊天补全与流式响应,适用于需要低延迟文本生成的场景,如实时问答或内容创作。使用前必须配置 app_key 认证头,且密钥需具备足够额度以避免服务中断,建议设置用量告警。

API 地址为 https://mc.agaii.org/grok/v1,协议完全兼容 OpenAI,可直接替换 openai 客户端。注意此为第三方托管服务,稳定性与数据安全由运营方保障,生产环境建议自建代理层隔离风险。

来源仓库内路径:skills/grok-api

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/catfishw/grokagentskill --skill grok-api;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

grok-api 怎么安装?

在终端执行 npx skills add https://github.com/catfishw/grokagentskill --skill grok-api。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

grok-api 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

grok-api 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

grok-api 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

grok-api 用的人多吗?

公开数据是累计安装 269 次,近一周安装 11 次,下载 86 次。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

grok-api 安全吗?

第三方扫描有未通过项,风险较高。除非你确认过源码,否则不建议直接安装到常用环境。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
grok-api

grok API 文档 · 本页

269—接触敏感数据未明确未通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Grok API (via grok2api)

OpenAI-compatible Grok API proxy hosted at https://mc.agaii.org/grok. Use this skill whenever the user asks you to call Grok models, generate text with Grok, or interact with the Grok API.

Overview

  • Base URL: https://mc.agaii.org/grok/v1
  • Auth header: Authorization: Bearer <app_key>
  • Protocol: OpenAI-compatible (drop-in replacement for openai SDK)
  • Admin panel: https://mc.agaii.org/grok/admin/login

The API supports chat completions, streaming, and all standard OpenAI-compatible parameters.

Step 0: Confirm Credentials

Before making any call, confirm the app key is available. The key is used as a Bearer token:

# Verify the key works
curl -s https://mc.agaii.org/grok/v1/models \
  -H "Authorization: Bearer <app_key>"

A successful response lists available Grok models.

Step 1: Choose a Model

Use GET /v1/models to list available models, or pick from the well-known ones:

ModelDescription
grok-3Most capable, best for complex reasoning
grok-3-fastFast variant of Grok-3
grok-3-miniLightweight, efficient
grok-3-mini-fastFastest, lowest latency
grok-2-vision-1212Vision-capable model
curl -s https://mc.agaii.org/grok/v1/models \
  -H "Authorization: Bearer <app_key>" | python3 -m json.tool

Step 2: Chat Completions

Non-streaming

curl -s -X POST https://mc.agaii.org/grok/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <app_key>" \
  -d '{
    "model": "grok-3",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Explain quantum entanglement in simple terms."}
    ],
    "temperature": 0.7,
    "max_tokens": 1024
  }'

Response shape:

{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "created": 1234567890,
  "model": "grok-3",
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "..."
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "total_tokens": 0
  }
}

Streaming

curl -s -X POST https://mc.agaii.org/grok/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <app_key>" \
  -d '{
    "model": "grok-3",
    "messages": [{"role": "user", "content": "Write a haiku about the sea."}],
    "stream": true
  }'

Streaming returns text/event-stream Server-Sent Events. Each chunk is:

data: {"id":"...","object":"chat.completion.chunk","choices":[{"delta":{"content":"..."}}]}

The stream ends with data: [DONE].

Step 3: Using the Python Script

A ready-to-use Python script is available at scripts/grok_api.py in this skill directory.

Find it:

# If installed via npx skills add
ls .cursor/skills/GrokAgentSkill/scripts/grok_api.py

Run examples

# Simple chat
python scripts/grok_api.py chat "What is the capital of France?"

# Chat with a specific model
python scripts/grok_api.py chat "Write a poem" --model grok-3-mini

# Streaming chat
python scripts/grok_api.py chat "Tell me a story" --stream

# Multi-turn conversation (JSON file)
python scripts/grok_api.py file scripts/example_messages.json

# List models
python scripts/grok_api.py models

Set the app key via environment variable (recommended):

export GROK_API_KEY=<app_key>
python scripts/grok_api.py chat "Hello"

Or pass inline:

python scripts/grok_api.py chat "Hello" --key <app_key>

Step 4: Using the OpenAI Python SDK

The API is a drop-in replacement. Install: pip install openai

from openai import OpenAI

client = OpenAI(
    base_url="https://mc.agaii.org/grok/v1",
    api_key="<app_key>",
)

response = client.chat.completions.create(
    model="grok-3",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "What is 2 + 2?"},
    ],
)
print(response.choices[0].message.content)

Streaming with SDK

stream = client.chat.completions.create(
    model="grok-3",
    messages=[{"role": "user", "content": "Count to 5 slowly."}],
    stream=True,
)
for chunk in stream:
    delta = chunk.choices[0].delta.content
    if delta:
        print(delta, end="", flush=True)

Async usage

import asyncio
from openai import AsyncOpenAI

client = AsyncOpenAI(
    base_url="https://mc.agaii.org/grok/v1",
    api_key="<app_key>",
)

async def main():
    response = await client.chat.completions.create(
        model="grok-3-fast",
        messages=[{"role": "user", "content": "Hello!"}],
    )
    print(response.choices[0].message.content)

asyncio.run(main())

API Reference

POST /v1/chat/completions

ParameterTypeRequiredDescription
modelstringYesModel ID (e.g. grok-3)
messagesarrayYesArray of {role, content} objects
streambooleanNoEnable SSE streaming (default: false)
temperaturefloatNoSampling temperature 0–2 (default: 1.0)
max_tokensintegerNoMax tokens to generate
top_pfloatNoNucleus sampling (default: 1.0)
frequency_penaltyfloatNo-2.0 to 2.0
presence_penaltyfloatNo-2.0 to 2.0
stopstring/arrayNoStop sequences
nintegerNoNumber of completions
userstringNoEnd-user identifier

Message roles

RoleDescription
systemSets assistant behavior/persona
userHuman turn
assistantPrevious assistant turn (for multi-turn)

GET /v1/models

Returns list of available models. No body required.

Error codes

CodeMeaning
401Invalid or missing API key
429No available tokens / rate limited
500Internal server error

Admin API

All admin endpoints require Authorization: Bearer <app_key>.

List tokens

curl https://mc.agaii.org/grok/v1/admin/tokens \
  -H "Authorization: Bearer <app_key>"

Add / update tokens

curl -X POST https://mc.agaii.org/grok/v1/admin/tokens \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <app_key>" \
  -d '{"ssoBasic": [{"token": "<sso_token>", "status": "active", "quota": 10, "created_at": 0, "use_count": 0, "fail_count": 0, "tags": [], "note": ""}]}'

Refresh token quota

curl -X POST https://mc.agaii.org/grok/v1/admin/tokens/refresh \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <app_key>" \
  -d '{"token": "<sso_token>"}'

Common Patterns

System prompt + user message

messages = [
    {"role": "system", "content": "You are an expert Python developer. Be concise."},
    {"role": "user", "content": "How do I read a file line by line in Python?"},
]

Multi-turn conversation

messages = [
    {"role": "user", "content": "My name is Alice."},
    {"role": "assistant", "content": "Nice to meet you, Alice!"},
    {"role": "user", "content": "What is my name?"},
]

Low-latency use case

Use grok-3-mini-fast with max_tokens set to limit response length:

client.chat.completions.create(
    model="grok-3-mini-fast",
    messages=[{"role": "user", "content": "Summarize in one sentence: ..."}],
    max_tokens=100,
)

Structured output (JSON mode)

client.chat.completions.create(
    model="grok-3",
    messages=[
        {"role": "system", "content": "Always respond with valid JSON only."},
        {"role": "user", "content": "List 3 fruits with their colors as JSON."},
    ],
    temperature=0,
)

Image Generation

Use model grok-imagine-1.0 to generate images from a text prompt.

curl -s -X POST https://mc.agaii.org/grok/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <app_key>" \
  -d '{
    "model": "grok-imagine-1.0",
    "messages": [{"role": "user", "content": "A photorealistic red apple on a wooden table"}]
  }'

The response content will contain an <img> tag with a src URL pointing to the generated image.

Parse the image URL from the response:

import re
content = response["choices"][0]["message"]["content"]
match = re.search(r'src="([^"]+)"', content)
image_url = match.group(1) if match else None

Image editing

Use model grok-imagine-1.0-edit with an existing image URL in the prompt:

-d '{"model": "grok-imagine-1.0-edit", "messages": [{"role": "user", "content": "Make the apple golden. Image: https://..."}]}'

Video Generation

Use model grok-imagine-1.0-video to generate short videos from a text prompt.

Important: The API streams progress updates as SSE chunks (percent complete), then delivers the final video URL embedded in HTML at 100%. You MUST stream the response and parse the final chunk for the video URL.

Step-by-step workflow

1. Submit the request (streaming required):

curl -s -X POST https://mc.agaii.org/grok/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <app_key>" \
  -d '{
    "model": "grok-imagine-1.0-video",
    "messages": [{"role": "user", "content": "<your video prompt>"}]
  }' > /tmp/video_response.txt

2. Extract the video URL from the streamed output:

grep -oP 'src=\\"https://[^"]+\.mp4\\"' /tmp/video_response.txt | head -1 | grep -oP 'https://[^"\\]+'

Or in Python:

import re, subprocess, json

# Run curl and capture all SSE lines
output = subprocess.check_output([
    "curl", "-s", "-X", "POST",
    "https://mc.agaii.org/grok/v1/chat/completions",
    "-H", "Content-Type: application/json",
    "-H", f"Authorization: Bearer {api_key}",
    "-d", json.dumps({
        "model": "grok-imagine-1.0-video",
        "messages": [{"role": "user", "content": prompt}]
    })
], timeout=300).decode()

# Extract video URL
match = re.search(r'src=\\"(https://[^"\\]+\.mp4)\\"', output)
video_url = match.group(1) if match else None
print("Video URL:", video_url)

3. Download the video:

wget -O output.mp4 "<video_url>"
# or
curl -L -o output.mp4 "<video_url>"

Using the bundled script

GROK_API_KEY=<key> python scripts/grok_api.py video "A glowing figure rotating in the dark"

This will print the video URL when generation completes (typically takes 20–60 seconds).

Progress tracking

During generation the API streams lines like:

正在生成视频中,当前进度1%
正在生成视频中,当前进度25%
...
正在生成视频中,当前进度100%
<video id="video" ...><source src="https://.../generated_video.mp4" ...></video>

The final content after 100% contains the <video> HTML with the mp4 URL and a preview image (poster).

Preview image

The poster/thumbnail URL is also embedded:

poster="https://mc.agaii.org/grok/v1/files/image/.../preview_image.jpg"

Extract with:

match = re.search(r'poster=\\"(https://[^"\\]+)\\"', output)
preview_url = match.group(1) if match else None

Tips for good video prompts

  • Describe subject, motion, camera movement, and lighting explicitly
  • Mention tone (cinematic, futuristic, elegant, etc.)
  • Keep prompts under 300 words
  • Dark backgrounds with glowing elements tend to render well
  • Specify duration feel with pacing words ("slowly pulls back", "quick cut", etc.)

Troubleshooting

SymptomCauseFix
429 "No available tokens"Token pool empty or all coolingAdd more SSO tokens via admin API
401 UnauthorizedWrong app keyCheck Authorization: Bearer <key> header
Connection refusedServer not runningCheck service on port 15125
Blank content in responseModel returned emptyTry again or reduce temperature
Token refresh returns falseSSO token expiredRemove token and add a fresh one

平台分布

Codex

35.29%
按下载量换算30

Claude

29.95%
按下载量换算26

Cursor

19.17%
按下载量换算16

Gemini CLI

9.89%
按下载量换算9

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

未通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills