← 返回 Skills 市场
nixeifoit

Grok Imagine Image Pro

作者 NixeiFoit · GitHub ↗ · v1.0.2
cross-platform ⚠ suspicious
1167
总下载
3
收藏
1
当前安装
3
版本数
在 OpenClaw 中安装
/install grok-imagine-image-pro
功能描述
Generates and edits high-quality PNG images via xAI Grok/Flux API using prompts, styles, aspect ratios, and batch processing with base64 output.
使用说明 (SKILL.md)

Grok Imagine Image Pro

API Key: $XAI_API_KEY (already configured) Save dir: ~/.openclaw/media/ (resolves to /data/.openclaw/media/ — allowed for Telegram sending)

Available Models

  • grok-imagine-image — standard quality, faster
  • grok-imagine-image-pro — higher quality (default for generation)

1. Image Generation

curl -s https://api.x.ai/v1/images/generations \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "model": "grok-imagine-image-pro",
    "prompt": "\x3CPROMPT>",
    "n": 1,
    "response_format": "b64_json"
  }' | python3 -c "
import json, sys, base64, os, time
os.makedirs(os.path.expanduser('~/.openclaw/media'), exist_ok=True)
r = json.load(sys.stdin)
ts = int(time.time())
for i, img in enumerate(r['data']):
    img_data = base64.b64decode(img['b64_json'])
    fpath = os.path.expanduser(f'~/.openclaw/media/generated_{ts}_{i}.png')
    with open(fpath, 'wb') as f:
        f.write(img_data)
    print(fpath)
"

Aspect Ratios

Add "aspect_ratio": "\x3Cratio>" to the JSON body. Supported values:

Ratio Use case
1:1 Social media, thumbnails
16:9 / 9:16 Widescreen, mobile stories
4:3 / 3:4 Presentations, portraits
3:2 / 2:3 Photography
2:1 / 1:2 Banners, headers
auto Model picks best ratio (default)

Batch Generation

Set "n": \x3Ccount> (1-10) to generate multiple images in one request.

2. Image Editing / Style Transfer

Edit an existing image by providing a source image plus an edit prompt. Uses the same /v1/images/generations endpoint with an added image_url field.

Do NOT use /v1/images/edits with multipart — xAI requires JSON.

IMPORTANT: For local files, use Python to build the payload JSON file, then curl with @file. Inline base64 in curl args causes "Argument list too long" for images >~100KB.

NOTE: This is NOT true image editing — the API generates a new image inspired by the source. It cannot make pixel-precise edits (e.g. changing only a car's color while keeping everything else identical).

Edit from local file (recommended approach):

python3 -c "
import json, base64
with open('\x3CSOURCE_PATH>', 'rb') as f:
    b64 = base64.b64encode(f.read()).decode()
payload = {
    'model': 'grok-imagine-image',
    'prompt': '\x3CEDIT_PROMPT>',
    'image_url': f'data:image/png;base64,{b64}',
    'n': 1,
    'response_format': 'b64_json'
}
with open('/tmp/img_edit_payload.json', 'w') as f:
    json.dump(payload, f)
print('Payload ready')
" && \
curl -s https://api.x.ai/v1/images/generations \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d @/tmp/img_edit_payload.json | python3 -c "
import json, sys, base64, os, time
os.makedirs(os.path.expanduser('~/.openclaw/media'), exist_ok=True)
r = json.load(sys.stdin)
img_data = base64.b64decode(r['data'][0]['b64_json'])
fpath = os.path.expanduser(f'~/.openclaw/media/edited_{int(time.time())}.png')
with open(fpath, 'wb') as f:
    f.write(img_data)
print(fpath)
"

Edit from URL:

curl -s https://api.x.ai/v1/images/generations \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "model": "grok-imagine-image",
    "prompt": "\x3CEDIT_PROMPT>",
    "image_url": "\x3CPUBLIC_IMAGE_URL>",
    "n": 1,
    "response_format": "b64_json"
  }' | python3 -c "
import json, sys, base64, os, time
os.makedirs(os.path.expanduser('~/.openclaw/media'), exist_ok=True)
r = json.load(sys.stdin)
img_data = base64.b64decode(r['data'][0]['b64_json'])
fpath = os.path.expanduser(f'~/.openclaw/media/edited_{int(time.time())}.png')
with open(fpath, 'wb') as f:
    f.write(img_data)
print(fpath)
"

Style Transfer Examples

Use editing with a style prompt, e.g.:

  • "Render this as an oil painting in impressionist style"
  • "Make this a pencil sketch with detailed shading"
  • "Convert to pop art with bold colors"
  • "Watercolor painting with soft edges"

3. Sending to Telegram

message tool: action=send, channel=telegram, target=\x3Cid>,
  message="\x3Ccaption>", filePath=~/.openclaw/media/\x3Cfile>.png
  • Always include message field (required even for media-only sends)
  • Allowed media paths: /tmp/, ~/.openclaw/media/, ~/.openclaw/agents/

Notes

  • Do NOT pass size parameter — returns 400
  • Aspect ratio: pass aspect_ratio in JSON body (not size)
  • Editing: use image_url field in the generations endpoint (NOT the edits endpoint with multipart)
  • Always use "response_format": "b64_json" — URL format returns temporary URLs that often 403
  • For large images: build payload with Python → save to /tmp/ → curl with @file syntax
  • Max 10 images per request
  • Images are subject to content moderation
  • Editing is style-transfer/reimagination, NOT pixel-precise inpainting
安全使用建议
This skill appears to do what it says: it calls xAI's image generation endpoint and saves PNGs. Before installing or using it, make sure you trust the XAI API key you provide (rotate it if unsure) and avoid pointing the skill at sensitive local files—the examples show base64-encoding and uploading arbitrary files, which is necessary for image edits but could leak secrets if misused. Confirm the API domain (api.x.ai) is correct for your account, and be aware files are saved under ~/.openclaw/media and /tmp. If you need stricter controls, do not grant the skill your primary account API key or only use a key with limited permissions / billing limits.
功能分析
Type: OpenClaw Skill Name: grok-imagine-image-pro Version: 1.0.2 The skill is classified as suspicious due to the potential for Local File Inclusion (LFI) and subsequent data exfiltration. The 'Edit from local file' command in SKILL.md allows reading an arbitrary local file (via `<SOURCE_PATH>`), base64 encoding its content, and sending it to the external xAI API endpoint (`https://api.x.ai/v1/images/generations`). While the skill's stated purpose is to process image files, this mechanism could be abused by a malicious user or a prompt-injected agent to exfiltrate sensitive non-image files from the local system to an external service. Additionally, the direct insertion of user prompts into JSON payloads for the `curl` commands presents a prompt injection vulnerability against the xAI API if the agent does not properly sanitize user input.
能力评估
Purpose & Capability
The skill's name/description match the runtime instructions: it calls an xAI images endpoint, requires XAI_API_KEY, and uses curl/python3 to send requests and save PNGs. Required binaries and the single env var are proportional to the stated purpose.
Instruction Scope
Instructions are focused on generation and editing and show concrete curl+python examples that create ~/.openclaw/media and /tmp payloads. This is expected for image editing, but be aware the guidance includes base64-encoding local files and sending them to an external API—while needed for edits, that behavior could be used to exfiltrate arbitrary local files if misused. The SKILL.md does not attempt to read other system configs or require unrelated environment variables.
Install Mechanism
There is no install spec (instruction-only), so nothing is downloaded or written beyond the agent executing the provided commands. This is the lowest-risk install model.
Credentials
Only XAI_API_KEY is required, which is appropriate for calling the xAI API. No unrelated credentials or config paths are requested.
Persistence & Privilege
The skill is not marked always:true, has no install-time persistence, and does not modify other skills or system-wide settings. It writes output files to ~/.openclaw/media and /tmp as described (normal for media artifacts).
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install grok-imagine-image-pro
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /grok-imagine-image-pro 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.2
Fix: TIMESTAMP bug in Python f-strings. Fix: consistent paths with expanduser. Added editing limitation note.
v1.0.1
Added metadata: declared XAI_API_KEY env requirement and curl/python3 binary dependencies
v1.0.0
Initial release: xAI Grok image generation & style transfer. Supports grok-imagine-image and grok-imagine-image-pro models, aspect ratios, batch generation, b64_json response format.
元数据
Slug grok-imagine-image-pro
版本 1.0.2
许可证
累计安装 1
当前安装数 1
历史版本数 3
常见问题

Grok Imagine Image Pro 是什么?

Generates and edits high-quality PNG images via xAI Grok/Flux API using prompts, styles, aspect ratios, and batch processing with base64 output. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 1167 次。

如何安装 Grok Imagine Image Pro?

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

Grok Imagine Image Pro 是免费的吗?

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

Grok Imagine Image Pro 支持哪些平台?

Grok Imagine Image Pro 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Grok Imagine Image Pro?

由 NixeiFoit(@nixeifoit)开发并维护,当前版本 v1.0.2。

💬 留言讨论