/install grok-image-api
Grok Image API
Use this skill to work with image endpoints that expose:
POST /v1/images/generationsPOST /v1/images/edits
Prefer practical workflows: generate or edit an image, save the result locally, and then send or reuse the saved file.
Quick start
Prefer the bundled script:
scripts/grok_image_api.py generatefor text-to-imagescripts/grok_image_api.py editfor image editingscripts/grok_image_api.py probeto verify the endpoint is reachable
Default environment variables:
IMAGE_API_BASE_URLIMAGE_API_KEY
Workflow
- Identify the task: generate or edit.
- Load credentials through environment variables.
- For generation, send JSON to
/v1/images/generations. - For editing, send multipart form data to
/v1/images/editswithimageand optionalmask. - Save the returned image locally. If the API returns a URL, download it locally by default.
- If the user is on QQ and wants the image delivered, reply with a
\x3Cqqimg>tag pointing to the local file or returned URL.
Generation
Example:
IMAGE_API_BASE_URL="https://example.com/v1" \
IMAGE_API_KEY="..." \
python3 scripts/grok_image_api.py generate \
--style anime \
--preset-size portrait \
--prompt "a cozy cyberpunk tea shop at night" \
--out /tmp/generated.png
Use --size or --preset-size, --style, --model, --n, and --extra key=value when needed.
Editing
Example:
IMAGE_API_BASE_URL="https://example.com/v1" \
IMAGE_API_KEY="..." \
python3 scripts/grok_image_api.py edit \
--image /absolute/path/input.png \
--style cute \
--prompt "replace the background with a sunset beach" \
--out /tmp/edited.png
Add --mask /absolute/path/mask.png if the API supports masked edits.
Notes
- Assume this service is not a full chat-completions endpoint.
- Do not call unrelated routes unless the user explicitly says they exist.
- Avoid echoing secrets back to the user.
- Prefer local saved files for messaging channels that can upload local images.
- Default output directory is a local
output/grok-images/folder when--outis omitted.
References
Read references/api-notes.md when you need a compact reminder of request/response patterns, presets, and output behavior.
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install grok-image-api - 安装完成后,直接呼叫该 Skill 的名称或使用
/grok-image-api触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Grok Image API 是什么?
Work with OpenAI-compatible image generation and image editing endpoints. Use when the user wants to generate images from prompts, edit images with prompts a... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 350 次。
如何安装 Grok Image API?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install grok-image-api」即可一键安装,无需额外配置。
Grok Image API 是免费的吗?
是的,Grok Image API 完全免费(开源免费),可自由下载、安装和使用。
Grok Image API 支持哪些平台?
Grok Image API 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Grok Image API?
由 XiaoLozee(@xiaolozee)开发并维护,当前版本 v1.1.1。