Skip to content

Commit 7ba4460

Browse files
authored
Merge pull request #218 from RyanLee-Dev/feat/h3-video-skill
docs: add standalone MiniMax-H3 video skill
2 parents aa7de5e + 4276c31 commit 7ba4460

3 files changed

Lines changed: 412 additions & 20 deletions

File tree

skill/SKILL.md

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ mmx image generate --prompt "Logo" --n 3 --out-dir ./gen/ --quiet
117117

118118
### video generate
119119

120-
Generate video. Default model: `MiniMax-Hailuo-2.3`. Select `MiniMax-H3` to use the Video Generation V2 multimodal API. This is an async task — by default it polls until completion.
120+
Generate video. Default model: `MiniMax-Hailuo-2.3` (or `MiniMax-Hailuo-2.3-Fast` for fast mode with `--image`). This is an async task — by default it polls until completion.
121+
122+
For `MiniMax-H3` — text-to-video, first/last-frame, multimodal reference image/video/audio generation, prompt construction, and failure handling — use the dedicated [mmx-h3-video skill](h3-video/SKILL.md) instead.
121123

122124
```bash
123125
mmx video generate --prompt <text> [flags]
@@ -126,14 +128,9 @@ mmx video generate --prompt <text> [flags]
126128
| Flag | Type | Description |
127129
|---|---|---|
128130
| `--prompt <text>` | string, **required** | Video description |
129-
| `--model <model>` | string | `MiniMax-Hailuo-2.3` (default), `MiniMax-Hailuo-2.3-Fast`, or `MiniMax-H3` |
131+
| `--model <model>` | string | `MiniMax-Hailuo-2.3` (default) or `MiniMax-Hailuo-2.3-Fast` |
130132
| `--image <path-or-url>` | string | Input image for image-to-video |
131-
| `--last-frame <path-or-url>` | string | Last frame image; H3 supports last-frame-only input |
132-
| `--reference-image <path-or-url>` | string, repeatable | H3 reference image |
133-
| `--reference-video <path-or-url>` | string, repeatable | H3 reference video |
134-
| `--reference-audio <path-or-url>` | string, repeatable | H3 reference audio; requires a reference image or video |
135-
| `--duration <seconds>` | number | H3 duration, 4-15 seconds (default: 5) |
136-
| `--ratio <ratio>` | string | H3 output ratio; T2V cannot use `adaptive` |
133+
| `--last-frame <path-or-url>` | string | Optional ending image for frame interpolation (used with `--image`) |
137134
| `--callback-url <url>` | string | Webhook URL for completion |
138135
| `--download <path>` | string | Save video to specific file |
139136
| `--async` | boolean | Return task ID immediately |
@@ -145,18 +142,6 @@ mmx video generate --prompt <text> [flags]
145142
mmx video generate --prompt "A robot." --async --quiet
146143
# stdout: {"taskId":"..."}
147144

148-
# H3 text-to-video
149-
mmx video generate --model MiniMax-H3 --prompt "Ocean waves." --async --quiet
150-
151-
# H3 image-to-video
152-
mmx video generate --model MiniMax-H3 --prompt "The subject walks forward." \
153-
--image start.jpg --async --quiet
154-
155-
# H3 reference-to-video
156-
mmx video generate --model MiniMax-H3 --prompt "Keep the same character." \
157-
--reference-image character.png \
158-
--reference-video motion.mp4 --async --quiet
159-
160145
# Blocking: wait and get file path
161146
mmx video generate --prompt "Ocean waves." --download ocean.mp4 --quiet
162147
# stdout: ocean.mp4

skill/h3-video/SKILL.md

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
---
2+
name: mmx-h3-video
3+
description: Generate, monitor, and download MiniMax-H3 videos through the mmx CLI. Use for H3 text-to-video, first/last-frame video, multimodal reference image/video/audio generation, H3 prompt improvement, media preflight, Pay-as-you-go API key selection, task waiting, downloads, and H3 failure handling.
4+
---
5+
6+
# MiniMax-H3 Video With MMX
7+
8+
Use this skill only for `MiniMax-H3` video generation. Do not handle text, image generation, speech, music, search, legacy Hailuo models, or unrelated MMX commands.
9+
10+
Before a paid request, read `references/h3-video.md` for prompt construction, media constraints, waiting behavior, and failure handling.
11+
12+
## Required Rules
13+
14+
1. Use a Pay-as-you-go/Credit API Key. H3 does not use OAuth or Token Plan Subscription Keys.
15+
2. Reuse a saved MMX API key when available. Never print, repeat, or place a literal API key in a command transcript.
16+
3. Always pass `--model MiniMax-H3`; never rely on the configured default model.
17+
4. For a completed video, run one direct blocking `mmx video generate` command. Do not use Bash wrappers or hand-written polling loops.
18+
5. If the terminal command remains active, wait on that exact execution session. Do not run `ps`, scrape process arguments, inspect the output repeatedly, kill the process, or submit another task.
19+
6. Treat `Detecting region... cn` or `Detecting region... global` as normal stderr progress, not a submission failure.
20+
7. Never submit a replacement paid task because terminal waiting, status polling, or downloading was interrupted.
21+
8. Retry the alternate region at most once, and only when the first command clearly failed before task creation because of region detection, endpoint, or authentication routing.
22+
9. Use `--async` only when the user explicitly wants a task ID without waiting or downloading.
23+
24+
## Resolve The CLI
25+
26+
Inside the `minimax-cli` repository, build changes and use the local artifact:
27+
28+
```bash
29+
bun run build
30+
node ./dist/mmx.mjs video generate --help
31+
```
32+
33+
Outside the repository, use the installed `mmx` executable. Do not install or update MMX unless the user asks.
34+
35+
In commands below, replace `mmx` with `node ./dist/mmx.mjs` when testing the local repository build.
36+
37+
## Resolve And Save The API Key
38+
39+
Before the first paid H3 request, inspect the active credential without exposing it:
40+
41+
```bash
42+
mmx auth status --output json --quiet
43+
```
44+
45+
- If `method` is `api-key`, reuse it from MMX config. Do not add `--api-key` to generation commands.
46+
- If the user already supplied a key and the runtime holds it securely as `MINIMAX_API_KEY`, save it once, then use MMX config:
47+
48+
```bash
49+
mmx config set --key api_key --value "$MINIMAX_API_KEY" --quiet
50+
```
51+
52+
- Saving `api_key` replaces stale OAuth credentials, clears the cached region, and stores the key in `~/.mmx/config.json` with owner-only permissions.
53+
- Never reconstruct a previously supplied key into visible shell text. Use the runtime's secret/environment injection when available.
54+
- If no saved API key or securely injected variable is available, ask the user to run `mmx auth login` and choose API key. Do not ask them to paste the key into chat again.
55+
- After saving, future Agent commands must omit both the literal key and `--api-key`.
56+
57+
## Default Completed-Video Path
58+
59+
Use this path when the user wants the final file:
60+
61+
```bash
62+
mmx video generate \
63+
--model MiniMax-H3 \
64+
--prompt "<video prompt>" \
65+
--duration <4-15> \
66+
--download <output.mp4> \
67+
--poll-interval 10 \
68+
--timeout 1800 \
69+
--non-interactive
70+
```
71+
72+
This one CLI process submits exactly one task, waits internally between status checks, and downloads the completed video. When the execution tool returns a running session or cell ID, continue waiting on that same session until it exits.
73+
74+
Do not add `--async` to this command. Async mode returns before download handling.
75+
76+
## Input Modes
77+
78+
Use exactly one mode per request.
79+
80+
### Text-To-Video
81+
82+
```bash
83+
mmx video generate \
84+
--model MiniMax-H3 \
85+
--prompt "A cinematic coastal sunset, slow dolly forward" \
86+
--duration 15 \
87+
--ratio 16:9 \
88+
--download ./result.mp4 \
89+
--poll-interval 10 \
90+
--timeout 1800 \
91+
--non-interactive
92+
```
93+
94+
### First/Last-Frame Video
95+
96+
`--image` is the first frame. It may be combined with one `--last-frame`.
97+
98+
```bash
99+
mmx video generate \
100+
--model MiniMax-H3 \
101+
--prompt "The subject walks naturally from the starting pose to the ending pose" \
102+
--image ./start.png \
103+
--last-frame ./end.png \
104+
--duration 15 \
105+
--download ./result.mp4 \
106+
--poll-interval 10 \
107+
--timeout 1800 \
108+
--non-interactive
109+
```
110+
111+
Do not use the hidden `--first-frame` compatibility alias in new commands.
112+
113+
### Multimodal Reference Video
114+
115+
Repeat each reference flag to pass multiple inputs. Do not comma-separate paths.
116+
117+
```bash
118+
mmx video generate \
119+
--model MiniMax-H3 \
120+
--prompt "Preserve the referenced character, follow the motion and audio rhythm" \
121+
--reference-image ./character-1.png \
122+
--reference-image ./character-2.png \
123+
--reference-video ./motion.mp4 \
124+
--reference-audio ./rhythm.mp3 \
125+
--duration 15 \
126+
--download ./result.mp4 \
127+
--poll-interval 10 \
128+
--timeout 1800 \
129+
--non-interactive
130+
```
131+
132+
Frame mode cannot be mixed with reference mode. Reference audio requires at least one reference image or reference video.
133+
134+
## Region Recovery
135+
136+
Omit `--region` on the first request so MMX can use or detect the key's region. If that command fails, retry the same request once with the alternate region only when all of these are true:
137+
138+
1. No `taskId` was returned.
139+
2. `[Model: MiniMax-H3]` was not printed, so the CLI did not confirm task creation.
140+
3. The error explicitly concerns region detection, a regional endpoint, or a pre-submission 401/403 authentication-routing mismatch.
141+
142+
Use `--region global` after a failed `cn` attempt, or `--region cn` after a failed `global` attempt. Keep every generation argument unchanged. If the alternate region succeeds, persist it without exposing credentials:
143+
144+
```bash
145+
mmx config set --key region --value <global-or-cn> --quiet
146+
```
147+
148+
Do not perform region fallback for validation errors, error `2013`, billing, rate limits, sensitive content, generic service errors, or an ambiguous timeout. Never region-retry after task creation, during polling, or during download.
149+
150+
## Core Limits
151+
152+
- Prompt: at most 7000 characters.
153+
- Output duration: integer from 4 through 15 seconds.
154+
- Resolution: 2K.
155+
- Reference images: at most 9.
156+
- Reference videos: at most 3.
157+
- Reference audios: at most 3.
158+
- Mixed reference items: at most 12 total.
159+
- Local image: at most 30 MB each.
160+
- Local video: MP4, at most 50 MB each.
161+
- Local audio: MP3 or WAV, at most 15 MB each.
162+
- Complete local Base64 request body: at most 64 MB.
163+
164+
Use URLs or `mm_file://<file-id>` for large or numerous assets. Read `references/h3-video.md` for official duration, codec, frame-rate, dimension, and aspect-ratio limits that are not fully validated by the CLI.
165+
166+
## Async Task-ID Path
167+
168+
Use this only when the user wants immediate submission and a task ID:
169+
170+
```bash
171+
mmx video generate \
172+
--model MiniMax-H3 \
173+
--prompt "<video prompt>" \
174+
--duration <4-15> \
175+
--async \
176+
--output json \
177+
--non-interactive
178+
```
179+
180+
Return and retain the `taskId`, then stop. Do not automatically monitor or download it. MMX does not provide a task-list command or persist local task history.
181+
182+
## Prompt Handling
183+
184+
Preserve the user's intent. Write the prompt in the user's language. When a prompt is too short, expand it once using:
185+
186+
1. Duration, ratio, and use case.
187+
2. Subjects and reference mapping.
188+
3. Chronological actions.
189+
4. Scene, lighting, weather, and background.
190+
5. Shot size, angle, camera motion, focus, and cuts.
191+
6. Style, color, mood, and pacing.
192+
7. Dialogue, ambience, music, and audio synchronization.
193+
8. Elements to preserve and artifacts to avoid.
194+
195+
For two or more ordered reference images, use a structured storyboard prompt instead of one prose paragraph:
196+
197+
1. Output specification and ordered reference count.
198+
2. Global visual style and continuity rules.
199+
3. Locked character identity, wardrobe, position, and props.
200+
4. A contiguous master timeline mapped to `reference image 1`, `reference image 2`, and so on.
201+
5. A micro-timeline inside each shot: establish, prepare, execute, settle/hold, and end-state lock.
202+
6. Explicit action and object-state transitions for handoffs or other precise motion.
203+
7. Sound requirements and a final negative-constraint block.
204+
205+
Use two timeline levels. The master timeline divides the full clip into shots. Each shot then divides its own interval into timestamped micro-beats. A shot may contain several phases, but they must form one causal action beat. Every shot must state its exact range, duration, reference image, initial state, camera behavior, micro-beats, and locked end state. The next shot's initial state must equal the previous locked end state.
206+
207+
Master and micro intervals must cover their parent duration without gaps or overlaps, and reference numbering must match the repeated `--reference-image` flag order. Keep the action achievable within 4-15 seconds. Do not silently add brands, celebrities, dialogue, text overlays, or unsafe content. Use the detailed Chinese and English templates in `references/h3-video.md`.
208+
209+
If the user already provides a complete structured storyboard prompt, do not summarize, shorten, translate, or stylistically rewrite it. Check only the 7000-character limit, duration coverage, reference count/order, media-mode compatibility, and contradictory constraints; preserve the original wording unless a correction is required.
210+
211+
## Failure Handling
212+
213+
- Wrong Token Plan/OAuth credential or H3 error `2013`: stop and request a compatible Pay-as-you-go API Key.
214+
- Clear pre-submission region-routing failure: retry the unchanged command once with the alternate `--region`; never retry after task creation.
215+
- Authentication, balance, or sensitive-content errors: stop and report the exact error without retrying or silently changing the request.
216+
- A running terminal session: keep waiting on the same session; absence of a final path is not failure.
217+
- Terminal task status `failed`, `cancelled`, or `expired`: report the status and task error; require approval before another paid submission.
218+
- Polling timeout: report the task ID when available; do not submit a duplicate.
219+
- Download failure after success: retry the same result download only; never regenerate the video.
220+
221+
Read the complete failure matrix in `references/h3-video.md` before recovery.

0 commit comments

Comments
 (0)