Files
skills/grok-imagine/SKILL.md
T

47 lines
1.6 KiB
Markdown

---
name: grok-imagine
description: Generate or edit images with xAI Grok Imagine. Use when the user asks to create an image with Grok, draw/paint something, generate concept art, posters, illustrations, photos, or edit an existing image with Grok Imagine. Trigger words include "grok imagine", "用 grok 生图", "grok 画", "imagine 生图". Requires an authenticated `grok` CLI (SuperGrok or X Premium+ subscription).
---
# Grok Imagine
Generate or edit images with xAI's Grok Imagine models.
## Prerequisites
- Install the Grok CLI (already present at `~/.grok/bin/grok`) and sign in once: `grok login`
- No API key needed; the SuperGrok / X Premium+ subscription provides `/imagine` access.
## Interactive mode (grok CLI)
Run `grok`, then use the TUI slash command:
```text
/imagine <prompt>
/imagine-video <prompt>
```
The same `/imagine` command also works in headless mode (`grok -p "/imagine ..."`), which the script below wraps.
## Scripted generation
Run `scripts/grok_imagine.py`:
```bash
V=~/.codex/skills/grok-imagine/scripts/grok_imagine.py
# Text to image
python3 "$V" "a cozy bar at night, anime style" -a 16:9
# Copy the result into a specific folder
python3 "$V" "neon cyberpunk alley" -a 9:16 -o ./outputs
```
The script prints the absolute path of the saved image. Images land in the grok session directory by default; use `-o DIR` to copy them somewhere stable.
## Notes
- `/imagine` consumes the subscription's image-generation quota.
- Image editing is interactive-only: paste the image in the grok TUI, then run `/imagine <edit instruction>`.
- For videos, use Grok Build's `/imagine-video` interactively.