diff --git a/skill/SKILL.md b/skill/SKILL.md index 273a92e..a6c3ee8 100644 --- a/skill/SKILL.md +++ b/skill/SKILL.md @@ -1,221 +1,458 @@ --- -name: mmx-h3-video -description: Generate, monitor, and download MiniMax-H3 videos through the mmx CLI. Use for H3 text-to-video, first/last-frame video, multimodal reference image/video/audio generation, H3 prompt improvement, media preflight, Pay-as-you-go API key selection, task waiting, downloads, and H3 failure handling. +name: mmx-cli +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. --- -# MiniMax-H3 Video With MMX +# MiniMax CLI — Agent Skill Guide -Use this skill only for `MiniMax-H3` video generation. Do not handle text, image generation, speech, music, search, legacy Hailuo models, or unrelated MMX commands. +Use `mmx` to generate text, images, video, speech, music, and perform web search via the MiniMax AI platform. -Before a paid request, read `references/h3-video.md` for prompt construction, media constraints, waiting behavior, and failure handling. +## Prerequisites -## Required Rules +```bash +# Install +npm install -g mmx-cli + +# Auth (OAuth persists to ~/.mmx/credentials.json, API key persists to ~/.mmx/config.json) +mmx auth login --api-key sk-xxxxx + +# Verify active auth source +mmx auth status + +# Or pass per-call +mmx text chat --api-key sk-xxxxx --message "Hello" +``` + +Region is auto-detected. Override with `--region global` or `--region cn`. + +--- + +## Agent Flags + +Always use these flags in non-interactive (agent/CI) contexts: + +| Flag | Purpose | +|---|---| +| `--non-interactive` | Fail fast on missing args instead of prompting | +| `--quiet` | Suppress spinners/progress; stdout is pure data | +| `--output json` | Machine-readable JSON output | +| `--async` | Return task ID immediately (video generation) | +| `--dry-run` | Preview the API request without executing | +| `--yes` | Skip confirmation prompts | + +--- -1. Use a Pay-as-you-go/Credit API Key. H3 does not use OAuth or Token Plan Subscription Keys. -2. Reuse a saved MMX API key when available. Never print, repeat, or place a literal API key in a command transcript. -3. Always pass `--model MiniMax-H3`; never rely on the configured default model. -4. For a completed video, run one direct blocking `mmx video generate` command. Do not use Bash wrappers or hand-written polling loops. -5. If the terminal command remains active, wait on that exact execution session. Do not run `ps`, scrape process arguments, inspect the output repeatedly, kill the process, or submit another task. -6. Treat `Detecting region... cn` or `Detecting region... global` as normal stderr progress, not a submission failure. -7. Never submit a replacement paid task because terminal waiting, status polling, or downloading was interrupted. -8. Retry the alternate region at most once, and only when the first command clearly failed before task creation because of region detection, endpoint, or authentication routing. -9. Use `--async` only when the user explicitly wants a task ID without waiting or downloading. +## Commands -## Resolve The CLI +### text chat -Inside the `minimax-cli` repository, build changes and use the local artifact: +Chat completion. Default model: `MiniMax-M3`. ```bash -bun run build -node ./dist/mmx.mjs video generate --help +mmx text chat --message [flags] ``` -Outside the repository, use the installed `mmx` executable. Do not install or update MMX unless the user asks. +| Flag | Type | Description | +|---|---|---| +| `--message ` | string, **required**, repeatable | Message text. Prefix with `role:` to set role (e.g. `"system:You are helpful"`, `"user:Hello"`) | +| `--messages-file ` | string | JSON file with messages array. Use `-` for stdin | +| `--system ` | string | System prompt | +| `--model ` | string | Model ID (default: `MiniMax-M3`) | +| `--max-tokens ` | number | Max tokens (default: 4096) | +| `--temperature ` | number | Sampling temperature (0.0, 1.0] | +| `--top-p ` | number | Nucleus sampling threshold | +| `--stream` | boolean | Stream tokens (default: on in TTY) | +| `--tool ` | string, repeatable | Tool definition JSON or file path | -In commands below, replace `mmx` with `node ./dist/mmx.mjs` when testing the local repository build. +```bash +# Single message +mmx text chat --message "user:What is MiniMax?" --output json --quiet + +# Multi-turn +mmx text chat \ + --system "You are a coding assistant." \ + --message "user:Write fizzbuzz in Python" \ + --output json + +# From file +cat conversation.json | mmx text chat --messages-file - --output json +``` + +**stdout**: response text (text mode) or full response object (json mode). + +--- -## Resolve And Save The API Key +### image generate -Before the first paid H3 request, inspect the active credential without exposing it: +Generate images. Model: `image-01`. ```bash -mmx auth status --output json --quiet +mmx image generate --prompt [flags] ``` -- If `method` is `api-key`, reuse it from MMX config. Do not add `--api-key` to generation commands. -- If the user already supplied a key and the runtime holds it securely as `MINIMAX_API_KEY`, save it once, then use MMX config: +| Flag | Type | Description | +|---|---|---| +| `--prompt ` | string, **required** | Image description | +| `--aspect-ratio ` | string | e.g. `16:9`, `1:1`. Ignored if `--width` and `--height` are both set | +| `--n ` | number | Number of images (default: 1) | +| `--seed ` | number | Random seed for reproducible generation | +| `--width ` | number | Width in pixels (512–2048, multiple of 8). Requires `--height` | +| `--height ` | number | Height in pixels (512–2048, multiple of 8). Requires `--width` | +| `--prompt-optimizer` | boolean | Optimize prompt before generation | +| `--aigc-watermark` | boolean | Embed AI-generated content watermark | +| `--subject-ref ` | string | Subject reference: `type=character,image=path-or-url` | +| `--response-format ` | string | `url` (default) or `base64`. Base64 bypasses CDN download | +| `--out-dir ` | string | Download images to directory | +| `--out-prefix ` | string | Filename prefix (default: `image`) | ```bash -mmx config set --key api_key --value "$MINIMAX_API_KEY" --quiet +mmx image generate --prompt "A cat in a spacesuit" --output json --quiet +# stdout: image URLs (one per line in quiet mode) + +mmx image generate --prompt "Logo" --n 3 --out-dir ./gen/ --quiet +# stdout: saved file paths (one per line) ``` -- Saving `api_key` replaces stale OAuth credentials, clears the cached region, and stores the key in `~/.mmx/config.json` with owner-only permissions. -- Never reconstruct a previously supplied key into visible shell text. Use the runtime's secret/environment injection when available. -- If no saved API key or securely injected variable is available, ask the user to run `mmx auth login` and choose API key. Do not ask them to paste the key into chat again. -- After saving, future Agent commands must omit both the literal key and `--api-key`. +--- -## Default Completed-Video Path +### video generate -Use this path when the user wants the final file: +Generate video. Default model: `MiniMax-Hailuo-2.3`. Select `MiniMax-H3` to use the Video Generation V2 multimodal API. This is an async task — by default it polls until completion. ```bash -mmx video generate \ - --model MiniMax-H3 \ - --prompt "