Agent Skillscalesthio/OpenMontage › grok-media

grok-media

GitHub

提供 xAI Grok 图像和视频生成的 API 集成指南,涵盖认证、端点调用、提示词技巧及异步轮询处理。

.agents/skills/grok-media/SKILL.md calesthio/OpenMontage

Trigger Scenarios

需要调用 xAI API 生成图片或视频 询问 Grok 媒体模型的 Prompt 编写规范

Install

npx skills add calesthio/OpenMontage --skill grok-media -g -y
More Options

Non-standard path

npx skills add https://github.com/calesthio/OpenMontage/tree/main/.agents/skills/grok-media -g -y

Use without installing

npx skills use calesthio/OpenMontage@grok-media

指定 Agent (Claude Code)

npx skills add calesthio/OpenMontage --skill grok-media -a claude-code -g -y

安装 repo 全部 skill

npx skills add calesthio/OpenMontage --all -g -y

预览 repo 内 skill

npx skills add calesthio/OpenMontage --list

SKILL.md

Frontmatter
{
    "name": "grok-media",
    "metadata": {
        "tags": "xai, grok, image-generation, video-generation, media",
        "author": "OpenMontage",
        "version": "1.0.0"
    },
    "description": "xAI Grok image and video generation guide covering authentication, endpoints, prompt structure, image editing, reference-image video, and async polling."
}

Grok Media

Use this skill when working with xAI media models in OpenMontage.

Models

  • grok-imagine-image for image generation and image editing
  • grok-imagine-video for text-to-video, image-to-video, and reference-image video

Authentication

  • Env var: XAI_API_KEY
  • Base URL: https://api.x.ai/v1
  • Header: Authorization: Bearer $XAI_API_KEY

Image API

Text-to-image

  • Endpoint: POST /images/generations
  • Core fields:
    • model
    • prompt
    • n
    • aspect_ratio
    • resolution

Image edit

  • Endpoint: POST /images/edits
  • Use image for one source image
  • Use images for multi-image compositing
  • Each source image can be:
    • a public HTTPS URL
    • a base64 data URI

Image prompting

  • Grok responds well to direct natural language
  • For edits, describe only the intended change and preserve everything else implicitly
  • For multi-image merges, explicitly name how each source contributes
  • Prefer one strong scene description over long style-stacking

Video API

Generation

  • Endpoint: POST /videos/generations
  • Polling endpoint: GET /videos/{request_id}
  • Success state: status == "done"
  • Failure states to handle explicitly: failed, expired

Modes

  • Text-to-video:
    • prompt-only generation
  • Image-to-video:
    • use image: {"url": ...}
    • this anchors the starting frame
  • Reference-to-video:
    • use reference_images: [{"url": ...}, ...]
    • this influences who/what appears in the video without locking the first frame
    • prompts can reference inputs with placeholders like <IMAGE_1>, <IMAGE_2>

Video constraints

  • Grok video is best treated as short-form generation
  • Current output resolutions are 480p and 720p
  • Reference-image video supports multiple images and is useful for product placement, wardrobe transfer, and identity consistency
  • Download outputs promptly; provider URLs may be temporary

Pricing

  • grok-imagine-image: $0.02 per generated image
  • grok-imagine-image edits/composites: add $0.002 per input image
  • grok-imagine-video:
    • 480p: $0.05 per second
    • 720p: $0.07 per second
  • grok-imagine-video image-conditioned requests: add $0.002 per input image

Grok-Specific Prompt Guidance

Images

  • Start with subject, action, setting
  • Add one style anchor, not five
  • For edits:
    • describe the desired modification
    • keep the rest of the image stable by omission, not by writing a giant preservation list

Video

  • Keep prompts scene-local: one shot, one main motion idea, one emotional beat
  • For reference-conditioned video, explicitly map source images to roles:
    • person from <IMAGE_1>
    • jacket from <IMAGE_2>
    • product from <IMAGE_3>
  • Camera and pacing language helps:
    • slow push-in
    • handheld follow
    • locked-off medium shot
    • high-energy whip pan transition

Good Fits

  • Image style transfer
  • Image compositing from multiple sources
  • Reference-conditioned short video
  • Product-led motion clips
  • Character-consistent scenes without hard first-frame lock

Weak Fits

  • Long-form clip generation
  • Heavy reliance on deterministic seeds
  • Overloaded prompts with multiple scene changes

Failure Handling

  • If generation submission succeeds but polling expires, surface it as a provider/runtime issue
  • If a request fails, preserve the endpoint, mode, and prompt summary in the error
  • Do not silently substitute a different provider after xAI was selected without user approval

Version History

  • 0af32ce Current 2026-07-24 22:20

Same Skill Collection

.agents/skills/3d-asset-generation/SKILL.md
.agents/skills/acestep/SKILL.md
.agents/skills/agents/SKILL.md
.agents/skills/ai-video-gen/SKILL.md
.agents/skills/atlas-cloud/SKILL.md
.agents/skills/azure-speech-to-text/SKILL.md
.agents/skills/azure-text-to-speech/SKILL.md
.agents/skills/beautiful-mermaid/SKILL.md
.agents/skills/character-animation-qa/SKILL.md
.agents/skills/comfyui/SKILL.md
.agents/skills/create-video/SKILL.md
.agents/skills/d3-viz/SKILL.md
.agents/skills/dashscope/SKILL.md
.agents/skills/doubao-tts/SKILL.md
.agents/skills/elevenlabs/SKILL.md
.agents/skills/faceswap/SKILL.md
.agents/skills/ffmpeg/SKILL.md
.agents/skills/fish-audio-tts/SKILL.md
.agents/skills/flux-best-practices/SKILL.md
.agents/skills/framer-motion/SKILL.md
.agents/skills/gsap-frameworks/SKILL.md
.agents/skills/gsap-performance/SKILL.md
.agents/skills/gsap-plugins/SKILL.md
.agents/skills/gsap-react/SKILL.md
.agents/skills/gsap-scrolltrigger/SKILL.md
.agents/skills/gsap-timeline/SKILL.md
.agents/skills/gsap-utils/SKILL.md
.agents/skills/heygen/SKILL.md
.agents/skills/hyperframes-cli/SKILL.md
.agents/skills/hyperframes-core/SKILL.md
.agents/skills/hyperframes-creative/SKILL.md
.agents/skills/hyperframes-registry/SKILL.md
.agents/skills/kling-official/SKILL.md
.agents/skills/lottie-bodymovin/SKILL.md
.agents/skills/ltx2/SKILL.md
.agents/skills/lyria/SKILL.md
.agents/skills/media-use/SKILL.md
.agents/skills/minimax-h3/SKILL.md
.agents/skills/music/SKILL.md
.agents/skills/playwright-recording/SKILL.md
.agents/skills/pose-library-design/SKILL.md
.agents/skills/remotion-best-practices/SKILL.md
.agents/skills/remotion/SKILL.md
.agents/skills/seedance-2-5/SKILL.md
.agents/skills/setup-api-key/SKILL.md
.agents/skills/sound-effects/SKILL.md
.agents/skills/speech-to-text/SKILL.md
.agents/skills/svg-character-animation/SKILL.md
.agents/skills/synthetic-screen-recording/SKILL.md

Metadata

Files
0
Version
1bab711
Hash
a5b968d1
Indexed
2026-07-24 22:20

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 00:45
浙ICP备14020137号-1 $mapa de visitantes$