cli
Generate text, images, video, speech, and music by MiniMax.
中文简介经编辑校订 · ai
README / 项目原文

The official CLI for the MiniMax AI Platform
Built for AI agents. Generate text, images, video, and speech — from any agent or terminal.
中文文档 · Global Platform · CN Platform · Example
Features
- Text — Multi-turn chat, streaming, system prompts, JSON output
- Image — Text-to-image with aspect ratio and batch controls
- Video — Async video generation with progress tracking
- Speech — TTS with 30+ voices, speed control, streaming playback; speech-to-text transcription (json, verbose_json, srt, vtt)
- Vision — Image understanding and description
- Search — Web search powered by MiniMax
- Dual Region — Seamless Global (
api.minimax.io) and CN (api.minimaxi.com) support

Install
# For AI agents (OpenClaw, Cursor, Claude Code, etc.): add skill to your agent
npx skills add MiniMax-AI/cli -y -g
# Or install CLI globally for terminal use
npm install -g mmx-cli
Requires Node.js 18+
Quick Start
# Authenticate (interactive — choose MiniMax OAuth or paste an API key)
mmx auth login
# Or non-interactive
mmx auth login --api-key sk-xxxxx
# Start creating
mmx text chat --message "What is MiniMax?"
mmx image "A cat in a spacesuit"
mmx speech synthesize --text "Hello!" --out hello.mp3
mmx speech transcribe --file meeting.mp3
mmx video generate --prompt "Ocean waves at sunset"
mmx search "MiniMax AI latest news"
mmx vision photo.jpg
mmx quota
Releasing
Maintainers publish releases by pushing a SemVer Git tag; the release workflow derives the npm package version from that tag. See the release guide.
Commands
mmx text
text chat and text repl default to MiniMax-M3.1-Flash. An explicit --model or saved default-text-model takes precedence. It is available with Token Plan, MiniMax Code, and pay-as-you-go keys. See the model guide.
mmx text chat --message "Write a poem"
mmx text chat --model MiniMax-M3.1-Flash --message "Hello" --stream
mmx text chat --system "You are a coding assistant" --message "Fizzbuzz in Go"
mmx text chat --message "user:Hi" --message "assistant:Hey!" --message "How are you?"
cat messages.json | mmx text chat --messages-file - --output json
mmx image
mmx image "A cat in a spacesuit"
mmx image generate --prompt "A cat" --n 3 --aspect-ratio 16:9
mmx image generate --prompt "Logo" --out-dir ./out/
mmx video
# Hailuo-2.3 (Video Generation V1)
mmx video generate --prompt "Ocean waves at sunset" --download sunset.mp4
mmx video generate --prompt "A robot painting" --async
# MiniMax-H3 (Video Generation V2)
mmx video generate --api-key "$MINIMAX_API_KEY" --model MiniMax-H3 --prompt "Ocean waves at sunset"
mmx video generate --api-key "$MINIMAX_API_KEY" --model MiniMax-H3 --prompt "The subject walks forward" --image start.jpg
mmx video generate --api-key "$MINIMAX_API_KEY" --model MiniMax-H3 --prompt "Keep the same character" --reference-image character.png --reference-video motion.mp4
mmx video task get --task-id 123456
mmx video task get --task-id 424010985738629 --model MiniMax-H3
mmx video download --file-id 176844028768320 --out video.mp4
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.
--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.
mmx speech
mmx speech synthesize --text "Hello!" --out hello.mp3
mmx speech synthesize --text "Stream me" --stream | mpv -
mmx speech synthesize --text "Hi" --voice English_magnetic_voiced_man --speed 1.2
echo "Breaking news" | mmx speech synthesize --text-file - --out news.mp3
mmx speech voices
# Speech-to-text (asr-1.0)
mmx speech transcribe --file meeting.mp3
mmx speech transcribe --file call.mp3 --language zh
mmx speech transcribe --file talk.mp3 --response-format verbose_json --output json
mmx speech transcribe --file talk.mp3 --response-format srt --out talk.srt
mmx speech transcribe --file long.mp3 --stream
mmx speech transcribe accepts wav, aiff, flac, m4a, mp3, aac, opus, and ogg files up to
50 MB and 500 seconds. Audio above 50 MB is rejected locally before upload; the 500 second
limit is enforced by the API. Omitting --language enables mixed-language recognition.
--response-format json (default) prints the transcript, verbose_json adds speakers and
per-segment timestamps, and srt / vtt return subtitle documents. n_speakers and
segments are part of the response, so pass --output json to see them. --stream prints
incremental text and requires json; when stdout is not a terminal it accumulates into a single
JSON result unless --output text is passed. mmx speech recognize is an alias for
mmx speech transcribe.
mmx vision
mmx vision photo.jpg
mmx vision describe --image https://example.com/img.jpg --prompt "What breed?"
mmx vision describe --file-id file-123
mmx search
mmx search "MiniMax AI"
mmx search query --q "latest news" --output json
The
/v1/coding_plan/searchAPI 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.
mmx auth
mmx auth login # interactive: pick OAuth (Global / China) or paste an API key
mmx auth login --api-key sk-xxxxx # save an API key directly
mmx auth login --recommend # skip the menu, pick OAuth region interactively
mmx auth login --recommend --region=global # OAuth → api.minimax.io
mmx auth login --recommend --region=cn # OAuth → api.minimaxi.com
mmx auth status
mmx auth refresh
mmx auth logout
mmx auth status is the canonical way to verify active authentication.
OAuth uses the Device Authorization Grant (RFC 8628) with PKCE —
the CLI opens your browser, you enter a code, and access_token + refresh_token
are saved to ~/.mmx/config.json. Tokens refresh automatically (5-min buffer);
manual refresh via mmx auth refresh.
API key auth auto-detects the correct region by probing both Global and CN.
Useful for CI/CD (mmx auth login --api-key sk-xxxxx), or pass per-command via --api-key.
OAuth and API key are mutually exclusive — logging in with one clears the other.
Credential priority: --api-key flag > OAuth (config) > api_key (config).
Environment variables
| Variable | Description |
|---|---|
MINIMAX_REGION |
global or cn. |
MINIMAX_BASE_URL |
Override the API base URL. |
MINIMAX_OUTPUT |
text or json. |
MINIMAX_TIMEOUT |
Request timeout in seconds. |
MINIMAX_VERBOSE |
1 to enable verbose HTTP logging. |
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. |
mmx config · mmx quota
mmx quota
mmx config show
mmx config set --key region --value cn
mmx config set --key default-text-model --value MiniMax-M3.1-Flash
mmx config export-schema | jq .
mmx agent setup
Configure MiniMax for Claude Code, Codex, Grok Build, OpenCode, Hermes, Pi, Oh my Pi, or Zed while preserving unrelated settings. Run without options for the interactive wizard; supplying options makes the command non-interactive and suitable for scripts.
mmx agent setup
mmx agent setup --agent codex --agent claude-code --api-key "$MINIMAX_API_KEY" --region global
mmx agent setup --all --api-key "$MINIMAX_API_KEY" --region cn --output json
mmx agent setup --agent oh-my-pi --api-key "$MINIMAX_API_KEY" --region global
# --agent omp is an alias for --agent oh-my-pi
agent setup defaults to MiniMax-M3.1-Flash for both Token Plan and pay-as-you-go keys (sk-api-...). In non-interactive mode, --model overrides this selection.
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.
Oh my Pi uses its native ~/.omp/agent/models.yml and config.yml (existing .yaml files are updated in place). Configuration honors OMP_PROFILE / PI_PROFILE, PI_CONFIG_DIR, and the default-profile PI_CODING_AGENT_DIR override. Run omp once to migrate legacy JSON-only configuration before using setup. Interactive installation uses the official prebuilt-binary installer, so it does not require Bun or npm.
mmx update
mmx update
mmx update latest
Thanks to
License

MiniMax AI 开放平台官方命令行工具
专为 AI Agent 打造。在任意 Agent 或终端中生成文字、图像、视频和语音。
功能特性
- 文本对话 — 多轮对话、流式输出、系统提示词、JSON 格式输出
- 图像生成 — 文生图,支持比例和批量控制
- 视频生成 — 异步生成,进度追踪
- 语音 — 语音合成(30+ 音色、语速调节、流式播放)与语音识别(音频转文字,支持 json、verbose_json、srt、vtt)
- 图像理解 — 图片描述与识别
- 网络搜索 — MiniMax 搜索引擎
- 双区域 — 国际版(
api.minimax.io)和国内版(api.minimaxi.com)自动切换

安装
# AI Agent 使用(OpenClaw、Cursor、Claude Code 等):添加 Skill 到你的 Agent
npx skills add MiniMax-AI/cli -y -g
# 或全局安装 CLI 在终端中使用
npm install -g mmx-cli
需要 Node.js 18+
快速开始
# 认证(交互式 — 选 MiniMax OAuth 或粘 API Key)
mmx auth login
# 或者非交互
mmx auth login --api-key sk-xxxxx
# 开始创作
mmx text chat --message "你好,MiniMax!"
mmx image "一只穿宇航服的猫"
mmx speech synthesize --text "你好!" --out hello.mp3
mmx speech transcribe --file meeting.mp3
mmx video generate --prompt "海浪拍打礁石"
mmx search "MiniMax AI 最新动态"
mmx vision photo.jpg
mmx quota
命令参考
mmx text
text chat 和 text repl 默认使用 MiniMax-M3.1-Flash;显式指定的 --model 或已保存的 default-text-model 优先。Token Plan、MiniMax Code 和按量付费 Key 均可使用该模型。详见模型调用文档。
mmx text chat --message "写一首诗"
mmx text chat --model MiniMax-M3.1-Flash --message "你好" --stream
mmx text chat --system "你是编程助手" --message "用 Go 写 Fizzbuzz"
mmx text chat --message "user:你好" --message "assistant:嗨!" --message "你叫什么名字?"
cat messages.json | mmx text chat --messages-file - --output json
mmx image
mmx image "一只穿宇航服的猫"
mmx image generate --prompt "科技感 Logo" --n 3 --aspect-ratio 16:9
mmx image generate --prompt "山水画" --out-dir ./output/
mmx video
# Hailuo-2.3(视频生成 V1)
mmx video generate --prompt "海浪拍打礁石" --download sunset.mp4
mmx video generate --prompt "机器人作画" --async
# MiniMax-H3(视频生成 V2)
mmx video generate --api-key "$MINIMAX_API_KEY" --model MiniMax-H3 --prompt "夕阳下的海浪"
mmx video generate --api-key "$MINIMAX_API_KEY" --model MiniMax-H3 --prompt "主体向前行走" --image start.jpg
mmx video generate --api-key "$MINIMAX_API_KEY" --model MiniMax-H3 --prompt "保持相同角色和动作" --reference-image character.png --reference-video motion.mp4
mmx video task get --task-id 123456
mmx video task get --task-id 424010985738629 --model MiniMax-H3
mmx video download --file-id 176844028768320 --out video.mp4
MiniMax-H3 会在发送前检查本地文件和 Base64 数据:图片不超过 30 MB、参考视频不超过 50 MB、参考音频不超过 15 MB、JSON 请求体总计不超过 64 MB。所有素材的尺寸、宽高比、时长、帧率和编码格式仍由 API 服务端校验。
--region 是 CLI 原有的全局选项,不是 H3 参数。正常生成视频无需填写,CLI 会使用已保存或自动识别的区域。H3 默认使用 2K、5 秒,文生视频默认比例为 16:9。
mmx speech
mmx speech synthesize --text "你好!" --out hello.mp3
mmx speech synthesize --text "流式输出" --stream | mpv -
mmx speech synthesize --text "Hi" --voice English_magnetic_voiced_man --speed 1.2
echo "头条新闻" | mmx speech synthesize --text-file - --out news.mp3
mmx speech voices
# 语音识别(asr-1.0)
mmx speech transcribe --file meeting.mp3
mmx speech transcribe --file call.mp3 --language zh
mmx speech transcribe --file talk.mp3 --response-format verbose_json --output json
mmx speech transcribe --file talk.mp3 --response-format srt --out talk.srt
mmx speech transcribe --file long.mp3 --stream
mmx speech transcribe 支持 wav、aiff、flac、m4a、mp3、aac、opus、ogg 格式,音频上限为
50 MB / 500 秒。超过 50 MB 会在上传前直接报错;500 秒时长上限由服务端校验。
不传 --language 时启用混合语言识别。--response-format json(默认)输出转写文本,
verbose_json 附带说话人标识与分段 时间戳,srt / vtt 直接返回字幕文档;
n_speakers 与 segments 属于响应字段,需加 --output json 才能看到。
--stream 逐段输出文本,仅支持 json;当 stdout 不是终端时会汇总为单个 JSON 结果,
除非显式传 --output text。mmx speech recognize 是 mmx speech transcribe 的别名。
mmx vision
mmx vision photo.jpg
mmx vision describe --image https://example.com/img.jpg --prompt "这是什么品种的狗?"
mmx vision describe --file-id file-123
mmx search
mmx search "MiniMax AI"
mmx search query --q "最新动态" --output json
/v1/coding_plan/search接口单次最多返回 10 条结果,目前不支持翻页参数(参见 #107)。如需不同结果,请调整查询关键词。
mmx auth
mmx auth login # 交互式:选 OAuth (Global / 中国) 或粘 API Key
mmx auth login --api-key sk-xxxxx # 直接保存 API Key
mmx auth login --recommend # 跳过 3 选 1 菜单,弹出 region 选择器
mmx auth login --recommend --region=global # 直接 OAuth → api.minimax.io
mmx auth login --recommend --region=cn # 直接 OAuth → api.minimaxi.com
mmx auth status
mmx auth refresh
mmx auth logout
请使用 mmx auth status 作为认证状态的权威检查方式。OAuth 与 API Key 凭据
都保存在 ~/.mmx/config.json 里,两者互斥 —— 用一种登录会清掉另一种。
也可以每次通过 --api-key 直接传入。使用 API Key 登录时,会自动同时探测
Global 与中国两个 region,选用能通过的那个。
mmx config · mmx quota
mmx quota
mmx config show
mmx config set --key region --value cn
mmx config set --key default-text-model --value MiniMax-M3.1-Flash
mmx config export-schema | jq .
mmx agent setup
一键为 Claude Code、Codex、Grok Build、OpenCode、Hermes、Pi、Oh my Pi 或 Zed 配置 MiniMax,并保留配置文件中的其他设置。不带选项时进入交互式向导;带选项时自动使用非交互模式,便于脚本调用。
mmx agent setup
mmx agent setup --agent codex --agent claude-code --api-key "$MINIMAX_API_KEY" --region global
mmx agent setup --all --api-key "$MINIMAX_API_KEY" --region cn --output json
mmx agent setup --agent oh-my-pi --api-key "$MINIMAX_API_KEY" --region cn
# --agent omp 是 --agent oh-my-pi 的别名
agent setup 对订阅 Key 和按量付费 Key(sk-api-...)都默认使用 MiniMax-M3.1-Flash。非交互模式下可用 --model 覆盖该选择。
写入前会验证 Key 和所选区域;修改已有文件时会创建备份。可用 --dry-run 预览且不会发起联网请求。在交互式向导中,兼容且未在 PATH 中检测到的 Agent 会出现在第二个安装多选列表,并通过官方软件包或安装脚本安装。Hermes 仅执行官方核心 CLI 安装阶段,跳过可选系统软件包、Node 工作区、浏览器、计算机控制、初始化和网关阶段。安装完成后,mmx 会保留安装器生成的其他设置并写入 MiniMax 配置。平台或依赖检查不通过的 Agent 会说明原因并保持仅配置。非交互调用仍只写配置,且该命令不会启动 Agent。
Oh my Pi 使用原生 ~/.omp/agent/models.yml 和 config.yml(已有 .yaml 文件会原地更新),遵循 OMP_PROFILE / PI_PROFILE、PI_CONFIG_DIR 和默认 profile 的 PI_CODING_AGENT_DIR 配置。仅有旧版 JSON 配置时,请先运行一次 omp 完成迁移。交互式安装使用官方预编译二进制安装器,无需 Bun 或 npm。
mmx update
mmx update
mmx update latest