Skip to content

Commit f0bf565

Browse files
Merge pull request #108 from JochenYang/fix-hailuo-fast-i2v-validation
fix: validate explicit Hailuo fast I2V usage
2 parents b166645 + cce0d7b commit f0bf565

2 files changed

Lines changed: 44 additions & 3 deletions

File tree

src/commands/video/generate.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ import { promptText, failIfMissing } from '../../utils/prompt';
2121

2222
export default defineCommand({
2323
name: 'video generate',
24-
description: 'Generate a video (T2V: Hailuo-2.3 / 2.3-Fast / Hailuo-02 | I2V: I2V-01 / I2V-01-Director / I2V-01-live | S2V: S2V-01)',
24+
description: 'Generate a video\n T2V: Hailuo-2.3\n I2V: Hailuo-2.3 (default) / Hailuo-2.3-Fast (fast mode, requires --first-frame)\n SEF: Hailuo-02 (requires --first-frame and --last-frame)\n S2V: S2V-01 (requires --subject-image)',
2525
apiDocs: '/docs/api-reference/video-generation',
2626
usage: 'mmx video generate --prompt <text> [flags]',
2727
options: [
28-
{ flag: '--model <model>', description: 'Model ID (default: MiniMax-Hailuo-2.3). Auto-switched to Hailuo-02 with --last-frame, or S2V-01 with --subject-image.' },
28+
{ flag: '--model <model>', description: 'Model ID. T2V: MiniMax-Hailuo-2.3; I2V: MiniMax-Hailuo-2.3 (default) or MiniMax-Hailuo-2.3-Fast (fast, requires --first-frame). Auto-switched to Hailuo-02 with --last-frame, or S2V-01 with --subject-image.' },
2929
{ flag: '--prompt <text>', description: 'Video description', required: true },
3030
{ flag: '--first-frame <path-or-url>', description: 'First frame image (local path or URL). Auto base64-encoded for local files.' },
3131
{ flag: '--last-frame <path-or-url>', description: 'Last frame image (local path or URL). Enables SEF (start-end frame) interpolation mode with Hailuo-02 model. Requires --first-frame.' },
@@ -71,8 +71,17 @@ export default defineCommand({
7171
);
7272
}
7373

74-
// Determine model: explicit --model > auto-switch > config default > hardcoded
74+
// MiniMax-Hailuo-2.3-Fast only supports I2V, not T2V
7575
const explicitModel = flags.model as string | undefined;
76+
if (explicitModel === 'MiniMax-Hailuo-2.3-Fast' && !flags.firstFrame) {
77+
throw new CLIError(
78+
'MiniMax-Hailuo-2.3-Fast only supports I2V (image-to-video). Use --first-frame to provide an input image.',
79+
ExitCode.USAGE,
80+
'mmx video generate --prompt <text> --model MiniMax-Hailuo-2.3-Fast --first-frame <image>',
81+
);
82+
}
83+
84+
// Determine model: explicit --model > auto-switch > config default > hardcoded
7685
let model: string;
7786
if (explicitModel) {
7887
model = explicitModel;

test/commands/video/generate.test.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,36 @@ describe('video generate command', () => {
162162
console.log = originalLog;
163163
}
164164
});
165+
166+
it('rejects explicit MiniMax-Hailuo-2.3-Fast without --first-frame', async () => {
167+
const config = {
168+
apiKey: 'test-key',
169+
region: 'global' as const,
170+
baseUrl: 'https://api.mmx.io',
171+
output: 'json' as const,
172+
timeout: 10,
173+
verbose: false,
174+
quiet: false,
175+
noColor: true,
176+
yes: false,
177+
dryRun: true,
178+
nonInteractive: true,
179+
async: false,
180+
};
181+
182+
await expect(
183+
generateCommand.execute(config, {
184+
prompt: 'A cat',
185+
model: 'MiniMax-Hailuo-2.3-Fast',
186+
quiet: false,
187+
verbose: false,
188+
noColor: true,
189+
yes: false,
190+
dryRun: true,
191+
help: false,
192+
nonInteractive: true,
193+
async: false,
194+
}),
195+
).rejects.toThrow('MiniMax-Hailuo-2.3-Fast only supports I2V');
196+
});
165197
});

0 commit comments

Comments
 (0)