ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified

grok-imagine-image-pro

Generiert hochwertige Bilder mit xAI Grok/Flux API. Use when user asks for image generation ("mach a Bild von...", "generier PNG...", "Bild erstellen") or image editing ("ändere das Bild", "mach daraus..."). Handles Prompts, styles, aspect ratios, edits, batch generation. Outputs PNG via base64 or file.

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/nixeifoit/grok-imagine-image-pro
Or

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": "<PROMPT>",
    "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": "<ratio>" to the JSON body. Supported values:

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

Batch Generation

Set "n": <count> (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):

Metadata

Author@nixeifoit
Stars1287
Views1
Updated2026-02-22
View Author Profile
AI Skill Finder

Not sure this is the right skill?

Describe what you want to build — we'll match you to the best skill from 16,000+ options.

Find the right skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-nixeifoit-grok-imagine-image-pro": {
      "enabled": true,
      "auto_update": true
    }
  }
}
Safety NoteClawKit audits metadata but not runtime behavior. Use with caution.