telnyx 5.43.0 → 5.44.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16165a575a8ba5351fd5cbdfd588ec9a502c69181223aac0f594d489f3cb0ece
4
- data.tar.gz: d2a6544c0084fa29d9021451ed17fa1c365bc7ca73045d4cadccb13d715cd53d
3
+ metadata.gz: 7fe268e9f5711b397cebf7cdde7592128a848e61bf2030a7b3cab7d2420f4997
4
+ data.tar.gz: 2eef9ec8559af1b1562f516b43f741cd886611433a46aaeb5cdaf4878f4a05ff
5
5
  SHA512:
6
- metadata.gz: 4d81fc785fe00c04ba6e1ad07f323872f5fe6e827b93e397e444aeebe154c5737dd3fdb1e0d1dd296267180b32e56d616dff7656e6b76b3eae27f4f5d9f737e3
7
- data.tar.gz: 84913adb37c8857c6f736e00df9626fd7f88a1688a81c562069209f574cf22ae46131af0d0e88bb64d3f7e0b2ac62d9203a60496cce190767e8a6c7cdb4de495
6
+ metadata.gz: 69e947ca4bd0dda23730add20dab9f170dfd6c7a4bc35b71d169200ead869c7611099a69cadef7684e48b66e8c47fdbde96f4e488f4853e9a81eab93c2f8aea3
7
+ data.tar.gz: d7283bb88ef4b9439f5c8e15df31a35aba4daabe04699136ceb182334ad17b59d21933f7aec3ec4c5e41a728307d5461786e682bc41898c301088233961e92cc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.44.0 (2026-02-26)
4
+
5
+ Full Changelog: [v5.43.0...v5.44.0](https://github.com/team-telnyx/telnyx-ruby/compare/v5.43.0...v5.44.0)
6
+
7
+ ### Features
8
+
9
+ * Add text-to-speech WebSocket streaming OpenAPI spec ([c6c082b](https://github.com/team-telnyx/telnyx-ruby/commit/c6c082b8a0d47d63c136f7c81e5bd4eceffb2872))
10
+ * **api:** manual updates ([d834462](https://github.com/team-telnyx/telnyx-ruby/commit/d834462641d4d929399bf7dbdef9e1bac6dcde8a))
11
+
3
12
  ## 5.43.0 (2026-02-25)
4
13
 
5
14
  Full Changelog: [v5.42.0...v5.43.0](https://github.com/team-telnyx/telnyx-ruby/compare/v5.42.0...v5.43.0)
data/README.md CHANGED
@@ -24,7 +24,7 @@ To use this gem, install via Bundler by adding the following to your application
24
24
  <!-- x-release-please-start-version -->
25
25
 
26
26
  ```ruby
27
- gem "telnyx", "~> 5.43.0"
27
+ gem "telnyx", "~> 5.44.0"
28
28
  ```
29
29
 
30
30
  <!-- x-release-please-end -->
@@ -0,0 +1,111 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telnyx
4
+ module Models
5
+ # @see Telnyx::Resources::TextToSpeech#stream
6
+ class TextToSpeechStreamParams < Telnyx::Internal::Type::BaseModel
7
+ extend Telnyx::Internal::Type::RequestParameters::Converter
8
+ include Telnyx::Internal::Type::RequestParameters
9
+
10
+ # @!attribute audio_format
11
+ # Audio output format override. Supported for Telnyx `Natural`/`NaturalHD` models
12
+ # only. Accepted values: `pcm`, `wav`.
13
+ #
14
+ # @return [Symbol, Telnyx::Models::TextToSpeechStreamParams::AudioFormat, nil]
15
+ optional :audio_format, enum: -> { Telnyx::TextToSpeechStreamParams::AudioFormat }
16
+
17
+ # @!attribute disable_cache
18
+ # When `true`, bypass the audio cache and generate fresh audio.
19
+ #
20
+ # @return [Boolean, nil]
21
+ optional :disable_cache, Telnyx::Internal::Type::Boolean
22
+
23
+ # @!attribute model_id
24
+ # Model identifier for the chosen provider. Examples: `Natural`, `NaturalHD`
25
+ # (Telnyx); `Polly.Generative` (AWS).
26
+ #
27
+ # @return [String, nil]
28
+ optional :model_id, String
29
+
30
+ # @!attribute provider
31
+ # TTS provider. Defaults to `telnyx` if not specified. Ignored when `voice` is
32
+ # provided.
33
+ #
34
+ # @return [Symbol, Telnyx::Models::TextToSpeechStreamParams::Provider, nil]
35
+ optional :provider, enum: -> { Telnyx::TextToSpeechStreamParams::Provider }
36
+
37
+ # @!attribute socket_id
38
+ # Client-provided socket identifier for tracking. If not provided, one is
39
+ # generated server-side.
40
+ #
41
+ # @return [String, nil]
42
+ optional :socket_id, String
43
+
44
+ # @!attribute voice
45
+ # Voice identifier in the format `provider.model_id.voice_id` or
46
+ # `provider.voice_id` (e.g. `telnyx.NaturalHD.Telnyx_Alloy` or
47
+ # `azure.en-US-AvaMultilingualNeural`). When provided, the `provider`, `model_id`,
48
+ # and `voice_id` are extracted automatically. Takes precedence over individual
49
+ # `provider`/`model_id`/`voice_id` parameters.
50
+ #
51
+ # @return [String, nil]
52
+ optional :voice, String
53
+
54
+ # @!attribute voice_id
55
+ # Voice identifier for the chosen provider.
56
+ #
57
+ # @return [String, nil]
58
+ optional :voice_id, String
59
+
60
+ # @!method initialize(audio_format: nil, disable_cache: nil, model_id: nil, provider: nil, socket_id: nil, voice: nil, voice_id: nil, request_options: {})
61
+ # Some parameter documentations has been truncated, see
62
+ # {Telnyx::Models::TextToSpeechStreamParams} for more details.
63
+ #
64
+ # @param audio_format [Symbol, Telnyx::Models::TextToSpeechStreamParams::AudioFormat] Audio output format override. Supported for Telnyx `Natural`/`NaturalHD` models
65
+ #
66
+ # @param disable_cache [Boolean] When `true`, bypass the audio cache and generate fresh audio.
67
+ #
68
+ # @param model_id [String] Model identifier for the chosen provider. Examples: `Natural`, `NaturalHD` (Teln
69
+ #
70
+ # @param provider [Symbol, Telnyx::Models::TextToSpeechStreamParams::Provider] TTS provider. Defaults to `telnyx` if not specified. Ignored when `voice` is pro
71
+ #
72
+ # @param socket_id [String] Client-provided socket identifier for tracking. If not provided, one is generate
73
+ #
74
+ # @param voice [String] Voice identifier in the format `provider.model_id.voice_id` or `provider.voice_i
75
+ #
76
+ # @param voice_id [String] Voice identifier for the chosen provider.
77
+ #
78
+ # @param request_options [Telnyx::RequestOptions, Hash{Symbol=>Object}]
79
+
80
+ # Audio output format override. Supported for Telnyx `Natural`/`NaturalHD` models
81
+ # only. Accepted values: `pcm`, `wav`.
82
+ module AudioFormat
83
+ extend Telnyx::Internal::Type::Enum
84
+
85
+ PCM = :pcm
86
+ WAV = :wav
87
+
88
+ # @!method self.values
89
+ # @return [Array<Symbol>]
90
+ end
91
+
92
+ # TTS provider. Defaults to `telnyx` if not specified. Ignored when `voice` is
93
+ # provided.
94
+ module Provider
95
+ extend Telnyx::Internal::Type::Enum
96
+
97
+ AWS = :aws
98
+ TELNYX = :telnyx
99
+ AZURE = :azure
100
+ ELEVENLABS = :elevenlabs
101
+ MINIMAX = :minimax
102
+ MURFAI = :murfai
103
+ RIME = :rime
104
+ RESEMBLE = :resemble
105
+
106
+ # @!method self.values
107
+ # @return [Array<Symbol>]
108
+ end
109
+ end
110
+ end
111
+ end
data/lib/telnyx/models.rb CHANGED
@@ -1488,10 +1488,10 @@ module Telnyx
1488
1488
 
1489
1489
  TexmlSecretsParams = Telnyx::Models::TexmlSecretsParams
1490
1490
 
1491
- TextToSpeechGenerateSpeechParams = Telnyx::Models::TextToSpeechGenerateSpeechParams
1492
-
1493
1491
  TextToSpeechListVoicesParams = Telnyx::Models::TextToSpeechListVoicesParams
1494
1492
 
1493
+ TextToSpeechStreamParams = Telnyx::Models::TextToSpeechStreamParams
1494
+
1495
1495
  TrafficType = Telnyx::Models::TrafficType
1496
1496
 
1497
1497
  Transcription = Telnyx::Models::Transcription
@@ -3,55 +3,82 @@
3
3
  module Telnyx
4
4
  module Resources
5
5
  class TextToSpeech
6
- # Some parameter documentations has been truncated, see
7
- # {Telnyx::Models::TextToSpeechGenerateSpeechParams} for more details.
8
- #
9
- # Converts the provided text to speech using the specified voice and returns audio
10
- # data
6
+ # Returns a list of voices that can be used with the text to speech commands.
11
7
  #
12
- # @overload generate_speech(text:, voice:, request_options: {})
8
+ # @overload list_voices(elevenlabs_api_key_ref: nil, provider: nil, request_options: {})
13
9
  #
14
- # @param text [String] The text to convert to speech
10
+ # @param elevenlabs_api_key_ref [String] Reference to your ElevenLabs API key stored in the Telnyx Portal
15
11
  #
16
- # @param voice [String] The voice ID in the format Provider.ModelId.VoiceId.
12
+ # @param provider [Symbol, Telnyx::Models::TextToSpeechListVoicesParams::Provider] Filter voices by provider
17
13
  #
18
14
  # @param request_options [Telnyx::RequestOptions, Hash{Symbol=>Object}, nil]
19
15
  #
20
- # @return [StringIO]
16
+ # @return [Telnyx::Models::TextToSpeechListVoicesResponse]
21
17
  #
22
- # @see Telnyx::Models::TextToSpeechGenerateSpeechParams
23
- def generate_speech(params)
24
- parsed, options = Telnyx::TextToSpeechGenerateSpeechParams.dump_request(params)
18
+ # @see Telnyx::Models::TextToSpeechListVoicesParams
19
+ def list_voices(params = {})
20
+ parsed, options = Telnyx::TextToSpeechListVoicesParams.dump_request(params)
25
21
  @client.request(
26
- method: :post,
27
- path: "text-to-speech/speech",
28
- headers: {"accept" => "audio/mpeg"},
29
- body: parsed,
30
- model: StringIO,
22
+ method: :get,
23
+ path: "text-to-speech/voices",
24
+ query: parsed,
25
+ model: Telnyx::Models::TextToSpeechListVoicesResponse,
31
26
  options: options
32
27
  )
33
28
  end
34
29
 
35
- # Returns a list of voices that can be used with the text to speech commands.
30
+ # Some parameter documentations has been truncated, see
31
+ # {Telnyx::Models::TextToSpeechStreamParams} for more details.
36
32
  #
37
- # @overload list_voices(elevenlabs_api_key_ref: nil, provider: nil, request_options: {})
33
+ # Open a WebSocket connection to stream text and receive synthesized audio in real
34
+ # time. Authentication is provided via the standard
35
+ # `Authorization: Bearer <API_KEY>` header. Send JSON frames with text to
36
+ # synthesize; receive JSON frames containing base64-encoded audio chunks.
38
37
  #
39
- # @param elevenlabs_api_key_ref [String] Reference to your ElevenLabs API key stored in the Telnyx Portal
38
+ # Supported providers: `aws`, `telnyx`, `azure`, `murfai`, `minimax`, `rime`,
39
+ # `resemble`, `elevenlabs`.
40
40
  #
41
- # @param provider [Symbol, Telnyx::Models::TextToSpeechListVoicesParams::Provider] Filter voices by provider
41
+ # **Connection flow:**
42
+ #
43
+ # 1. Open WebSocket with query parameters specifying provider, voice, and model.
44
+ # 2. Send an initial handshake message `{"text": " "}` (single space) with
45
+ # optional `voice_settings` to initialize the session.
46
+ # 3. Send text messages as `{"text": "Hello world"}`.
47
+ # 4. Receive audio chunks as JSON frames with base64-encoded audio.
48
+ # 5. A final frame with `isFinal: true` indicates the end of audio for the current
49
+ # text.
50
+ #
51
+ # To interrupt and restart synthesis mid-stream, send `{"force": true}` — the
52
+ # current worker is stopped and a new one is started.
53
+ #
54
+ # @overload stream(audio_format: nil, disable_cache: nil, model_id: nil, provider: nil, socket_id: nil, voice: nil, voice_id: nil, request_options: {})
55
+ #
56
+ # @param audio_format [Symbol, Telnyx::Models::TextToSpeechStreamParams::AudioFormat] Audio output format override. Supported for Telnyx `Natural`/`NaturalHD` models
57
+ #
58
+ # @param disable_cache [Boolean] When `true`, bypass the audio cache and generate fresh audio.
59
+ #
60
+ # @param model_id [String] Model identifier for the chosen provider. Examples: `Natural`, `NaturalHD` (Teln
61
+ #
62
+ # @param provider [Symbol, Telnyx::Models::TextToSpeechStreamParams::Provider] TTS provider. Defaults to `telnyx` if not specified. Ignored when `voice` is pro
63
+ #
64
+ # @param socket_id [String] Client-provided socket identifier for tracking. If not provided, one is generate
65
+ #
66
+ # @param voice [String] Voice identifier in the format `provider.model_id.voice_id` or `provider.voice_i
67
+ #
68
+ # @param voice_id [String] Voice identifier for the chosen provider.
42
69
  #
43
70
  # @param request_options [Telnyx::RequestOptions, Hash{Symbol=>Object}, nil]
44
71
  #
45
- # @return [Telnyx::Models::TextToSpeechListVoicesResponse]
72
+ # @return [nil]
46
73
  #
47
- # @see Telnyx::Models::TextToSpeechListVoicesParams
48
- def list_voices(params = {})
49
- parsed, options = Telnyx::TextToSpeechListVoicesParams.dump_request(params)
74
+ # @see Telnyx::Models::TextToSpeechStreamParams
75
+ def stream(params = {})
76
+ parsed, options = Telnyx::TextToSpeechStreamParams.dump_request(params)
50
77
  @client.request(
51
78
  method: :get,
52
- path: "text-to-speech/voices",
79
+ path: "text-to-speech/speech",
53
80
  query: parsed,
54
- model: Telnyx::Models::TextToSpeechListVoicesResponse,
81
+ model: NilClass,
55
82
  options: options
56
83
  )
57
84
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Telnyx
4
- VERSION = "5.43.0"
4
+ VERSION = "5.44.0"
5
5
  end
data/lib/telnyx.rb CHANGED
@@ -2036,9 +2036,9 @@ require_relative "telnyx/models/texml_application_update_params"
2036
2036
  require_relative "telnyx/models/texml_application_update_response"
2037
2037
  require_relative "telnyx/models/texml_secrets_params"
2038
2038
  require_relative "telnyx/models/texml_secrets_response"
2039
- require_relative "telnyx/models/text_to_speech_generate_speech_params"
2040
2039
  require_relative "telnyx/models/text_to_speech_list_voices_params"
2041
2040
  require_relative "telnyx/models/text_to_speech_list_voices_response"
2041
+ require_relative "telnyx/models/text_to_speech_stream_params"
2042
2042
  require_relative "telnyx/models/traffic_type"
2043
2043
  require_relative "telnyx/models/transcription"
2044
2044
  require_relative "telnyx/models/transcription_webhook_event"
@@ -0,0 +1,231 @@
1
+ # typed: strong
2
+
3
+ module Telnyx
4
+ module Models
5
+ class TextToSpeechStreamParams < Telnyx::Internal::Type::BaseModel
6
+ extend Telnyx::Internal::Type::RequestParameters::Converter
7
+ include Telnyx::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(Telnyx::TextToSpeechStreamParams, Telnyx::Internal::AnyHash)
12
+ end
13
+
14
+ # Audio output format override. Supported for Telnyx `Natural`/`NaturalHD` models
15
+ # only. Accepted values: `pcm`, `wav`.
16
+ sig do
17
+ returns(
18
+ T.nilable(Telnyx::TextToSpeechStreamParams::AudioFormat::OrSymbol)
19
+ )
20
+ end
21
+ attr_reader :audio_format
22
+
23
+ sig do
24
+ params(
25
+ audio_format: Telnyx::TextToSpeechStreamParams::AudioFormat::OrSymbol
26
+ ).void
27
+ end
28
+ attr_writer :audio_format
29
+
30
+ # When `true`, bypass the audio cache and generate fresh audio.
31
+ sig { returns(T.nilable(T::Boolean)) }
32
+ attr_reader :disable_cache
33
+
34
+ sig { params(disable_cache: T::Boolean).void }
35
+ attr_writer :disable_cache
36
+
37
+ # Model identifier for the chosen provider. Examples: `Natural`, `NaturalHD`
38
+ # (Telnyx); `Polly.Generative` (AWS).
39
+ sig { returns(T.nilable(String)) }
40
+ attr_reader :model_id
41
+
42
+ sig { params(model_id: String).void }
43
+ attr_writer :model_id
44
+
45
+ # TTS provider. Defaults to `telnyx` if not specified. Ignored when `voice` is
46
+ # provided.
47
+ sig do
48
+ returns(T.nilable(Telnyx::TextToSpeechStreamParams::Provider::OrSymbol))
49
+ end
50
+ attr_reader :provider
51
+
52
+ sig do
53
+ params(
54
+ provider: Telnyx::TextToSpeechStreamParams::Provider::OrSymbol
55
+ ).void
56
+ end
57
+ attr_writer :provider
58
+
59
+ # Client-provided socket identifier for tracking. If not provided, one is
60
+ # generated server-side.
61
+ sig { returns(T.nilable(String)) }
62
+ attr_reader :socket_id
63
+
64
+ sig { params(socket_id: String).void }
65
+ attr_writer :socket_id
66
+
67
+ # Voice identifier in the format `provider.model_id.voice_id` or
68
+ # `provider.voice_id` (e.g. `telnyx.NaturalHD.Telnyx_Alloy` or
69
+ # `azure.en-US-AvaMultilingualNeural`). When provided, the `provider`, `model_id`,
70
+ # and `voice_id` are extracted automatically. Takes precedence over individual
71
+ # `provider`/`model_id`/`voice_id` parameters.
72
+ sig { returns(T.nilable(String)) }
73
+ attr_reader :voice
74
+
75
+ sig { params(voice: String).void }
76
+ attr_writer :voice
77
+
78
+ # Voice identifier for the chosen provider.
79
+ sig { returns(T.nilable(String)) }
80
+ attr_reader :voice_id
81
+
82
+ sig { params(voice_id: String).void }
83
+ attr_writer :voice_id
84
+
85
+ sig do
86
+ params(
87
+ audio_format: Telnyx::TextToSpeechStreamParams::AudioFormat::OrSymbol,
88
+ disable_cache: T::Boolean,
89
+ model_id: String,
90
+ provider: Telnyx::TextToSpeechStreamParams::Provider::OrSymbol,
91
+ socket_id: String,
92
+ voice: String,
93
+ voice_id: String,
94
+ request_options: Telnyx::RequestOptions::OrHash
95
+ ).returns(T.attached_class)
96
+ end
97
+ def self.new(
98
+ # Audio output format override. Supported for Telnyx `Natural`/`NaturalHD` models
99
+ # only. Accepted values: `pcm`, `wav`.
100
+ audio_format: nil,
101
+ # When `true`, bypass the audio cache and generate fresh audio.
102
+ disable_cache: nil,
103
+ # Model identifier for the chosen provider. Examples: `Natural`, `NaturalHD`
104
+ # (Telnyx); `Polly.Generative` (AWS).
105
+ model_id: nil,
106
+ # TTS provider. Defaults to `telnyx` if not specified. Ignored when `voice` is
107
+ # provided.
108
+ provider: nil,
109
+ # Client-provided socket identifier for tracking. If not provided, one is
110
+ # generated server-side.
111
+ socket_id: nil,
112
+ # Voice identifier in the format `provider.model_id.voice_id` or
113
+ # `provider.voice_id` (e.g. `telnyx.NaturalHD.Telnyx_Alloy` or
114
+ # `azure.en-US-AvaMultilingualNeural`). When provided, the `provider`, `model_id`,
115
+ # and `voice_id` are extracted automatically. Takes precedence over individual
116
+ # `provider`/`model_id`/`voice_id` parameters.
117
+ voice: nil,
118
+ # Voice identifier for the chosen provider.
119
+ voice_id: nil,
120
+ request_options: {}
121
+ )
122
+ end
123
+
124
+ sig do
125
+ override.returns(
126
+ {
127
+ audio_format:
128
+ Telnyx::TextToSpeechStreamParams::AudioFormat::OrSymbol,
129
+ disable_cache: T::Boolean,
130
+ model_id: String,
131
+ provider: Telnyx::TextToSpeechStreamParams::Provider::OrSymbol,
132
+ socket_id: String,
133
+ voice: String,
134
+ voice_id: String,
135
+ request_options: Telnyx::RequestOptions
136
+ }
137
+ )
138
+ end
139
+ def to_hash
140
+ end
141
+
142
+ # Audio output format override. Supported for Telnyx `Natural`/`NaturalHD` models
143
+ # only. Accepted values: `pcm`, `wav`.
144
+ module AudioFormat
145
+ extend Telnyx::Internal::Type::Enum
146
+
147
+ TaggedSymbol =
148
+ T.type_alias do
149
+ T.all(Symbol, Telnyx::TextToSpeechStreamParams::AudioFormat)
150
+ end
151
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
152
+
153
+ PCM =
154
+ T.let(
155
+ :pcm,
156
+ Telnyx::TextToSpeechStreamParams::AudioFormat::TaggedSymbol
157
+ )
158
+ WAV =
159
+ T.let(
160
+ :wav,
161
+ Telnyx::TextToSpeechStreamParams::AudioFormat::TaggedSymbol
162
+ )
163
+
164
+ sig do
165
+ override.returns(
166
+ T::Array[
167
+ Telnyx::TextToSpeechStreamParams::AudioFormat::TaggedSymbol
168
+ ]
169
+ )
170
+ end
171
+ def self.values
172
+ end
173
+ end
174
+
175
+ # TTS provider. Defaults to `telnyx` if not specified. Ignored when `voice` is
176
+ # provided.
177
+ module Provider
178
+ extend Telnyx::Internal::Type::Enum
179
+
180
+ TaggedSymbol =
181
+ T.type_alias do
182
+ T.all(Symbol, Telnyx::TextToSpeechStreamParams::Provider)
183
+ end
184
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
185
+
186
+ AWS =
187
+ T.let(:aws, Telnyx::TextToSpeechStreamParams::Provider::TaggedSymbol)
188
+ TELNYX =
189
+ T.let(
190
+ :telnyx,
191
+ Telnyx::TextToSpeechStreamParams::Provider::TaggedSymbol
192
+ )
193
+ AZURE =
194
+ T.let(
195
+ :azure,
196
+ Telnyx::TextToSpeechStreamParams::Provider::TaggedSymbol
197
+ )
198
+ ELEVENLABS =
199
+ T.let(
200
+ :elevenlabs,
201
+ Telnyx::TextToSpeechStreamParams::Provider::TaggedSymbol
202
+ )
203
+ MINIMAX =
204
+ T.let(
205
+ :minimax,
206
+ Telnyx::TextToSpeechStreamParams::Provider::TaggedSymbol
207
+ )
208
+ MURFAI =
209
+ T.let(
210
+ :murfai,
211
+ Telnyx::TextToSpeechStreamParams::Provider::TaggedSymbol
212
+ )
213
+ RIME =
214
+ T.let(:rime, Telnyx::TextToSpeechStreamParams::Provider::TaggedSymbol)
215
+ RESEMBLE =
216
+ T.let(
217
+ :resemble,
218
+ Telnyx::TextToSpeechStreamParams::Provider::TaggedSymbol
219
+ )
220
+
221
+ sig do
222
+ override.returns(
223
+ T::Array[Telnyx::TextToSpeechStreamParams::Provider::TaggedSymbol]
224
+ )
225
+ end
226
+ def self.values
227
+ end
228
+ end
229
+ end
230
+ end
231
+ end
@@ -1648,11 +1648,10 @@ module Telnyx
1648
1648
 
1649
1649
  TexmlSecretsParams = Telnyx::Models::TexmlSecretsParams
1650
1650
 
1651
- TextToSpeechGenerateSpeechParams =
1652
- Telnyx::Models::TextToSpeechGenerateSpeechParams
1653
-
1654
1651
  TextToSpeechListVoicesParams = Telnyx::Models::TextToSpeechListVoicesParams
1655
1652
 
1653
+ TextToSpeechStreamParams = Telnyx::Models::TextToSpeechStreamParams
1654
+
1656
1655
  TrafficType = Telnyx::Models::TrafficType
1657
1656
 
1658
1657
  Transcription = Telnyx::Models::Transcription
@@ -3,34 +3,6 @@
3
3
  module Telnyx
4
4
  module Resources
5
5
  class TextToSpeech
6
- # Converts the provided text to speech using the specified voice and returns audio
7
- # data
8
- sig do
9
- params(
10
- text: String,
11
- voice: String,
12
- request_options: Telnyx::RequestOptions::OrHash
13
- ).returns(StringIO)
14
- end
15
- def generate_speech(
16
- # The text to convert to speech
17
- text:,
18
- # The voice ID in the format Provider.ModelId.VoiceId.
19
- #
20
- # Examples:
21
- #
22
- # - AWS.Polly.Joanna-Neural
23
- # - Azure.en-US-AvaMultilingualNeural
24
- # - ElevenLabs.eleven_multilingual_v2.Rachel
25
- # - Telnyx.KokoroTTS.af
26
- #
27
- # Use the `GET /text-to-speech/voices` endpoint to get a complete list of
28
- # available voices.
29
- voice:,
30
- request_options: {}
31
- )
32
- end
33
-
34
6
  # Returns a list of voices that can be used with the text to speech commands.
35
7
  sig do
36
8
  params(
@@ -48,6 +20,65 @@ module Telnyx
48
20
  )
49
21
  end
50
22
 
23
+ # Open a WebSocket connection to stream text and receive synthesized audio in real
24
+ # time. Authentication is provided via the standard
25
+ # `Authorization: Bearer <API_KEY>` header. Send JSON frames with text to
26
+ # synthesize; receive JSON frames containing base64-encoded audio chunks.
27
+ #
28
+ # Supported providers: `aws`, `telnyx`, `azure`, `murfai`, `minimax`, `rime`,
29
+ # `resemble`, `elevenlabs`.
30
+ #
31
+ # **Connection flow:**
32
+ #
33
+ # 1. Open WebSocket with query parameters specifying provider, voice, and model.
34
+ # 2. Send an initial handshake message `{"text": " "}` (single space) with
35
+ # optional `voice_settings` to initialize the session.
36
+ # 3. Send text messages as `{"text": "Hello world"}`.
37
+ # 4. Receive audio chunks as JSON frames with base64-encoded audio.
38
+ # 5. A final frame with `isFinal: true` indicates the end of audio for the current
39
+ # text.
40
+ #
41
+ # To interrupt and restart synthesis mid-stream, send `{"force": true}` — the
42
+ # current worker is stopped and a new one is started.
43
+ sig do
44
+ params(
45
+ audio_format: Telnyx::TextToSpeechStreamParams::AudioFormat::OrSymbol,
46
+ disable_cache: T::Boolean,
47
+ model_id: String,
48
+ provider: Telnyx::TextToSpeechStreamParams::Provider::OrSymbol,
49
+ socket_id: String,
50
+ voice: String,
51
+ voice_id: String,
52
+ request_options: Telnyx::RequestOptions::OrHash
53
+ ).void
54
+ end
55
+ def stream(
56
+ # Audio output format override. Supported for Telnyx `Natural`/`NaturalHD` models
57
+ # only. Accepted values: `pcm`, `wav`.
58
+ audio_format: nil,
59
+ # When `true`, bypass the audio cache and generate fresh audio.
60
+ disable_cache: nil,
61
+ # Model identifier for the chosen provider. Examples: `Natural`, `NaturalHD`
62
+ # (Telnyx); `Polly.Generative` (AWS).
63
+ model_id: nil,
64
+ # TTS provider. Defaults to `telnyx` if not specified. Ignored when `voice` is
65
+ # provided.
66
+ provider: nil,
67
+ # Client-provided socket identifier for tracking. If not provided, one is
68
+ # generated server-side.
69
+ socket_id: nil,
70
+ # Voice identifier in the format `provider.model_id.voice_id` or
71
+ # `provider.voice_id` (e.g. `telnyx.NaturalHD.Telnyx_Alloy` or
72
+ # `azure.en-US-AvaMultilingualNeural`). When provided, the `provider`, `model_id`,
73
+ # and `voice_id` are extracted automatically. Takes precedence over individual
74
+ # `provider`/`model_id`/`voice_id` parameters.
75
+ voice: nil,
76
+ # Voice identifier for the chosen provider.
77
+ voice_id: nil,
78
+ request_options: {}
79
+ )
80
+ end
81
+
51
82
  # @api private
52
83
  sig { params(client: Telnyx::Client).returns(T.attached_class) }
53
84
  def self.new(client:)
@@ -0,0 +1,110 @@
1
+ module Telnyx
2
+ module Models
3
+ type text_to_speech_stream_params =
4
+ {
5
+ audio_format: Telnyx::Models::TextToSpeechStreamParams::audio_format,
6
+ disable_cache: bool,
7
+ model_id: String,
8
+ provider: Telnyx::Models::TextToSpeechStreamParams::provider,
9
+ socket_id: String,
10
+ voice: String,
11
+ voice_id: String
12
+ }
13
+ & Telnyx::Internal::Type::request_parameters
14
+
15
+ class TextToSpeechStreamParams < Telnyx::Internal::Type::BaseModel
16
+ extend Telnyx::Internal::Type::RequestParameters::Converter
17
+ include Telnyx::Internal::Type::RequestParameters
18
+
19
+ attr_reader audio_format: Telnyx::Models::TextToSpeechStreamParams::audio_format?
20
+
21
+ def audio_format=: (
22
+ Telnyx::Models::TextToSpeechStreamParams::audio_format
23
+ ) -> Telnyx::Models::TextToSpeechStreamParams::audio_format
24
+
25
+ attr_reader disable_cache: bool?
26
+
27
+ def disable_cache=: (bool) -> bool
28
+
29
+ attr_reader model_id: String?
30
+
31
+ def model_id=: (String) -> String
32
+
33
+ attr_reader provider: Telnyx::Models::TextToSpeechStreamParams::provider?
34
+
35
+ def provider=: (
36
+ Telnyx::Models::TextToSpeechStreamParams::provider
37
+ ) -> Telnyx::Models::TextToSpeechStreamParams::provider
38
+
39
+ attr_reader socket_id: String?
40
+
41
+ def socket_id=: (String) -> String
42
+
43
+ attr_reader voice: String?
44
+
45
+ def voice=: (String) -> String
46
+
47
+ attr_reader voice_id: String?
48
+
49
+ def voice_id=: (String) -> String
50
+
51
+ def initialize: (
52
+ ?audio_format: Telnyx::Models::TextToSpeechStreamParams::audio_format,
53
+ ?disable_cache: bool,
54
+ ?model_id: String,
55
+ ?provider: Telnyx::Models::TextToSpeechStreamParams::provider,
56
+ ?socket_id: String,
57
+ ?voice: String,
58
+ ?voice_id: String,
59
+ ?request_options: Telnyx::request_opts
60
+ ) -> void
61
+
62
+ def to_hash: -> {
63
+ audio_format: Telnyx::Models::TextToSpeechStreamParams::audio_format,
64
+ disable_cache: bool,
65
+ model_id: String,
66
+ provider: Telnyx::Models::TextToSpeechStreamParams::provider,
67
+ socket_id: String,
68
+ voice: String,
69
+ voice_id: String,
70
+ request_options: Telnyx::RequestOptions
71
+ }
72
+
73
+ type audio_format = :pcm | :wav
74
+
75
+ module AudioFormat
76
+ extend Telnyx::Internal::Type::Enum
77
+
78
+ PCM: :pcm
79
+ WAV: :wav
80
+
81
+ def self?.values: -> ::Array[Telnyx::Models::TextToSpeechStreamParams::audio_format]
82
+ end
83
+
84
+ type provider =
85
+ :aws
86
+ | :telnyx
87
+ | :azure
88
+ | :elevenlabs
89
+ | :minimax
90
+ | :murfai
91
+ | :rime
92
+ | :resemble
93
+
94
+ module Provider
95
+ extend Telnyx::Internal::Type::Enum
96
+
97
+ AWS: :aws
98
+ TELNYX: :telnyx
99
+ AZURE: :azure
100
+ ELEVENLABS: :elevenlabs
101
+ MINIMAX: :minimax
102
+ MURFAI: :murfai
103
+ RIME: :rime
104
+ RESEMBLE: :resemble
105
+
106
+ def self?.values: -> ::Array[Telnyx::Models::TextToSpeechStreamParams::provider]
107
+ end
108
+ end
109
+ end
110
+ end
@@ -1431,10 +1431,10 @@ module Telnyx
1431
1431
 
1432
1432
  class TexmlSecretsParams = Telnyx::Models::TexmlSecretsParams
1433
1433
 
1434
- class TextToSpeechGenerateSpeechParams = Telnyx::Models::TextToSpeechGenerateSpeechParams
1435
-
1436
1434
  class TextToSpeechListVoicesParams = Telnyx::Models::TextToSpeechListVoicesParams
1437
1435
 
1436
+ class TextToSpeechStreamParams = Telnyx::Models::TextToSpeechStreamParams
1437
+
1438
1438
  module TrafficType = Telnyx::Models::TrafficType
1439
1439
 
1440
1440
  class Transcription = Telnyx::Models::Transcription
@@ -1,18 +1,23 @@
1
1
  module Telnyx
2
2
  module Resources
3
3
  class TextToSpeech
4
- def generate_speech: (
5
- text: String,
6
- voice: String,
7
- ?request_options: Telnyx::request_opts
8
- ) -> StringIO
9
-
10
4
  def list_voices: (
11
5
  ?elevenlabs_api_key_ref: String,
12
6
  ?provider: Telnyx::Models::TextToSpeechListVoicesParams::provider,
13
7
  ?request_options: Telnyx::request_opts
14
8
  ) -> Telnyx::Models::TextToSpeechListVoicesResponse
15
9
 
10
+ def stream: (
11
+ ?audio_format: Telnyx::Models::TextToSpeechStreamParams::audio_format,
12
+ ?disable_cache: bool,
13
+ ?model_id: String,
14
+ ?provider: Telnyx::Models::TextToSpeechStreamParams::provider,
15
+ ?socket_id: String,
16
+ ?voice: String,
17
+ ?voice_id: String,
18
+ ?request_options: Telnyx::request_opts
19
+ ) -> nil
20
+
16
21
  def initialize: (client: Telnyx::Client) -> void
17
22
  end
18
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telnyx
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.43.0
4
+ version: 5.44.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Telnyx
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-25 00:00:00.000000000 Z
11
+ date: 2026-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cgi
@@ -2053,9 +2053,9 @@ files:
2053
2053
  - lib/telnyx/models/texml_application_update_response.rb
2054
2054
  - lib/telnyx/models/texml_secrets_params.rb
2055
2055
  - lib/telnyx/models/texml_secrets_response.rb
2056
- - lib/telnyx/models/text_to_speech_generate_speech_params.rb
2057
2056
  - lib/telnyx/models/text_to_speech_list_voices_params.rb
2058
2057
  - lib/telnyx/models/text_to_speech_list_voices_response.rb
2058
+ - lib/telnyx/models/text_to_speech_stream_params.rb
2059
2059
  - lib/telnyx/models/traffic_type.rb
2060
2060
  - lib/telnyx/models/transcription.rb
2061
2061
  - lib/telnyx/models/transcription_webhook_event.rb
@@ -4475,9 +4475,9 @@ files:
4475
4475
  - rbi/telnyx/models/texml_application_update_response.rbi
4476
4476
  - rbi/telnyx/models/texml_secrets_params.rbi
4477
4477
  - rbi/telnyx/models/texml_secrets_response.rbi
4478
- - rbi/telnyx/models/text_to_speech_generate_speech_params.rbi
4479
4478
  - rbi/telnyx/models/text_to_speech_list_voices_params.rbi
4480
4479
  - rbi/telnyx/models/text_to_speech_list_voices_response.rbi
4480
+ - rbi/telnyx/models/text_to_speech_stream_params.rbi
4481
4481
  - rbi/telnyx/models/traffic_type.rbi
4482
4482
  - rbi/telnyx/models/transcription.rbi
4483
4483
  - rbi/telnyx/models/transcription_webhook_event.rbi
@@ -6896,9 +6896,9 @@ files:
6896
6896
  - sig/telnyx/models/texml_application_update_response.rbs
6897
6897
  - sig/telnyx/models/texml_secrets_params.rbs
6898
6898
  - sig/telnyx/models/texml_secrets_response.rbs
6899
- - sig/telnyx/models/text_to_speech_generate_speech_params.rbs
6900
6899
  - sig/telnyx/models/text_to_speech_list_voices_params.rbs
6901
6900
  - sig/telnyx/models/text_to_speech_list_voices_response.rbs
6901
+ - sig/telnyx/models/text_to_speech_stream_params.rbs
6902
6902
  - sig/telnyx/models/traffic_type.rbs
6903
6903
  - sig/telnyx/models/transcription.rbs
6904
6904
  - sig/telnyx/models/transcription_webhook_event.rbs
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Telnyx
4
- module Models
5
- # @see Telnyx::Resources::TextToSpeech#generate_speech
6
- class TextToSpeechGenerateSpeechParams < Telnyx::Internal::Type::BaseModel
7
- extend Telnyx::Internal::Type::RequestParameters::Converter
8
- include Telnyx::Internal::Type::RequestParameters
9
-
10
- # @!attribute text
11
- # The text to convert to speech
12
- #
13
- # @return [String]
14
- required :text, String
15
-
16
- # @!attribute voice
17
- # The voice ID in the format Provider.ModelId.VoiceId.
18
- #
19
- # Examples:
20
- #
21
- # - AWS.Polly.Joanna-Neural
22
- # - Azure.en-US-AvaMultilingualNeural
23
- # - ElevenLabs.eleven_multilingual_v2.Rachel
24
- # - Telnyx.KokoroTTS.af
25
- #
26
- # Use the `GET /text-to-speech/voices` endpoint to get a complete list of
27
- # available voices.
28
- #
29
- # @return [String]
30
- required :voice, String
31
-
32
- # @!method initialize(text:, voice:, request_options: {})
33
- # Some parameter documentations has been truncated, see
34
- # {Telnyx::Models::TextToSpeechGenerateSpeechParams} for more details.
35
- #
36
- # @param text [String] The text to convert to speech
37
- #
38
- # @param voice [String] The voice ID in the format Provider.ModelId.VoiceId.
39
- #
40
- # @param request_options [Telnyx::RequestOptions, Hash{Symbol=>Object}]
41
- end
42
- end
43
- end
@@ -1,74 +0,0 @@
1
- # typed: strong
2
-
3
- module Telnyx
4
- module Models
5
- class TextToSpeechGenerateSpeechParams < Telnyx::Internal::Type::BaseModel
6
- extend Telnyx::Internal::Type::RequestParameters::Converter
7
- include Telnyx::Internal::Type::RequestParameters
8
-
9
- OrHash =
10
- T.type_alias do
11
- T.any(
12
- Telnyx::TextToSpeechGenerateSpeechParams,
13
- Telnyx::Internal::AnyHash
14
- )
15
- end
16
-
17
- # The text to convert to speech
18
- sig { returns(String) }
19
- attr_accessor :text
20
-
21
- # The voice ID in the format Provider.ModelId.VoiceId.
22
- #
23
- # Examples:
24
- #
25
- # - AWS.Polly.Joanna-Neural
26
- # - Azure.en-US-AvaMultilingualNeural
27
- # - ElevenLabs.eleven_multilingual_v2.Rachel
28
- # - Telnyx.KokoroTTS.af
29
- #
30
- # Use the `GET /text-to-speech/voices` endpoint to get a complete list of
31
- # available voices.
32
- sig { returns(String) }
33
- attr_accessor :voice
34
-
35
- sig do
36
- params(
37
- text: String,
38
- voice: String,
39
- request_options: Telnyx::RequestOptions::OrHash
40
- ).returns(T.attached_class)
41
- end
42
- def self.new(
43
- # The text to convert to speech
44
- text:,
45
- # The voice ID in the format Provider.ModelId.VoiceId.
46
- #
47
- # Examples:
48
- #
49
- # - AWS.Polly.Joanna-Neural
50
- # - Azure.en-US-AvaMultilingualNeural
51
- # - ElevenLabs.eleven_multilingual_v2.Rachel
52
- # - Telnyx.KokoroTTS.af
53
- #
54
- # Use the `GET /text-to-speech/voices` endpoint to get a complete list of
55
- # available voices.
56
- voice:,
57
- request_options: {}
58
- )
59
- end
60
-
61
- sig do
62
- override.returns(
63
- {
64
- text: String,
65
- voice: String,
66
- request_options: Telnyx::RequestOptions
67
- }
68
- )
69
- end
70
- def to_hash
71
- end
72
- end
73
- end
74
- end
@@ -1,28 +0,0 @@
1
- module Telnyx
2
- module Models
3
- type text_to_speech_generate_speech_params =
4
- { text: String, voice: String }
5
- & Telnyx::Internal::Type::request_parameters
6
-
7
- class TextToSpeechGenerateSpeechParams < Telnyx::Internal::Type::BaseModel
8
- extend Telnyx::Internal::Type::RequestParameters::Converter
9
- include Telnyx::Internal::Type::RequestParameters
10
-
11
- attr_accessor text: String
12
-
13
- attr_accessor voice: String
14
-
15
- def initialize: (
16
- text: String,
17
- voice: String,
18
- ?request_options: Telnyx::request_opts
19
- ) -> void
20
-
21
- def to_hash: -> {
22
- text: String,
23
- voice: String,
24
- request_options: Telnyx::RequestOptions
25
- }
26
- end
27
- end
28
- end