← 返回 Skills 市场
cyberash-dev

Grok Image Cli

作者 cyberash-dev · GitHub ↗ · v0.2.1
macoswindowslinux ✓ 安全检测通过
1377
总下载
0
收藏
4
当前安装
5
版本数
在 OpenClaw 中安装
/install grok-image-cli
功能描述
Generate and edit images via Grok API from the command line. Cross-platform secure credential storage for xAI API key. Supports batch generation, aspect rati...
使用说明 (SKILL.md)

grok-image-cli

A CLI for generating and editing images using the xAI Grok API. Supports multiple models: grok-imagine-image (default), grok-imagine-image-pro, grok-2-image-1212. Powered by the official @ai-sdk/xai SDK. Credentials are stored in the OS native credential store (macOS Keychain, Windows Credential Manager, Linux Secret Service) via cross-keychain.

Installation

Requires Node.js >= 20.19.0. Works on macOS, Windows, and Linux. The package is fully open source under the MIT license: https://github.com/cyberash-dev/grok-image-cli

npm install -g grok-image-cli

The npm package is published with provenance attestation, linking each release to its source commit via GitHub Actions. You can verify the published contents before installing:

npm pack grok-image-cli --dry-run

Install from source (if you prefer to audit the code before running):

git clone https://github.com/cyberash-dev/grok-image-cli.git
cd grok-image-cli
npm install && npm run build && npm link

After installation the grok-img command is available globally.

Quick Start

grok-img auth login                                                      # Interactive prompt: enter xAI API key
grok-img generate "A futuristic city skyline at night"                   # Generate with default model
grok-img generate "A futuristic city skyline at night" -m grok-imagine-image-pro  # Use pro model
grok-img edit "Make it a watercolor painting" -i ./photo.jpg             # Edit an existing image

API Key Management

Store API key (interactive prompt):

grok-img auth login

Show stored key (masked) and source:

grok-img auth status

Remove key from credential store:

grok-img auth logout

The CLI also supports the XAI_API_KEY environment variable as a fallback when no credential store entry is found.

Image Generation

grok-img generate "A collage of London landmarks in street-art style"
grok-img generate "Mountain landscape at sunrise" -n 4 -a 16:9
grok-img generate "A serene Japanese garden" -o ./my-images
grok-img generate "Photorealistic portrait" -m grok-imagine-image-pro
grok-img generate "Abstract art" -m grok-2-image-1212

Image Editing

Edit a local file or a remote URL:

grok-img edit "Change the landmarks to New York City" -i ./landmarks.jpg
grok-img edit "Render as a pencil sketch" -i https://example.com/portrait.jpg
grok-img edit "Add a vintage film grain effect" -i ./photo.jpg -a 3:2 -o ./edited

Flag Reference

generate

Flag Description Default
-m, --model \x3Cmodel> Model (grok-imagine-image, grok-imagine-image-pro, grok-2-image-1212) grok-imagine-image
-a, --aspect-ratio \x3Cratio> Aspect ratio (1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 2:1, 1:2, 19.5:9, 9:19.5, 20:9, 9:20, auto) auto
-n, --count \x3Cnumber> Number of images to generate (1-10) 1
-o, --output \x3Cdir> Output directory ./grok-images

edit

Flag Description Default
-i, --image \x3Cpath> Source image (local file path or URL) required
-m, --model \x3Cmodel> Model (grok-imagine-image, grok-imagine-image-pro, grok-2-image-1212) grok-imagine-image
-a, --aspect-ratio \x3Cratio> Aspect ratio auto
-o, --output \x3Cdir> Output directory ./grok-images

Security and Data Storage

The following properties are by design and can be verified in the source code:

  • xAI API key: stored in the OS native credential store via cross-keychain (macOS Keychain / Windows Credential Manager / Linux Secret Service; service: grok-image-cli, account: api-key). By design, never written to disk in plaintext. If no credential store entry is found, the CLI falls back to the XAI_API_KEY environment variable. See src/infrastructure/adapters/credential-store.adapter.ts for the implementation.
  • No config files: all settings are passed via CLI flags. Nothing is stored on disk besides the credential store entry.
  • Network: the API key is only sent to api.x.ai over HTTPS via the official @ai-sdk/xai SDK. When editing images with a remote URL (-i https://...), the SDK makes an additional outbound HTTPS request to fetch the source image. No other outbound connections are made by the CLI itself (npm/git fetches during installation are standard package manager behavior). See src/infrastructure/adapters/grok-api.adapter.ts.
  • Generated images: saved to the local output directory (default: ./grok-images). No images are cached or uploaded elsewhere.

API Reference

This CLI wraps the xAI Image Generation API via the Vercel AI SDK:

  • Generation: POST /v1/images/generations
  • Editing: POST /v1/images/edits

Documentation: https://docs.x.ai/docs/guides/image-generation

安全使用建议
This skill appears to do what it says: it's a CLI wrapper around xAI image APIs and requires Node and the grok-img binary plus an xAI API key stored in your OS credential store (or via XAI_API_KEY). Before installing: 1) verify the npm package and GitHub repo (check the provenance/commit referenced) and prefer auditing source if you have concerns; 2) confirm you trust the grok-img binary's origin (npm scope and publisher); 3) be aware that when you use the edit command with a remote image URL the CLI will fetch that URL over HTTPS; 4) note the minor metadata mismatch (registry claims no primary credential but SKILL.md uses a cross-keychain credential) — this is likely an editorial issue but you may want the publisher to correct it. If any of these checks fail, avoid installing or run installation in an isolated environment.
功能分析
Type: OpenClaw Skill Name: grok-image-cli Version: 0.2.1 The OpenClaw AgentSkills bundle for 'grok-image-cli' is classified as benign. The `SKILL.md` clearly describes a CLI tool for image generation and editing via the xAI Grok API. It outlines secure credential storage using OS native keychains (`cross-keychain`), explicitly states that API keys are never written to disk in plaintext, and limits network activity to the official `api.x.ai` endpoint and image fetching for editing. Installation instructions are standard for a Node.js CLI, and there are no signs of prompt injection, data exfiltration, unauthorized execution, or other malicious behaviors. The skill promotes transparency by linking to its open-source GitHub repository.
能力评估
Purpose & Capability
The name/description (grok-image-cli) align with requested binaries (grok-img, node) and the declared use of an xAI API key; these are reasonable for a CLI that wraps the xAI Grok Image API.
Instruction Scope
SKILL.md instructs the agent to use the grok-img CLI, manage credentials via the OS keychain, call api.x.ai over HTTPS, and optionally fetch remote images when editing — all within the stated image-generation/editing scope. There are no instructions to read unrelated system files or exfiltrate data to other endpoints.
Install Mechanism
No automated install spec is bundled with the skill (instruction-only), but the README provides standard install commands (npm install -g or git clone then npm build). These use known channels (npm, GitHub); user guidance to audit before installing is included. This is normal but the registry lacks an automated install spec.
Credentials
The CLI legitimately needs an xAI API key stored in the OS credential store and optionally accepts XAI_API_KEY as a fallback. There is a small metadata inconsistency: the registry summary showed 'no primary credential' while SKILL.md declares a cross-keychain credential and optional XAI_API_KEY — functionally this is proportional but the metadata mismatch should be corrected.
Persistence & Privilege
The skill does not request always:true and does not modify other skills or system-wide configs. It stores only its own API key in the OS credential store (expected behavior for a CLI).
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install grok-image-cli
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /grok-image-cli 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.2.1
No changes detected in this version. - No file changes found between this and the previous version. - No updates or modifications to features, documentation, or metadata. - Functionality and usage remain the same as the previous release.
v0.2.0
**Cross-platform credential store and model selection support.** - Credential storage is now cross-platform: supports macOS, Windows, and Linux native credential stores (via `cross-keychain`). - Expanded OS support in metadata to include Windows and Linux. - Supports multiple xAI image models: `grok-imagine-image` (default), `grok-imagine-image-pro`, and `grok-2-image-1212`; added `--model` flag to both generate and edit commands. - Documentation updated to reflect new installation requirements, credential management, available models, and cross-platform compatibility. - Updated environment variable fallback to clarify cross-platform credential handling.
v0.1.2
- Added npm provenance attestation details to installation instructions. - Documented how to verify published npm package contents with npm pack --dry-run. - Expanded metadata to include explicit "Install from source" instructions under the install array.
v0.1.1
- Expanded metadata to specify environment variable fallback and credential storage details. - Documented that the xAI API key is stored in macOS Keychain (service: grok-image-cli, account: api-key), with fallback to XAI_API_KEY environment variable. - Clarified network behavior: when editing with a remote image URL, an outbound HTTPS request fetches the source image. - No behavioral or CLI changes; documentation and metadata only.
v0.1.0
Initial release of grok-image-cli – a command-line tool for generating and editing images via the xAI Grok API. - Provides global grok-img CLI to generate and edit images. - Secure API key management using macOS Keychain. - Supports batch image generation, custom aspect ratios, and style transfer. - Compatible with Node.js ≥ 20.19.0 on macOS. - No plaintext storage of credentials or config files on disk. - Output images saved locally; all network calls are directed to xAI’s official API over HTTPS.
元数据
Slug grok-image-cli
版本 0.2.1
许可证
累计安装 4
当前安装数 4
历史版本数 5
常见问题

Grok Image Cli 是什么?

Generate and edit images via Grok API from the command line. Cross-platform secure credential storage for xAI API key. Supports batch generation, aspect rati... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 1377 次。

如何安装 Grok Image Cli?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install grok-image-cli」即可一键安装,无需额外配置。

Grok Image Cli 是免费的吗?

是的,Grok Image Cli 完全免费(开源免费),可自由下载、安装和使用。

Grok Image Cli 支持哪些平台?

Grok Image Cli 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(macos, windows, linux)。

谁开发了 Grok Image Cli?

由 cyberash-dev(@cyberash-dev)开发并维护,当前版本 v0.2.1。

💬 留言讨论