$npx -y skills add calesthio/OpenMontage --skill grok-mediaxAI Grok image and video generation guide covering authentication, endpoints, prompt structure, image editing, reference-image video, and async polling.
| 1 | # Grok Media |
| 2 | |
| 3 | Use this skill when working with xAI media models in OpenMontage. |
| 4 | |
| 5 | ## Models |
| 6 | |
| 7 | - `grok-imagine-image` for image generation and image editing |
| 8 | - `grok-imagine-video` for text-to-video, image-to-video, and reference-image video |
| 9 | |
| 10 | ## Authentication |
| 11 | |
| 12 | - Env var: `XAI_API_KEY` |
| 13 | - Base URL: `https://api.x.ai/v1` |
| 14 | - Header: `Authorization: Bearer $XAI_API_KEY` |
| 15 | |
| 16 | ## Image API |
| 17 | |
| 18 | ### Text-to-image |
| 19 | |
| 20 | - Endpoint: `POST /images/generations` |
| 21 | - Core fields: |
| 22 | - `model` |
| 23 | - `prompt` |
| 24 | - `n` |
| 25 | - `aspect_ratio` |
| 26 | - `resolution` |
| 27 | |
| 28 | ### Image edit |
| 29 | |
| 30 | - Endpoint: `POST /images/edits` |
| 31 | - Use `image` for one source image |
| 32 | - Use `images` for multi-image compositing |
| 33 | - Each source image can be: |
| 34 | - a public HTTPS URL |
| 35 | - a base64 data URI |
| 36 | |
| 37 | ### Image prompting |
| 38 | |
| 39 | - Grok responds well to direct natural language |
| 40 | - For edits, describe only the intended change and preserve everything else implicitly |
| 41 | - For multi-image merges, explicitly name how each source contributes |
| 42 | - Prefer one strong scene description over long style-stacking |
| 43 | |
| 44 | ## Video API |
| 45 | |
| 46 | ### Generation |
| 47 | |
| 48 | - Endpoint: `POST /videos/generations` |
| 49 | - Polling endpoint: `GET /videos/{request_id}` |
| 50 | - Success state: `status == "done"` |
| 51 | - Failure states to handle explicitly: `failed`, `expired` |
| 52 | |
| 53 | ### Modes |
| 54 | |
| 55 | - Text-to-video: |
| 56 | - prompt-only generation |
| 57 | - Image-to-video: |
| 58 | - use `image: {"url": ...}` |
| 59 | - this anchors the starting frame |
| 60 | - Reference-to-video: |
| 61 | - use `reference_images: [{"url": ...}, ...]` |
| 62 | - this influences who/what appears in the video without locking the first frame |
| 63 | - prompts can reference inputs with placeholders like `<IMAGE_1>`, `<IMAGE_2>` |
| 64 | |
| 65 | ### Video constraints |
| 66 | |
| 67 | - Grok video is best treated as short-form generation |
| 68 | - Current output resolutions are `480p` and `720p` |
| 69 | - Reference-image video supports multiple images and is useful for product placement, wardrobe transfer, and identity consistency |
| 70 | - Download outputs promptly; provider URLs may be temporary |
| 71 | |
| 72 | ## Pricing |
| 73 | |
| 74 | - `grok-imagine-image`: `$0.02` per generated image |
| 75 | - `grok-imagine-image` edits/composites: add `$0.002` per input image |
| 76 | - `grok-imagine-video`: |
| 77 | - `480p`: `$0.05` per second |
| 78 | - `720p`: `$0.07` per second |
| 79 | - `grok-imagine-video` image-conditioned requests: add `$0.002` per input image |
| 80 | |
| 81 | ## Grok-Specific Prompt Guidance |
| 82 | |
| 83 | ### Images |
| 84 | |
| 85 | - Start with subject, action, setting |
| 86 | - Add one style anchor, not five |
| 87 | - For edits: |
| 88 | - describe the desired modification |
| 89 | - keep the rest of the image stable by omission, not by writing a giant preservation list |
| 90 | |
| 91 | ### Video |
| 92 | |
| 93 | - Keep prompts scene-local: one shot, one main motion idea, one emotional beat |
| 94 | - For reference-conditioned video, explicitly map source images to roles: |
| 95 | - person from `<IMAGE_1>` |
| 96 | - jacket from `<IMAGE_2>` |
| 97 | - product from `<IMAGE_3>` |
| 98 | - Camera and pacing language helps: |
| 99 | - slow push-in |
| 100 | - handheld follow |
| 101 | - locked-off medium shot |
| 102 | - high-energy whip pan transition |
| 103 | |
| 104 | ## Good Fits |
| 105 | |
| 106 | - Image style transfer |
| 107 | - Image compositing from multiple sources |
| 108 | - Reference-conditioned short video |
| 109 | - Product-led motion clips |
| 110 | - Character-consistent scenes without hard first-frame lock |
| 111 | |
| 112 | ## Weak Fits |
| 113 | |
| 114 | - Long-form clip generation |
| 115 | - Heavy reliance on deterministic seeds |
| 116 | - Overloaded prompts with multiple scene changes |
| 117 | |
| 118 | ## Failure Handling |
| 119 | |
| 120 | - If generation submission succeeds but polling expires, surface it as a provider/runtime issue |
| 121 | - If a request fails, preserve the endpoint, mode, and prompt summary in the error |
| 122 | - Do not silently substitute a different provider after xAI was selected without user approval |