Skip to content

Commit d461d82

Browse files
author
Octopus
authored
Add minimax-video plugin for MiniMax-Hailuo video generation (#255)
Adds slash commands for text-to-video, image-to-video, query, and download across global and China MiniMax endpoints.
1 parent 8cd972f commit d461d82

6 files changed

Lines changed: 265 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "minimax-video",
3+
"version": "0.1.0",
4+
"description": "Generate videos with MiniMax-Hailuo-2.3 from a text prompt or a first-frame image, poll generation status, and download the finished file across the global and China API endpoints.",
5+
"author": {
6+
"name": "BuildWithClaude Community",
7+
"url": "https://github.com/davepoon/buildwithclaude"
8+
},
9+
"repository": "https://github.com/davepoon/buildwithclaude",
10+
"license": "MIT",
11+
"keywords": [
12+
"minimax",
13+
"hailuo",
14+
"video-generation",
15+
"text-to-video",
16+
"image-to-video",
17+
"slash-commands"
18+
]
19+
}

plugins/minimax-video/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# minimax-video
2+
3+
Generate videos with **MiniMax-Hailuo-2.3** directly from Claude Code. This plugin
4+
adds slash commands that wrap the MiniMax video-generation REST API, covering the
5+
full asynchronous flow — create a task, poll its status, and download the result —
6+
across both the global and China API hosts.
7+
8+
## Commands
9+
10+
| Command | Operation | Method & path |
11+
| --- | --- | --- |
12+
| `/minimax-video:text-to-video` | Create a task from a text prompt | `POST /v1/video_generation` |
13+
| `/minimax-video:image-to-video` | Create a task from a first-frame image | `POST /v1/video_generation` |
14+
| `/minimax-video:query-video` | Poll a task's status and read its `file_id` | `GET /v1/query/video_generation` |
15+
| `/minimax-video:download-video` | Resolve a `file_id` to a download URL | `GET /v1/files/retrieve` |
16+
17+
## Endpoints
18+
19+
| Region | Base URL | Docs |
20+
| --- | --- | --- |
21+
| Global | `https://api.minimax.io` | https://platform.minimax.io/docs/api-reference/api-overview |
22+
| China | `https://api.minimaxi.com` | https://platform.minimaxi.com/docs/api-reference/api-overview |
23+
24+
Each command takes an optional `--region global|cn` flag (default `global`) that
25+
selects the matching host.
26+
27+
## Models
28+
29+
Default: `MiniMax-Hailuo-2.3`. Also accepted: `MiniMax-Hailuo-2.3-Fast`,
30+
`MiniMax-Hailuo-02`, `T2V-01-Director`, `T2V-01`, `I2V-01-Director`, `I2V-01-live`,
31+
`I2V-01`.
32+
33+
## Authentication
34+
35+
Set your API key before running the commands:
36+
37+
```bash
38+
export MINIMAX_API_KEY="your-key"
39+
```
40+
41+
Every request sends `Authorization: Bearer $MINIMAX_API_KEY`. A response is
42+
successful when `base_resp.status_code` is `0`.
43+
44+
## Typical flow
45+
46+
1. `/minimax-video:text-to-video "a neon koi in a rainy alley"` → returns a `task_id`.
47+
2. `/minimax-video:query-video <task_id>` → poll until status is success, read `file_id`.
48+
3. `/minimax-video:download-video <file_id> ./clip.mp4` → resolve and save the video.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
description: Retrieve the download URL for a finished MiniMax video by file id and save the file.
3+
category: integration-sync
4+
argument-hint: <file_id> [output_path] [--region global|cn]
5+
allowed-tools: Bash
6+
---
7+
8+
# Download Video (MiniMax-Hailuo)
9+
10+
Resolve a finished video's `file_id` (returned by `/minimax-video:query-video`) into
11+
a download URL and save the file locally.
12+
13+
## Instructions
14+
15+
1. Read the `file_id` from `$ARGUMENTS` (required); an optional second token is the
16+
output path (default `./minimax-video.mp4`).
17+
2. Choose the endpoint host by region:
18+
- `global` (default): `https://api.minimax.io/v1/files/retrieve`
19+
- `cn`: `https://api.minimaxi.com/v1/files/retrieve`
20+
3. Authenticate with a Bearer token from the `MINIMAX_API_KEY` environment variable.
21+
4. GET the file metadata with the `file_id` query parameter, read the download URL
22+
from `file.download_url`, then fetch that URL to the output path.
23+
5. Check `base_resp.status_code == 0` before downloading.
24+
25+
## Request
26+
27+
```bash
28+
# region=global -> https://api.minimax.io ; region=cn -> https://api.minimaxi.com
29+
curl -sS -G "https://api.minimax.io/v1/files/retrieve" \
30+
-H "Authorization: Bearer $MINIMAX_API_KEY" \
31+
--data-urlencode "file_id=205258526306433"
32+
33+
# then download the resolved URL
34+
curl -sS -L -o "./minimax-video.mp4" "<file.download_url from the response above>"
35+
```
36+
37+
## Response
38+
39+
```json
40+
{
41+
"file": {
42+
"file_id": "205258526306433",
43+
"download_url": "https://cdn.minimax.io/.../output.mp4"
44+
},
45+
"base_resp": { "status_code": 0, "status_msg": "success" }
46+
}
47+
```
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
description: Create a MiniMax-Hailuo-2.3 video-generation task from a first-frame image and return its task id.
3+
category: integration-sync
4+
argument-hint: <first_frame_image_url_or_base64> [prompt] [--model MiniMax-Hailuo-2.3] [--region global|cn]
5+
allowed-tools: Bash
6+
---
7+
8+
# Image to Video (MiniMax-Hailuo)
9+
10+
Animate a still image with the MiniMax video-generation endpoint. The image is
11+
supplied as the `first_frame_image` (a public URL or a `data:` base64 string) and
12+
becomes the opening frame of the clip. Returns the `task_id` for polling.
13+
14+
## Instructions
15+
16+
1. Parse `$ARGUMENTS`: the first token is the `first_frame_image`; any remaining
17+
text is an optional `prompt` describing the motion.
18+
2. Choose the endpoint host by region:
19+
- `global` (default): `https://api.minimax.io/v1/video_generation`
20+
- `cn`: `https://api.minimaxi.com/v1/video_generation`
21+
3. Authenticate with a Bearer token from the `MINIMAX_API_KEY` environment variable.
22+
4. Default `model` to `MiniMax-Hailuo-2.3`. Other accepted models: `MiniMax-Hailuo-2.3-Fast`,
23+
`MiniMax-Hailuo-02`, `I2V-01-Director`, `I2V-01-live`, `I2V-01`.
24+
5. `model` and `first_frame_image` are required. Optional fields: `prompt`,
25+
`prompt_optimizer`, `fast_pretreatment`, `duration`, `resolution`, `callback_url`.
26+
6. POST the request, then report the `task_id` (check `base_resp.status_code == 0`).
27+
28+
## Request
29+
30+
```bash
31+
# region=global -> https://api.minimax.io ; region=cn -> https://api.minimaxi.com
32+
curl -sS -X POST "https://api.minimax.io/v1/video_generation" \
33+
-H "Authorization: Bearer $MINIMAX_API_KEY" \
34+
-H "Content-Type: application/json" \
35+
-d '{
36+
"model": "MiniMax-Hailuo-2.3",
37+
"first_frame_image": "https://example.com/first-frame.jpg",
38+
"prompt": "Slow push-in as the character turns toward the camera",
39+
"prompt_optimizer": true,
40+
"duration": 6,
41+
"resolution": "1080P"
42+
}'
43+
```
44+
45+
## Response
46+
47+
```json
48+
{
49+
"task_id": "176843928495987",
50+
"base_resp": { "status_code": 0, "status_msg": "success" }
51+
}
52+
```
53+
54+
Pass the returned `task_id` to `/minimax-video:query-video`.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
description: Poll a MiniMax video-generation task by task id and report its status and file id.
3+
category: integration-sync
4+
argument-hint: <task_id> [--region global|cn]
5+
allowed-tools: Bash
6+
---
7+
8+
# Query Video Generation (MiniMax-Hailuo)
9+
10+
Check the status of a previously submitted video-generation task. When the task
11+
finishes, the response carries the `file_id` needed to download the video.
12+
13+
## Instructions
14+
15+
1. Read the `task_id` from `$ARGUMENTS` (required).
16+
2. Choose the endpoint host by region:
17+
- `global` (default): `https://api.minimax.io/v1/query/video_generation`
18+
- `cn`: `https://api.minimaxi.com/v1/query/video_generation`
19+
3. Authenticate with a Bearer token from the `MINIMAX_API_KEY` environment variable.
20+
4. Send a GET request with the `task_id` query parameter.
21+
5. Report `status`; when it indicates success, surface the `file_id` and hand it to
22+
`/minimax-video:download-video`. Also check `base_resp.status_code == 0`.
23+
24+
## Request
25+
26+
```bash
27+
# region=global -> https://api.minimax.io ; region=cn -> https://api.minimaxi.com
28+
curl -sS -G "https://api.minimax.io/v1/query/video_generation" \
29+
-H "Authorization: Bearer $MINIMAX_API_KEY" \
30+
--data-urlencode "task_id=176843928495123"
31+
```
32+
33+
## Response
34+
35+
```json
36+
{
37+
"task_id": "176843928495123",
38+
"status": "Success",
39+
"file_id": "205258526306433",
40+
"base_resp": { "status_code": 0, "status_msg": "success" }
41+
}
42+
```
43+
44+
Pass the returned `file_id` to `/minimax-video:download-video`.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
description: Create a MiniMax-Hailuo-2.3 video-generation task from a text prompt and return its task id.
3+
category: integration-sync
4+
argument-hint: <prompt> [--model MiniMax-Hailuo-2.3] [--duration 6] [--resolution 1080P] [--region global|cn]
5+
allowed-tools: Bash
6+
---
7+
8+
# Text to Video (MiniMax-Hailuo)
9+
10+
Submit a text prompt to the MiniMax video-generation endpoint and return the
11+
`task_id` that identifies the asynchronous job. Follow up with `/minimax-video:query-video`
12+
to poll status and `/minimax-video:download-video` to fetch the result.
13+
14+
## Instructions
15+
16+
1. Read the user's prompt from `$ARGUMENTS`. Choose the endpoint host by region:
17+
- `global` (default): `https://api.minimax.io/v1/video_generation`
18+
- `cn`: `https://api.minimaxi.com/v1/video_generation`
19+
2. Authenticate with a Bearer token from the `MINIMAX_API_KEY` environment variable.
20+
3. Default `model` to `MiniMax-Hailuo-2.3`. Other accepted models: `MiniMax-Hailuo-2.3-Fast`,
21+
`MiniMax-Hailuo-02`, `T2V-01-Director`, `T2V-01`.
22+
4. `model` and `prompt` are required. Optional fields: `prompt_optimizer`,
23+
`fast_pretreatment`, `duration`, `resolution`, `callback_url`.
24+
5. POST the request, then report the `task_id` from the response (also check
25+
`base_resp.status_code`, where `0` means success).
26+
27+
## Request
28+
29+
```bash
30+
# region=global -> https://api.minimax.io ; region=cn -> https://api.minimaxi.com
31+
curl -sS -X POST "https://api.minimax.io/v1/video_generation" \
32+
-H "Authorization: Bearer $MINIMAX_API_KEY" \
33+
-H "Content-Type: application/json" \
34+
-d '{
35+
"model": "MiniMax-Hailuo-2.3",
36+
"prompt": "A neon koi swimming through a rainy Tokyo alley at night",
37+
"prompt_optimizer": true,
38+
"fast_pretreatment": false,
39+
"duration": 6,
40+
"resolution": "1080P"
41+
}'
42+
```
43+
44+
## Response
45+
46+
```json
47+
{
48+
"task_id": "176843928495123",
49+
"base_resp": { "status_code": 0, "status_msg": "success" }
50+
}
51+
```
52+
53+
Pass the returned `task_id` to `/minimax-video:query-video`.

0 commit comments

Comments
 (0)