MiniMax

Updated

Use MiniMax for text-to-speech (TTS) in a Conversational AI Platform agent.

Preview documentation

You're reading the Conversational AI Platform (Preview) docs. Switch to Main.

MiniMax provides text-to-speech (TTS) with multiple voice styles and low-latency streaming output.

Sample configuration

The following example shows how to configure MiniMax as the agent's TTS when you create or update an agent. For a complete example, see Create an agent and start a session.

MiniMax supports managed mode and BYOK. In managed mode, Agora provides access to MiniMax, and you don't need a MiniMax account. For BYOK, store your MiniMax API key in a secret set, and refer to it from the agent. For details, see Use managed mode and Use your own provider keys.

from agora_agent import Agent, MiniMaxTTS, secret_ref

# client is your configured Agora client
agent = (
    Agent(client=client)
    .with_stt(...)  # configure your ASR vendor
    .with_llm(...)  # configure your LLM vendor
    .with_tts(
        MiniMaxTTS(
            key=secret_ref("support_prod", "minimax"),  # omit to use managed mode
            group_id="<your_minimax_group_id>",  # omit to use managed mode
            url="wss://api-uw.minimax.io/ws/v1/t2a_v2",  # omit to use managed mode
            model="speech-2.8-turbo",
            voice_id="English_captivating_female1",
            speed=1.0,
            sample_rate=44100,
        )
    )
)
import { Agent, MiniMaxTTS, secretRef } from 'agora-agents';

// client is your configured Agora client
const agent = new Agent({ client })
  .withStt(/* configure your ASR vendor */)
  .withLlm(/* configure your LLM vendor */)
  .withTts(
    new MiniMaxTTS({
      key: secretRef('support_prod', 'minimax'), // omit to use managed mode
      groupId: '<your_minimax_group_id>', // omit to use managed mode
      url: 'wss://api-uw.minimax.io/ws/v1/t2a_v2', // omit to use managed mode
      model: 'speech-2.8-turbo',
      voiceId: 'English_captivating_female1',
      speed: 1.0,
      sampleRate: 44100,
    }),
  );
// client is your configured Agora client
speed, sampleRate := 1.0, 44100
agent := agentkit.NewAgent(client).
	WithStt( /* configure your ASR vendor */ ).
	WithLlm( /* configure your LLM vendor */ ).
	WithTts(vendors.NewMiniMaxTTS(vendors.MiniMaxTTSOptions{
		Key:        agentkit.SecretRef("support_prod", "minimax"), // omit to use managed mode
		GroupID:    "<your_minimax_group_id>",                     // omit to use managed mode
		URL:        "wss://api-uw.minimax.io/ws/v1/t2a_v2",        // omit to use managed mode
		Model:      "speech-2.8-turbo",
		VoiceID:    "English_captivating_female1",
		Speed:      &speed,
		SampleRate: &sampleRate,
	}))
  • Managed mode

    Set credential.mode to managed in the tts block. Agora provides access to MiniMax, and you don't need a MiniMax account.

    "tts": {
      "credential": { "mode": "managed" },
      "vendor": "minimax",
      "params": {
        "model": "speech-2.8-turbo",
        "voice_setting": {
          "voice_id": "English_captivating_female1",
          "speed": 1.0
        },
        "audio_setting": {
          "sample_rate": 44100
        }
      }
    }
  • BYOK

    Set credential.mode to byok and credential.fields.key to a reference to your MiniMax API key in a secret set. Your MiniMax group ID isn't secret. Pass it in params. In the following example, the key is stored as minimax in the support_prod set:

    "tts": {
      "credential": {
        "mode": "byok",
        "fields": {
          "key": "$secrets.support_prod.minimax"
        }
      },
      "vendor": "minimax",
      "url": "wss://api-uw.minimax.io/ws/v1/t2a_v2",
      "params": {
        "group_id": "<your_minimax_group_id>",
        "model": "speech-2.8-turbo",
        "voice_setting": {
          "voice_id": "English_captivating_female1",
          "speed": 1.0
        },
        "audio_setting": {
          "sample_rate": 44100
        }
      }
    }

Key parameters

The tts block takes the following fields. In the SDKs, the MiniMax TTS class sets them from its options.

tts
vendorstring
required

Set to minimax.

credentialobject
required

How the agent authenticates with MiniMax. Set mode to managed, or to byok with fields.key set to a $secrets.<set>.<key> reference to your MiniMax API key.

urlstring
optional

A custom WebSocket endpoint for streaming TTS output, for example wss://api-uw.minimax.io/ws/v1/t2a_v2. Not needed in managed mode.

paramsobject
required
group_idstring
optional

The MiniMax group identifier. Required for BYOK.

modelstring
required

The TTS model to use, for example speech-02-turbo. For managed mode, use speech-2.6-turbo or speech-2.8-turbo.

voice_setting.voice_idstring
required

The voice style identifier to use, for example English_captivating_female1.

voice_setting.speednumber
required

The speaking speed, for example 1.0.

audio_setting.sample_ratenumber
optional
Possible values
  • 8000
  • 16000
  • 22050
  • 24000
  • 32000
  • 44100

The audio sampling rate in Hz.

Caution

The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in params are passed through directly to MiniMax without validation. For a full list of supported options, refer to the MiniMax documentation.