@mastra/voice-openai-realtime 0.13.6-alpha.2 → 0.13.6

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @mastra/voice-openai-realtime
2
2
 
3
+ ## 0.13.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`6bff877`](https://github.com/mastra-ai/mastra/commit/6bff877e214695ff8d9c84b06c13a6e6bcf9f1ed), [`f5a17d9`](https://github.com/mastra-ai/mastra/commit/f5a17d95c19e7d4149996932bd8d1905089f031d), [`5dba2a4`](https://github.com/mastra-ai/mastra/commit/5dba2a41600385751f5aace79878904e1972609d), [`9be8878`](https://github.com/mastra-ai/mastra/commit/9be8878dcf0388e84fc4873e0eec27bd49b881a4)]:
8
+ - @mastra/schema-compat@1.3.6
9
+
10
+ ## 0.13.6-alpha.3
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`5dba2a4`](https://github.com/mastra-ai/mastra/commit/5dba2a41600385751f5aace79878904e1972609d)]:
15
+ - @mastra/schema-compat@1.3.6-alpha.3
16
+
3
17
  ## 0.13.6-alpha.2
4
18
 
5
19
  ### Patch Changes
@@ -3,7 +3,7 @@ name: mastra-voice-openai-realtime
3
3
  description: Documentation for @mastra/voice-openai-realtime. Use when working with @mastra/voice-openai-realtime APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/voice-openai-realtime"
6
- version: "0.13.6-alpha.2"
6
+ version: "0.13.6"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -19,9 +19,12 @@ Read the individual reference documents for detailed explanations and code examp
19
19
  - [Voice in Mastra](references/guides-voice-overview.md) - Overview of voice capabilities in Mastra, including text-to-speech, speech-to-text, and real-time speech-to-speech interactions.
20
20
  - [Speech-to-Speech capabilities in Mastra](references/guides-voice-speech-to-speech.md) - Overview of speech-to-speech capabilities in Mastra, including real-time interactions and event-driven architecture.
21
21
 
22
+ ### Integrations
23
+
24
+ - [OpenAI](references/integrations-voice-openai.md) - Documentation for the OpenAIVoice class, providing text-to-speech and speech-to-text capabilities.
25
+
22
26
  ### Reference
23
27
 
24
- - [Reference: OpenAI Realtime voice](references/reference-voice-openai-realtime.md) - Documentation for the OpenAIRealtimeVoice class, providing real-time text-to-speech and speech-to-text capabilities via WebSockets.
25
28
  - [Reference: voice.addInstructions()](references/reference-voice-voice.addInstructions.md) - Documentation for the addInstructions() method available in voice providers, which adds instructions to guide the voice model's behavior.
26
29
  - [Reference: voice.addTools()](references/reference-voice-voice.addTools.md) - Documentation for the addTools() method available in voice providers, which equips voice models with function calling capabilities.
27
30
  - [Reference: voice.answer()](references/reference-voice-voice.answer.md) - Documentation for the answer() method available in real-time voice providers, which triggers the voice provider to generate a response.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.13.6-alpha.2",
2
+ "version": "0.13.6",
3
3
  "package": "@mastra/voice-openai-realtime",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -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/reference/voice/openai) for more information on the OpenAI voice provider.
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
 
@@ -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/reference/voice/azure) for more information on the Azure voice provider.
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
 
@@ -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/reference/voice/elevenlabs) for more information on the ElevenLabs voice provider.
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.6-sol',
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
 
@@ -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/reference/voice/google) for more information on the Google voice provider.
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
 
@@ -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/reference/voice/cloudflare) for more information on the Cloudflare voice provider.
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
 
@@ -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/reference/voice/deepgram) for more information on the Deepgram voice provider.
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
 
@@ -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/reference/voice/inworld) for more information on the Inworld voice provider.
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
 
@@ -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/reference/voice/speechify) for more information on the Speechify voice provider.
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
 
@@ -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/reference/voice/sarvam) for more information on the Sarvam voice provider.
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
 
@@ -327,7 +300,7 @@ const audioStream = await voiceAgent.voice.speak(text, {
327
300
  playAudio(audioStream)
328
301
  ```
329
302
 
330
- Visit the [Murf Voice Reference](https://mastra.ai/reference/voice/murf) for more information on the Murf voice provider.
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
 
@@ -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/reference/voice/openai) for more information on the OpenAI voice provider.
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
 
@@ -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/reference/voice/azure) for more information on the Azure voice provider.
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
 
@@ -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/reference/voice/elevenlabs) for more information on the ElevenLabs voice provider.
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
 
@@ -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/reference/voice/google) for more information on the Google voice provider.
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
 
@@ -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/reference/voice/cloudflare) for more information on the Cloudflare voice provider.
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
 
@@ -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/reference/voice/deepgram) for more information on the Deepgram voice provider.
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
 
@@ -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/reference/voice/inworld) for more information on the Inworld voice provider.
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
 
@@ -560,7 +533,7 @@ 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/reference/voice/sarvam) for more information on the Sarvam voice provider.
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
 
@@ -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/reference/voice/openai-realtime) for more information on the OpenAI voice provider.
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
 
@@ -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/reference/voice/google-gemini-live) for more information on the Google Gemini Live voice provider.
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
 
@@ -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/reference/voice/aws-nova-sonic) for more information on the AWS Nova Sonic voice provider.
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
 
@@ -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/reference/voice/inworld-realtime) for more information on the Inworld Realtime voice provider.
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,11 +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/reference/voice/xai-realtime) for more information on the xAI voice provider.
747
+ Visit the [xAI Realtime Voice Reference](https://mastra.ai/integrations/voice/xai) for more information on the xAI voice provider.
775
748
 
776
749
  ### Realtime voice
777
750
 
778
- 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/guides/voice/realtime-voice).
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).
779
752
 
780
753
  ## Voice configuration
781
754
 
@@ -802,7 +775,7 @@ const voice = new OpenAIVoice({
802
775
  })
803
776
  ```
804
777
 
805
- Visit the [OpenAI Voice Reference](https://mastra.ai/reference/voice/openai) for more information on the OpenAI voice provider.
778
+ Visit the [OpenAI Voice Reference](https://mastra.ai/integrations/voice/openai) for more information on the OpenAI voice provider.
806
779
 
807
780
  **Azure**:
808
781
 
@@ -827,7 +800,7 @@ const voice = new AzureVoice({
827
800
  })
828
801
  ```
829
802
 
830
- Visit the [Azure Voice Reference](https://mastra.ai/reference/voice/azure) for more information on the Azure voice provider.
803
+ Visit the [Azure Voice Reference](https://mastra.ai/integrations/voice/azure) for more information on the Azure voice provider.
831
804
 
832
805
  **ElevenLabs**:
833
806
 
@@ -845,25 +818,7 @@ const voice = new ElevenLabsVoice({
845
818
  })
846
819
  ```
847
820
 
848
- Visit the [ElevenLabs Voice Reference](https://mastra.ai/reference/voice/elevenlabs) for more information on the ElevenLabs voice provider.
849
-
850
- **PlayAI**:
851
-
852
- ```typescript
853
- // PlayAI Voice Configuration
854
- const voice = new PlayAIVoice({
855
- speechModel: {
856
- name: 'playai-voice', // Example model name
857
- speaker: 'emma', // Example speaker name
858
- apiKey: process.env.PLAYAI_API_KEY,
859
- language: 'en-US', // Language code
860
- speed: 1.0, // Speech speed
861
- },
862
- // PlayAI may not have a separate listening model
863
- })
864
- ```
865
-
866
- 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.
867
822
 
868
823
  **Google**:
869
824
 
@@ -884,7 +839,7 @@ const voice = new GoogleVoice({
884
839
  })
885
840
  ```
886
841
 
887
- Visit the [Google Voice Reference](https://mastra.ai/reference/voice/google) for more information on the Google voice provider.
842
+ Visit the [Google Voice Reference](https://mastra.ai/integrations/voice/google) for more information on the Google voice provider.
888
843
 
889
844
  **Cloudflare**:
890
845
 
@@ -902,7 +857,7 @@ const voice = new CloudflareVoice({
902
857
  })
903
858
  ```
904
859
 
905
- Visit the [Cloudflare Voice Reference](https://mastra.ai/reference/voice/cloudflare) for more information on the Cloudflare voice provider.
860
+ Visit the [Cloudflare Voice Reference](https://mastra.ai/integrations/voice/cloudflare) for more information on the Cloudflare voice provider.
906
861
 
907
862
  **Deepgram**:
908
863
 
@@ -923,7 +878,7 @@ const voice = new DeepgramVoice({
923
878
  })
924
879
  ```
925
880
 
926
- Visit the [Deepgram Voice Reference](https://mastra.ai/reference/voice/deepgram) for more information on the Deepgram voice provider.
881
+ Visit the [Deepgram Voice Reference](https://mastra.ai/integrations/voice/deepgram) for more information on the Deepgram voice provider.
927
882
 
928
883
  **Inworld**:
929
884
 
@@ -951,7 +906,7 @@ const audioStream = await voice.speak('Hello!', {
951
906
  })
952
907
  ```
953
908
 
954
- Visit the [Inworld Voice Reference](https://mastra.ai/reference/voice/inworld) for more information on the Inworld voice provider.
909
+ Visit the [Inworld Voice Reference](https://mastra.ai/integrations/voice/inworld) for more information on the Inworld voice provider.
955
910
 
956
911
  **Speechify**:
957
912
 
@@ -969,7 +924,7 @@ const voice = new SpeechifyVoice({
969
924
  })
970
925
  ```
971
926
 
972
- Visit the [Speechify Voice Reference](https://mastra.ai/reference/voice/speechify) for more information on the Speechify voice provider.
927
+ Visit the [Speechify Voice Reference](https://mastra.ai/integrations/voice/speechify) for more information on the Speechify voice provider.
973
928
 
974
929
  **Sarvam**:
975
930
 
@@ -989,7 +944,7 @@ const voice = new SarvamVoice({
989
944
  })
990
945
  ```
991
946
 
992
- Visit the [Sarvam Voice Reference](https://mastra.ai/reference/voice/sarvam) for more information on the Sarvam voice provider.
947
+ Visit the [Sarvam Voice Reference](https://mastra.ai/integrations/voice/sarvam) for more information on the Sarvam voice provider.
993
948
 
994
949
  **Murf**:
995
950
 
@@ -1006,7 +961,7 @@ const voice = new MurfVoice({
1006
961
  })
1007
962
  ```
1008
963
 
1009
- Visit the [Murf Voice Reference](https://mastra.ai/reference/voice/murf) for more information on the Murf voice provider.
964
+ Visit the [Murf Voice Reference](https://mastra.ai/integrations/voice/murf) for more information on the Murf voice provider.
1010
965
 
1011
966
  **OpenAI Realtime**:
1012
967
 
@@ -1027,7 +982,7 @@ const voice = new OpenAIRealtimeVoice({
1027
982
  })
1028
983
  ```
1029
984
 
1030
- For more information on the OpenAI Realtime voice provider, refer to the [OpenAI Realtime Voice Reference](https://mastra.ai/reference/voice/openai-realtime).
985
+ For more information on the OpenAI Realtime voice provider, refer to the [OpenAI Realtime Voice Reference](https://mastra.ai/integrations/voice/openai).
1031
986
 
1032
987
  **xAI Realtime**:
1033
988
 
@@ -1059,7 +1014,7 @@ const voice = new XAIRealtimeVoice({
1059
1014
  })
1060
1015
  ```
1061
1016
 
1062
- Visit the [xAI Realtime Voice Reference](https://mastra.ai/reference/voice/xai-realtime) for more information on the xAI realtime voice provider.
1017
+ Visit the [xAI Realtime Voice Reference](https://mastra.ai/integrations/voice/xai) for more information on the xAI realtime voice provider.
1063
1018
 
1064
1019
  **Google Gemini Live**:
1065
1020
 
@@ -1075,7 +1030,7 @@ const voice = new GeminiLiveVoice({
1075
1030
  })
1076
1031
  ```
1077
1032
 
1078
- Visit the [Google Gemini Live Reference](https://mastra.ai/reference/voice/google-gemini-live) for more information on the Google Gemini Live voice provider.
1033
+ Visit the [Google Gemini Live Reference](https://mastra.ai/integrations/voice/google) for more information on the Google Gemini Live voice provider.
1079
1034
 
1080
1035
  **AWS Nova Sonic**:
1081
1036
 
@@ -1097,7 +1052,7 @@ const voice = new NovaSonicVoice({
1097
1052
  })
1098
1053
  ```
1099
1054
 
1100
- Visit the [AWS Nova Sonic Reference](https://mastra.ai/reference/voice/aws-nova-sonic) for more information on the AWS Nova Sonic voice provider.
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.
1101
1056
 
1102
1057
  **Inworld Realtime**:
1103
1058
 
@@ -1117,7 +1072,7 @@ const voice = new InworldRealtimeVoice({
1117
1072
  })
1118
1073
  ```
1119
1074
 
1120
- Visit the [Inworld Realtime Reference](https://mastra.ai/reference/voice/inworld-realtime) for more information on the Inworld Realtime voice provider.
1075
+ Visit the [Inworld Realtime Reference](https://mastra.ai/integrations/voice/inworld) for more information on the Inworld Realtime voice provider.
1121
1076
 
1122
1077
  **AI SDK**:
1123
1078
 
@@ -1145,13 +1100,13 @@ const voiceAgent = new Agent({
1145
1100
 
1146
1101
  ### Using multiple voice providers
1147
1102
 
1148
- This example demonstrates how to create and use two different voice providers in Mastra: OpenAI for speech-to-text (STT) and PlayAI for text-to-speech (TTS).
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).
1149
1104
 
1150
1105
  Start by creating instances of the voice providers with any necessary configuration.
1151
1106
 
1152
1107
  ```typescript
1153
1108
  import { OpenAIVoice } from '@mastra/voice-openai'
1154
- import { PlayAIVoice } from '@mastra/voice-playai'
1109
+ import { ElevenLabsVoice } from '@mastra/voice-elevenlabs'
1155
1110
  import { CompositeVoice } from '@mastra/core/voice'
1156
1111
  import { playAudio, getMicrophoneStream } from '@mastra/node-audio'
1157
1112
 
@@ -1163,13 +1118,8 @@ const input = new OpenAIVoice({
1163
1118
  },
1164
1119
  })
1165
1120
 
1166
- // Initialize PlayAI voice for TTS
1167
- const output = new PlayAIVoice({
1168
- speechModel: {
1169
- name: 'playai-voice',
1170
- apiKey: process.env.PLAYAI_API_KEY,
1171
- },
1172
- })
1121
+ // Initialize ElevenLabs voice for TTS
1122
+ const output = new ElevenLabsVoice()
1173
1123
 
1174
1124
  // Combine the providers using CompositeVoice
1175
1125
  const voice = new CompositeVoice({
@@ -1228,12 +1178,12 @@ You can also mix AI SDK models with Mastra providers:
1228
1178
 
1229
1179
  ```typescript
1230
1180
  import { CompositeVoice } from '@mastra/core/voice'
1231
- import { PlayAIVoice } from '@mastra/voice-playai'
1181
+ import { ElevenLabsVoice } from '@mastra/voice-elevenlabs'
1232
1182
  import { groq } from '@ai-sdk/groq'
1233
1183
 
1234
1184
  const voice = new CompositeVoice({
1235
1185
  input: groq.transcription('whisper-large-v3'), // AI SDK for STT
1236
- output: new PlayAIVoice(), // Mastra provider for TTS
1186
+ output: new ElevenLabsVoice(), // Mastra provider for TTS
1237
1187
  })
1238
1188
  ```
1239
1189
 
@@ -1243,15 +1193,14 @@ For more information on the CompositeVoice, refer to the [CompositeVoice Referen
1243
1193
 
1244
1194
  - [CompositeVoice](https://mastra.ai/reference/voice/composite-voice)
1245
1195
  - [MastraVoice](https://mastra.ai/reference/voice/mastra-voice)
1246
- - [OpenAI Voice](https://mastra.ai/reference/voice/openai)
1247
- - [OpenAI Realtime Voice](https://mastra.ai/reference/voice/openai-realtime)
1248
- - [xAI Realtime Voice](https://mastra.ai/reference/voice/xai-realtime)
1249
- - [Azure Voice](https://mastra.ai/reference/voice/azure)
1250
- - [Google Voice](https://mastra.ai/reference/voice/google)
1251
- - [Google Gemini Live Voice](https://mastra.ai/reference/voice/google-gemini-live)
1252
- - [AWS Nova Sonic Voice](https://mastra.ai/reference/voice/aws-nova-sonic)
1253
- - [Deepgram Voice](https://mastra.ai/reference/voice/deepgram)
1254
- - [Inworld Voice](https://mastra.ai/reference/voice/inworld)
1255
- - [LiveKit](https://mastra.ai/reference/voice/livekit)
1256
- - [PlayAI Voice](https://mastra.ai/reference/voice/playai)
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)
1257
1206
  - [Voice Examples](https://github.com/mastra-ai/voice-examples)
@@ -1,10 +1,107 @@
1
1
  > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
2
 
3
- # OpenAI Realtime voice
3
+ # OpenAI
4
+
5
+ ## Voice
6
+
7
+ The OpenAIVoice class in Mastra provides text-to-speech and speech-to-text capabilities using OpenAI's models.
8
+
9
+ ### Usage example
10
+
11
+ ```typescript
12
+ import { OpenAIVoice } from '@mastra/voice-openai'
13
+
14
+ // Initialize with default configuration using environment variables
15
+ const voice = new OpenAIVoice()
16
+
17
+ // Or initialize with specific configuration
18
+ const voiceWithConfig = new OpenAIVoice({
19
+ speechModel: {
20
+ name: 'tts-1-hd',
21
+ apiKey: 'your-openai-api-key',
22
+ },
23
+ listeningModel: {
24
+ name: 'whisper-1',
25
+ apiKey: 'your-openai-api-key',
26
+ },
27
+ speaker: 'alloy', // Default voice
28
+ })
29
+
30
+ // Convert text to speech
31
+ const audioStream = await voice.speak('Hello, how can I help you?', {
32
+ speaker: 'nova', // Override default voice
33
+ speed: 1.2, // Adjust speech speed
34
+ })
35
+
36
+ // Convert speech to text
37
+ const text = await voice.listen(audioStream, {
38
+ filetype: 'mp3',
39
+ })
40
+ ```
41
+
42
+ ### Configuration
43
+
44
+ #### Constructor options
45
+
46
+ **speechModel** (`OpenAIConfig`): Configuration for text-to-speech synthesis. (Default: `{ name: 'tts-1' }`)
47
+
48
+ **speechModel.name** (`'tts-1' | 'tts-1-hd' | 'whisper-1'`): Model name. Use 'tts-1-hd' for higher quality audio.
49
+
50
+ **speechModel.apiKey** (`string`): OpenAI API key. Falls back to OPENAI\_API\_KEY environment variable.
51
+
52
+ **listeningModel** (`OpenAIConfig`): Configuration for speech-to-text recognition. (Default: `{ name: 'whisper-1' }`)
53
+
54
+ **listeningModel.name** (`'tts-1' | 'tts-1-hd' | 'whisper-1'`): Model name. Use 'tts-1-hd' for higher quality audio.
55
+
56
+ **listeningModel.apiKey** (`string`): OpenAI API key. Falls back to OPENAI\_API\_KEY environment variable.
57
+
58
+ **speaker** (`OpenAIVoiceId`): Default voice ID for speech synthesis. (Default: `'alloy'`)
59
+
60
+ ### Methods
61
+
62
+ #### `speak()`
63
+
64
+ Converts text to speech using OpenAI's text-to-speech models.
65
+
66
+ **input** (`string | NodeJS.ReadableStream`): Text or text stream to convert to speech.
67
+
68
+ **options** (`Options`): Configuration options.
69
+
70
+ **options.speaker** (`OpenAIVoiceId`): Voice ID to use for speech synthesis.
71
+
72
+ **options.speed** (`number`): Speech speed multiplier.
73
+
74
+ Returns: `Promise<NodeJS.ReadableStream>`
75
+
76
+ #### `listen()`
77
+
78
+ Transcribes audio using OpenAI's Whisper model.
79
+
80
+ **audioStream** (`NodeJS.ReadableStream`): Audio stream to transcribe.
81
+
82
+ **options** (`Options`): Configuration options.
83
+
84
+ **options.filetype** (`string`): Audio format of the input stream.
85
+
86
+ Returns: `Promise<string>`
87
+
88
+ #### `getSpeakers()`
89
+
90
+ Returns an array of available voice options, where each node contains:
91
+
92
+ **voiceId** (`string`): Unique identifier for the voice
93
+
94
+ ### Notes
95
+
96
+ - API keys can be provided via constructor options or the `OPENAI_API_KEY` environment variable
97
+ - The `tts-1-hd` model provides higher quality audio but may have slower processing times
98
+ - Speech recognition supports multiple audio formats including mp3, wav, and webm
99
+
100
+ ## Realtime
4
101
 
5
102
  The OpenAIRealtimeVoice class provides real-time voice interaction capabilities using OpenAI's WebSocket-based API. It supports real time speech to speech, voice activity detection, and event-based audio streaming.
6
103
 
7
- ## Usage example
104
+ ### Usage example
8
105
 
9
106
  ```typescript
10
107
  import { OpenAIRealtimeVoice } from '@mastra/voice-openai-realtime'
@@ -55,9 +152,9 @@ await voice.send(microphoneStream)
55
152
  voice.connect()
56
153
  ```
57
154
 
58
- ## Configuration
155
+ ### Configuration
59
156
 
60
- ### Constructor options
157
+ #### Constructor options
61
158
 
62
159
  **model** (`string`): The model ID to use for real-time voice interactions. (Default: `'gpt-5.1-realtime-preview-2024-12-17'`)
63
160
 
@@ -65,7 +162,7 @@ voice.connect()
65
162
 
66
163
  **speaker** (`string`): Default voice ID for speech synthesis. (Default: `'alloy'`)
67
164
 
68
- ### Voice Activity Detection (VAD) Configuration
165
+ #### Voice Activity Detection (VAD) Configuration
69
166
 
70
167
  **type** (`string`): Type of VAD to use. Server-side VAD provides better accuracy. (Default: `'server_vad'`)
71
168
 
@@ -75,15 +172,15 @@ voice.connect()
75
172
 
76
173
  **silence\_duration\_ms** (`number`): Milliseconds of silence before ending a turn. (Default: `1000`)
77
174
 
78
- ## Methods
175
+ ### Methods
79
176
 
80
- ### `connect()`
177
+ #### `connect()`
81
178
 
82
179
  Establishes a connection to the OpenAI Realtime service. Must be called before using speak, listen, or send functions.
83
180
 
84
181
  **returns** (`Promise<void>`): Promise that resolves when the connection is established.
85
182
 
86
- ### `speak()`
183
+ #### `speak()`
87
184
 
88
185
  Emits a speaking event using the configured voice model. Can accept either a string or a readable stream as input.
89
186
 
@@ -95,7 +192,7 @@ Emits a speaking event using the configured voice model. Can accept either a str
95
192
 
96
193
  Returns: `Promise<void>`
97
194
 
98
- ### `listen()`
195
+ #### `listen()`
99
196
 
100
197
  Processes audio input for speech recognition. Takes a readable stream of audio data and emits a 'listening' event with the transcribed text.
101
198
 
@@ -103,7 +200,7 @@ Processes audio input for speech recognition. Takes a readable stream of audio d
103
200
 
104
201
  Returns: `Promise<void>`
105
202
 
106
- ### `send()`
203
+ #### `send()`
107
204
 
108
205
  Streams audio data in real-time to the OpenAI service for continuous audio streaming scenarios like live microphone input.
109
206
 
@@ -111,7 +208,7 @@ Streams audio data in real-time to the OpenAI service for continuous audio strea
111
208
 
112
209
  Returns: `Promise<void>`
113
210
 
114
- ### `updateConfig()`
211
+ #### `updateConfig()`
115
212
 
116
213
  Updates the session configuration for the voice instance. This can modify voice settings and turn detection. It can also modify other parameters.
117
214
 
@@ -119,7 +216,7 @@ Updates the session configuration for the voice instance. This can modify voice
119
216
 
120
217
  Returns: `void`
121
218
 
122
- ### `addTools()`
219
+ #### `addTools()`
123
220
 
124
221
  Adds a set of tools to the voice instance. Tools allow the model to perform additional actions during conversations. When OpenAIRealtimeVoice is added to an Agent, any tools configured for the Agent will automatically be available to the voice interface.
125
222
 
@@ -127,19 +224,19 @@ Adds a set of tools to the voice instance. Tools allow the model to perform addi
127
224
 
128
225
  Returns: `void`
129
226
 
130
- ### `close()`
227
+ #### `close()`
131
228
 
132
229
  Disconnects from the OpenAI Realtime session and cleans up resources. Should be called when you're done with the voice instance.
133
230
 
134
231
  Returns: `void`
135
232
 
136
- ### `getSpeakers()`
233
+ #### `getSpeakers()`
137
234
 
138
235
  Returns a list of available voice speakers.
139
236
 
140
237
  Returns: `Promise<Array<{ voiceId: string; [key: string]: any }>>`
141
238
 
142
- ### `on()`
239
+ #### `on()`
143
240
 
144
241
  Registers an event listener for voice events.
145
242
 
@@ -149,7 +246,7 @@ Registers an event listener for voice events.
149
246
 
150
247
  Returns: `void`
151
248
 
152
- ### `off()`
249
+ #### `off()`
153
250
 
154
251
  Removes a previously registered event listener.
155
252
 
@@ -159,7 +256,7 @@ Removes a previously registered event listener.
159
256
 
160
257
  Returns: `void`
161
258
 
162
- ## Events
259
+ ### Events
163
260
 
164
261
  The OpenAIRealtimeVoice class emits the following events:
165
262
 
@@ -169,7 +266,7 @@ The OpenAIRealtimeVoice class emits the following events:
169
266
 
170
267
  **error** (`event`): Emitted when an error occurs. Callback receives the error object.
171
268
 
172
- ### OpenAI Realtime Events
269
+ #### OpenAI Realtime Events
173
270
 
174
271
  You can also listen to [OpenAI Realtime utility events](https://github.com/openai/openai-realtime-api-beta#reference-client-utility-events) by prefixing with 'openAIRealtime:':
175
272
 
@@ -183,7 +280,7 @@ You can also listen to [OpenAI Realtime utility events](https://github.com/opena
183
280
 
184
281
  **openAIRealtime:conversation.item.completed** (`event`): Emitted when an item in the conversation is completed.
185
282
 
186
- ## Available voices
283
+ ### Available voices
187
284
 
188
285
  The following voice options are available:
189
286
 
@@ -196,7 +293,7 @@ The following voice options are available:
196
293
  - `shimmer`: Bright and energetic
197
294
  - `verse`: Versatile and expressive
198
295
 
199
- ## Notes
296
+ ### Notes
200
297
 
201
298
  - API keys can be provided via constructor options or the `OPENAI_API_KEY` environment variable
202
299
  - The OpenAI Realtime Voice API uses WebSockets for real-time communication
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/voice-openai-realtime",
3
- "version": "0.13.6-alpha.2",
3
+ "version": "0.13.6",
4
4
  "description": "Mastra OpenAI Realtime API integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -26,7 +26,7 @@
26
26
  "dependencies": {
27
27
  "openai-realtime-api": "^1.0.8",
28
28
  "ws": "^8.21.0",
29
- "@mastra/schema-compat": "1.3.6-alpha.2"
29
+ "@mastra/schema-compat": "1.3.6"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/node": "22.20.1",
@@ -39,9 +39,9 @@
39
39
  "typescript": "^6.0.3",
40
40
  "vitest": "4.1.10",
41
41
  "zod": "^4.4.3",
42
- "@internal/voice": "0.0.19",
43
- "@internal/types-builder": "0.0.96",
44
- "@internal/lint": "0.0.121"
42
+ "@internal/lint": "0.0.122",
43
+ "@internal/types-builder": "0.0.97",
44
+ "@internal/voice": "0.0.20"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "zod": "^3.25.0 || ^4.0.0"