grok-media
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGrok Media
Grok 媒体生成
Use this skill when working with xAI media models in OpenMontage.
在OpenMontage中使用xAI媒体模型时,请使用此技能。
Models
模型
- for image generation and image editing
grok-imagine-image - for text-to-video, image-to-video, and reference-image video
grok-imagine-video
- :用于图像生成与图像编辑
grok-imagine-image - :用于文本转视频、图像转视频以及参考图像生成视频
grok-imagine-video
Authentication
认证
- Env var:
XAI_API_KEY - Base URL:
https://api.x.ai/v1 - Header:
Authorization: Bearer $XAI_API_KEY
- 环境变量:
XAI_API_KEY - 基础URL:
https://api.x.ai/v1 - 请求头:
Authorization: Bearer $XAI_API_KEY
Image API
图像API
Text-to-image
文本转图像
- Endpoint:
POST /images/generations - Core fields:
modelpromptnaspect_ratioresolution
- 接口端点:
POST /images/generations - 核心字段:
modelpromptnaspect_ratioresolution
Image edit
图像编辑
- Endpoint:
POST /images/edits - Use for one source image
image - Use for multi-image compositing
images - Each source image can be:
- a public HTTPS URL
- a base64 data URI
- 接口端点:
POST /images/edits - 使用参数传入单张源图片
image - 使用参数进行多图片合成
images - 每张源图片可以是:
- 公开的HTTPS链接
- Base64数据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
- Grok对直接的自然语言指令响应良好
- 对于编辑操作,仅描述预期的修改内容,其余部分会默认保留
- 对于多图片融合,需明确说明每张源图片的作用
- 优先使用清晰的单一场景描述,而非堆砌多种风格
Video API
视频API
Generation
生成流程
- Endpoint:
POST /videos/generations - Polling endpoint:
GET /videos/{request_id} - Success state:
status == "done" - Failure states to handle explicitly: ,
failedexpired
- 接口端点:
POST /videos/generations - 轮询接口:
GET /videos/{request_id} - 成功状态:
status == "done" - 需要显式处理的失败状态:、
failedexpired
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
- 文本转视频:
- 仅通过提示词生成
- 图像转视频:
- 使用参数
image: {"url": ...} - 以此锚定起始帧
- 使用
- 参考图像转视频:
- 使用参数
reference_images: [{"url": ...}, ...] - 这会影响视频中出现的人物/物体,但不会锁定第一帧
- 提示词中可使用、
<IMAGE_1>等占位符引用输入的图片<IMAGE_2>
- 使用
Video constraints
视频限制
- Grok video is best treated as short-form generation
- Current output resolutions are and
480p720p - 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
- Grok视频最适合用于短内容生成
- 当前支持的输出分辨率为和
480p720p - 参考图像生成视频支持多张图片输入,适用于产品植入、服装迁移以及角色一致性保持等场景
- 请及时下载输出内容;服务商提供的链接可能是临时的
Pricing
定价
- :
grok-imagine-imageper generated image$0.02 - edits/composites: add
grok-imagine-imageper input image$0.002 - :
grok-imagine-video- :
480pper second$0.05 - :
720pper second$0.07
- image-conditioned requests: add
grok-imagine-videoper input image$0.002
- :每张生成图片收费
grok-imagine-image$0.02 - 编辑/合成:每张输入图片额外收取
grok-imagine-image$0.002 - :
grok-imagine-video- :每秒收费
480p$0.05 - :每秒收费
720p$0.07
- 图像条件请求:每张输入图片额外收取
grok-imagine-video$0.002
Grok-Specific Prompt Guidance
Grok专属提示词指南
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
- 提示词聚焦单一场景:一个镜头、一个核心动作、一种情绪基调
- 对于参考图像驱动的视频,需明确将源图片映射到对应角色:
- 来自的人物
<IMAGE_1> - 来自的夹克
<IMAGE_2> - 来自的产品
<IMAGE_3>
- 来自
- 使用镜头和节奏相关的描述词会有帮助:
- 缓慢推进镜头
- 手持跟拍
- 固定中景镜头
- 高能量快速摇移转场
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后默认替换为其他服务商