DocsReferenceTTSProviders and Models

Providers and Models

ProviderSupported Models
ElevenLabseleven_multilingual_v2, eleven_flash_v2_5, eleven_flash_v2, eleven_multilingual_sts_v2, eleven_english_sts_v2
OpenAItts-1, tts-1-hd
PlayAIPlayDialog, Play3.0-mini
AzureVarious voices available through Azure Cognitive Services
Deepgramaura and other models with voice options like asteria-en
GoogleVarious voices through Google Cloud Text-to-Speech
IBMVarious voices including en-US_AllisonV3Voice
MurfGEN1, GEN2 with various voices like en-US-natalie

Configuration

Each provider requires specific configuration. Here are examples for each provider:

ElevenLabs Configuration

import { ElevenLabsTTS } from "@mastra/speech-elevenlabs";
 
const tts = new ElevenLabsTTS({
  model: {
    name: "eleven_multilingual_v2",
    apiKey: process.env.ELEVENLABS_API_KEY,
  },
});

OpenAI Configuration

import { OpenAITTS } from "@mastra/speech-openai";
 
const tts = new OpenAITTS({
  model: {
    name: "tts-1", // or 'tts-1-hd' for higher quality
    apiKey: process.env.OPENAI_API_KEY,
  },
});

PlayAI Configuration

import { PlayAITTS } from "@mastra/speech-playai";
 
const tts = new PlayAITTS({
  model: {
    name: "PlayDialog", // or 'Play3.0-mini'
    apiKey: process.env.PLAYAI_API_KEY,
  },
  userId: process.env.PLAYAI_USER_ID,
});

Azure Configuration

import { AzureTTS } from "@mastra/speech-azure";
 
const tts = new AzureTTS({
  model: {
    name: "en-US-JennyNeural",
    apiKey: process.env.AZURE_API_KEY,
    region: process.env.AZURE_REGION,
  },
});

Deepgram Configuration

import { DeepgramTTS } from "@mastra/speech-deepgram";
 
const tts = new DeepgramTTS({
  model: {
    name: "aura",
    voice: "asteria-en",
    apiKey: process.env.DEEPGRAM_API_KEY,
  },
});

Google Configuration

const tts = new GoogleTTS({
  model: {
    name: "en-US-Standard-A",
    credentials: process.env.GOOGLE_CREDENTIALS,
  },
});

IBM Configuration

const tts = new IbmTTS({
  model: {
    voice: "en-US_AllisonV3Voice",
    apiKey: process.env.IBM_API_KEY,
  },
});

Murf Configuration

const tts = new MurfTTS({
  model: {
    name: "GEN2",
    voice: "en-US-natalie",
    apiKey: process.env.MURF_API_KEY,
  },
});