-
Notifications
You must be signed in to change notification settings - Fork 269
feat(minimax): port MiniMax TTS plugin from Python agents #1287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
toubatbrian
wants to merge
13
commits into
main
Choose a base branch
from
claude/jolly-lovelace-blf3Z
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e5fd90b
feat(minimax): add package.json
toubatbrian fd6a9d9
feat(minimax): add tsconfig.json
toubatbrian d40a2ac
feat(minimax): add tsup config
toubatbrian b696a86
feat(minimax): add api-extractor config
toubatbrian f8b2bc3
feat(minimax): add README
toubatbrian 0b14ea5
feat(minimax): add plugin entry point
toubatbrian 1463303
feat(minimax): add models and literal types
toubatbrian 05c9ccd
feat(minimax): add TTS implementation (HTTP SSE + WebSocket streaming)
toubatbrian 105f587
fix(minimax): address CI failures and review feedback
claude 5e6ea00
fix(minimax): address Devin review (validation + Ref comments)
toubatbrian 0453bdc
fix(minimax): clear task_start timeout on happy path
toubatbrian d4c0e53
fix(minimax): don't close tokenStream in run() finally
toubatbrian c34b65d
fix(minimax): bump SPDX year to 2026 + mark MiniMax app errors non-re…
toubatbrian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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`). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| { | ||
| "name": "@livekit/agents-plugin-minimax", | ||
| "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:" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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', () => {}); | ||
| }); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit introduces
plugins/minimax/package.jsonas a new workspace package, butpnpm-lock.yamlwas not regenerated to include aplugins/minimaximporter. Because CI runspnpm install --frozen-lockfilein 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 👍 / 👎.