This package has been deprecated in favor of @mastra/voice-elevenlabs.
To migrate to the new package:
- Install the new package:
npm install @mastra/voice-elevenlabs
- Update your imports:
- import { ElevenLabsTTS } from '@mastra/speech-elevenlabs'
+ import { ElevenLabsVoice } from '@mastra/voice-elevenlabs'
- Update your code:
- const tts = new ElevenLabsTTS({
- model: {
- name: 'Adam',
- apiKey: 'your-api-key'
- }
- });
+ const voice = new ElevenLabsVoice({
+ speechModel: {
+ name: 'eleven_multilingual_v2',
+ apiKey: 'your-api-key'
+ },
+ speaker: 'Adam'
+ });
- const voices = await tts.voices();
+ const speakers = await voice.getSpeakers();
- const result = await tts.generate({ voice: 'Adam', text: 'Hello' });
+ const stream = await voice.speak('Hello', { speaker: 'Adam' });
All functionality remains the same - only the API structure has changed to be more consistent with other voice packages.