xai-studio
xAI Studio — generate and edit images and videos via the xAI API. Image: text-to-image, batch generation, multi-image editing, concurrent style transfers, multi-turn chaining. Video: text-to-video, image-to-video, video editing, concurrent video edits. All from a single expandable CLI.
install
source · Clone the upstream repo
git clone https://github.com/H0llyW00dzZ/xai-studio-skills
Claude Code · Install into ~/.claude/skills/
git clone --depth=1 https://github.com/H0llyW00dzZ/xai-studio-skills ~/.claude/skills/h0llyw00dzz-xai-studio-skills-xai-studio
manifest:
SKILL.mdsource content
xAI Studio
Generate and edit images and videos using xAI's models via the xAI SDK.
Setup (Venv + SDK)
Create an isolated virtual environment and install the SDK:
python3 -m venv venv source venv/bin/activate pip3 install xai-sdk deactivate
Generate Images
venv/bin/python3 scripts/run.py generate --prompt "A futuristic cityscape at dawn"
Generate multiple images in one request:
venv/bin/python3 scripts/run.py generate --prompt "Abstract art" --count 4
Edit Images
Edit an existing image with a text prompt:
venv/bin/python3 scripts/run.py edit --prompt "Make it a watercolor painting" --image photo.png
Combine up to 3 source images:
venv/bin/python3 scripts/run.py edit --prompt "Add the cat to the landscape" --image cat.png --image landscape.png
Concurrent Style Transfers
Apply multiple styles to the same image in parallel:
venv/bin/python3 scripts/run.py concurrent --image photo.png --prompt "oil painting" --prompt "pencil sketch" --prompt "pop art"
Multi-Turn Editing
Chain edits sequentially — each output feeds into the next:
venv/bin/python3 scripts/run.py multi-turn --image photo.png --prompt "Add dramatic clouds" --prompt "Make it a sunset"
Common Flags
: Model name (default:--model
)grok-imagine-image
: e.g.--aspect-ratio
,16:9
,4:3
(default:auto
)1:1
:--resolution
or1k
(default: API default)2k
:--format
(default) orbase64url
: Output directory (default:--out-dir
)media/xai-output
Output
Images are saved to
<out-dir>/<YYYY-MM-DD>/<prefix>_<NNN>_<HHMMSS>.<ext>, organized by UTC date. The prefix reflects the subcommand: generate, edit, style (concurrent), or step (multi-turn). The file extension is detected automatically from image magic bytes (PNG, JPEG, WebP, GIF).
Video: Generate
# Text-to-video venv/bin/python3 scripts/run.py video-generate --prompt "A rocket launching from Mars" --duration 10 --resolution 720p # Image-to-video venv/bin/python3 scripts/run.py video-generate --prompt "Animate this scene" --image photo.png --duration 5
Video: Edit
venv/bin/python3 scripts/run.py video-edit --prompt "Add a silver necklace" --video https://example.com/clip.mp4
Video: Concurrent Edits
venv/bin/python3 scripts/run.py video-concurrent --video https://example.com/clip.mp4 --prompt "Add a hat" --prompt "Change outfit to red"
Video Flags
: Model name (default:--model
)grok-imagine-video
: Length in seconds, 1–15 (default:--duration
) — generate only5
: e.g.--aspect-ratio
(default: API default)16:9
:--resolution
or480p
(default: API default)720p
: Max polling wait in seconds (default: SDK default)--timeout
: Seconds between status checks (default: SDK default)--poll-interval
Videos are saved as
.mp4 to <out-dir>/<YYYY-MM-DD>/<prefix>_<NNN>_<HHMMSS>.mp4. The prefix reflects the subcommand: video (generate), video_edit, or video_style (concurrent).