xai-image-genGenerate images from text prompts using xAI's Grok API with options for format, batch size, and automatic media attachment in OpenClaw.
Install via ClawdBot CLI:
clawdbot install mexicanamerican/xai-image-genGenerate images using xAI's Grok API (grok-imagine-image model).
Production-ready CLI tool for generating images via xAI's image generation API. Supports multiple output formats, resolutions, and batch generation. Automatically outputs MEDIA: paths for OpenClaw auto-attachment.
Features:
xai-gen "" # Navigate to skills directory
cd ~/.openclaw/workspace/skills
# Clone or copy this skill
# (or install via clawhub when published)
# Install dependencies
pip3 install requests
# Ensure the script is executable
chmod +x xai-image-gen/xai-gen
Set your xAI API key:
export XAI_API_KEY="your-api-key-here"
Add to your shell profile (~/.bashrc, ~/.zshrc) to persist:
echo 'export XAI_API_KEY="your-api-key-here"' >> ~/.bashrc
# Generate with simple prompt
xai-gen "sunset over mountains"
# Custom filename
xai-gen "cyberpunk city" --filename city.png
# Generate multiple images
xai-gen "futuristic vehicle" --n 3
# Base64 output (no download)
xai-gen "logo design" --format b64
# Verbose mode
xai-gen "space station" --verbose
positional arguments:
prompt Text description of the image to generate
options:
-h, --help Show help message
--model MODEL Model name (default: grok-imagine-image)
--filename FILENAME Output filename (default: out.png)
--format {url,png,b64}
Response format: url (download), png (alias), b64 (base64)
--n N Number of images to generate (default: 1)
--verbose, -v Show detailed progress
Generate a meme:
xai-gen "dumbest trade meme: YOLO panic fail" --filename trade_meme.png
Batch generation:
xai-gen "logo variations for tech startup" --n 5
# Outputs: out_1.png, out_2.png, out_3.png, out_4.png, out_5.png
High-quality artwork:
xai-gen "photorealistic portrait of a cat astronaut" --filename cat_astronaut.png
The tool outputs MEDIA: /path/to/image.png which OpenClaw automatically detects and attaches to messages. Use in agent workflows:
# In an agent skill or automation
xai-gen "chart showing Q1 sales data" --filename sales_chart.png
# โ Image auto-attaches to response
https://api.x.ai/v1/images/generationsgrok-imagine-imageXAI_API_KEYThe tool handles common errors gracefully:
requests"XAI_API_KEY not found"
export XAI_API_KEY="xai-..."
"requests library not found"
pip3 install requests
Permission denied
chmod +x xai-gen
API errors
MIT License - Free to use and modify
Built for OpenClaw by subagent xAI Image Gen Skill Builder
1.0.0 - Initial release
AI Usage Analysis
Analysis is being generatedโฆ refresh in a few seconds.
Generate/edit images with Nano Banana Pro (Gemini 3 Pro Image). Use for image create/modify requests incl. edits. Supports text-to-image + image-to-image; 1K/2K/4K; use --input-image.
Capture frames or clips from RTSP/ONVIF cameras.
Batch-generate images via OpenAI Images API. Random prompt sampler + `index.html` gallery.
Generate images using the internal Google Antigravity API (Gemini 3 Pro Image). High quality, native generation without browser automation.
ไฝฟ็จๅ ็ฝฎ image_generate.py ่ๆฌ็ๆๅพ็, ๅๅคๆธ ๆฐๅ ทไฝ็ `prompt`ใ
AI image generation powered by CellCog. Create images, edit photos, consistent characters, product photography, reference-based images, sets of images, style transfer. Professional image creation with AI.