mimo-cli 0.1.1
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/LICENSE +21 -0
- package/README.md +193 -0
- package/dist/mimo.mjs +204 -0
- package/dist/mimo.mjs.map +173 -0
- package/dist/sdk.mjs +822 -0
- package/dist/sdk.mjs.map +25 -0
- package/package.json +70 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ljj6600
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# MiMo CLI
|
|
2
|
+
|
|
3
|
+
MiMo AI 平台命令行工具 — 对话、多模态理解、语音识别与合成,一键接入小米大模型。
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/mimo-cli)
|
|
6
|
+
[](https://github.com/ljj6600/MIMO-CLI/blob/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
## 特性
|
|
9
|
+
|
|
10
|
+
- **对话补全** — 单轮对话 / 交互式多轮对话,支持思维链、联网搜索
|
|
11
|
+
- **多模态理解** — 图片、音频、视频内容理解
|
|
12
|
+
- **语音识别 (ASR)** — wav/mp3 音频转文字
|
|
13
|
+
- **语音合成 (TTS)** — 预设音色合成 / 声音克隆 / 自定义音色设计
|
|
14
|
+
- **中英文界面** — 默认中文,`mimo language en` 一键切换
|
|
15
|
+
- **API Key 自动识别** — 按量计费 (`sk-`) / TokenPlan (`tp-`) 自动推断 Base URL
|
|
16
|
+
- **安全脱敏** — API Key 本地加密存储、输出脱敏、路径遍历防护
|
|
17
|
+
|
|
18
|
+
## 快速开始
|
|
19
|
+
|
|
20
|
+
### 安装
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install -g mimo-cli
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 登录
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
mimo auth login --api-key <your-api-key>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
支持两种 API Key:
|
|
33
|
+
- **按量计费 Key**(`sk-` 前缀)→ 自动配置 `https://api.xiaomimimo.com/v1`
|
|
34
|
+
- **TokenPlan Key**(`tp-` 前缀)→ 自动配置 `https://token-plan-cn.xiaomimimo.com/v1`
|
|
35
|
+
|
|
36
|
+
### 使用
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# 对话
|
|
40
|
+
mimo chat -m "你好,介绍一下你自己"
|
|
41
|
+
|
|
42
|
+
# 交互式多轮对话
|
|
43
|
+
mimo repl
|
|
44
|
+
|
|
45
|
+
# 思维链推理
|
|
46
|
+
mimo chat -m "分析一下量子计算的前景" --thinking
|
|
47
|
+
|
|
48
|
+
# 联网搜索
|
|
49
|
+
mimo chat -m "今天北京天气怎么样" --search
|
|
50
|
+
|
|
51
|
+
# 图片理解
|
|
52
|
+
mimo vision --image photo.jpg -p "描述这张图片"
|
|
53
|
+
|
|
54
|
+
# 视频理解(URL 模式,支持最大 300MB)
|
|
55
|
+
mimo vision --video https://example.com/video.mp4 -p "描述这个视频"
|
|
56
|
+
|
|
57
|
+
# 语音识别
|
|
58
|
+
mimo asr recording.wav
|
|
59
|
+
|
|
60
|
+
# 语音合成
|
|
61
|
+
mimo tts synthesize -t "你好世界" --voice 茉莉 --format mp3
|
|
62
|
+
|
|
63
|
+
# 声音克隆
|
|
64
|
+
mimo tts clone --sample voice.wav -t "这是克隆语音"
|
|
65
|
+
|
|
66
|
+
# 音色设计
|
|
67
|
+
mimo tts design --prompt "温柔的女声,语速较慢" -t "你好世界"
|
|
68
|
+
|
|
69
|
+
# 切换界面语言
|
|
70
|
+
mimo language en
|
|
71
|
+
mimo language zh
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## 命令一览
|
|
75
|
+
|
|
76
|
+
| 命令 | 说明 |
|
|
77
|
+
|------|------|
|
|
78
|
+
| `mimo chat` | 单轮对话补全 |
|
|
79
|
+
| `mimo repl` | 交互式多轮对话 |
|
|
80
|
+
| `mimo vision` | 多模态理解(图片/音频/视频) |
|
|
81
|
+
| `mimo asr` | 语音识别 |
|
|
82
|
+
| `mimo tts synthesize` | 预设音色语音合成 |
|
|
83
|
+
| `mimo tts clone` | 声音克隆 |
|
|
84
|
+
| `mimo tts design` | 音色设计 |
|
|
85
|
+
| `mimo tts voices` | 列出可用音色 |
|
|
86
|
+
| `mimo auth login` | 登录(保存 API Key) |
|
|
87
|
+
| `mimo auth status` | 查看认证状态 |
|
|
88
|
+
| `mimo auth logout` | 登出 |
|
|
89
|
+
| `mimo config show` | 显示当前配置 |
|
|
90
|
+
| `mimo config set` | 设置配置项 |
|
|
91
|
+
| `mimo language` | 切换界面语言 (zh/en) |
|
|
92
|
+
|
|
93
|
+
## 默认模型
|
|
94
|
+
|
|
95
|
+
| 能力 | 模型 | 说明 |
|
|
96
|
+
|------|------|------|
|
|
97
|
+
| 对话 | `mimo-v2.5-pro` | 常规对话、复杂推理、深度分析 |
|
|
98
|
+
| 多模态 | `mimo-v2.5` | 图片/音频/视频内容理解 |
|
|
99
|
+
| 语音识别 | `mimo-v2.5-asr` | 语音转文字 |
|
|
100
|
+
| 语音合成 | `mimo-v2.5-tts` | 文字转语音 |
|
|
101
|
+
| 声音克隆 | `mimo-v2.5-tts-voiceclone` | 基于参考音频克隆声音 |
|
|
102
|
+
| 音色设计 | `mimo-v2.5-tts-voicedesign` | 自然语言描述生成音色 |
|
|
103
|
+
|
|
104
|
+
## SDK 编程接口
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { MiMoSDK } from 'mimo-cli/sdk';
|
|
108
|
+
|
|
109
|
+
const sdk = new MiMoSDK({ apiKey: 'sk-xxx' });
|
|
110
|
+
|
|
111
|
+
// 对话
|
|
112
|
+
const result = await sdk.chat.chat({
|
|
113
|
+
messages: [{ role: 'user', content: 'Hello' }],
|
|
114
|
+
stream: false,
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
// 多模态理解
|
|
118
|
+
const vision = await sdk.vision.describe({
|
|
119
|
+
image: 'https://example.com/photo.jpg',
|
|
120
|
+
prompt: '描述这张图片',
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// 语音识别
|
|
124
|
+
const asr = await sdk.asr.transcribe({
|
|
125
|
+
file: 'data:audio/wav;base64,...',
|
|
126
|
+
language: 'zh',
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// 语音合成
|
|
130
|
+
const tts = await sdk.tts.synthesize({
|
|
131
|
+
text: '你好世界',
|
|
132
|
+
voice: '茉莉',
|
|
133
|
+
format: 'mp3',
|
|
134
|
+
});
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## 配置
|
|
138
|
+
|
|
139
|
+
配置文件位于 `~/.mimo/config.json`:
|
|
140
|
+
|
|
141
|
+
```json
|
|
142
|
+
{
|
|
143
|
+
"api_key": "sk-xxxxxxxx",
|
|
144
|
+
"base_url": "https://api.xiaomimimo.com/v1",
|
|
145
|
+
"output": "text",
|
|
146
|
+
"timeout": 300,
|
|
147
|
+
"default_model": "mimo-v2.5-pro",
|
|
148
|
+
"language": "zh"
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**配置优先级**:命令行标志 > 环境变量 > 配置文件 > 内置默认值
|
|
153
|
+
|
|
154
|
+
### 环境变量
|
|
155
|
+
|
|
156
|
+
| 变量 | 说明 |
|
|
157
|
+
|------|------|
|
|
158
|
+
| `MIMO_API_KEY` | API 密钥 |
|
|
159
|
+
| `MIMO_BASE_URL` | API 基础 URL |
|
|
160
|
+
| `MIMO_CONFIG_DIR` | 配置目录(默认 `~/.mimo`) |
|
|
161
|
+
| `MIMO_OUTPUT` | 输出格式 (text/json) |
|
|
162
|
+
| `MIMO_TIMEOUT` | 请求超时秒数 |
|
|
163
|
+
| `HTTPS_PROXY` | 代理设置 |
|
|
164
|
+
|
|
165
|
+
## 开发
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
# 安装依赖
|
|
169
|
+
bun install
|
|
170
|
+
|
|
171
|
+
# 开发运行
|
|
172
|
+
bun run dev
|
|
173
|
+
|
|
174
|
+
# 构建
|
|
175
|
+
bun run build
|
|
176
|
+
|
|
177
|
+
# 类型检查
|
|
178
|
+
bun run typecheck
|
|
179
|
+
|
|
180
|
+
# 代码检查
|
|
181
|
+
bun run lint
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## 安全
|
|
185
|
+
|
|
186
|
+
- API Key 仅存储在本地 `~/.mimo/config.json`,权限 0o600
|
|
187
|
+
- 所有输出自动脱敏,防止 API Key 泄露
|
|
188
|
+
- 文件路径遍历防护
|
|
189
|
+
- 视频文件大小检测(Base64 ≤ 37.5MB / URL ≤ 300MB)
|
|
190
|
+
|
|
191
|
+
## License
|
|
192
|
+
|
|
193
|
+
[MIT](LICENSE)
|