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.
Files changed (51) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/client.d.mts +3 -3
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +3 -3
  5. package/client.d.ts.map +1 -1
  6. package/client.js +2 -2
  7. package/client.js.map +1 -1
  8. package/client.mjs +2 -2
  9. package/client.mjs.map +1 -1
  10. package/internal/tslib.js +17 -17
  11. package/internal/utils/query.d.mts +2 -0
  12. package/internal/utils/query.d.mts.map +1 -0
  13. package/internal/utils/query.d.ts +2 -0
  14. package/internal/utils/query.d.ts.map +1 -0
  15. package/internal/utils/query.js +10 -0
  16. package/internal/utils/query.js.map +1 -0
  17. package/internal/utils/query.mjs +6 -0
  18. package/internal/utils/query.mjs.map +1 -0
  19. package/internal/utils.d.mts +1 -0
  20. package/internal/utils.d.ts +1 -0
  21. package/internal/utils.js +1 -0
  22. package/internal/utils.js.map +1 -1
  23. package/internal/utils.mjs +1 -0
  24. package/package.json +1 -1
  25. package/resources/conferences/actions.d.mts +0 -5
  26. package/resources/conferences/actions.d.mts.map +1 -1
  27. package/resources/conferences/actions.d.ts +0 -5
  28. package/resources/conferences/actions.d.ts.map +1 -1
  29. package/resources/index.d.mts +1 -1
  30. package/resources/index.d.mts.map +1 -1
  31. package/resources/index.d.ts +1 -1
  32. package/resources/index.d.ts.map +1 -1
  33. package/resources/text-to-speech.d.mts +26 -62
  34. package/resources/text-to-speech.d.mts.map +1 -1
  35. package/resources/text-to-speech.d.ts +26 -62
  36. package/resources/text-to-speech.d.ts.map +1 -1
  37. package/resources/text-to-speech.js +12 -29
  38. package/resources/text-to-speech.js.map +1 -1
  39. package/resources/text-to-speech.mjs +12 -29
  40. package/resources/text-to-speech.mjs.map +1 -1
  41. package/src/client.ts +7 -7
  42. package/src/internal/utils/query.ts +7 -0
  43. package/src/internal/utils.ts +1 -0
  44. package/src/resources/conferences/actions.ts +0 -6
  45. package/src/resources/index.ts +1 -1
  46. package/src/resources/text-to-speech.ts +34 -77
  47. package/src/version.ts +1 -1
  48. package/version.d.mts +1 -1
  49. package/version.d.ts +1 -1
  50. package/version.js +1 -1
  51. package/version.mjs +1 -1
@@ -6,6 +6,19 @@ import { buildHeaders } from '../internal/headers';
6
6
  import { RequestOptions } from '../internal/request-options';
7
7
 
8
8
  export class TextToSpeech extends APIResource {
9
+ /**
10
+ * Converts the provided text to speech using the specified voice and returns audio
11
+ * data
12
+ */
13
+ generateSpeech(body: TextToSpeechGenerateSpeechParams, options?: RequestOptions): APIPromise<Response> {
14
+ return this._client.post('/text-to-speech/speech', {
15
+ body,
16
+ ...options,
17
+ headers: buildHeaders([{ Accept: 'audio/mpeg' }, options?.headers]),
18
+ __binaryResponse: true,
19
+ });
20
+ }
21
+
9
22
  /**
10
23
  * Returns a list of voices that can be used with the text to speech commands.
11
24
  */
@@ -15,39 +28,6 @@ export class TextToSpeech extends APIResource {
15
28
  ): APIPromise<TextToSpeechListVoicesResponse> {
16
29
  return this._client.get('/text-to-speech/voices', { query, ...options });
17
30
  }
18
-
19
- /**
20
- * Open a WebSocket connection to stream text and receive synthesized audio in real
21
- * time. Authentication is provided via the standard
22
- * `Authorization: Bearer <API_KEY>` header. Send JSON frames with text to
23
- * synthesize; receive JSON frames containing base64-encoded audio chunks.
24
- *
25
- * Supported providers: `aws`, `telnyx`, `azure`, `murfai`, `minimax`, `rime`,
26
- * `resemble`, `elevenlabs`.
27
- *
28
- * **Connection flow:**
29
- *
30
- * 1. Open WebSocket with query parameters specifying provider, voice, and model.
31
- * 2. Send an initial handshake message `{"text": " "}` (single space) with
32
- * optional `voice_settings` to initialize the session.
33
- * 3. Send text messages as `{"text": "Hello world"}`.
34
- * 4. Receive audio chunks as JSON frames with base64-encoded audio.
35
- * 5. A final frame with `isFinal: true` indicates the end of audio for the current
36
- * text.
37
- *
38
- * To interrupt and restart synthesis mid-stream, send `{"force": true}` — the
39
- * current worker is stopped and a new one is started.
40
- */
41
- stream(
42
- query: TextToSpeechStreamParams | null | undefined = {},
43
- options?: RequestOptions,
44
- ): APIPromise<void> {
45
- return this._client.get('/text-to-speech/speech', {
46
- query,
47
- ...options,
48
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
49
- });
50
- }
51
31
  }
52
32
 
53
33
  export interface TextToSpeechListVoicesResponse {
@@ -74,67 +54,44 @@ export namespace TextToSpeechListVoicesResponse {
74
54
  }
75
55
  }
76
56
 
77
- export interface TextToSpeechListVoicesParams {
57
+ export interface TextToSpeechGenerateSpeechParams {
78
58
  /**
79
- * Reference to your ElevenLabs API key stored in the Telnyx Portal
59
+ * The text to convert to speech
80
60
  */
81
- elevenlabs_api_key_ref?: string;
61
+ text: string;
82
62
 
83
63
  /**
84
- * Filter voices by provider
64
+ * The voice ID in the format Provider.ModelId.VoiceId.
65
+ *
66
+ * Examples:
67
+ *
68
+ * - AWS.Polly.Joanna-Neural
69
+ * - Azure.en-US-AvaMultilingualNeural
70
+ * - ElevenLabs.eleven_multilingual_v2.Rachel
71
+ * - Telnyx.KokoroTTS.af
72
+ *
73
+ * Use the `GET /text-to-speech/voices` endpoint to get a complete list of
74
+ * available voices.
85
75
  */
86
- provider?: 'aws' | 'azure' | 'elevenlabs' | 'telnyx';
76
+ voice: string;
87
77
  }
88
78
 
89
- export interface TextToSpeechStreamParams {
90
- /**
91
- * Audio output format override. Supported for Telnyx `Natural`/`NaturalHD` models
92
- * only. Accepted values: `pcm`, `wav`.
93
- */
94
- audio_format?: 'pcm' | 'wav';
95
-
96
- /**
97
- * When `true`, bypass the audio cache and generate fresh audio.
98
- */
99
- disable_cache?: boolean;
100
-
101
- /**
102
- * Model identifier for the chosen provider. Examples: `Natural`, `NaturalHD`
103
- * (Telnyx); `Polly.Generative` (AWS).
104
- */
105
- model_id?: string;
106
-
107
- /**
108
- * TTS provider. Defaults to `telnyx` if not specified. Ignored when `voice` is
109
- * provided.
110
- */
111
- provider?: 'aws' | 'telnyx' | 'azure' | 'elevenlabs' | 'minimax' | 'murfai' | 'rime' | 'resemble';
112
-
113
- /**
114
- * Client-provided socket identifier for tracking. If not provided, one is
115
- * generated server-side.
116
- */
117
- socket_id?: string;
118
-
79
+ export interface TextToSpeechListVoicesParams {
119
80
  /**
120
- * Voice identifier in the format `provider.model_id.voice_id` or
121
- * `provider.voice_id` (e.g. `telnyx.NaturalHD.Telnyx_Alloy` or
122
- * `azure.en-US-AvaMultilingualNeural`). When provided, the `provider`, `model_id`,
123
- * and `voice_id` are extracted automatically. Takes precedence over individual
124
- * `provider`/`model_id`/`voice_id` parameters.
81
+ * Reference to your ElevenLabs API key stored in the Telnyx Portal
125
82
  */
126
- voice?: string;
83
+ elevenlabs_api_key_ref?: string;
127
84
 
128
85
  /**
129
- * Voice identifier for the chosen provider.
86
+ * Filter voices by provider
130
87
  */
131
- voice_id?: string;
88
+ provider?: 'aws' | 'azure' | 'elevenlabs' | 'telnyx';
132
89
  }
133
90
 
134
91
  export declare namespace TextToSpeech {
135
92
  export {
136
93
  type TextToSpeechListVoicesResponse as TextToSpeechListVoicesResponse,
94
+ type TextToSpeechGenerateSpeechParams as TextToSpeechGenerateSpeechParams,
137
95
  type TextToSpeechListVoicesParams as TextToSpeechListVoicesParams,
138
- type TextToSpeechStreamParams as TextToSpeechStreamParams,
139
96
  };
140
97
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '5.43.0'; // x-release-please-version
1
+ export const VERSION = '5.44.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "5.43.0";
1
+ export declare const VERSION = "5.44.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "5.43.0";
1
+ export declare const VERSION = "5.44.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '5.43.0'; // x-release-please-version
4
+ exports.VERSION = '5.44.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '5.43.0'; // x-release-please-version
1
+ export const VERSION = '5.44.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map