[MiniMax](/ai-gateway/models/labs/minimax)

# MiniMax H3

MiniMax H3 is MiniMax's video model. It generates 2K mp4 clips from a text prompt, a starting image, a pair of first and last frames, or reference images, video, and audio. Your use is subject to MiniMax's [Terms](https://platform.minimax.io/protocol/terms-of-service) & [Privacy](https://platform.minimax.io/protocol/privacy-policy) Policies.

Video Genimage-to-videotext-to-videoreference-to-videoVision (Image)

[Use with AI Gateway](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%3Futm_source%3Dgateway-model-page%26utm_campaign%3Dai-gateway-models&title=Get+Started+with+Vercel+AI+Gateway) [View docs](https://vercel.com/docs/ai-gateway)

```
1import { experimental_generateVideo as generateVideo } from 'ai';
2

3const result = await generateVideo({
4  model: 'minimax/minimax-h3',
5  prompt: 'A serene mountain lake at sunrise.'
6});
```

[Read docs](https://vercel.com/docs/ai-gateway/sdks-and-apis/ai-sdk)

[Overview](/ai-gateway/models/minimax-h3) [API](/ai-gateway/models/minimax-h3/api) [About](/ai-gateway/models/minimax-h3/about) [Providers](/ai-gateway/models/minimax-h3/providers) [Similar](/ai-gateway/models/minimax-h3/similar) [FAQ](/ai-gateway/models/minimax-h3/faq)

## Getting started

Generate videos with MiniMax H3 using the `experimental_generateVideo` function from AI SDK 6 or later. AI Gateway handles routing and polls until the video is ready.

Install the AI SDK (`pnpm add ai dotenv`), create an API key from the [API Keys page](/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fapi-keys&title=AI+Gateway+API+Keys), and set it as `AI_GATEWAY_API_KEY` in your environment. Full setup is covered in the [video generation quickstart](/docs/ai-gateway/getting-started/video).

index.ts

```
1import { experimental_generateVideo as generateVideo } from 'ai';
2import fs from 'node:fs';
3import 'dotenv/config';
4

5async function main() {
6  const result = await generateVideo({
7    model: 'minimax/minimax-h3',
8    prompt: 'A white kitten chases a butterfly across a sunlit garden.',
9  });
10

11  // Save the generated video
12  fs.writeFileSync('output.mp4', result.videos[0].uint8Array);
13

14  console.log('Video saved to output.mp4');
15}
16

17main().catch(console.error);
```

## Top-level parameters

Load the supported top-level parameters: prompt, duration, aspectRatio, and resolution. `2K` is the only resolution H3 renders, and the named tier is accepted in place of the `{width}x{height}` form.

top-level-params.ts

5async function main() {
6  const result = await generateVideo({
7    model: 'minimax/minimax-h3',
8    prompt: 'A white kitten chases a butterfly across a sunlit garden.',
9    duration: 5,
10    aspectRatio: '16:9',
11    resolution: '2048x2048',
12  });
13

14  // Save the generated video
15  fs.writeFileSync('output.mp4', result.videos[0].uint8Array);
16

17  console.log('Video saved to output.mp4');
18}
19

20main().catch(console.error);
```

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `prompt` | `string` | No | Text description of the video to generate. |
| `duration` | `number` | No | Video length in seconds. 4-15 seconds. |
| `resolution` | `string` | No | Resolution ('2048x2048'). |
| `aspectRatio` | `string` | No | Aspect ratio ('21:9', '16:9', '4:3', '1:1', '3:4', '9:16'). |
| `prompt.image` | `string` | No | URL of an image to animate as the first frame. Equivalent to a single `frameImages` entry with `frameType: "first_frame"`. |
| `frameImages` | `Array<{ image: string; frameType: 'first_frame' \| 'last_frame' }>` | No | First and last frames of the clip. A `last_frame` without a `first_frame` is dropped with a warning, and only images are accepted. |
| `inputReferences` | `Array<string \| { data: string; mediaType: string }>` | No | Reference images and videos to keep a subject or follow motion. Up to 9 images and 3 videos. Pass videos as `{ data, mediaType: "video/mp4" }` — a URL without a media type is treated as an image. |

## Input limits

| Input | Formats | Sources | Max count | Max size | Limits |
| --- | --- | --- | --- | --- | --- |
| Image | jpg, jpeg, png, webp, heic, heif | url | 9 | 30 MB | ≥256px · ≤5760px · aspect 2:5–5:2 |
| Video | h264, h265, mp4 | url | 3 | 50 MB | 2-15s · ≥256px · ≤5760px |
| Audio | wav, mp3 | url | — | 15 MB | 2-15s |

## Provider options

Pass MiniMax options under `providerOptions.minimax`. `ratio` overrides the top-level `aspectRatio` and is the only way to request `adaptive`.

Learn more in the [AI SDK MiniMax video docs](https://ai-sdk.dev/providers/ai-sdk-providers/minimax#video-models).

provider-options.ts

5async function main() {
6  const result = await generateVideo({
7    model: 'minimax/minimax-h3',
8    prompt: 'A white kitten chases a butterfly across a sunlit garden.',
9    duration: 5,
10    providerOptions: {
11      minimax: {
12        ratio: '16:9',
13        resolution: '2K',
14        aigcWatermark: false,
15        pollIntervalMs: 10000,
16        pollTimeoutMs: 600000,
17      },
18    },
19  });
20

21  // Save the generated video
22  fs.writeFileSync('output.mp4', result.videos[0].uint8Array);
23

24  console.log('Video saved to output.mp4');
25}
26

27main().catch(console.error);
```

Pass MiniMax-specific options under `providerOptions.minimax` in your generateVideo call.

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `ratio` | `'adaptive' \| '21:9' \| '16:9' \| '4:3' \| '1:1' \| '3:4' \| '9:16'` | No | Aspect ratio of the generated video. Overrides the top-level `aspectRatio`, and unlike it can be set to `adaptive`. |
| `resolution` | `'2K'` | No | Output resolution. H3 currently only supports `2K`, which is also the default. |
| `referenceAudioUrls` | `string[]` | No | Up to 3 reference audio URLs for reference-to-video. Must be paired with at least one reference image or video, or the audio is dropped with a warning. The only input that accepts `mm_file://` handles — pass images and videos as public URLs, data URIs, or binary data. |
| `aigcWatermark` | `boolean` | No | Whether to embed an AIGC watermark in the output. Defaults to `false`. |
| `pollIntervalMs` | `number` | No | How often to check task status. Defaults to `10000`. |
| `pollTimeoutMs` | `number` | No | Maximum wait time. Defaults to `600000` (10 minutes). |

## First and last frame

Control the transition by opening on one image and closing on another. The aspect ratio follows the input images, so an explicit `aspectRatio` is ignored.

first-last-frame.ts

5async function main() {
6  const result = await generateVideo({
7    model: 'minimax/minimax-h3',
8    prompt: 'The kitten crosses the garden and settles under the bench.',
9    duration: 5,
10    frameImages: [
11      { image: 'https://example.com/start.jpg', frameType: 'first_frame' },
12      { image: 'https://example.com/end.jpg', frameType: 'last_frame' },
13    ],
14  });
15

16  // Save the generated video
17  fs.writeFileSync('output.mp4', result.videos[0].uint8Array);
18

19  console.log('Video saved to output.mp4');
20}
21

22main().catch(console.error);
```

## Reference to video

Keep a subject or follow motion from reference media, and optionally drive it with reference audio. Videos need an explicit media type; audio goes in `providerOptions.minimax.referenceAudioUrls` and has to accompany at least one image or video.

reference-to-video.ts

5async function main() {
6  const result = await generateVideo({
7    model: 'minimax/minimax-h3',
8    prompt: 'The same kitten, now padding along a rainy city street at night.',
9    duration: 5,
10    inputReferences: [
11      'https://example.com/kitten.jpg',
12      { data: 'https://example.com/motion.mp4', mediaType: 'video/mp4' },
13    ],
14    providerOptions: {
15      minimax: {
16        ratio: 'adaptive',
17        referenceAudioUrls: ['https://example.com/voice.wav'],
18      },
19    },
20  });
21

22  // Save the generated video
23  fs.writeFileSync('output.mp4', result.videos[0].uint8Array);
24

25  console.log('Video saved to output.mp4');
26}
27

28main().catch(console.error);
```