Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/minimax-plugin-initial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@livekit/agents-plugin-minimax": minor
---

feat(minimax): port MiniMax TTS plugin from Python agents (HTTP SSE + WebSocket streaming, PCM output)
30 changes: 30 additions & 0 deletions plugins/minimax/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!--
SPDX-FileCopyrightText: 2026 LiveKit, Inc.

SPDX-License-Identifier: Apache-2.0
-->
# MiniMax plugin for LiveKit Agents

The Agents Framework is designed for building realtime, programmable
participants that run on servers. Use it to create conversational, multi-modal
voice agents that can see, hear, and understand.

This package contains the MiniMax plugin, which provides text-to-speech via
MiniMax's `t2a_v2` APIs (both HTTP streaming and WebSocket streaming).

Refer to the [documentation](https://docs.livekit.io/agents/overview/) for
information on how to use it. See the
[repository](https://github.com/livekit/agents-js) for more information about
the framework as a whole.

## Installation

```bash
pnpm add @livekit/agents-plugin-minimax
```

## Pre-requisites

You'll need an API key from MiniMax. It can be set as an environment variable:
`MINIMAX_API_KEY`. You can also override the API endpoint via `MINIMAX_BASE_URL`
(defaults to `https://api-uw.minimax.io`).
8 changes: 8 additions & 0 deletions plugins/minimax/api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Config file for API Extractor. For more info, please visit: https://api-extractor.com
*/
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "../../api-extractor-shared.json",
"mainEntryPointFilePath": "./dist/index.d.ts"
}
52 changes: 52 additions & 0 deletions plugins/minimax/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "@livekit/agents-plugin-minimax",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Update lockfile when adding the new workspace package

This commit introduces plugins/minimax/package.json as a new workspace package, but pnpm-lock.yaml was not regenerated to include a plugins/minimax importer. Because CI runs pnpm install --frozen-lockfile in build/test workflows, installs will fail when the lockfile is out of sync with workspace manifests. Regenerating and committing the lockfile with this package is required to keep CI green.

Useful? React with 👍 / 👎.

"version": "0.1.0",
"description": "MiniMax plugin for LiveKit Node Agents",
"main": "dist/index.js",
"require": "dist/index.cjs",
"types": "dist/index.d.ts",
"exports": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
},
"author": "LiveKit",
"type": "module",
"repository": "git@github.com:livekit/agents-js.git",
"license": "Apache-2.0",
"files": [
"dist",
"src",
"README.md"
],
"scripts": {
"build": "tsup --onSuccess \"pnpm build:types\"",
"build:types": "tsc --declaration --emitDeclarationOnly && node ../../scripts/copyDeclarationOutput.js",
"clean": "rm -rf dist",
"clean:build": "pnpm clean && pnpm build",
"lint": "eslint -f unix \"src/**/*.{ts,js}\"",
"api:check": "api-extractor run --typescript-compiler-folder ../../node_modules/typescript",
"api:update": "api-extractor run --local --typescript-compiler-folder ../../node_modules/typescript --verbose"
},
"devDependencies": {
"@livekit/agents": "workspace:*",
"@livekit/agents-plugins-test": "workspace:*",
"@livekit/rtc-node": "catalog:",
"@microsoft/api-extractor": "^7.35.0",
"@types/ws": "catalog:",
"tsup": "^8.3.5",
"typescript": "^5.0.0"
},
"dependencies": {
"ws": "catalog:"
},
"peerDependencies": {
"@livekit/agents": "workspace:*",
"@livekit/rtc-node": "catalog:"
}
}
19 changes: 19 additions & 0 deletions plugins/minimax/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-FileCopyrightText: 2026 LiveKit, Inc.
//
// SPDX-License-Identifier: Apache-2.0
import { Plugin } from '@livekit/agents';

export * from './models.js';
export * from './tts.js';

class MiniMaxPlugin extends Plugin {
constructor() {
super({
title: 'minimax',
version: __PACKAGE_VERSION__,
package: __PACKAGE_NAME__,
});
}
}

Plugin.registerPlugin(new MiniMaxPlugin());
137 changes: 137 additions & 0 deletions plugins/minimax/src/models.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
// SPDX-FileCopyrightText: 2026 LiveKit, Inc.
//
// SPDX-License-Identifier: Apache-2.0

// Ref: python livekit-plugins/livekit-plugins-minimax/livekit/plugins/minimax/tts.py - 27-38 lines
/** Supported MiniMax TTS models. */
export type TTSModel =
| 'speech-2.8-hd'
| 'speech-2.8-turbo'
| 'speech-2.6-hd'
| 'speech-2.6-turbo'
| 'speech-2.5-hd-preview'
| 'speech-2.5-turbo-preview'
| 'speech-02-hd'
| 'speech-02-turbo'
| 'speech-01-hd'
| 'speech-01-turbo';

// Ref: python livekit-plugins/livekit-plugins-minimax/livekit/plugins/minimax/tts.py - 40-83 lines
/**
* A subset of commonly used MiniMax voice IDs. Any string is accepted by
* {@link TTSOptions.voice} - these literals exist purely for IDE
* auto-completion. See the MiniMax documentation for the full voice list.
*/
export type TTSVoice =
// Social Media Voices
| 'socialmedia_female_2_v1'
| 'socialmedia_female_1_v1'
// Voice Agent Series
| 'voice_agent_Female_Phone_4'
| 'voice_agent_Male_Phone_1'
| 'voice_agent_Male_Phone_2'
// English Voices - Female
| 'English_StressedLady'
| 'English_SentimentalLady'
| 'English_radiant_girl'
// English Voices - Male
| 'English_WiseScholar'
| 'English_Persuasive_Man'
| 'English_Explanatory_Man'
| 'English_Insightful_Speaker'
// Japanese Voices
| 'japanese_male_social_media_1_v2'
| 'japanese_female_social_media_1_v2'
// French Voices
| 'French_CasualMan'
| 'French_Female Journalist'
// Spanish Voices
| 'Spanish_Narrator'
| 'Spanish_WiseScholar'
| 'Spanish_ThoughtfulMan'
// Arabic Voices
| 'Arabic_CalmWoman'
| 'Arabic_FriendlyGuy'
// Portuguese Voices
| 'Portuguese_ThoughtfulLady'
// German Voices
| 'German_PlayfulMan'
| 'German_SweetLady'
// MOSS Audio Series
| 'moss_audio_7c7e7ae2-7356-11f0-9540-7ef9b4b62566'
| 'moss_audio_b118f320-78c0-11f0-bbeb-26e8167c4779'
| 'moss_audio_84f32de9-2363-11f0-b7ab-d255fae1f27b'
| 'moss_audio_82ebf67c-78c8-11f0-8e8e-36b92fbb4f95';

// Ref: python livekit-plugins/livekit-plugins-minimax/livekit/plugins/minimax/tts.py - 89-92 lines
/**
* MiniMax-supported emotions.
*
* @remarks `fluent` is only supported by `speech-2.6-*` models.
*/
export type TTSEmotion =
| 'happy'
| 'sad'
| 'angry'
| 'fearful'
| 'disgusted'
| 'surprised'
| 'neutral'
| 'fluent';

// Ref: python livekit-plugins/livekit-plugins-minimax/livekit/plugins/minimax/tts.py - 94-136 lines
/** Language hint for multilingual performance. */
export type TTSLanguageBoost =
| 'auto'
| 'Chinese'
| 'Chinese,Yue'
| 'English'
| 'Arabic'
| 'Russian'
| 'Spanish'
| 'French'
| 'Portuguese'
| 'German'
| 'Turkish'
| 'Dutch'
| 'Ukrainian'
| 'Vietnamese'
| 'Indonesian'
| 'Japanese'
| 'Italian'
| 'Korean'
| 'Thai'
| 'Polish'
| 'Romanian'
| 'Greek'
| 'Czech'
| 'Finnish'
| 'Hindi'
| 'Bulgarian'
| 'Danish'
| 'Hebrew'
| 'Malay'
| 'Persian'
| 'Slovak'
| 'Swedish'
| 'Croatian'
| 'Filipino'
| 'Hungarian'
| 'Norwegian'
| 'Slovenian'
| 'Catalan'
| 'Nynorsk'
| 'Tamil'
| 'Afrikaans';

// Ref: python livekit-plugins/livekit-plugins-minimax/livekit/plugins/minimax/tts.py - 139 line
/**
* Valid PCM sample rates accepted by the MiniMax API.
*/
export type TTSSampleRate = 8000 | 16000 | 22050 | 24000 | 32000 | 44100;

// Ref: python livekit-plugins/livekit-plugins-minimax/livekit/plugins/minimax/tts.py - 85-86 lines
export const DEFAULT_MODEL: TTSModel = 'speech-02-turbo';
export const DEFAULT_VOICE_ID: TTSVoice = 'socialmedia_female_2_v1';
// Ref: python livekit-plugins/livekit-plugins-minimax/livekit/plugins/minimax/tts.py - 142-144 lines
export const DEFAULT_BASE_URL = 'https://api-uw.minimax.io';
19 changes: 19 additions & 0 deletions plugins/minimax/src/tts.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-FileCopyrightText: 2026 LiveKit, Inc.
//
// SPDX-License-Identifier: Apache-2.0
import { describe, it } from 'vitest';
import { TTS } from './tts.js';

const hasMinimaxConfig = Boolean(process.env.MINIMAX_API_KEY);

if (hasMinimaxConfig) {
describe('MiniMax TTS', () => {
it('constructs without throwing', () => {
new TTS();
});
});
} else {
describe('MiniMax TTS', () => {
it.skip('requires MINIMAX_API_KEY', () => {});
});
}
Loading
Loading