|
| 1 | +--- |
| 2 | +name: mmx-cli |
| 3 | +description: Use mmx to generate text, images, video, speech, and music via the MiniMax AI platform. Use when the user wants to create media content, chat with MiniMax models, perform web search, or manage MiniMax API resources from the terminal. |
| 4 | +--- |
| 5 | + |
| 6 | +# MiniMax CLI — Agent Skill Guide |
| 7 | + |
| 8 | +Use `mmx` to generate text, images, video, speech, music, and perform web search via the MiniMax AI platform. |
| 9 | + |
| 10 | +## Prerequisites |
| 11 | + |
| 12 | +```bash |
| 13 | +# Auth (persisted to ~/.mmx/credentials.json) |
| 14 | +mmx auth login --api-key sk-xxxxx |
| 15 | + |
| 16 | +# Or pass per-call |
| 17 | +mmx text chat --api-key sk-xxxxx --message "Hello" |
| 18 | +``` |
| 19 | + |
| 20 | +Region is auto-detected. Override with `--region global` or `--region cn`. |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +## Agent Flags |
| 25 | + |
| 26 | +Always use these flags in non-interactive (agent/CI) contexts: |
| 27 | + |
| 28 | +| Flag | Purpose | |
| 29 | +|---|---| |
| 30 | +| `--non-interactive` | Fail fast on missing args instead of prompting | |
| 31 | +| `--quiet` | Suppress spinners/progress; stdout is pure data | |
| 32 | +| `--output json` | Machine-readable JSON output | |
| 33 | +| `--async` | Return task ID immediately (video generation) | |
| 34 | +| `--dry-run` | Preview the API request without executing | |
| 35 | +| `--yes` | Skip confirmation prompts | |
| 36 | + |
| 37 | +--- |
| 38 | + |
| 39 | +## Commands |
| 40 | + |
| 41 | +### text chat |
| 42 | + |
| 43 | +Chat completion. Default model: `MiniMax-M2.7`. |
| 44 | + |
| 45 | +```bash |
| 46 | +mmx text chat --message <text> [flags] |
| 47 | +``` |
| 48 | + |
| 49 | +| Flag | Type | Description | |
| 50 | +|---|---|---| |
| 51 | +| `--message <text>` | string, **required**, repeatable | Message text. Prefix with `role:` to set role (e.g. `"system:You are helpful"`, `"user:Hello"`) | |
| 52 | +| `--messages-file <path>` | string | JSON file with messages array. Use `-` for stdin | |
| 53 | +| `--system <text>` | string | System prompt | |
| 54 | +| `--model <model>` | string | Model ID (default: `MiniMax-M2.7`) | |
| 55 | +| `--max-tokens <n>` | number | Max tokens (default: 4096) | |
| 56 | +| `--temperature <n>` | number | Sampling temperature (0.0, 1.0] | |
| 57 | +| `--top-p <n>` | number | Nucleus sampling threshold | |
| 58 | +| `--stream` | boolean | Stream tokens (default: on in TTY) | |
| 59 | +| `--tool <json-or-path>` | string, repeatable | Tool definition JSON or file path | |
| 60 | + |
| 61 | +```bash |
| 62 | +# Single message |
| 63 | +mmx text chat --message "user:What is MiniMax?" --output json --quiet |
| 64 | + |
| 65 | +# Multi-turn |
| 66 | +mmx text chat \ |
| 67 | + --system "You are a coding assistant." \ |
| 68 | + --message "user:Write fizzbuzz in Python" \ |
| 69 | + --output json |
| 70 | + |
| 71 | +# From file |
| 72 | +cat conversation.json | mmx text chat --messages-file - --output json |
| 73 | +``` |
| 74 | + |
| 75 | +**stdout**: response text (text mode) or full response object (json mode). |
| 76 | + |
| 77 | +--- |
| 78 | + |
| 79 | +### image generate |
| 80 | + |
| 81 | +Generate images. Model: `image-01`. |
| 82 | + |
| 83 | +```bash |
| 84 | +mmx image generate --prompt <text> [flags] |
| 85 | +``` |
| 86 | + |
| 87 | +| Flag | Type | Description | |
| 88 | +|---|---|---| |
| 89 | +| `--prompt <text>` | string, **required** | Image description | |
| 90 | +| `--aspect-ratio <ratio>` | string | e.g. `16:9`, `1:1` | |
| 91 | +| `--n <count>` | number | Number of images (default: 1) | |
| 92 | +| `--subject-ref <params>` | string | Subject reference: `type=character,image=path-or-url` | |
| 93 | +| `--out-dir <dir>` | string | Download images to directory | |
| 94 | +| `--out-prefix <prefix>` | string | Filename prefix (default: `image`) | |
| 95 | + |
| 96 | +```bash |
| 97 | +mmx image generate --prompt "A cat in a spacesuit" --output json --quiet |
| 98 | +# stdout: image URLs (one per line in quiet mode) |
| 99 | + |
| 100 | +mmx image generate --prompt "Logo" --n 3 --out-dir ./gen/ --quiet |
| 101 | +# stdout: saved file paths (one per line) |
| 102 | +``` |
| 103 | + |
| 104 | +--- |
| 105 | + |
| 106 | +### video generate |
| 107 | + |
| 108 | +Generate video. Default model: `MiniMax-Hailuo-2.3`. This is an async task — by default it polls until completion. |
| 109 | + |
| 110 | +```bash |
| 111 | +mmx video generate --prompt <text> [flags] |
| 112 | +``` |
| 113 | + |
| 114 | +| Flag | Type | Description | |
| 115 | +|---|---|---| |
| 116 | +| `--prompt <text>` | string, **required** | Video description | |
| 117 | +| `--model <model>` | string | `MiniMax-Hailuo-2.3` (default) or `MiniMax-Hailuo-2.3-Fast` | |
| 118 | +| `--first-frame <path-or-url>` | string | First frame image | |
| 119 | +| `--callback-url <url>` | string | Webhook URL for completion | |
| 120 | +| `--download <path>` | string | Save video to specific file | |
| 121 | +| `--async` | boolean | Return task ID immediately | |
| 122 | +| `--no-wait` | boolean | Same as `--async` | |
| 123 | +| `--poll-interval <seconds>` | number | Polling interval (default: 5) | |
| 124 | + |
| 125 | +```bash |
| 126 | +# Non-blocking: get task ID |
| 127 | +mmx video generate --prompt "A robot." --async --quiet |
| 128 | +# stdout: {"taskId":"..."} |
| 129 | + |
| 130 | +# Blocking: wait and get file path |
| 131 | +mmx video generate --prompt "Ocean waves." --download ocean.mp4 --quiet |
| 132 | +# stdout: ocean.mp4 |
| 133 | +``` |
| 134 | + |
| 135 | +### video task get |
| 136 | + |
| 137 | +Query status of a video generation task. |
| 138 | + |
| 139 | +```bash |
| 140 | +mmx video task get --task-id <id> [--output json] |
| 141 | +``` |
| 142 | + |
| 143 | +### video download |
| 144 | + |
| 145 | +Download a completed video by task ID. |
| 146 | + |
| 147 | +```bash |
| 148 | +mmx video download --file-id <id> [--out <path>] |
| 149 | +``` |
| 150 | + |
| 151 | +--- |
| 152 | + |
| 153 | +### speech synthesize |
| 154 | + |
| 155 | +Text-to-speech. Default model: `speech-2.8-hd`. Max 10k chars. |
| 156 | + |
| 157 | +```bash |
| 158 | +mmx speech synthesize --text <text> [flags] |
| 159 | +``` |
| 160 | + |
| 161 | +| Flag | Type | Description | |
| 162 | +|---|---|---| |
| 163 | +| `--text <text>` | string | Text to synthesize | |
| 164 | +| `--text-file <path>` | string | Read text from file. Use `-` for stdin | |
| 165 | +| `--model <model>` | string | `speech-2.8-hd` (default), `speech-2.6`, `speech-02` | |
| 166 | +| `--voice <id>` | string | Voice ID (default: `English_expressive_narrator`) | |
| 167 | +| `--speed <n>` | number | Speed multiplier | |
| 168 | +| `--volume <n>` | number | Volume level | |
| 169 | +| `--pitch <n>` | number | Pitch adjustment | |
| 170 | +| `--format <fmt>` | string | Audio format (default: `mp3`) | |
| 171 | +| `--sample-rate <hz>` | number | Sample rate (default: 32000) | |
| 172 | +| `--bitrate <bps>` | number | Bitrate (default: 128000) | |
| 173 | +| `--channels <n>` | number | Audio channels (default: 1) | |
| 174 | +| `--language <code>` | string | Language boost | |
| 175 | +| `--subtitles` | boolean | Include subtitle timing data | |
| 176 | +| `--pronunciation <from/to>` | string, repeatable | Custom pronunciation | |
| 177 | +| `--sound-effect <effect>` | string | Add sound effect | |
| 178 | +| `--out <path>` | string | Save audio to file | |
| 179 | +| `--stream` | boolean | Stream raw audio to stdout | |
| 180 | + |
| 181 | +```bash |
| 182 | +mmx speech synthesize --text "Hello world" --out hello.mp3 --quiet |
| 183 | +# stdout: hello.mp3 |
| 184 | + |
| 185 | +echo "Breaking news." | mmx speech synthesize --text-file - --out news.mp3 |
| 186 | +``` |
| 187 | + |
| 188 | +--- |
| 189 | + |
| 190 | +### music generate |
| 191 | + |
| 192 | +Generate music. Model: `music-2.5`. Responds well to rich, structured descriptions. |
| 193 | + |
| 194 | +```bash |
| 195 | +mmx music generate --prompt <text> [--lyrics <text>] [flags] |
| 196 | +``` |
| 197 | + |
| 198 | +| Flag | Type | Description | |
| 199 | +|---|---|---| |
| 200 | +| `--prompt <text>` | string | Music style description (can be detailed) | |
| 201 | +| `--lyrics <text>` | string | Song lyrics with structure tags. Use `"\u65e0\u6b4c\u8bcd"` for instrumental. Cannot be used with `--instrumental` | |
| 202 | +| `--lyrics-file <path>` | string | Read lyrics from file. Use `-` for stdin | |
| 203 | +| `--vocals <text>` | string | Vocal style, e.g. `"warm male baritone"`, `"bright female soprano"`, `"duet with harmonies"` | |
| 204 | +| `--genre <text>` | string | Music genre, e.g. folk, pop, jazz | |
| 205 | +| `--mood <text>` | string | Mood or emotion, e.g. warm, melancholic, uplifting | |
| 206 | +| `--instruments <text>` | string | Instruments to feature, e.g. `"acoustic guitar, piano"` | |
| 207 | +| `--tempo <text>` | string | Tempo description, e.g. fast, slow, moderate | |
| 208 | +| `--bpm <number>` | number | Exact tempo in beats per minute | |
| 209 | +| `--key <text>` | string | Musical key, e.g. C major, A minor, G sharp | |
| 210 | +| `--avoid <text>` | string | Elements to avoid in the generated music | |
| 211 | +| `--use-case <text>` | string | Use case context, e.g. `"background music for video"`, `"theme song"` | |
| 212 | +| `--structure <text>` | string | Song structure, e.g. `"verse-chorus-verse-bridge-chorus"` | |
| 213 | +| `--references <text>` | string | Reference tracks or artists, e.g. `"similar to Ed Sheeran"` | |
| 214 | +| `--extra <text>` | string | Additional fine-grained requirements | |
| 215 | +| `--instrumental` | boolean | Generate instrumental music (no vocals). Cannot be used with `--lyrics` or `--lyrics-file` | |
| 216 | +| `--aigc-watermark` | boolean | Embed AI-generated content watermark | |
| 217 | +| `--format <fmt>` | string | Audio format (default: `mp3`) | |
| 218 | +| `--sample-rate <hz>` | number | Sample rate (default: 44100) | |
| 219 | +| `--bitrate <bps>` | number | Bitrate (default: 256000) | |
| 220 | +| `--out <path>` | string | Save audio to file | |
| 221 | +| `--stream` | boolean | Stream raw audio to stdout | |
| 222 | + |
| 223 | +At least one of `--prompt` or `--lyrics` is required. |
| 224 | + |
| 225 | +```bash |
| 226 | +# Simple usage |
| 227 | +mmx music generate --prompt "Upbeat pop" --lyrics "La la la..." --out song.mp3 --quiet |
| 228 | + |
| 229 | +# Detailed prompt with vocal characteristics |
| 230 | +mmx music generate --prompt "Warm morning folk" \ |
| 231 | + --vocals "male and female duet, harmonies in chorus" \ |
| 232 | + --instruments "acoustic guitar, piano" \ |
| 233 | + --bpm 95 \ |
| 234 | + --lyrics-file song.txt \ |
| 235 | + --out duet.mp3 |
| 236 | + |
| 237 | +# Instrumental (use --instrumental flag) |
| 238 | +mmx music generate --prompt "Cinematic orchestral, building tension" --instrumental --out bgm.mp3 |
| 239 | +``` |
| 240 | + |
| 241 | +--- |
| 242 | + |
| 243 | +### vision describe |
| 244 | + |
| 245 | +Image understanding via VLM. Provide either `--image` or `--file-id`, not both. |
| 246 | + |
| 247 | +```bash |
| 248 | +mmx vision describe (--image <path-or-url> | --file-id <id>) [flags] |
| 249 | +``` |
| 250 | + |
| 251 | +| Flag | Type | Description | |
| 252 | +|---|---|---| |
| 253 | +| `--image <path-or-url>` | string | Local path or URL (auto base64-encoded) | |
| 254 | +| `--file-id <id>` | string | Pre-uploaded file ID (skips base64) | |
| 255 | +| `--prompt <text>` | string | Question about the image (default: `"Describe the image."`) | |
| 256 | + |
| 257 | +```bash |
| 258 | +mmx vision describe --image photo.jpg --prompt "What breed?" --output json |
| 259 | +``` |
| 260 | + |
| 261 | +**stdout**: description text (text mode) or full response (json mode). |
| 262 | + |
| 263 | +--- |
| 264 | + |
| 265 | +### search query |
| 266 | + |
| 267 | +Web search via MiniMax. |
| 268 | + |
| 269 | +```bash |
| 270 | +mmx search query --q <query> |
| 271 | +``` |
| 272 | + |
| 273 | +| Flag | Type | Description | |
| 274 | +|---|---|---| |
| 275 | +| `--q <query>` | string, **required** | Search query | |
| 276 | + |
| 277 | +```bash |
| 278 | +mmx search query --q "MiniMax AI" --output json --quiet |
| 279 | +``` |
| 280 | + |
| 281 | +--- |
| 282 | + |
| 283 | +### quota show |
| 284 | + |
| 285 | +Display Token Plan usage and remaining quotas. |
| 286 | + |
| 287 | +```bash |
| 288 | +mmx quota show [--output json] |
| 289 | +``` |
| 290 | + |
| 291 | +--- |
| 292 | + |
| 293 | +## Tool Schema Export |
| 294 | + |
| 295 | +Export all commands as Anthropic/OpenAI-compatible JSON tool schemas: |
| 296 | + |
| 297 | +```bash |
| 298 | +# All tool-worthy commands (excludes auth/config/update) |
| 299 | +mmx config export-schema |
| 300 | + |
| 301 | +# Single command |
| 302 | +mmx config export-schema --command "video generate" |
| 303 | +``` |
| 304 | + |
| 305 | +Use this to dynamically register mmx commands as tools in your agent framework. |
| 306 | + |
| 307 | +--- |
| 308 | + |
| 309 | +## Exit Codes |
| 310 | + |
| 311 | +| Code | Meaning | |
| 312 | +|---|---| |
| 313 | +| 0 | Success | |
| 314 | +| 1 | General error | |
| 315 | +| 2 | Usage error (bad flags, missing args) | |
| 316 | +| 3 | Authentication error | |
| 317 | +| 4 | Quota exceeded | |
| 318 | +| 5 | Timeout | |
| 319 | +| 10 | Content filter triggered | |
| 320 | + |
| 321 | +--- |
| 322 | + |
| 323 | +## Piping Patterns |
| 324 | + |
| 325 | +```bash |
| 326 | +# stdout is always clean data — safe to pipe |
| 327 | +mmx text chat --message "Hi" --output json | jq '.content' |
| 328 | + |
| 329 | +# stderr has progress/spinners — discard if needed |
| 330 | +mmx video generate --prompt "Waves" 2>/dev/null |
| 331 | + |
| 332 | +# Chain: generate image → describe it |
| 333 | +URL=$(mmx image generate --prompt "A sunset" --quiet) |
| 334 | +mmx vision describe --image "$URL" --quiet |
| 335 | + |
| 336 | +# Async video workflow |
| 337 | +TASK=$(mmx video generate --prompt "A robot" --async --quiet | jq -r '.taskId') |
| 338 | +mmx video task get --task-id "$TASK" --output json |
| 339 | +mmx video download --task-id "$TASK" --out robot.mp4 |
| 340 | +``` |
| 341 | + |
| 342 | +--- |
| 343 | + |
| 344 | +## Configuration Precedence |
| 345 | + |
| 346 | +CLI flags → environment variables → `~/.mmx/config.json` → defaults. |
| 347 | + |
| 348 | +```bash |
| 349 | +# Persistent config |
| 350 | +mmx config set --key region --value cn |
| 351 | +mmx config show |
| 352 | + |
| 353 | +# Environment |
| 354 | +export MINIMAX_API_KEY=sk-xxxxx |
| 355 | +export MINIMAX_REGION=cn |
| 356 | +``` |
0 commit comments