MiniMax
Text-to-speech with MiniMax's T2A API: MiniMaxHttpTTSService streams PCM audio over HTTP.
Overview
MiniMaxHttpTTSService posts each sentence to MiniMax's T2A (Text-to-Audio) endpoint with streaming on, and pushes the hex-encoded PCM audio of each streamed data: block as it arrives.
Upstream page
Pipecat's documentation for the same service.
Source
packages/minimax/src/tts.ts.
MiniMax docs
The T2A HTTP API reference.
Installation
bun add @pipedog/minimaximport { MiniMaxHttpTTSService } from "@pipedog/minimax/tts";Prerequisites
- A MiniMax account, an API key and your group id.
- Pass them as
apiKeyandgroupId. The examples read them fromMINIMAX_API_KEYandMINIMAX_GROUP_ID.
Configuration
Prop
Type
Settings
Runtime-updatable settings, passed as settings: new MiniMaxHttpTTSService.Settings({...})
(MiniMaxTTSSettings). Any setting you leave out keeps the default below.
| Setting | Type | Default | Description |
|---|---|---|---|
model | string | "speech-2.8-turbo" | Speech model. |
voice | string | "Calm_Woman" | Voice id. |
language | Language | null | null | Not sent. Use languageBoost. |
speed | number | null | 1.0 | Speed, 0.5 to 2.0. |
volume | number | null | 1.0 | Volume, above 0 up to 10. |
pitch | number | null | 0 | Pitch, -12 to 12. |
emotion | string | null | null | Emotional tone: happy, sad, angry, fearful, disgusted, surprised, calm or fluent. |
textNormalization | boolean | null | null | Text normalization (Chinese and English). |
latexRead | boolean | null | null | Read LaTeX formulas. |
languageBoost | string | null | null | A language name to boost, such as English. languageToMinimaxLanguage() maps a Language. |
Usage
import { TTSUpdateSettingsFrame } from "@pipedog/core/frames/frames";
import { MiniMaxHttpTTSService } from "@pipedog/minimax/tts";
const tts = new MiniMaxHttpTTSService({
apiKey: process.env.MINIMAX_API_KEY ?? "",
groupId: process.env.MINIMAX_GROUP_ID ?? "",
settings: new MiniMaxHttpTTSService.Settings({
model: "speech-2.8-turbo",
voice: "Calm_Woman",
emotion: "calm",
}),
});Change settings mid-call with a TTSUpdateSettingsFrame:
// Queue it on the worker, or push it from a processor upstream of the service.
const update = new TTSUpdateSettingsFrame({
delta: new MiniMaxHttpTTSService.Settings({ speed: 1.2 }),
});Notes
baseUrlpicks the region:https://api.minimax.io/v1/t2a_v2(global, the default),https://api.minimaxi.chat/v1/t2a_v2(mainland China) orhttps://api-uw.minimax.io/v1/t2a_v2(western United States). The group id is added as?GroupId=.- The last streamed block repeats the whole utterance and carries
extra_info. It is skipped, so no audio is played twice. - The audio is 16-bit PCM at the pipeline's sample rate, one channel.
MiniMaxTTSSettings.fromMapping()also accepts the older nestedvoice_settingdict (withvolforvolume).
Runtime notes
- It uses the global
fetch, so it works on Bun, Node, Deno and Cloudflare Workers. Passfetchto use another one (upstream takes an aiohttp session). - The deprecated
params(InputParams),modelandvoiceIdconstructor options are not ported. Usesettings. - Tested against a local server, not against MiniMax itself.
| Runtime | Works | What it needs |
|---|---|---|
| Bun | ✅ yes | Nothing. |
| Node.js | ✅ yes | Nothing. |
| Deno | ✅ yes | Nothing. |
| Cloudflare Workers | ✅ yes | Nothing. |
Generated from pipecat.runtimes and pipecat.compat in packages/minimax/package.json: ✅ means the compat smoke test passes on that runtime.
pipedog is an unofficial community TypeScript port of Pipecat. It is not affiliated with or endorsed by Daily or the Pipecat project.
Portions adapted from the Pipecat documentation, Copyright (c) 2024–2025 Daily, BSD-2-Clause (see apps/docs/LICENSE-pipecat-docs).