@mastra/voice-google 0.14.0 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/_types/@internal_voice/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +19 -220
- package/dist/_types/@internal_voice/dist/_types/@internal_core/dist/base/index.d.ts +27 -27
- package/dist/_types/@internal_voice/dist/_types/@internal_core/dist/index-S1lgaKO7.d.ts +218 -0
- package/dist/_types/@internal_voice/dist/_types/@internal_core/dist/request-context/index.d.ts +122 -105
- package/dist/_types/@internal_voice/dist/_types/@internal_core/dist/types/index.d.ts +4 -2
- package/dist/docs/SKILL.md +5 -5
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/{docs-voice-overview.md → guides-voice-overview.md} +85 -131
- package/dist/docs/references/integrations-voice-google.md +688 -0
- package/dist/index.cjs +547 -531
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +546 -529
- package/dist/index.js.map +1 -1
- package/package.json +12 -11
- package/dist/_types/@internal_voice/dist/_types/@internal_core/dist/logger/index.d.ts +0 -217
- package/dist/docs/references/reference-voice-google.md +0 -274
|
@@ -18,7 +18,7 @@ const voiceAgent = new Agent({
|
|
|
18
18
|
id: 'voice-agent',
|
|
19
19
|
name: 'Voice Agent',
|
|
20
20
|
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
21
|
-
model: 'openai/gpt-5.
|
|
21
|
+
model: 'openai/gpt-5.6-sol',
|
|
22
22
|
voice: new OpenAIVoice(),
|
|
23
23
|
})
|
|
24
24
|
```
|
|
@@ -29,7 +29,7 @@ You can then use the following voice capabilities:
|
|
|
29
29
|
|
|
30
30
|
Turn your agent's responses into natural-sounding speech using Mastra's TTS capabilities. Choose from multiple providers like OpenAI, ElevenLabs, and more.
|
|
31
31
|
|
|
32
|
-
For detailed configuration options and advanced features, check out our [Text-to-Speech guide](https://mastra.ai/
|
|
32
|
+
For detailed configuration options and advanced features, check out our [Text-to-Speech guide](https://mastra.ai/guides/voice/text-to-speech).
|
|
33
33
|
|
|
34
34
|
**OpenAI**:
|
|
35
35
|
|
|
@@ -42,7 +42,7 @@ const voiceAgent = new Agent({
|
|
|
42
42
|
id: 'voice-agent',
|
|
43
43
|
name: 'Voice Agent',
|
|
44
44
|
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
45
|
-
model: 'openai/gpt-5.
|
|
45
|
+
model: 'openai/gpt-5.6-sol',
|
|
46
46
|
voice: new OpenAIVoice(),
|
|
47
47
|
})
|
|
48
48
|
|
|
@@ -57,7 +57,7 @@ const audioStream = await voiceAgent.voice.speak(text, {
|
|
|
57
57
|
playAudio(audioStream)
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
Visit the [OpenAI Voice Reference](https://mastra.ai/
|
|
60
|
+
Visit the [OpenAI Voice Reference](https://mastra.ai/integrations/voice/openai) for more information on the OpenAI voice provider.
|
|
61
61
|
|
|
62
62
|
**Azure**:
|
|
63
63
|
|
|
@@ -70,7 +70,7 @@ const voiceAgent = new Agent({
|
|
|
70
70
|
id: 'voice-agent',
|
|
71
71
|
name: 'Voice Agent',
|
|
72
72
|
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
73
|
-
model: 'openai/gpt-5.
|
|
73
|
+
model: 'openai/gpt-5.6-sol',
|
|
74
74
|
voice: new AzureVoice(),
|
|
75
75
|
})
|
|
76
76
|
|
|
@@ -84,7 +84,7 @@ const audioStream = await voiceAgent.voice.speak(text, {
|
|
|
84
84
|
playAudio(audioStream)
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
-
Visit the [Azure Voice Reference](https://mastra.ai/
|
|
87
|
+
Visit the [Azure Voice Reference](https://mastra.ai/integrations/voice/azure) for more information on the Azure voice provider.
|
|
88
88
|
|
|
89
89
|
**ElevenLabs**:
|
|
90
90
|
|
|
@@ -97,7 +97,7 @@ const voiceAgent = new Agent({
|
|
|
97
97
|
id: 'voice-agent',
|
|
98
98
|
name: 'Voice Agent',
|
|
99
99
|
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
100
|
-
model: 'openai/gpt-5.
|
|
100
|
+
model: 'openai/gpt-5.6-sol',
|
|
101
101
|
voice: new ElevenLabsVoice(),
|
|
102
102
|
})
|
|
103
103
|
|
|
@@ -111,34 +111,7 @@ const audioStream = await voiceAgent.voice.speak(text, {
|
|
|
111
111
|
playAudio(audioStream)
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
-
Visit the [ElevenLabs Voice Reference](https://mastra.ai/
|
|
115
|
-
|
|
116
|
-
**PlayAI**:
|
|
117
|
-
|
|
118
|
-
```typescript
|
|
119
|
-
import { Agent } from '@mastra/core/agent'
|
|
120
|
-
import { PlayAIVoice } from '@mastra/voice-playai'
|
|
121
|
-
import { playAudio } from '@mastra/node-audio'
|
|
122
|
-
|
|
123
|
-
const voiceAgent = new Agent({
|
|
124
|
-
id: 'voice-agent',
|
|
125
|
-
name: 'Voice Agent',
|
|
126
|
-
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
127
|
-
model: 'openai/gpt-5.5',
|
|
128
|
-
voice: new PlayAIVoice(),
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
const { text } = await voiceAgent.generate('What color is the sky?')
|
|
132
|
-
|
|
133
|
-
// Convert text to speech to an Audio Stream
|
|
134
|
-
const audioStream = await voiceAgent.voice.speak(text, {
|
|
135
|
-
speaker: 'default', // Optional: specify a speaker
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
playAudio(audioStream)
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
Visit the [PlayAI Voice Reference](https://mastra.ai/reference/voice/playai) for more information on the PlayAI voice provider.
|
|
114
|
+
Visit the [ElevenLabs Voice Reference](https://mastra.ai/integrations/voice/elevenlabs) for more information on the ElevenLabs voice provider.
|
|
142
115
|
|
|
143
116
|
**Google**:
|
|
144
117
|
|
|
@@ -151,7 +124,7 @@ const voiceAgent = new Agent({
|
|
|
151
124
|
id: 'voice-agent',
|
|
152
125
|
name: 'Voice Agent',
|
|
153
126
|
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
154
|
-
model: 'openai/gpt-5.
|
|
127
|
+
model: 'openai/gpt-5.6-sol',
|
|
155
128
|
voice: new GoogleVoice(),
|
|
156
129
|
})
|
|
157
130
|
|
|
@@ -165,7 +138,7 @@ const audioStream = await voiceAgent.voice.speak(text, {
|
|
|
165
138
|
playAudio(audioStream)
|
|
166
139
|
```
|
|
167
140
|
|
|
168
|
-
Visit the [Google Voice Reference](https://mastra.ai/
|
|
141
|
+
Visit the [Google Voice Reference](https://mastra.ai/integrations/voice/google) for more information on the Google voice provider.
|
|
169
142
|
|
|
170
143
|
**Cloudflare**:
|
|
171
144
|
|
|
@@ -178,7 +151,7 @@ const voiceAgent = new Agent({
|
|
|
178
151
|
id: 'voice-agent',
|
|
179
152
|
name: 'Voice Agent',
|
|
180
153
|
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
181
|
-
model: 'openai/gpt-5.
|
|
154
|
+
model: 'openai/gpt-5.6-sol',
|
|
182
155
|
voice: new CloudflareVoice(),
|
|
183
156
|
})
|
|
184
157
|
|
|
@@ -192,7 +165,7 @@ const audioStream = await voiceAgent.voice.speak(text, {
|
|
|
192
165
|
playAudio(audioStream)
|
|
193
166
|
```
|
|
194
167
|
|
|
195
|
-
Visit the [Cloudflare Voice Reference](https://mastra.ai/
|
|
168
|
+
Visit the [Cloudflare Voice Reference](https://mastra.ai/integrations/voice/cloudflare) for more information on the Cloudflare voice provider.
|
|
196
169
|
|
|
197
170
|
**Deepgram**:
|
|
198
171
|
|
|
@@ -205,7 +178,7 @@ const voiceAgent = new Agent({
|
|
|
205
178
|
id: 'voice-agent',
|
|
206
179
|
name: 'Voice Agent',
|
|
207
180
|
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
208
|
-
model: 'openai/gpt-5.
|
|
181
|
+
model: 'openai/gpt-5.6-sol',
|
|
209
182
|
voice: new DeepgramVoice(),
|
|
210
183
|
})
|
|
211
184
|
|
|
@@ -219,7 +192,7 @@ const audioStream = await voiceAgent.voice.speak(text, {
|
|
|
219
192
|
playAudio(audioStream)
|
|
220
193
|
```
|
|
221
194
|
|
|
222
|
-
Visit the [Deepgram Voice Reference](https://mastra.ai/
|
|
195
|
+
Visit the [Deepgram Voice Reference](https://mastra.ai/integrations/voice/deepgram) for more information on the Deepgram voice provider.
|
|
223
196
|
|
|
224
197
|
**Inworld**:
|
|
225
198
|
|
|
@@ -232,7 +205,7 @@ const voiceAgent = new Agent({
|
|
|
232
205
|
id: 'voice-agent',
|
|
233
206
|
name: 'Voice Agent',
|
|
234
207
|
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
235
|
-
model: 'openai/gpt-5.
|
|
208
|
+
model: 'openai/gpt-5.6-sol',
|
|
236
209
|
voice: new InworldVoice(),
|
|
237
210
|
})
|
|
238
211
|
|
|
@@ -246,7 +219,7 @@ const audioStream = await voiceAgent.voice.speak(text, {
|
|
|
246
219
|
playAudio(audioStream)
|
|
247
220
|
```
|
|
248
221
|
|
|
249
|
-
Visit the [Inworld Voice Reference](https://mastra.ai/
|
|
222
|
+
Visit the [Inworld Voice Reference](https://mastra.ai/integrations/voice/inworld) for more information on the Inworld voice provider.
|
|
250
223
|
|
|
251
224
|
**Speechify**:
|
|
252
225
|
|
|
@@ -259,7 +232,7 @@ const voiceAgent = new Agent({
|
|
|
259
232
|
id: 'voice-agent',
|
|
260
233
|
name: 'Voice Agent',
|
|
261
234
|
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
262
|
-
model: 'openai/gpt-5.
|
|
235
|
+
model: 'openai/gpt-5.6-sol',
|
|
263
236
|
voice: new SpeechifyVoice(),
|
|
264
237
|
})
|
|
265
238
|
|
|
@@ -273,7 +246,7 @@ const audioStream = await voiceAgent.voice.speak(text, {
|
|
|
273
246
|
playAudio(audioStream)
|
|
274
247
|
```
|
|
275
248
|
|
|
276
|
-
Visit the [Speechify Voice Reference](https://mastra.ai/
|
|
249
|
+
Visit the [Speechify Voice Reference](https://mastra.ai/integrations/voice/speechify) for more information on the Speechify voice provider.
|
|
277
250
|
|
|
278
251
|
**Sarvam**:
|
|
279
252
|
|
|
@@ -286,7 +259,7 @@ const voiceAgent = new Agent({
|
|
|
286
259
|
id: 'voice-agent',
|
|
287
260
|
name: 'Voice Agent',
|
|
288
261
|
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
289
|
-
model: 'openai/gpt-5.
|
|
262
|
+
model: 'openai/gpt-5.6-sol',
|
|
290
263
|
voice: new SarvamVoice(),
|
|
291
264
|
})
|
|
292
265
|
|
|
@@ -300,7 +273,7 @@ const audioStream = await voiceAgent.voice.speak(text, {
|
|
|
300
273
|
playAudio(audioStream)
|
|
301
274
|
```
|
|
302
275
|
|
|
303
|
-
Visit the [Sarvam Voice Reference](https://mastra.ai/
|
|
276
|
+
Visit the [Sarvam Voice Reference](https://mastra.ai/integrations/voice/sarvam) for more information on the Sarvam voice provider.
|
|
304
277
|
|
|
305
278
|
**Murf**:
|
|
306
279
|
|
|
@@ -313,7 +286,7 @@ const voiceAgent = new Agent({
|
|
|
313
286
|
id: 'voice-agent',
|
|
314
287
|
name: 'Voice Agent',
|
|
315
288
|
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
316
|
-
model: 'openai/gpt-5.
|
|
289
|
+
model: 'openai/gpt-5.6-sol',
|
|
317
290
|
voice: new MurfVoice(),
|
|
318
291
|
})
|
|
319
292
|
|
|
@@ -327,11 +300,11 @@ const audioStream = await voiceAgent.voice.speak(text, {
|
|
|
327
300
|
playAudio(audioStream)
|
|
328
301
|
```
|
|
329
302
|
|
|
330
|
-
Visit the [Murf Voice Reference](https://mastra.ai/
|
|
303
|
+
Visit the [Murf Voice Reference](https://mastra.ai/integrations/voice/murf) for more information on the Murf voice provider.
|
|
331
304
|
|
|
332
305
|
### Speech to Text (STT)
|
|
333
306
|
|
|
334
|
-
Transcribe spoken content using
|
|
307
|
+
Transcribe spoken content using providers like OpenAI, ElevenLabs, and more. For detailed configuration options and more, check out [Speech to Text](https://mastra.ai/guides/voice/speech-to-text).
|
|
335
308
|
|
|
336
309
|
You can download a sample audio file from [here](https://github.com/mastra-ai/realtime-voice-demo/raw/refs/heads/main/how_can_i_help_you.mp3).
|
|
337
310
|
|
|
@@ -348,7 +321,7 @@ const voiceAgent = new Agent({
|
|
|
348
321
|
id: 'voice-agent',
|
|
349
322
|
name: 'Voice Agent',
|
|
350
323
|
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
351
|
-
model: 'openai/gpt-5.
|
|
324
|
+
model: 'openai/gpt-5.6-sol',
|
|
352
325
|
voice: new OpenAIVoice(),
|
|
353
326
|
})
|
|
354
327
|
|
|
@@ -363,7 +336,7 @@ console.log(`User said: ${transcript}`)
|
|
|
363
336
|
const { text } = await voiceAgent.generate(transcript)
|
|
364
337
|
```
|
|
365
338
|
|
|
366
|
-
Visit the [OpenAI Voice Reference](https://mastra.ai/
|
|
339
|
+
Visit the [OpenAI Voice Reference](https://mastra.ai/integrations/voice/openai) for more information on the OpenAI voice provider.
|
|
367
340
|
|
|
368
341
|
**Azure**:
|
|
369
342
|
|
|
@@ -377,7 +350,7 @@ const voiceAgent = new Agent({
|
|
|
377
350
|
id: 'voice-agent',
|
|
378
351
|
name: 'Voice Agent',
|
|
379
352
|
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
380
|
-
model: 'openai/gpt-5.
|
|
353
|
+
model: 'openai/gpt-5.6-sol',
|
|
381
354
|
voice: new AzureVoice(),
|
|
382
355
|
})
|
|
383
356
|
|
|
@@ -392,7 +365,7 @@ console.log(`User said: ${transcript}`)
|
|
|
392
365
|
const { text } = await voiceAgent.generate(transcript)
|
|
393
366
|
```
|
|
394
367
|
|
|
395
|
-
Visit the [Azure Voice Reference](https://mastra.ai/
|
|
368
|
+
Visit the [Azure Voice Reference](https://mastra.ai/integrations/voice/azure) for more information on the Azure voice provider.
|
|
396
369
|
|
|
397
370
|
**ElevenLabs**:
|
|
398
371
|
|
|
@@ -405,7 +378,7 @@ const voiceAgent = new Agent({
|
|
|
405
378
|
id: 'voice-agent',
|
|
406
379
|
name: 'Voice Agent',
|
|
407
380
|
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
408
|
-
model: 'openai/gpt-5.
|
|
381
|
+
model: 'openai/gpt-5.6-sol',
|
|
409
382
|
voice: new ElevenLabsVoice(),
|
|
410
383
|
})
|
|
411
384
|
|
|
@@ -420,7 +393,7 @@ console.log(`User said: ${transcript}`)
|
|
|
420
393
|
const { text } = await voiceAgent.generate(transcript)
|
|
421
394
|
```
|
|
422
395
|
|
|
423
|
-
Visit the [ElevenLabs Voice Reference](https://mastra.ai/
|
|
396
|
+
Visit the [ElevenLabs Voice Reference](https://mastra.ai/integrations/voice/elevenlabs) for more information on the ElevenLabs voice provider.
|
|
424
397
|
|
|
425
398
|
**Google**:
|
|
426
399
|
|
|
@@ -433,7 +406,7 @@ const voiceAgent = new Agent({
|
|
|
433
406
|
id: 'voice-agent',
|
|
434
407
|
name: 'Voice Agent',
|
|
435
408
|
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
436
|
-
model: 'openai/gpt-5.
|
|
409
|
+
model: 'openai/gpt-5.6-sol',
|
|
437
410
|
voice: new GoogleVoice(),
|
|
438
411
|
})
|
|
439
412
|
|
|
@@ -448,7 +421,7 @@ console.log(`User said: ${transcript}`)
|
|
|
448
421
|
const { text } = await voiceAgent.generate(transcript)
|
|
449
422
|
```
|
|
450
423
|
|
|
451
|
-
Visit the [Google Voice Reference](https://mastra.ai/
|
|
424
|
+
Visit the [Google Voice Reference](https://mastra.ai/integrations/voice/google) for more information on the Google voice provider.
|
|
452
425
|
|
|
453
426
|
**Cloudflare**:
|
|
454
427
|
|
|
@@ -461,7 +434,7 @@ const voiceAgent = new Agent({
|
|
|
461
434
|
id: 'voice-agent',
|
|
462
435
|
name: 'Voice Agent',
|
|
463
436
|
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
464
|
-
model: 'openai/gpt-5.
|
|
437
|
+
model: 'openai/gpt-5.6-sol',
|
|
465
438
|
voice: new CloudflareVoice(),
|
|
466
439
|
})
|
|
467
440
|
|
|
@@ -476,7 +449,7 @@ console.log(`User said: ${transcript}`)
|
|
|
476
449
|
const { text } = await voiceAgent.generate(transcript)
|
|
477
450
|
```
|
|
478
451
|
|
|
479
|
-
Visit the [Cloudflare Voice Reference](https://mastra.ai/
|
|
452
|
+
Visit the [Cloudflare Voice Reference](https://mastra.ai/integrations/voice/cloudflare) for more information on the Cloudflare voice provider.
|
|
480
453
|
|
|
481
454
|
**Deepgram**:
|
|
482
455
|
|
|
@@ -489,7 +462,7 @@ const voiceAgent = new Agent({
|
|
|
489
462
|
id: 'voice-agent',
|
|
490
463
|
name: 'Voice Agent',
|
|
491
464
|
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
492
|
-
model: 'openai/gpt-5.
|
|
465
|
+
model: 'openai/gpt-5.6-sol',
|
|
493
466
|
voice: new DeepgramVoice(),
|
|
494
467
|
})
|
|
495
468
|
|
|
@@ -504,7 +477,7 @@ console.log(`User said: ${transcript}`)
|
|
|
504
477
|
const { text } = await voiceAgent.generate(transcript)
|
|
505
478
|
```
|
|
506
479
|
|
|
507
|
-
Visit the [Deepgram Voice Reference](https://mastra.ai/
|
|
480
|
+
Visit the [Deepgram Voice Reference](https://mastra.ai/integrations/voice/deepgram) for more information on the Deepgram voice provider.
|
|
508
481
|
|
|
509
482
|
**Inworld**:
|
|
510
483
|
|
|
@@ -517,7 +490,7 @@ const voiceAgent = new Agent({
|
|
|
517
490
|
id: 'voice-agent',
|
|
518
491
|
name: 'Voice Agent',
|
|
519
492
|
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
520
|
-
model: 'openai/gpt-5.
|
|
493
|
+
model: 'openai/gpt-5.6-sol',
|
|
521
494
|
voice: new InworldVoice(),
|
|
522
495
|
})
|
|
523
496
|
|
|
@@ -532,7 +505,7 @@ console.log(`User said: ${transcript}`)
|
|
|
532
505
|
const { text } = await voiceAgent.generate(transcript)
|
|
533
506
|
```
|
|
534
507
|
|
|
535
|
-
Visit the [Inworld Voice Reference](https://mastra.ai/
|
|
508
|
+
Visit the [Inworld Voice Reference](https://mastra.ai/integrations/voice/inworld) for more information on the Inworld voice provider.
|
|
536
509
|
|
|
537
510
|
**Sarvam**:
|
|
538
511
|
|
|
@@ -545,7 +518,7 @@ const voiceAgent = new Agent({
|
|
|
545
518
|
id: 'voice-agent',
|
|
546
519
|
name: 'Voice Agent',
|
|
547
520
|
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
548
|
-
model: 'openai/gpt-5.
|
|
521
|
+
model: 'openai/gpt-5.6-sol',
|
|
549
522
|
voice: new SarvamVoice(),
|
|
550
523
|
})
|
|
551
524
|
|
|
@@ -560,11 +533,11 @@ console.log(`User said: ${transcript}`)
|
|
|
560
533
|
const { text } = await voiceAgent.generate(transcript)
|
|
561
534
|
```
|
|
562
535
|
|
|
563
|
-
Visit the [Sarvam Voice Reference](https://mastra.ai/
|
|
536
|
+
Visit the [Sarvam Voice Reference](https://mastra.ai/integrations/voice/sarvam) for more information on the Sarvam voice provider.
|
|
564
537
|
|
|
565
538
|
### Speech to Speech (STS)
|
|
566
539
|
|
|
567
|
-
Create conversational experiences with speech-to-speech capabilities. The unified API enables real-time voice interactions between users and AI agents. For detailed configuration options and advanced features, check out [Speech to Speech](https://mastra.ai/
|
|
540
|
+
Create conversational experiences with speech-to-speech capabilities. The unified API enables real-time voice interactions between users and AI agents. For detailed configuration options and advanced features, check out [Speech to Speech](https://mastra.ai/guides/voice/speech-to-speech).
|
|
568
541
|
|
|
569
542
|
**OpenAI**:
|
|
570
543
|
|
|
@@ -577,7 +550,7 @@ const voiceAgent = new Agent({
|
|
|
577
550
|
id: 'voice-agent',
|
|
578
551
|
name: 'Voice Agent',
|
|
579
552
|
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
580
|
-
model: 'openai/gpt-5.
|
|
553
|
+
model: 'openai/gpt-5.6-sol',
|
|
581
554
|
voice: new OpenAIRealtimeVoice(),
|
|
582
555
|
})
|
|
583
556
|
|
|
@@ -594,7 +567,7 @@ const micStream = getMicrophoneStream()
|
|
|
594
567
|
await voiceAgent.voice.send(micStream)
|
|
595
568
|
```
|
|
596
569
|
|
|
597
|
-
Visit the [OpenAI Voice Reference](https://mastra.ai/
|
|
570
|
+
Visit the [OpenAI Voice Reference](https://mastra.ai/integrations/voice/openai) for more information on the OpenAI voice provider.
|
|
598
571
|
|
|
599
572
|
**Google**:
|
|
600
573
|
|
|
@@ -607,7 +580,7 @@ const voiceAgent = new Agent({
|
|
|
607
580
|
id: 'voice-agent',
|
|
608
581
|
name: 'Voice Agent',
|
|
609
582
|
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
610
|
-
model: 'openai/gpt-5.
|
|
583
|
+
model: 'openai/gpt-5.6-sol',
|
|
611
584
|
voice: new GeminiLiveVoice({
|
|
612
585
|
// Live API mode
|
|
613
586
|
apiKey: process.env.GOOGLE_API_KEY,
|
|
@@ -643,7 +616,7 @@ const micStream = getMicrophoneStream()
|
|
|
643
616
|
await voiceAgent.voice.send(micStream)
|
|
644
617
|
```
|
|
645
618
|
|
|
646
|
-
Visit the [Google Gemini Live Reference](https://mastra.ai/
|
|
619
|
+
Visit the [Google Gemini Live Reference](https://mastra.ai/integrations/voice/google) for more information on the Google Gemini Live voice provider.
|
|
647
620
|
|
|
648
621
|
**AWS Nova Sonic**:
|
|
649
622
|
|
|
@@ -656,7 +629,7 @@ const voiceAgent = new Agent({
|
|
|
656
629
|
id: 'voice-agent',
|
|
657
630
|
name: 'Voice Agent',
|
|
658
631
|
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
659
|
-
model: 'openai/gpt-5.
|
|
632
|
+
model: 'openai/gpt-5.6-sol',
|
|
660
633
|
voice: new NovaSonicVoice({
|
|
661
634
|
region: 'us-east-1',
|
|
662
635
|
speaker: 'matthew',
|
|
@@ -686,7 +659,7 @@ const micStream = getMicrophoneStream()
|
|
|
686
659
|
await voiceAgent.voice.send(micStream)
|
|
687
660
|
```
|
|
688
661
|
|
|
689
|
-
Visit the [AWS Nova Sonic Reference](https://mastra.ai/
|
|
662
|
+
Visit the [AWS Nova Sonic Reference](https://mastra.ai/integrations/voice/aws-nova-sonic) for more information on the AWS Nova Sonic voice provider.
|
|
690
663
|
|
|
691
664
|
**Inworld Realtime**:
|
|
692
665
|
|
|
@@ -699,7 +672,7 @@ const voiceAgent = new Agent({
|
|
|
699
672
|
id: 'voice-agent',
|
|
700
673
|
name: 'Voice Agent',
|
|
701
674
|
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
702
|
-
model: 'openai/gpt-5.
|
|
675
|
+
model: 'openai/gpt-5.6-sol',
|
|
703
676
|
voice: new InworldRealtimeVoice({
|
|
704
677
|
apiKey: process.env.INWORLD_API_KEY,
|
|
705
678
|
model: 'inworld/models/gemma-4-26b-a4b-it',
|
|
@@ -728,7 +701,7 @@ const micStream = getMicrophoneStream()
|
|
|
728
701
|
await voiceAgent.voice.send(micStream)
|
|
729
702
|
```
|
|
730
703
|
|
|
731
|
-
Visit the [Inworld Realtime Reference](https://mastra.ai/
|
|
704
|
+
Visit the [Inworld Realtime Reference](https://mastra.ai/integrations/voice/inworld) for more information on the Inworld Realtime voice provider.
|
|
732
705
|
|
|
733
706
|
**xAI**:
|
|
734
707
|
|
|
@@ -771,7 +744,11 @@ const micStream = getMicrophoneStream()
|
|
|
771
744
|
await voiceAgent.voice.send(micStream)
|
|
772
745
|
```
|
|
773
746
|
|
|
774
|
-
Visit the [xAI Realtime Voice Reference](https://mastra.ai/
|
|
747
|
+
Visit the [xAI Realtime Voice Reference](https://mastra.ai/integrations/voice/xai) for more information on the xAI voice provider.
|
|
748
|
+
|
|
749
|
+
### Realtime voice
|
|
750
|
+
|
|
751
|
+
Run live calls a user can talk over, in the browser or over the phone. Mastra hands the audio loop to LiveKit, which covers voice activity detection, semantic turn detection, and barge-in, while your agent generates each reply with its own model, tools, and memory. For setup and configuration options, check out [Realtime voice](https://mastra.ai/integrations/voice/livekit).
|
|
775
752
|
|
|
776
753
|
## Voice configuration
|
|
777
754
|
|
|
@@ -798,7 +775,7 @@ const voice = new OpenAIVoice({
|
|
|
798
775
|
})
|
|
799
776
|
```
|
|
800
777
|
|
|
801
|
-
Visit the [OpenAI Voice Reference](https://mastra.ai/
|
|
778
|
+
Visit the [OpenAI Voice Reference](https://mastra.ai/integrations/voice/openai) for more information on the OpenAI voice provider.
|
|
802
779
|
|
|
803
780
|
**Azure**:
|
|
804
781
|
|
|
@@ -823,7 +800,7 @@ const voice = new AzureVoice({
|
|
|
823
800
|
})
|
|
824
801
|
```
|
|
825
802
|
|
|
826
|
-
Visit the [Azure Voice Reference](https://mastra.ai/
|
|
803
|
+
Visit the [Azure Voice Reference](https://mastra.ai/integrations/voice/azure) for more information on the Azure voice provider.
|
|
827
804
|
|
|
828
805
|
**ElevenLabs**:
|
|
829
806
|
|
|
@@ -841,25 +818,7 @@ const voice = new ElevenLabsVoice({
|
|
|
841
818
|
})
|
|
842
819
|
```
|
|
843
820
|
|
|
844
|
-
Visit the [ElevenLabs Voice Reference](https://mastra.ai/
|
|
845
|
-
|
|
846
|
-
**PlayAI**:
|
|
847
|
-
|
|
848
|
-
```typescript
|
|
849
|
-
// PlayAI Voice Configuration
|
|
850
|
-
const voice = new PlayAIVoice({
|
|
851
|
-
speechModel: {
|
|
852
|
-
name: 'playai-voice', // Example model name
|
|
853
|
-
speaker: 'emma', // Example speaker name
|
|
854
|
-
apiKey: process.env.PLAYAI_API_KEY,
|
|
855
|
-
language: 'en-US', // Language code
|
|
856
|
-
speed: 1.0, // Speech speed
|
|
857
|
-
},
|
|
858
|
-
// PlayAI may not have a separate listening model
|
|
859
|
-
})
|
|
860
|
-
```
|
|
861
|
-
|
|
862
|
-
Visit the [PlayAI Voice Reference](https://mastra.ai/reference/voice/playai) for more information on the PlayAI voice provider.
|
|
821
|
+
Visit the [ElevenLabs Voice Reference](https://mastra.ai/integrations/voice/elevenlabs) for more information on the ElevenLabs voice provider.
|
|
863
822
|
|
|
864
823
|
**Google**:
|
|
865
824
|
|
|
@@ -880,7 +839,7 @@ const voice = new GoogleVoice({
|
|
|
880
839
|
})
|
|
881
840
|
```
|
|
882
841
|
|
|
883
|
-
Visit the [Google Voice Reference](https://mastra.ai/
|
|
842
|
+
Visit the [Google Voice Reference](https://mastra.ai/integrations/voice/google) for more information on the Google voice provider.
|
|
884
843
|
|
|
885
844
|
**Cloudflare**:
|
|
886
845
|
|
|
@@ -898,7 +857,7 @@ const voice = new CloudflareVoice({
|
|
|
898
857
|
})
|
|
899
858
|
```
|
|
900
859
|
|
|
901
|
-
Visit the [Cloudflare Voice Reference](https://mastra.ai/
|
|
860
|
+
Visit the [Cloudflare Voice Reference](https://mastra.ai/integrations/voice/cloudflare) for more information on the Cloudflare voice provider.
|
|
902
861
|
|
|
903
862
|
**Deepgram**:
|
|
904
863
|
|
|
@@ -919,7 +878,7 @@ const voice = new DeepgramVoice({
|
|
|
919
878
|
})
|
|
920
879
|
```
|
|
921
880
|
|
|
922
|
-
Visit the [Deepgram Voice Reference](https://mastra.ai/
|
|
881
|
+
Visit the [Deepgram Voice Reference](https://mastra.ai/integrations/voice/deepgram) for more information on the Deepgram voice provider.
|
|
923
882
|
|
|
924
883
|
**Inworld**:
|
|
925
884
|
|
|
@@ -947,7 +906,7 @@ const audioStream = await voice.speak('Hello!', {
|
|
|
947
906
|
})
|
|
948
907
|
```
|
|
949
908
|
|
|
950
|
-
Visit the [Inworld Voice Reference](https://mastra.ai/
|
|
909
|
+
Visit the [Inworld Voice Reference](https://mastra.ai/integrations/voice/inworld) for more information on the Inworld voice provider.
|
|
951
910
|
|
|
952
911
|
**Speechify**:
|
|
953
912
|
|
|
@@ -965,7 +924,7 @@ const voice = new SpeechifyVoice({
|
|
|
965
924
|
})
|
|
966
925
|
```
|
|
967
926
|
|
|
968
|
-
Visit the [Speechify Voice Reference](https://mastra.ai/
|
|
927
|
+
Visit the [Speechify Voice Reference](https://mastra.ai/integrations/voice/speechify) for more information on the Speechify voice provider.
|
|
969
928
|
|
|
970
929
|
**Sarvam**:
|
|
971
930
|
|
|
@@ -985,7 +944,7 @@ const voice = new SarvamVoice({
|
|
|
985
944
|
})
|
|
986
945
|
```
|
|
987
946
|
|
|
988
|
-
Visit the [Sarvam Voice Reference](https://mastra.ai/
|
|
947
|
+
Visit the [Sarvam Voice Reference](https://mastra.ai/integrations/voice/sarvam) for more information on the Sarvam voice provider.
|
|
989
948
|
|
|
990
949
|
**Murf**:
|
|
991
950
|
|
|
@@ -1002,7 +961,7 @@ const voice = new MurfVoice({
|
|
|
1002
961
|
})
|
|
1003
962
|
```
|
|
1004
963
|
|
|
1005
|
-
Visit the [Murf Voice Reference](https://mastra.ai/
|
|
964
|
+
Visit the [Murf Voice Reference](https://mastra.ai/integrations/voice/murf) for more information on the Murf voice provider.
|
|
1006
965
|
|
|
1007
966
|
**OpenAI Realtime**:
|
|
1008
967
|
|
|
@@ -1023,7 +982,7 @@ const voice = new OpenAIRealtimeVoice({
|
|
|
1023
982
|
})
|
|
1024
983
|
```
|
|
1025
984
|
|
|
1026
|
-
For more information on the OpenAI Realtime voice provider, refer to the [OpenAI Realtime Voice Reference](https://mastra.ai/
|
|
985
|
+
For more information on the OpenAI Realtime voice provider, refer to the [OpenAI Realtime Voice Reference](https://mastra.ai/integrations/voice/openai).
|
|
1027
986
|
|
|
1028
987
|
**xAI Realtime**:
|
|
1029
988
|
|
|
@@ -1055,7 +1014,7 @@ const voice = new XAIRealtimeVoice({
|
|
|
1055
1014
|
})
|
|
1056
1015
|
```
|
|
1057
1016
|
|
|
1058
|
-
Visit the [xAI Realtime Voice Reference](https://mastra.ai/
|
|
1017
|
+
Visit the [xAI Realtime Voice Reference](https://mastra.ai/integrations/voice/xai) for more information on the xAI realtime voice provider.
|
|
1059
1018
|
|
|
1060
1019
|
**Google Gemini Live**:
|
|
1061
1020
|
|
|
@@ -1071,7 +1030,7 @@ const voice = new GeminiLiveVoice({
|
|
|
1071
1030
|
})
|
|
1072
1031
|
```
|
|
1073
1032
|
|
|
1074
|
-
Visit the [Google Gemini Live Reference](https://mastra.ai/
|
|
1033
|
+
Visit the [Google Gemini Live Reference](https://mastra.ai/integrations/voice/google) for more information on the Google Gemini Live voice provider.
|
|
1075
1034
|
|
|
1076
1035
|
**AWS Nova Sonic**:
|
|
1077
1036
|
|
|
@@ -1093,7 +1052,7 @@ const voice = new NovaSonicVoice({
|
|
|
1093
1052
|
})
|
|
1094
1053
|
```
|
|
1095
1054
|
|
|
1096
|
-
Visit the [AWS Nova Sonic Reference](https://mastra.ai/
|
|
1055
|
+
Visit the [AWS Nova Sonic Reference](https://mastra.ai/integrations/voice/aws-nova-sonic) for more information on the AWS Nova Sonic voice provider.
|
|
1097
1056
|
|
|
1098
1057
|
**Inworld Realtime**:
|
|
1099
1058
|
|
|
@@ -1113,7 +1072,7 @@ const voice = new InworldRealtimeVoice({
|
|
|
1113
1072
|
})
|
|
1114
1073
|
```
|
|
1115
1074
|
|
|
1116
|
-
Visit the [Inworld Realtime Reference](https://mastra.ai/
|
|
1075
|
+
Visit the [Inworld Realtime Reference](https://mastra.ai/integrations/voice/inworld) for more information on the Inworld Realtime voice provider.
|
|
1117
1076
|
|
|
1118
1077
|
**AI SDK**:
|
|
1119
1078
|
|
|
@@ -1134,20 +1093,20 @@ const voiceAgent = new Agent({
|
|
|
1134
1093
|
id: 'aisdk-voice-agent',
|
|
1135
1094
|
name: 'AI SDK Voice Agent',
|
|
1136
1095
|
instructions: 'You are a helpful assistant with voice capabilities.',
|
|
1137
|
-
model: 'openai/gpt-5.
|
|
1096
|
+
model: 'openai/gpt-5.6-sol',
|
|
1138
1097
|
voice,
|
|
1139
1098
|
})
|
|
1140
1099
|
```
|
|
1141
1100
|
|
|
1142
1101
|
### Using multiple voice providers
|
|
1143
1102
|
|
|
1144
|
-
This example demonstrates how to create and use two different voice providers in Mastra: OpenAI for speech-to-text (STT) and
|
|
1103
|
+
This example demonstrates how to create and use two different voice providers in Mastra: OpenAI for speech-to-text (STT) and ElevenLabs for text-to-speech (TTS).
|
|
1145
1104
|
|
|
1146
1105
|
Start by creating instances of the voice providers with any necessary configuration.
|
|
1147
1106
|
|
|
1148
1107
|
```typescript
|
|
1149
1108
|
import { OpenAIVoice } from '@mastra/voice-openai'
|
|
1150
|
-
import {
|
|
1109
|
+
import { ElevenLabsVoice } from '@mastra/voice-elevenlabs'
|
|
1151
1110
|
import { CompositeVoice } from '@mastra/core/voice'
|
|
1152
1111
|
import { playAudio, getMicrophoneStream } from '@mastra/node-audio'
|
|
1153
1112
|
|
|
@@ -1159,13 +1118,8 @@ const input = new OpenAIVoice({
|
|
|
1159
1118
|
},
|
|
1160
1119
|
})
|
|
1161
1120
|
|
|
1162
|
-
// Initialize
|
|
1163
|
-
const output = new
|
|
1164
|
-
speechModel: {
|
|
1165
|
-
name: 'playai-voice',
|
|
1166
|
-
apiKey: process.env.PLAYAI_API_KEY,
|
|
1167
|
-
},
|
|
1168
|
-
})
|
|
1121
|
+
// Initialize ElevenLabs voice for TTS
|
|
1122
|
+
const output = new ElevenLabsVoice()
|
|
1169
1123
|
|
|
1170
1124
|
// Combine the providers using CompositeVoice
|
|
1171
1125
|
const voice = new CompositeVoice({
|
|
@@ -1224,12 +1178,12 @@ You can also mix AI SDK models with Mastra providers:
|
|
|
1224
1178
|
|
|
1225
1179
|
```typescript
|
|
1226
1180
|
import { CompositeVoice } from '@mastra/core/voice'
|
|
1227
|
-
import {
|
|
1181
|
+
import { ElevenLabsVoice } from '@mastra/voice-elevenlabs'
|
|
1228
1182
|
import { groq } from '@ai-sdk/groq'
|
|
1229
1183
|
|
|
1230
1184
|
const voice = new CompositeVoice({
|
|
1231
1185
|
input: groq.transcription('whisper-large-v3'), // AI SDK for STT
|
|
1232
|
-
output: new
|
|
1186
|
+
output: new ElevenLabsVoice(), // Mastra provider for TTS
|
|
1233
1187
|
})
|
|
1234
1188
|
```
|
|
1235
1189
|
|
|
@@ -1239,14 +1193,14 @@ For more information on the CompositeVoice, refer to the [CompositeVoice Referen
|
|
|
1239
1193
|
|
|
1240
1194
|
- [CompositeVoice](https://mastra.ai/reference/voice/composite-voice)
|
|
1241
1195
|
- [MastraVoice](https://mastra.ai/reference/voice/mastra-voice)
|
|
1242
|
-
- [OpenAI Voice](https://mastra.ai/
|
|
1243
|
-
- [OpenAI Realtime Voice](https://mastra.ai/
|
|
1244
|
-
- [xAI Realtime Voice](https://mastra.ai/
|
|
1245
|
-
- [Azure Voice](https://mastra.ai/
|
|
1246
|
-
- [Google Voice](https://mastra.ai/
|
|
1247
|
-
- [Google Gemini Live Voice](https://mastra.ai/
|
|
1248
|
-
- [AWS Nova Sonic Voice](https://mastra.ai/
|
|
1249
|
-
- [Deepgram Voice](https://mastra.ai/
|
|
1250
|
-
- [Inworld Voice](https://mastra.ai/
|
|
1251
|
-
- [
|
|
1196
|
+
- [OpenAI Voice](https://mastra.ai/integrations/voice/openai)
|
|
1197
|
+
- [OpenAI Realtime Voice](https://mastra.ai/integrations/voice/openai)
|
|
1198
|
+
- [xAI Realtime Voice](https://mastra.ai/integrations/voice/xai)
|
|
1199
|
+
- [Azure Voice](https://mastra.ai/integrations/voice/azure)
|
|
1200
|
+
- [Google Voice](https://mastra.ai/integrations/voice/google)
|
|
1201
|
+
- [Google Gemini Live Voice](https://mastra.ai/integrations/voice/google)
|
|
1202
|
+
- [AWS Nova Sonic Voice](https://mastra.ai/integrations/voice/aws-nova-sonic)
|
|
1203
|
+
- [Deepgram Voice](https://mastra.ai/integrations/voice/deepgram)
|
|
1204
|
+
- [Inworld Voice](https://mastra.ai/integrations/voice/inworld)
|
|
1205
|
+
- [LiveKit](https://mastra.ai/integrations/voice/livekit)
|
|
1252
1206
|
- [Voice Examples](https://github.com/mastra-ai/voice-examples)
|