mmx-cli 1.0.25 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +230 -0
- package/dist/index.d.ts +90 -1
- package/dist/mmx.mjs +332 -391
- package/dist/sdk.mjs +223 -73
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
<img src="https://file.cdn.minimax.io/public/MMX-capabilities.png" alt="MiniMax" width="100%" />
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>The official CLI for the MiniMax AI Platform</strong><br>
|
|
5
|
+
Built for AI agents. Generate text, images, video, and speech — from any agent or terminal.
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<p align="center">
|
|
9
|
+
<a href="https://www.npmjs.com/package/mmx-cli"><img src="https://img.shields.io/npm/v/mmx-cli.svg" alt="npm version" /></a>
|
|
10
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License: MIT" /></a>
|
|
11
|
+
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D18-brightgreen.svg" alt="Node.js >= 18" /></a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="README_CN.md">中文文档</a> · <a href="https://platform.minimax.io">Global Platform</a> · <a href="https://platform.minimaxi.com">CN Platform</a> · <a href="https://platform.minimax.io/docs/token-plan/minimax-cli">Example</a>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
- **Text** — Multi-turn chat, streaming, system prompts, JSON output
|
|
21
|
+
- **Image** — Text-to-image with aspect ratio and batch controls
|
|
22
|
+
- **Video** — Async video generation with progress tracking
|
|
23
|
+
- **Speech** — TTS with 30+ voices, speed control, streaming playback; speech-to-text transcription (json, verbose_json, srt, vtt)
|
|
24
|
+
- **Vision** — Image understanding and description
|
|
25
|
+
- **Search** — Web search powered by MiniMax
|
|
26
|
+
- **Dual Region** — Seamless Global (`api.minimax.io`) and CN (`api.minimaxi.com`) support
|
|
27
|
+
|
|
28
|
+
<img src="https://file.cdn.minimax.io/public/MMX-CLI-help.png" alt="MiniMax" width="100%" />
|
|
29
|
+
|
|
30
|
+
## Install
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# For AI agents (OpenClaw, Cursor, Claude Code, etc.): add skill to your agent
|
|
34
|
+
npx skills add MiniMax-AI/cli -y -g
|
|
35
|
+
|
|
36
|
+
# Or install CLI globally for terminal use
|
|
37
|
+
npm install -g mmx-cli
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
> Requires [Node.js](https://nodejs.org) 18+
|
|
41
|
+
|
|
42
|
+
> **Requires a MiniMax Token Plan** — [Global](https://platform.minimax.io/subscribe/token-plan) · [CN](https://platform.minimaxi.com/subscribe/token-plan)
|
|
43
|
+
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Authenticate (interactive — choose MiniMax OAuth or paste an API key)
|
|
48
|
+
mmx auth login
|
|
49
|
+
|
|
50
|
+
# Or non-interactive
|
|
51
|
+
mmx auth login --api-key sk-xxxxx
|
|
52
|
+
|
|
53
|
+
# Start creating
|
|
54
|
+
mmx text chat --message "What is MiniMax?"
|
|
55
|
+
mmx image "A cat in a spacesuit"
|
|
56
|
+
mmx speech synthesize --text "Hello!" --out hello.mp3
|
|
57
|
+
mmx speech transcribe --file meeting.mp3
|
|
58
|
+
mmx video generate --prompt "Ocean waves at sunset"
|
|
59
|
+
mmx search "MiniMax AI latest news"
|
|
60
|
+
mmx vision photo.jpg
|
|
61
|
+
mmx quota
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Releasing
|
|
65
|
+
|
|
66
|
+
Maintainers publish releases by pushing a SemVer Git tag; the release workflow
|
|
67
|
+
derives the npm package version from that tag. See [the release guide](docs/releasing.md).
|
|
68
|
+
|
|
69
|
+
## Commands
|
|
70
|
+
|
|
71
|
+
### `mmx text`
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
mmx text chat --message "Write a poem"
|
|
75
|
+
mmx text chat --model MiniMax-M3 --message "Hello" --stream
|
|
76
|
+
mmx text chat --system "You are a coding assistant" --message "Fizzbuzz in Go"
|
|
77
|
+
mmx text chat --message "user:Hi" --message "assistant:Hey!" --message "How are you?"
|
|
78
|
+
cat messages.json | mmx text chat --messages-file - --output json
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### `mmx image`
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
mmx image "A cat in a spacesuit"
|
|
85
|
+
mmx image generate --prompt "A cat" --n 3 --aspect-ratio 16:9
|
|
86
|
+
mmx image generate --prompt "Logo" --out-dir ./out/
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### `mmx video`
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Hailuo-2.3 (Video Generation V1)
|
|
93
|
+
mmx video generate --prompt "Ocean waves at sunset" --download sunset.mp4
|
|
94
|
+
mmx video generate --prompt "A robot painting" --async
|
|
95
|
+
|
|
96
|
+
# MiniMax-H3 (Video Generation V2)
|
|
97
|
+
mmx video generate --api-key "$MINIMAX_API_KEY" --model MiniMax-H3 --prompt "Ocean waves at sunset"
|
|
98
|
+
mmx video generate --api-key "$MINIMAX_API_KEY" --model MiniMax-H3 --prompt "The subject walks forward" --image start.jpg
|
|
99
|
+
mmx video generate --api-key "$MINIMAX_API_KEY" --model MiniMax-H3 --prompt "Keep the same character" --reference-image character.png --reference-video motion.mp4
|
|
100
|
+
|
|
101
|
+
mmx video task get --task-id 123456
|
|
102
|
+
mmx video task get --task-id 424010985738629 --model MiniMax-H3
|
|
103
|
+
mmx video download --file-id 176844028768320 --out video.mp4
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
For MiniMax-H3, local files and Base64 data URIs are preflight-checked against the documented limits: image 30 MB, reference video 50 MB, reference audio 15 MB, and total JSON request body 64 MB. The API validates dimensions, aspect ratio, duration, frame rate, and codecs for all media.
|
|
107
|
+
|
|
108
|
+
`--region` is an existing global CLI option, not an H3 parameter. Normal video generation does not need it; the CLI uses the saved or automatically detected region. H3 defaults to 2K, 5 seconds, and 16:9 for text-to-video.
|
|
109
|
+
|
|
110
|
+
### `mmx speech`
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
mmx speech synthesize --text "Hello!" --out hello.mp3
|
|
114
|
+
mmx speech synthesize --text "Stream me" --stream | mpv -
|
|
115
|
+
mmx speech synthesize --text "Hi" --voice English_magnetic_voiced_man --speed 1.2
|
|
116
|
+
echo "Breaking news" | mmx speech synthesize --text-file - --out news.mp3
|
|
117
|
+
mmx speech voices
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Speech-to-text (asr-1.0)
|
|
122
|
+
mmx speech transcribe --file meeting.mp3
|
|
123
|
+
mmx speech transcribe --file call.mp3 --language zh
|
|
124
|
+
mmx speech transcribe --file talk.mp3 --response-format verbose_json --output json
|
|
125
|
+
mmx speech transcribe --file talk.mp3 --response-format srt --out talk.srt
|
|
126
|
+
mmx speech transcribe --file long.mp3 --stream
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
`mmx speech transcribe` accepts wav, aiff, flac, m4a, mp3, aac, opus, and ogg files up to
|
|
130
|
+
50 MB and 500 seconds. Audio above 50 MB is rejected locally before upload; the 500 second
|
|
131
|
+
limit is enforced by the API. Omitting `--language` enables mixed-language recognition.
|
|
132
|
+
`--response-format json` (default) prints the transcript, `verbose_json` adds speakers and
|
|
133
|
+
per-segment timestamps, and `srt` / `vtt` return subtitle documents. `n_speakers` and
|
|
134
|
+
`segments` are part of the response, so pass `--output json` to see them. `--stream` prints
|
|
135
|
+
incremental text and requires `json`; when stdout is not a terminal it accumulates into a single
|
|
136
|
+
JSON result unless `--output text` is passed. `mmx speech recognize` is an alias for
|
|
137
|
+
`mmx speech transcribe`.
|
|
138
|
+
|
|
139
|
+
### `mmx vision`
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
mmx vision photo.jpg
|
|
143
|
+
mmx vision describe --image https://example.com/img.jpg --prompt "What breed?"
|
|
144
|
+
mmx vision describe --file-id file-123
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### `mmx search`
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
mmx search "MiniMax AI"
|
|
151
|
+
mmx search query --q "latest news" --output json
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
> The `/v1/coding_plan/search` API returns at most 10 results per call and does not currently expose a pagination parameter (see #107). Refine your query if you need different results.
|
|
155
|
+
|
|
156
|
+
### `mmx auth`
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
mmx auth login # interactive: pick OAuth (Global / China) or paste an API key
|
|
160
|
+
mmx auth login --api-key sk-xxxxx # save an API key directly
|
|
161
|
+
mmx auth login --recommend # skip the menu, pick OAuth region interactively
|
|
162
|
+
mmx auth login --recommend --region=global # OAuth → api.minimax.io
|
|
163
|
+
mmx auth login --recommend --region=cn # OAuth → api.minimaxi.com
|
|
164
|
+
mmx auth status
|
|
165
|
+
mmx auth refresh
|
|
166
|
+
mmx auth logout
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
`mmx auth status` is the canonical way to verify active authentication.
|
|
170
|
+
|
|
171
|
+
**OAuth** uses the [Device Authorization Grant (RFC 8628)](https://tools.ietf.org/html/rfc8628) with PKCE —
|
|
172
|
+
the CLI opens your browser, you enter a code, and `access_token` + `refresh_token`
|
|
173
|
+
are saved to `~/.mmx/config.json`. Tokens refresh automatically (5-min buffer);
|
|
174
|
+
manual refresh via `mmx auth refresh`.
|
|
175
|
+
|
|
176
|
+
**API key** auth auto-detects the correct region by probing both Global and CN.
|
|
177
|
+
Useful for CI/CD (`mmx auth login --api-key sk-xxxxx`), or pass per-command via `--api-key`.
|
|
178
|
+
|
|
179
|
+
OAuth and API key are mutually exclusive — logging in with one clears the other.
|
|
180
|
+
Credential priority: `--api-key` flag > OAuth (config) > `api_key` (config).
|
|
181
|
+
|
|
182
|
+
### Environment variables
|
|
183
|
+
|
|
184
|
+
| Variable | Description |
|
|
185
|
+
|---|---|
|
|
186
|
+
| `MINIMAX_REGION` | `global` or `cn`. |
|
|
187
|
+
| `MINIMAX_BASE_URL` | Override the API base URL. |
|
|
188
|
+
| `MINIMAX_OUTPUT` | `text` or `json`. |
|
|
189
|
+
| `MINIMAX_TIMEOUT` | Request timeout in seconds. |
|
|
190
|
+
| `MINIMAX_VERBOSE` | `1` to enable verbose HTTP logging. |
|
|
191
|
+
| `MMX_CONFIG_DIR` | Directory containing the `config.json` file (default: `~/.mmx`). Set this when `mmx` runs from a subprocess, service, or CI job whose home directory differs from where you logged in. |
|
|
192
|
+
|
|
193
|
+
### `mmx config` · `mmx quota`
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
mmx quota
|
|
197
|
+
mmx config show
|
|
198
|
+
mmx config set --key region --value cn
|
|
199
|
+
mmx config set --key default-text-model --value MiniMax-M3
|
|
200
|
+
mmx config export-schema | jq .
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### `mmx agent setup`
|
|
204
|
+
|
|
205
|
+
Configure MiniMax for Claude Code, Codex, Grok Build, OpenCode, Hermes, or Pi while preserving unrelated settings. Run without options for the interactive wizard; supplying options makes the command non-interactive and suitable for scripts.
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
mmx agent setup
|
|
209
|
+
mmx agent setup --agent codex --agent claude-code --api-key "$MINIMAX_API_KEY" --region global
|
|
210
|
+
mmx agent setup --all --api-key "$MINIMAX_API_KEY" --region cn --output json
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
The command verifies the key and selected region before writing. Existing files are backed up when changed; use `--dry-run` to preview without a live request. In the interactive wizard, compatible agents that are missing from `PATH` can be installed from a second multi-select list using their official packages or installer scripts. The Hermes install uses its official core CLI stages and skips optional system packages, Node workspace, browser, computer-use, setup, and gateway stages. After installation, mmx applies the MiniMax configuration while preserving installer settings. Agents that fail a platform or prerequisite check are explained and left configuration-only. Non-interactive invocations remain configuration-only, and the command never launches an agent.
|
|
214
|
+
|
|
215
|
+
### `mmx update`
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
mmx update
|
|
219
|
+
mmx update latest
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Thanks to
|
|
223
|
+
|
|
224
|
+
<a href="https://github.com/MiniMax-AI/cli/graphs/contributors">
|
|
225
|
+
<img src="https://contrib.rocks/image?repo=MiniMax-AI/cli" />
|
|
226
|
+
</a>
|
|
227
|
+
|
|
228
|
+
## License
|
|
229
|
+
|
|
230
|
+
[MIT](LICENSE)
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
declare const REGIONS: {
|
|
4
4
|
readonly global: "https://api.minimax.io";
|
|
5
|
-
readonly cn: "https://api.
|
|
5
|
+
readonly cn: "https://api.minimax.cn";
|
|
6
6
|
};
|
|
7
7
|
export type Region = keyof typeof REGIONS;
|
|
8
8
|
export interface Config {
|
|
@@ -185,6 +185,48 @@ export interface SpeechResponse {
|
|
|
185
185
|
invisible_character_ratio?: number;
|
|
186
186
|
};
|
|
187
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* Result shape for `POST /v1/speech_to_text`.
|
|
190
|
+
* `json` → text + duration; `verbose_json` → adds `n_speakers` and `segments`
|
|
191
|
+
* (both also returned as SRT / VTT documents by the same endpoint).
|
|
192
|
+
*/
|
|
193
|
+
export type SpeechToTextFormat = "json" | "verbose_json" | "srt" | "vtt";
|
|
194
|
+
/** Timestamp granularity for `verbose_json` / `srt` / `vtt` results. */
|
|
195
|
+
export type SpeechToTextTimestampLevel = "sentence" | "word";
|
|
196
|
+
/**
|
|
197
|
+
* Multipart body for `POST /v1/speech_to_text`. `file` is sent as a form part;
|
|
198
|
+
* unlike the other fields here, `language` travels as a request header — see
|
|
199
|
+
* `transcribe()` in `src/sdk/speech`.
|
|
200
|
+
*/
|
|
201
|
+
export interface SpeechToTextRequest {
|
|
202
|
+
model: string;
|
|
203
|
+
response_format?: SpeechToTextFormat;
|
|
204
|
+
timestamp_level?: SpeechToTextTimestampLevel;
|
|
205
|
+
stream?: boolean;
|
|
206
|
+
}
|
|
207
|
+
/** One timestamped unit (sentence, or word when `timestamp_level=word`). */
|
|
208
|
+
export interface SpeechToTextSegment {
|
|
209
|
+
id: number;
|
|
210
|
+
start: number;
|
|
211
|
+
end: number;
|
|
212
|
+
speaker: string;
|
|
213
|
+
text: string;
|
|
214
|
+
}
|
|
215
|
+
export interface SpeechToTextResponse {
|
|
216
|
+
text: string;
|
|
217
|
+
duration: number;
|
|
218
|
+
n_speakers?: number;
|
|
219
|
+
segments?: SpeechToTextSegment[];
|
|
220
|
+
trace_id?: string;
|
|
221
|
+
}
|
|
222
|
+
/** One `data:` event of the `stream=true` SSE response. */
|
|
223
|
+
export interface SpeechToTextStreamEvent {
|
|
224
|
+
index: number;
|
|
225
|
+
delta: string;
|
|
226
|
+
finish: boolean;
|
|
227
|
+
/** Total audio duration in seconds; only present on the final event. */
|
|
228
|
+
duration?: number;
|
|
229
|
+
}
|
|
188
230
|
export interface SystemVoiceInfo {
|
|
189
231
|
voice_id: string;
|
|
190
232
|
voice_name: string;
|
|
@@ -375,6 +417,28 @@ declare class TextSDK extends Client {
|
|
|
375
417
|
chat(request: Partial<ChatRequest>): Promise<ChatResponse>;
|
|
376
418
|
private validateParams;
|
|
377
419
|
}
|
|
420
|
+
export type TranscribeParams = ModelPartial<SpeechToTextRequest> & {
|
|
421
|
+
/** Local audio path, or a Blob/File to send as-is. */
|
|
422
|
+
file: string | Blob;
|
|
423
|
+
/**
|
|
424
|
+
* BCP-47 language hint (e.g. `zh`, `en`). Sent as the `language` request
|
|
425
|
+
* header — the API accepts and ignores the same value as a form field.
|
|
426
|
+
*/
|
|
427
|
+
language?: string;
|
|
428
|
+
};
|
|
429
|
+
export type TranscribeStreamParams = TranscribeParams & {
|
|
430
|
+
stream: true;
|
|
431
|
+
response_format?: "json";
|
|
432
|
+
};
|
|
433
|
+
/** Subtitle formats come back as documents, not as JSON. */
|
|
434
|
+
export type TranscribeSubtitleParams = TranscribeParams & {
|
|
435
|
+
response_format: Extract<SpeechToTextFormat, "srt" | "vtt">;
|
|
436
|
+
stream?: false;
|
|
437
|
+
};
|
|
438
|
+
export type TranscribeJsonParams = TranscribeParams & {
|
|
439
|
+
response_format?: Extract<SpeechToTextFormat, "json" | "verbose_json">;
|
|
440
|
+
stream?: false;
|
|
441
|
+
};
|
|
378
442
|
declare class SpeechSDK extends Client {
|
|
379
443
|
synthesize(request: ModelPartial<SpeechRequest> & {
|
|
380
444
|
stream: true;
|
|
@@ -382,6 +446,29 @@ declare class SpeechSDK extends Client {
|
|
|
382
446
|
synthesize(request: ModelPartial<SpeechRequest>): Promise<SpeechResponse>;
|
|
383
447
|
private synthesizeStream;
|
|
384
448
|
voices(language?: string): Promise<SystemVoiceInfo[]>;
|
|
449
|
+
/**
|
|
450
|
+
* Transcribe an audio file (speech-to-text).
|
|
451
|
+
*
|
|
452
|
+
* `json` and `verbose_json` resolve to a structured response; `srt` and `vtt`
|
|
453
|
+
* are returned by the API as subtitle documents and resolve to that document
|
|
454
|
+
* as a string. `stream: true` resolves to a stream of incremental text events
|
|
455
|
+
* and is only valid with `response_format: 'json'`; the generator ends at the
|
|
456
|
+
* API's final event (`finish: true`) and releases the connection, so breaking
|
|
457
|
+
* out early is safe. Concatenate `delta` values in `index` order. The audio is
|
|
458
|
+
* uploaded as `multipart/form-data`, and `language` travels as a request
|
|
459
|
+
* header — the API accepts and ignores the same value as a form field.
|
|
460
|
+
*/
|
|
461
|
+
transcribe(params: TranscribeStreamParams): Promise<AsyncGenerator<SpeechToTextStreamEvent>>;
|
|
462
|
+
transcribe(params: TranscribeSubtitleParams): Promise<string>;
|
|
463
|
+
transcribe(params: TranscribeJsonParams): Promise<SpeechToTextResponse>;
|
|
464
|
+
transcribe(params: TranscribeParams): Promise<SpeechToTextResponse | string | AsyncGenerator<SpeechToTextStreamEvent>>;
|
|
465
|
+
/**
|
|
466
|
+
* Yield events until the API's final one. Stopping there leaves the SSE body
|
|
467
|
+
* undrained, which keeps the connection (and any open handles) alive; the
|
|
468
|
+
* `finally` releases it whether the stream ended on `finish` or the consumer
|
|
469
|
+
* broke out early.
|
|
470
|
+
*/
|
|
471
|
+
private transcribeStream;
|
|
385
472
|
/**
|
|
386
473
|
* Save synthesized speech audio to a file. Decodes the hex-encoded audio
|
|
387
474
|
* from the API response and writes it to disk. Creates intermediate
|
|
@@ -394,6 +481,8 @@ declare class SpeechSDK extends Client {
|
|
|
394
481
|
*/
|
|
395
482
|
save(response: SpeechResponse, outPath?: string, ext?: string): string;
|
|
396
483
|
private validateParams;
|
|
484
|
+
/** Resolve the transcription response format, rejecting unusable values. */
|
|
485
|
+
private validateTranscribeFormat;
|
|
397
486
|
}
|
|
398
487
|
export interface ImageSaveOptions {
|
|
399
488
|
/** Save to exact file path (single image only). */
|