Skip to main content
Mastra v1 is coming in January 2026. Get ahead by starting new projects with the beta or upgrade your existing project today.

Speechify

The Speechify voice implementation in Mastra provides text-to-speech capabilities using Speechify's API.

Usage ExampleDirect link to Usage Example

import { SpeechifyVoice } from "@mastra/voice-speechify";

// Initialize with default configuration (uses SPEECHIFY_API_KEY environment variable)
const voice = new SpeechifyVoice();

// Initialize with custom configuration
const voice = new SpeechifyVoice({
speechModel: {
name: "simba-english",
apiKey: "your-api-key",
},
speaker: "george", // Default voice
});

// Convert text to speech
const audioStream = await voice.speak("Hello, world!", {
speaker: "henry", // Override default voice
});

Constructor ParametersDirect link to Constructor Parameters

speechModel?:

SpeechifyConfig
= { name: 'simba-english' }
Configuration for text-to-speech functionality

speaker?:

SpeechifyVoiceId
= 'george'
Default voice ID to use for speech synthesis

SpeechifyConfigDirect link to SpeechifyConfig

name?:

VoiceModelName
= 'simba-english'
The Speechify model to use

apiKey?:

string
Speechify API key. Falls back to SPEECHIFY_API_KEY environment variable

MethodsDirect link to Methods

speak()Direct link to speak()

Converts text to speech using the configured speech model and voice.

input:

string | NodeJS.ReadableStream
Text to convert to speech. If a stream is provided, it will be converted to text first.

options.speaker?:

string
= Constructor's speaker value
Override the default speaker for this request

options.model?:

VoiceModelName
= Constructor's model value
Override the default model for this request

Returns: Promise<NodeJS.ReadableStream>

getSpeakers()Direct link to getSpeakers()

Returns an array of available voice options, where each node contains:

voiceId:

string
Unique identifier for the voice

name:

string
Display name of the voice

language:

string
Language code for the voice

gender:

string
Gender of the voice

listen()Direct link to listen()

This method is not supported by Speechify and will throw an error. Speechify does not provide speech-to-text functionality.

NotesDirect link to Notes

  • Speechify requires an API key for authentication
  • The default model is 'simba-english'
  • Speech-to-text functionality is not supported
  • Additional audio stream options can be passed through the speak() method's options parameter