图片与图标75k · #2659
grok-media
它能做什么
这项技能涵盖 xAI 的 Grok 图像和视频模型。适合希望用 Grok 制作图片、编辑图片或生成短视频片段的创作者。
适用场景
- ✓当你想用 Grok 图像模型生成一张图片时。
- ✓当你想用 Grok 编辑现有图片,或把多张图片合成在一起时。
- ✓当你想根据文字、图片或参考图片制作一段短视频时。
技能链接
https://github.com/calesthio/OpenMontage/blob/main/.agents/skills/grok-media/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
请用这个技能帮我:https://github.com/calesthio/OpenMontage/blob/main/.agents/skills/grok-media/SKILL.md
阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
npx skills add calesthio/OpenMontage --skill grok-media
下载 SKILL.md,放进智能体的技能文件夹。
curl -L https://raw.githubusercontent.com/calesthio/OpenMontage/main/.agents/skills/grok-media/SKILL.md -o SKILL.md
可以这样问 AI
“请帮我用 Grok 生成一张黄昏时城市天际线的海报,再把它做成一段短视频。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会用你的 API 密钥把提示词或图片发送到 Grok 服务。制作视频时,它会检查任务状态,直到完成,然后保存结果。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Grok Media
Use this skill when working with xAI media models in OpenMontage.
Models
grok-imagine-imagefor image generation and image editinggrok-imagine-videofor 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:
modelpromptnaspect_ratioresolution
Image edit
- Endpoint:
POST /images/edits - Use
imagefor one source image - Use
imagesfor 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
- use
- 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>
- use
Video constraints
- Grok video is best treated as short-form generation
- Current output resolutions are
480pand720p - 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.02per generated imagegrok-imagine-imageedits/composites: add$0.002per input imagegrok-imagine-video:480p:$0.05per second720p:$0.07per second
grok-imagine-videoimage-conditioned requests: add$0.002per 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>
- person from
- 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
常见问题
我需要做哪些设置?
你需要在环境变量中设置 XAI_API_KEY。
怎样编辑图片?
只需描述你想改动的部分,图片中的其他内容会被保留。
视频任务失败怎么办?
这项技能会检查失败或过期的任务,并清楚地报告出来。
详情
作者的原始描述
xAI Grok image and video generation guide covering authentication, endpoints, prompt structure, image editing, reference-image video, and async polling.
repo: calesthio/OpenMontage
热度
- GitHub 星标
- 75k
- 排名
- #2659
- 许可证
- AGPL-3.0
- 更新时间
- 2026/10/28
评论
- …