Tools
Minimax Tts Sg
MiniMax TTS plugin for OpenClaw with Cantonese (Yue) language boost support
Install
openclaw plugins install --link
Configuration Example
{
"plugins": {
"entries": {
"minimax-tts-sg": {
"enabled": true,
"config": {
// ─── 語音參數 ────────────────────────────────
"speakerVoiceId": "Cantonese_crisp_reporter_vv2",
"speed": 1.0,
"vol": 1.0,
"pitch": 0,
// ─── 語言強化(核心功能)────────────────────
"languageBoost": "Chinese,Yue",
// ─── 音訊格式 ────────────────────────────────
"sampleRate": 44100,
"bitrate": 256000,
"channels": 1,
// ─── API 設定 ────────────────────────────────
"model": "speech-2.8-hd",
"baseUrl": "https://api.minimaxi.com"
}
}
}
},
"messages": {
"tts": {
"auto": "inbound", // "inbound" | "always" | "off"
"provider": "minimax-tts-sg",
"providers": {
"minimax-tts-sg": {
"speakerVoiceId": "Cantonese_crisp_reporter_vv2",
"languageBoost": "Chinese,Yue",
"speed": 1,
"vol": 1,
"pitch": 0,
"sampleRate": 44100,
"bitrate": 256000,
"channels": 1,
"model": "speech-2.8-hd",
"baseUrl": "https://api.minimaxi.com"
}
}
}
}
}
README
# MiniMax TTS (SG) — OpenClaw Plugin
> 自定義 MiniMax T2A v2 語音合成插件,支援粵語(Yue)發音優化,專為澳門 / 香港零售場景設計。
---
## 項目概述
本插件以 MiniMax T2A v2 API 為底層,透過 OpenClaw 插件架構提供語音合成服務。
**與 OpenClaw 內置 TTS 的分別:**
| 功能 | 內置 minimax | 本插件 minimax-tts-sg |
|---|---|---|
| `language_boost` | ❌ 不支援 | ✅ `"Chinese,Yue"` 粵語強化 |
| 語音 ID | 有限 | ✅ 完整 MiniMax 語音庫 |
| 粵語發音質量 | 一般 | ✅ 地道自然 |
| API URL | 固定 | ✅ 可自訂 |
| 音訊參數 | 固定 | ✅ 全部可調 |
---
## 安裝方式
```bash
# 一次性 link(推薦開發階段使用)
openclaw plugins install --link ~/.openclaw/workspace/dev/minimax-tts-sg
# 生產環境可 publish 到 ClawHub
clawhub package publish forward-fashion/minimax-tts-sg
```
> **注意**: link 後 Gateway 會自動重啟,新插件即時生效。
---
## 完整 openclaw.json 配置範例
```jsonc
{
"plugins": {
"entries": {
"minimax-tts-sg": {
"enabled": true,
"config": {
// ─── 語音參數 ────────────────────────────────
"speakerVoiceId": "Cantonese_crisp_reporter_vv2",
"speed": 1.0,
"vol": 1.0,
"pitch": 0,
// ─── 語言強化(核心功能)────────────────────
"languageBoost": "Chinese,Yue",
// ─── 音訊格式 ────────────────────────────────
"sampleRate": 44100,
"bitrate": 256000,
"channels": 1,
// ─── API 設定 ────────────────────────────────
"model": "speech-2.8-hd",
"baseUrl": "https://api.minimaxi.com"
}
}
}
},
"messages": {
"tts": {
"auto": "inbound", // "inbound" | "always" | "off"
"provider": "minimax-tts-sg",
"providers": {
"minimax-tts-sg": {
"speakerVoiceId": "Cantonese_crisp_reporter_vv2",
"languageBoost": "Chinese,Yue",
"speed": 1,
"vol": 1,
"pitch": 0,
"sampleRate": 44100,
"bitrate": 256000,
"channels": 1,
"model": "speech-2.8-hd",
"baseUrl": "https://api.minimaxi.com"
}
}
}
}
}
```
---
## 參數說明
### 🔊 語音參數
| 參數 | 類型 | 預設值 | 說明 |
|---|---|---|---|
| `speakerVoiceId` | string | `"Chinese (Mandarin)_News_Anchor"` | 語音 ID,決定音色與語言。見下方語音列表 |
| `speed` | number | `1.0` | 語速,範圍 `0.5` – `2.0`(1.0 為正常速度) |
| `vol` | number | `1.0` | 音量,範圍 `0` – `10` |
| `pitch` | integer | `0` | 音調調整,範圍 `-12` – `12`(正數偏高,負數偏低) |
### 🗣️ 語言強化(粵語關鍵參數)
| 參數 | 類型 | 預設值 | 說明 |
|---|---|---|---|
| `languageBoost` | string | `"Chinese,Yue"` | 語言強化標籤,決定發音引擎優先處理哪種語言。「Chinese,Yue」= 粵語發音優化 |
**`languageBoost` 可選值:**
| 值 | 效果 |
|---|---|
| `"Chinese,Yue"` | ✅ 粵語發音(適合港澳門店) |
| `"Chinese"` | 普通話發音 |
| `""`(空) | 無語言強化,自動判斷 |
### 🎛️ 音訊格式參數
| 參數 | 類型 | 預設值 | 說明 |
|---|---|---|---|
| `sampleRate` | integer | `44100` | 取樣率(Hz),44100 = CD 質量 |
| `bitrate` | integer | `256000` | 位元率(bps),256000 = 256kbps 高品質 |
| `channels` | integer | `1` | 聲道:1 = 單聲道(mono),2 = 立体聲(stereo) |
| `format` | string | `"mp3"` | 輸出格式(目前固定 mp3) |
### 🌐 API 參數
| 參數 | 類型 | 預設值 | 說明 |
|---|---|---|---|
| `model` | string | `"speech-2.8-hd"` | MiniMax TTS 模型,推薦用 `speech-2.8-hd` |
| `baseUrl` | string | `"https://api.minimaxi.com"` | API 端點,不建議修改 |
### 🔐 認證參數
認證透過環境變量自動讀取,**不需要**在 config 中寫 key:
| 優先順序 | 環境變量 | 說明 |
|---|---|---|
| 1 | `MINIMAX_OAUTH_TOKEN` | OAuth Token(推薦 Token Plan 用戶) |
| 2 | `MINIMAX_API_KEY` | 標準 API Key |
| 3 | `MINIMAX_CODING_API_KEY` | Coding Plan API Key |
| 4 | `MINIMAX_CODE_PLAN_KEY` | Code Plan Key |
---
## 語音 ID(speakerVoiceId)推薦
### 粵語語音
| Voice ID | 風格 | 推薦場景 |
|---|---|---|
| `Cantonese_crisp_reporter_vv2` | 清晰粵語女主播 | ✅ **零售商場廣播**(本插件當前預設) |
| `Cantonese_ProfessionalHost(F)` | 專業女主持 | 正式場合、服務台 |
| `Cantonese_female_voice` | 普通粵語女聲 | 一般用途 |
### 普通話 / 國語語音
| Voice ID | 風格 | 推薦場景 |
|---|---|---|
| `Chinese (Mandarin)_News_Anchor` | 新聞主播腔 | 正式公告、新聞資訊 |
| `Chinese_female_voice` | 普通女聲 | 一般用途 |
> 完整語音列表可查閱 [MiniMax Platform 文件](https://platform.minimaxi.com/document/T2A%20V2)
---
## TTS auto 模式說明
```json
"auto": "inbound" // 只對收到的語音訊息自動回覆
"auto": "always" // 所有回覆都生成語音
"auto": "off" // 關閉自動 TTS
```
---
## 測試方法
在 OpenClaw 任意對話中直接 send 文字,或使用 `/tts` 指令:
```
/tts 歡迎光臨老佛爺百貨,新春快樂
```
---
## 專案結構
```
minimax-tts-sg/
├── package.json # NPM 元數據 + OpenClaw 相容性聲明
├── openclaw.plugin.json # 插件清單(ID、描述、config schema)
├── index.ts # 插件主邏輯(registerSpeechProvider)
├── dist/ # esbuild 編譯輸出(自動生成)
│ └── index.js
└── README.md # 本文件
```
---
## 開發指令
```bash
# 重新編譯 TS → JS
cd ~/.openclaw/workspace/dev/minimax-tts-sg
npx esbuild index.ts \
--bundle \
--platform=node \
--format=esm \
--outfile=dist/index.js \
--external:openclaw \
--external:"openclaw/*"
# 重新 link 並重啟
openclaw plugins install --link ~/.openclaw/workspace/dev/minimax-tts-sg
# 檢查插件是否正常
openclaw plugins list | grep minimax-tts-sg
# 查看插件運行時狀態
openclaw plugins inspect minimax-tts-sg --runtime --json
```
---
## 疑難排斷
**Q: 插件 link 了但 `plugins list` 看不到?**
```
# 確認 gateway 已重啟
openclaw gateway restart
# 確認extensions目錄結構正確
ls ~/.openclaw/workspace/dev/minimax-tts-sg/dist/index.js
```
**Q: TTS 聲音還是普通話,不是粵語?**
```
# 檢查 config 中 languageBoost 是否為 "Chinese,Yue"
# 檢查 speakerVoiceId 是否為粵語語音
grep -A5 '"languageBoost"' ~/.openclaw/openclaw.json
```
**Q: 出現 401 / 403 認證錯誤?**
```
# 確認環境變量已設定
echo $MINIMAX_API_KEY
# 或
echo $MINIMAX_OAUTH_TOKEN
```
---
## 版本歷史
| 版本 | 日期 | 備註 |
|---|---|---|
| 1.0.0 | 2026-06-01 | 初始版本,支援粵語 language_boost |
---
## License
MIT — Forward Fashion IT Team
tools
Comments
Sign in to leave a comment