SuperAPI AI Directory

grok

Agents & models

View repository

Updated 10-16 06:52

About this skill

Grok — Search · Research · Images · Video · Post-processing

Use grok(grok build CLI) + ffmpeg to accomplish six things:Web/X search, large-batch research, image generation, video generation, green-screen/video post-processing, image post-processing. Images and videos go through grok logged-in built-in tools(image_gen/image_to_video), consuming subscription quota,without incurring xAI API costs。

⭐ Operating principles (read this first)

This skill is guidance, not a hardcoded set of scripts. On each invocation, do this in order:

  1. First probe the real environment:node {baseDir}/scripts/preflight.mjs(cross-platform, report OS / grok login / which filters and encoders ffmpeg has / what's missing and should be installed).
  2. If dependencies are missing, install them for the current platform— preflight will give install commands for that OS (install what's needed, e.g. if drawtext is missing, install a build with freetype; if libvpx-vp9 is missing, switch builds).Don't work around requirements by settling for less.
  3. Media generationUse the wrapper script (grok-media.mjs, node, cross-platform);ffmpeg post-processingRefer to post-processing.md 's principles and templates,write commands on the spot and tune parameters on the spot based on the material(such as similarity/blend for keying), rather than applying fixed parameters.

You (Claude / grok) can already read the environment, install tools, and write commands — please use your judgment and improvise, treating the scripts below asreliable wrappers / reference implementations, not the only path.

Platform support

Platform grok CLI Description
macOS / Linux ✅ curl -fsSL https://x.ai/cli/install.sh | bash
Windows ✅ Native PowerShell (irm https://x.ai/cli/install.ps1 | iex) or WSL2 node scripts are cross-platform; shell commands use PowerShell syntax
  • Media generation requires login (SuperGrok / X Premium+):grok login。
  • ffmpeg post-processing is cross-platform, and the main command body is the same; for complex orchestration, prefer using node to call ffmpeg (avoiding shell escaping differences).

Capability routing

What you want to do What to use Detailed reference
Web / X search (with citations) grok-search.mjs(requires key) or grok headless (logged-in state) search-and-research.md
Large-batch / multi-topic research grok -p headless + subagents (enabled by default) search-and-research.md
Generate images grok-media.mjs image media-generation.md
Generate videos (text-to-video/image-to-video) grok-media.mjs video media-generation.md
Green-screen keying / compositing / watermarking / GIF ffmpeg (probe → install per platform → write on the spot) post-processing.md

Common commands (media generation · cross-platform node)

BASE={baseDir}

# 0. 永远先自检环境
node "$BASE/scripts/preflight.mjs"

# 搜索(JSON-first + 引用;需 XAI_API_KEY)
node "$BASE/scripts/grok-search.mjs" "谁赢得了最新一届世界杯" --mode auto

# 生成图片(登录态,零 API 费;aspect-ratio: 1:1 2:3 3:2 16:9 9:16 …)
node "$BASE/scripts/grok-media.mjs" image --prompt "赛博朋克城市夜景,霓虹倒影" --out city.jpg --aspect-ratio 16:9

# 图生视频(duration 1-15s;resolution 480p/720p/1080p)
node "$BASE/scripts/grok-media.mjs" video --prompt "镜头缓慢推进" --image city.jpg --out city.mp4 --duration 6 --resolution 720p

# 文生视频(自动分镜 → 源图 → 动画)
node "$BASE/scripts/grok-media.mjs" video --prompt "一只猫在爵士酒吧弹钢琴" --out cat.mp4 --duration 6

No fixed scripts for post-processing— first preflight.mjs check the current ffmpeg state, then follow post-processing.md 's templates and write based on the material. For example, the core of green-screen keying is: first have grok generate solid chroma-key green (#00FF00) background material, then ffmpeg -vf "chromakey=0x00FF00:<sim>:<blend>,despill", and tune similarity/blend based on the result.

Mechanisms you must know

  1. Media generation = prompt-driven built-in tools。grok-media.mjs uses a strict prompt to call grok -p "…" --always-approve, having the agent call image_gen/image_to_video save to --out, and verify it was written to disk and return JSON. You can also directly grok -p "用 image_gen 生成…存为 x.jpg" to bypass the script.
  2. Artifact output location: grok first writes to ~/.grok/sessions/<cwd>/<id>/(the video is in videos/), then cp to the working directory; the script is already packaged.
  3. The video comes with an AAC audio track, H.264, 24fps, and the aspect ratio follows the source image / request.
  4. Time required: about 30–70s for a single image, several minutes for a single video segment; for batch tasks use subagents or a playbook (see examples/video-reel-playbook.md)。

Script list (all cross-platform · node)

  • scripts/preflight.mjs — environment/capability self-check, reports current status + gives installation suggestions by platform
  • scripts/grok-media.mjs — image/video generation (driven by grok login state, JSON output, cross-platform grok path resolution)
  • scripts/grok-search.mjs — search (xAI Responses API,XAI_API_KEY)
  • scripts/search-selftest.mjs — search script self-test

ffmpeg post-processingdeliberately does not provide a fixed script—it is environment-dependent and parameters need to be adjusted according to the material, see post-processing.md let the agent write it on the spot.

Installation

# 推荐:npx skills(装到 .agents/skills 并 symlink 到各 agent)
npx skills add Wangnov/grok-skills                    # 所有检测到的 agent
npx skills add Wangnov/grok-skills -g -a claude-code  # 全局 + 指定 Claude Code

Both grok build and Claude Code load from ~/.agents/skills/ and both recognize the Anthropic Skills format.