|
1 | 1 | # minimax-cli |
2 | 2 |
|
3 | | -Command-line interface for the [MiniMax Token Plan](https://platform.minimax.io/docs/token-plan/intro). |
| 3 | +CLI for the [MiniMax AI Platform](https://platform.minimax.io) — generate text, images, video, speech, and music from the terminal. |
4 | 4 |
|
5 | | -``` |
6 | | - __ __ ___ _ _ ___ __ __ _ __ __ |
7 | | - | \/ |_ _| \ | |_ _| \/ | / \ \ \/ / |
8 | | - | |\/| || || \| || || |\/| | / _ \ \ / |
9 | | - | | | || || |\ || || | | |/ ___ \/ \ |
10 | | - |_| |_|___|_| \_|___|_| |_/_/ \_\_/\ |
11 | | -``` |
12 | | - |
13 | | -Generate text, images, video, speech, and music from the terminal. Supports both the **Global** (`api.minimax.io`) and **CN** (`api.minimaxi.com`) platforms with automatic region detection. |
14 | | - |
15 | | -## What's New (v0.3.0) |
| 5 | +Supports **Global** (`api.minimax.io`) and **CN** (`api.minimaxi.com`) with automatic region detection. |
16 | 6 |
|
17 | | -**`minimax config export-schema`** — export all commands as Anthropic/OpenAI-compatible JSON tool schemas with a single command: |
18 | | - |
19 | | -```bash |
20 | | -minimax config export-schema | jq . |
21 | | -minimax config export-schema --command "video generate" | jq . |
22 | | -``` |
23 | | - |
24 | | -See [Changelog](#changelog) for full version history. |
25 | | - |
26 | | -## Installation |
27 | | - |
28 | | -### Standalone binary (recommended) |
| 7 | +## Install |
29 | 8 |
|
30 | 9 | ```bash |
31 | 10 | curl -fsSL https://raw.githubusercontent.com/MiniMax-AI-Dev/minimax-cli/main/install.sh | sh |
32 | 11 | ``` |
33 | 12 |
|
34 | | -### npm |
| 13 | +Or via npm / bun: |
35 | 14 |
|
36 | 15 | ```bash |
37 | 16 | npm install -g minimax-cli |
38 | 17 | ``` |
39 | 18 |
|
40 | | -### bun |
41 | | - |
42 | | -```bash |
43 | | -bun install -g minimax-cli |
44 | | -``` |
45 | | - |
46 | | -### From source |
47 | | - |
48 | | -```bash |
49 | | -git clone https://github.com/MiniMax-AI-Dev/minimax-cli.git && cd minimax-cli |
50 | | -bun install |
51 | | -bun run dev -- --help |
52 | | -``` |
53 | | - |
54 | | -## Quick start |
| 19 | +## Quick Start |
55 | 20 |
|
56 | 21 | ```bash |
57 | 22 | minimax auth login --api-key sk-xxxxx |
58 | | -minimax text chat --message "user:What is MiniMax?" |
59 | | -minimax image generate --prompt "A cat in a spacesuit on Mars" |
| 23 | +minimax text chat --message "What is MiniMax?" |
| 24 | +minimax image generate --prompt "A cat in a spacesuit" |
| 25 | +minimax video generate --prompt "Ocean waves at sunset" |
60 | 26 | minimax speech synthesize --text "Hello!" --out hello.mp3 |
| 27 | +minimax music generate --prompt "Indie folk" --lyrics "La la la..." |
61 | 28 | minimax vision describe --image photo.jpg |
62 | | -``` |
63 | | - |
64 | | -## Agent & CI usage |
65 | | - |
66 | | -```bash |
67 | | -# Async: get task ID immediately, no blocking |
68 | | -minimax video generate --prompt "A robot." --async --quiet |
69 | | -# → {"taskId":"..."} |
70 | | - |
71 | | -# Pipe-friendly: stdout is pure data, stderr is progress |
72 | | -minimax text chat --message "Hi" | jq . |
73 | | - |
74 | | -# CI: missing args fail fast with clear errors |
75 | | -minimax image generate --non-interactive |
76 | | -# → Error: Missing required argument: --prompt |
| 29 | +minimax search query --q "MiniMax AI latest news" |
77 | 30 | ``` |
78 | 31 |
|
79 | 32 | ## Commands |
80 | 33 |
|
81 | 34 | | Command | Description | |
82 | 35 | |---|---| |
83 | | -| `text chat` | Send a chat completion | |
84 | | -| `speech synthesize` | Text-to-speech, up to 10k chars | |
85 | | -| `image generate` | Generate images | |
86 | | -| `video generate` | Generate a video (auto-downloads on completion) | |
87 | | -| `video task get` | Query video task status | |
88 | | -| `video download` | Download a completed video | |
89 | | -| `music generate` | Generate a song | |
| 36 | +| `text chat` | Chat completion (MiniMax-M2.7) | |
| 37 | +| `image generate` | Image generation (image-01) | |
| 38 | +| `video generate` | Video generation (Hailuo-2.3) | |
| 39 | +| `speech synthesize` | Text-to-speech (speech-2.8-hd) | |
| 40 | +| `music generate` | Music generation (music-2.5) | |
| 41 | +| `vision describe` | Image understanding (VLM) | |
90 | 42 | | `search query` | Web search | |
91 | | -| `vision describe` | Describe an image (supports `--file-id` to skip base64) | |
92 | | -| `quota show` | Show usage quotas | |
| 43 | +| `quota show` | Usage quotas | |
| 44 | +| `config show / set` | Configuration | |
93 | 45 | | `config export-schema` | Export tool schemas as JSON | |
94 | | -| `config show` / `config set` | View or update configuration | |
95 | 46 | | `auth login/status/refresh/logout` | Authentication | |
| 47 | +| `update` | Self-update | |
96 | 48 |
|
97 | | -All commands accept [global flags](#global-flags). |
98 | | - |
99 | | -## Examples |
100 | | - |
101 | | -```bash |
102 | | -# Text chat |
103 | | -minimax text chat --message "user:Write fizzbuzz" |
104 | | -minimax text chat --message "Hi" --stream |
105 | | - |
106 | | -# Image generation |
107 | | -minimax image generate --prompt "Sunset over ocean" --aspect-ratio 16:9 --n 3 |
108 | | - |
109 | | -# Vision (path/URL or pre-uploaded file ID) |
110 | | -minimax vision describe --image photo.jpg --prompt "What breed is this?" |
111 | | -minimax vision describe --file-id file-123 --prompt "Extract the text" |
| 49 | +Run `minimax <command> --help` for full options. |
112 | 50 |
|
113 | | -# Video (auto-downloads to ~/.minimax-video/ on completion) |
114 | | -minimax video generate --prompt "A man reads a book." |
115 | | -minimax video generate --prompt "A robot." --async --quiet |
| 51 | +## Agent / CI Usage |
116 | 52 |
|
117 | | -# Speech synthesis |
118 | | -minimax speech synthesize --text "Hello world!" --out hello.mp3 |
119 | | -minimax speech synthesize --text "Breaking news." --text-file - --stream | mpv - |
120 | | - |
121 | | -# Music generation |
122 | | -minimax music generate --prompt "Indie folk" --lyrics "La la la..." --out song.mp3 |
123 | | - |
124 | | -# Web search |
125 | | -minimax search query --q "MiniMax AI latest news" |
126 | | - |
127 | | -# Export Agent tool schemas |
128 | | -minimax config export-schema | jq . |
129 | | -minimax config export-schema --command "video generate" | jq . |
130 | | - |
131 | | -# Auth |
132 | | -minimax auth login --api-key sk-xxxxx |
133 | | -minimax auth status |
134 | | -``` |
135 | | - |
136 | | -## Global flags |
137 | | - |
138 | | -| Flag | Description | |
139 | | -|---|---| |
140 | | -| `--api-key <key>` | API key (overrides all other auth) | |
141 | | -| `--region <region>` | `global` (default) or `cn` | |
142 | | -| `--base-url <url>` | Override API base URL | |
143 | | -| `--output <format>` | `text`, `json`, or `yaml` | |
144 | | -| `--quiet` | Suppress non-essential output to stderr | |
145 | | -| `--verbose` | Print HTTP request/response details | |
146 | | -| `--timeout <seconds>` | Request timeout (default: 300) | |
147 | | -| `--no-color` | Disable ANSI colors and spinners | |
148 | | -| `--yes` | Skip confirmation prompts | |
149 | | -| `--dry-run` | Show what would happen without executing | |
150 | | -| `--non-interactive` | Disable interactive prompts (CI/agent use) | |
151 | | -| `--async` | Return task ID immediately without polling | |
152 | | -| `--version` / `--help` | Version and help | |
153 | | - |
154 | | -## Output philosophy |
155 | | - |
156 | | -- `stdout` → result data only (text, file paths, JSON) |
157 | | -- `stderr` → spinners, region detection, help text, warnings, verbose logs |
158 | | - |
159 | | -```bash |
160 | | -# stdout is clean JSON — pipe to jq safely |
161 | | -minimax text chat --message "Hi" | jq . |
162 | | - |
163 | | -# stderr shows spinner without polluting the pipe |
164 | | -minimax video generate --prompt "Ocean waves." 2>/dev/null |
165 | | -``` |
166 | | - |
167 | | -## Configuration |
168 | | - |
169 | | -Precedence (highest to lowest): CLI flags → env vars → `~/.minimax/config.yaml` → defaults. |
170 | | - |
171 | | -```bash |
172 | | -minimax config set --key region --value cn |
173 | | -export MINIMAX_REGION=cn |
174 | | -``` |
175 | | - |
176 | | -## Exit codes |
177 | | - |
178 | | -| Code | Meaning | |
179 | | -|---|---| |
180 | | -| 0 | Success | |
181 | | -| 1 | General error | |
182 | | -| 2 | Usage error (bad flags, missing arguments) | |
183 | | -| 3 | Authentication error | |
184 | | -| 4 | Quota exceeded | |
185 | | -| 5 | Timeout | |
186 | | -| 10 | Content filter triggered | |
187 | | - |
188 | | -## Building |
| 53 | +See [skill/SKILL.md](skill/SKILL.md) for the complete agent integration guide, including all command signatures, tool schema export, and piping patterns. |
189 | 54 |
|
190 | 55 | ```bash |
191 | | -bun run dev -- <command> # Run from source |
192 | | -bun run typecheck # Type check |
193 | | -bun test # Run tests |
194 | | -bun run build # Build standalone binaries |
| 56 | +minimax video generate --prompt "A robot." --async --quiet # non-blocking |
| 57 | +minimax text chat --message "Hi" --output json | jq . # pipe-friendly |
| 58 | +minimax config export-schema | jq . # tool schemas |
195 | 59 | ``` |
196 | 60 |
|
197 | | -## Changelog |
198 | | - |
199 | | -### v0.4.0 — File Management API (🧊 Shelved) |
200 | | - |
201 | | -> **🧊 Shelved:** File API returned HTTP 404 with current API key. This feature is temporarily hidden until the endpoint permissions are officially opened. |
202 | | -> - `minimax file upload` — upload local file, get `file_id` |
203 | | -> - `minimax file list` — formatted table of uploaded files |
204 | | -> - `minimax file delete` — remove file by ID |
205 | | -> - `vision describe --file-id` — use pre-uploaded file instead of base64 |
206 | | -
|
207 | | -### v0.3.0 — Agent Tool Schema Auto-Generation |
208 | | - |
209 | | -- `OptionDef` interface extended with optional `type` and `required` fields |
210 | | -- New `CommandRegistry.getAllCommands()` traversal method |
211 | | -- `src/utils/schema.ts`: parses `--flag <value>` strings into Anthropic/OpenAI-compatible tool schemas |
212 | | -- New command: `minimax config export-schema` — exports all tool schemas as clean JSON to stdout |
213 | | -- Core commands marked `required: true`: `image generate --prompt`, `text chat --message`, `video generate --prompt`, `vision describe --image` |
214 | | - |
215 | | -### v0.2.0 — Agent & CI Compatibility |
216 | | - |
217 | | -- `src/utils/env.ts`: `isInteractive()` and `isCI()` helpers |
218 | | -- `--non-interactive`: forces non-interactive mode regardless of TTY state |
219 | | -- `--async`: immediate task-ID return without blocking poll |
220 | | -- All help routes to stderr (not stdout) — `--help | jq` works cleanly |
221 | | -- Streaming: thinking blocks go to stderr in non-TTY mode; final text always to stdout |
222 | | -- Interactive fallback: missing args prompt in TTY, fail fast in CI/agent mode |
223 | | - |
224 | | -### v0.1.0 — Initial release |
| 61 | +## Output Philosophy |
225 | 62 |
|
226 | | -Text chat with streaming · Image generation with batch and subject reference · Video generation with polling and download · Music generation with lyrics · Speech synthesis with voice customization · Web search · Image understanding · OAuth and API key authentication · Automatic region detection (global vs CN) · YAML/JSON/text output formats |
| 63 | +- `stdout` → data only (text, paths, JSON) |
| 64 | +- `stderr` → spinners, warnings, help |
227 | 65 |
|
228 | 66 | ## License |
229 | 67 |
|
|
0 commit comments