Skip to content

feat(tool/minimax_tts): add MiniMax text-to-speech tool - #582

Open
octo-patch wants to merge 1 commit into
leon-ai:developfrom
octo-patch:octo/20260817-tts-tool-recvs9dBcAgiVT
Open

feat(tool/minimax_tts): add MiniMax text-to-speech tool#582
octo-patch wants to merge 1 commit into
leon-ai:developfrom
octo-patch:octo/20260817-tts-tool-recvs9dBcAgiVT

Conversation

@octo-patch

Copy link
Copy Markdown
Contributor

Reason: The Music & Audio toolkit had no MiniMax text-to-speech tool, so speech could not be synthesized with the MiniMax speech models.

Changes

  • Add tools/music_audio/minimax_tts/ with tool.json, settings.sample.json, a Node.js tool and a Python tool that implement the same logic.
  • Register minimax_tts in tools/music_audio/toolkit.json so the toolkit registry picks it up.

Tool behaviour

synthesizeToFile(text, outputPath, options) (synthesize_to_file in Python) posts to the text-to-audio endpoint and writes the generated audio to outputPath:

  • Regional endpoints: global_en calls https://api.minimax.io/v1/t2a_v2 and cn_zh calls https://api.minimaxi.com/v1/t2a_v2. The region comes from the settings and can be overridden per call.
  • Models: speech-2.8-hd, speech-2.8-turbo, speech-2.6-hd, speech-2.6-turbo, speech-02-hd, speech-02-turbo, speech-01-hd and speech-01-turbo, defaulting to speech-2.8-hd.
  • Authorization: the API key is sent as a Bearer token and never logged.
  • Request fields: model and text are always sent, stream is forced to false because the whole audio is needed to write a file, and output_format, language_boost, voice_setting, pronunciation_dict, audio_setting, voice_modify and subtitle_enable are forwarded only when provided. audio_setting.format accepts mp3, wav, flac and pcm.
  • Audio handling: the hexadecimal payload returned in data.audio is decoded to bytes, and when output_format is url the audio is downloaded instead.
  • Error handling: a non-zero base_resp.status_code is reported with the returned message, a null data object and a malformed payload raise an explicit error instead of writing a truncated file, and the model, region, audio format and output path are validated before any request is sent.

Settings

MINIMAX_TTS_API_KEY is required, so the tool is reported as unavailable until it is filled. MINIMAX_TTS_MODEL and MINIMAX_TTS_REGION default to speech-2.8-hd and global_en.

Checks

  • tsc --noEmit -p tools/tsconfig.json reports no error in the added files.
  • python3 -m py_compile on the added Python files.
  • Local verification, not part of the diff: both implementations were exercised against a stubbed network layer, asserting the resolved host and path per region, the Bearer header, the exact request body for a full and a minimal call, every supported model, the hex decoding and the url download, and each validation and error path. The manifest was also checked against the registry expectations: the tool is discovered through toolkit.json, the runtime resolves src/nodejs/index.ts, MINIMAX_TTS_API_KEY is the only required setting, and the declared parameters map onto the method signature with the optional argument trailing.

Register a MiniMax text-to-speech tool in the Music & Audio toolkit.
The tool synthesizes speech from text through the regional text-to-audio
endpoints and writes the generated audio to a file.
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.

1 participant