Skip to content

feat: add MiniMax TTS provider support#4413

Open
octo-patch wants to merge 1 commit intocoqui-ai:devfrom
octo-patch:feature/add-minimax-tts-v2
Open

feat: add MiniMax TTS provider support#4413
octo-patch wants to merge 1 commit intocoqui-ai:devfrom
octo-patch:feature/add-minimax-tts-v2

Conversation

@octo-patch
Copy link
Copy Markdown

Summary

This PR adds MiniMax TTS support to coqui-ai/TTS via a lightweight, standalone MiniMaxTTS class.

What's added

  • TTS/minimax_tts.py — a new MiniMaxTTS class that:

    • Calls the MiniMax T2A v2 API for synthesis
    • Streams SSE events and decodes hex-encoded MP3 audio fragments
    • Returns a float32 numpy array at 32 kHz, fully compatible with coqui-ai/TTS audio utilities (save_wav, etc.)
    • Supports speech-2.8-hd (default) and speech-2.8-turbo models
    • Exposes six English voice IDs out of the box
    • Reads the API key from the MINIMAX_API_KEY environment variable
  • tests/tts_tests/test_minimax_tts.py — comprehensive test suite:

    • Unit tests (mock-based, no API key required)
    • Integration tests (auto-skipped when MINIMAX_API_KEY is not set)

Usage

from TTS.minimax_tts import MiniMaxTTS

# Requires MINIMAX_API_KEY in environment
tts = MiniMaxTTS()                              # default: speech-2.8-hd
wav = tts.tts("Hello, world!")                  # returns numpy float32 array
tts.tts_to_file("Hello!", file_path="out.wav")  # saves as WAV

# Custom model / voice
tts_turbo = MiniMaxTTS(model="speech-2.8-turbo")
wav = tts_turbo.tts("Quick synthesis!", voice="English_Lucky_Robot")

API reference

Dependencies

No new dependencies are introduced. The MP3→numpy conversion uses torchaudio (already in requirements.txt) with a fallback to soundfile.

- Add TTS/minimax_tts.py with standalone MiniMaxTTS class
- Supports speech-2.8-hd and speech-2.8-turbo models
- Streams SSE response from MiniMax T2A v2 API, decodes hex audio
- Returns float32 numpy array at 32 kHz, compatible with coqui TTS utils
- Add MINIMAX_API_KEY environment variable support
- Add unit tests (mock-based) and integration tests (skip without API key)
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@eginhard
Copy link
Copy Markdown
Contributor

eginhard commented Apr 8, 2026

Development is now at https://github.com/idiap/coqui-ai-TTS. However, Coqui TTS is for open-source models, not for accessing commercial APIs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants