telnyx 6.71.0 → 6.72.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 (111) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/client.d.mts +8 -8
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +8 -8
  5. package/client.d.ts.map +1 -1
  6. package/client.js +6 -6
  7. package/client.js.map +1 -1
  8. package/client.mjs +6 -6
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/ai/ai.d.mts +1 -1
  12. package/resources/ai/ai.d.mts.map +1 -1
  13. package/resources/ai/ai.d.ts +1 -1
  14. package/resources/ai/ai.d.ts.map +1 -1
  15. package/resources/ai/ai.js +2 -2
  16. package/resources/ai/ai.js.map +1 -1
  17. package/resources/ai/ai.mjs +2 -2
  18. package/resources/ai/ai.mjs.map +1 -1
  19. package/resources/index.d.mts +2 -2
  20. package/resources/index.d.mts.map +1 -1
  21. package/resources/index.d.ts +2 -2
  22. package/resources/index.d.ts.map +1 -1
  23. package/resources/index.js.map +1 -1
  24. package/resources/index.mjs.map +1 -1
  25. package/resources/speech-to-text/index.d.mts +3 -3
  26. package/resources/speech-to-text/index.d.mts.map +1 -1
  27. package/resources/speech-to-text/index.d.ts +3 -3
  28. package/resources/speech-to-text/index.d.ts.map +1 -1
  29. package/resources/speech-to-text/index.js +1 -5
  30. package/resources/speech-to-text/index.js.map +1 -1
  31. package/resources/speech-to-text/index.mjs +0 -2
  32. package/resources/speech-to-text/index.mjs.map +1 -1
  33. package/resources/speech-to-text/internal-base.d.mts +42 -11
  34. package/resources/speech-to-text/internal-base.d.mts.map +1 -1
  35. package/resources/speech-to-text/internal-base.d.ts +42 -11
  36. package/resources/speech-to-text/internal-base.d.ts.map +1 -1
  37. package/resources/speech-to-text/internal-base.js +5 -9
  38. package/resources/speech-to-text/internal-base.js.map +1 -1
  39. package/resources/speech-to-text/internal-base.mjs +5 -9
  40. package/resources/speech-to-text/internal-base.mjs.map +1 -1
  41. package/resources/speech-to-text/speech-to-text.d.mts +79 -100
  42. package/resources/speech-to-text/speech-to-text.d.mts.map +1 -1
  43. package/resources/speech-to-text/speech-to-text.d.ts +79 -100
  44. package/resources/speech-to-text/speech-to-text.d.ts.map +1 -1
  45. package/resources/speech-to-text/speech-to-text.js +16 -19
  46. package/resources/speech-to-text/speech-to-text.js.map +1 -1
  47. package/resources/speech-to-text/speech-to-text.mjs +16 -19
  48. package/resources/speech-to-text/speech-to-text.mjs.map +1 -1
  49. package/resources/speech-to-text/ws-base.d.mts +106 -0
  50. package/resources/speech-to-text/ws-base.d.mts.map +1 -0
  51. package/resources/speech-to-text/ws-base.d.ts +106 -0
  52. package/resources/speech-to-text/ws-base.d.ts.map +1 -0
  53. package/resources/speech-to-text/ws-base.js +476 -0
  54. package/resources/speech-to-text/ws-base.js.map +1 -0
  55. package/resources/speech-to-text/ws-base.mjs +472 -0
  56. package/resources/speech-to-text/ws-base.mjs.map +1 -0
  57. package/resources/speech-to-text/ws.d.mts +9 -28
  58. package/resources/speech-to-text/ws.d.mts.map +1 -1
  59. package/resources/speech-to-text/ws.d.ts +9 -28
  60. package/resources/speech-to-text/ws.d.ts.map +1 -1
  61. package/resources/speech-to-text/ws.js +17 -97
  62. package/resources/speech-to-text/ws.js.map +1 -1
  63. package/resources/speech-to-text/ws.mjs +17 -97
  64. package/resources/speech-to-text/ws.mjs.map +1 -1
  65. package/resources/speech-to-text.d.mts +1 -80
  66. package/resources/speech-to-text.d.mts.map +1 -1
  67. package/resources/speech-to-text.d.ts +1 -80
  68. package/resources/speech-to-text.d.ts.map +1 -1
  69. package/resources/speech-to-text.js +2 -32
  70. package/resources/speech-to-text.js.map +1 -1
  71. package/resources/speech-to-text.mjs +1 -30
  72. package/resources/speech-to-text.mjs.map +1 -1
  73. package/resources/texml/accounts/calls/calls.d.mts +31 -465
  74. package/resources/texml/accounts/calls/calls.d.mts.map +1 -1
  75. package/resources/texml/accounts/calls/calls.d.ts +31 -465
  76. package/resources/texml/accounts/calls/calls.d.ts.map +1 -1
  77. package/resources/texml/accounts/calls/calls.js +7 -1
  78. package/resources/texml/accounts/calls/calls.js.map +1 -1
  79. package/resources/texml/accounts/calls/calls.mjs +7 -1
  80. package/resources/texml/accounts/calls/calls.mjs.map +1 -1
  81. package/resources/text-to-speech/index.d.mts +1 -1
  82. package/resources/text-to-speech/index.d.mts.map +1 -1
  83. package/resources/text-to-speech/index.d.ts +1 -1
  84. package/resources/text-to-speech/index.d.ts.map +1 -1
  85. package/resources/text-to-speech/index.js.map +1 -1
  86. package/resources/text-to-speech/index.mjs.map +1 -1
  87. package/resources/text-to-speech/text-to-speech.d.mts +79 -13
  88. package/resources/text-to-speech/text-to-speech.d.mts.map +1 -1
  89. package/resources/text-to-speech/text-to-speech.d.ts +79 -13
  90. package/resources/text-to-speech/text-to-speech.d.ts.map +1 -1
  91. package/resources/text-to-speech/text-to-speech.js +33 -1
  92. package/resources/text-to-speech/text-to-speech.js.map +1 -1
  93. package/resources/text-to-speech/text-to-speech.mjs +33 -1
  94. package/resources/text-to-speech/text-to-speech.mjs.map +1 -1
  95. package/src/client.ts +26 -20
  96. package/src/resources/ai/ai.ts +3 -3
  97. package/src/resources/index.ts +5 -2
  98. package/src/resources/speech-to-text/index.ts +6 -9
  99. package/src/resources/speech-to-text/internal-base.ts +49 -22
  100. package/src/resources/speech-to-text/speech-to-text.ts +102 -128
  101. package/src/resources/speech-to-text/ws-base.ts +619 -0
  102. package/src/resources/speech-to-text/ws.ts +26 -111
  103. package/src/resources/speech-to-text.ts +1 -112
  104. package/src/resources/texml/accounts/calls/calls.ts +36 -564
  105. package/src/resources/text-to-speech/index.ts +3 -2
  106. package/src/resources/text-to-speech/text-to-speech.ts +100 -16
  107. package/src/version.ts +1 -1
  108. package/version.d.mts +1 -1
  109. package/version.d.ts +1 -1
  110. package/version.js +1 -1
  111. package/version.mjs +1 -1
package/src/client.ts CHANGED
@@ -819,11 +819,6 @@ import {
819
819
  SiprecConnectorUpdateResponse,
820
820
  SiprecConnectors,
821
821
  } from './resources/siprec-connectors';
822
- import {
823
- SpeechToText,
824
- SpeechToTextListProvidersParams,
825
- SpeechToTextListProvidersResponse,
826
- } from './resources/speech-to-text';
827
822
  import {
828
823
  SubNumberOrder,
829
824
  SubNumberOrderCancelResponse,
@@ -1536,6 +1531,13 @@ import {
1536
1531
  SimCardUpdateResponse,
1537
1532
  SimCards,
1538
1533
  } from './resources/sim-cards/sim-cards';
1534
+ import {
1535
+ SpeechToText,
1536
+ SpeechToTextListProvidersParams,
1537
+ SpeechToTextListProvidersResponse,
1538
+ TranscribeClientEvent,
1539
+ TranscribeServerEvent,
1540
+ } from './resources/speech-to-text/speech-to-text';
1539
1541
  import { Storage, StorageListMigrationSourceCoverageResponse } from './resources/storage/storage';
1540
1542
  import { TermsOfService } from './resources/terms-of-service/terms-of-service';
1541
1543
  import {
@@ -1549,8 +1551,9 @@ import {
1549
1551
  StreamClientEvent,
1550
1552
  StreamServerEvent,
1551
1553
  TextToSpeech,
1552
- TextToSpeechGenerateParams,
1553
- TextToSpeechGenerateResponse,
1554
+ TextToSpeechCreateSpeechParams,
1555
+ TextToSpeechCreateSpeechResponse,
1556
+ TextToSpeechGenerateSpeechParams,
1554
1557
  TextToSpeechListVoicesParams,
1555
1558
  TextToSpeechListVoicesResponse,
1556
1559
  } from './resources/text-to-speech/text-to-speech';
@@ -2791,6 +2794,10 @@ export class Telnyx {
2791
2794
  */
2792
2795
  regulatoryRequirements: API.RegulatoryRequirements = new API.RegulatoryRequirements(this);
2793
2796
  reports: API.Reports = new API.Reports(this);
2797
+ /**
2798
+ * Discover available speech-to-text providers, models, and supported languages.
2799
+ */
2800
+ speechToText: API.SpeechToText = new API.SpeechToText(this);
2794
2801
  /**
2795
2802
  * Requirement Groups
2796
2803
  */
@@ -2984,10 +2991,6 @@ export class Telnyx {
2984
2991
  * UAC connection operations
2985
2992
  */
2986
2993
  uacConnections: API.UacConnections = new API.UacConnections(this);
2987
- /**
2988
- * Discover available speech-to-text providers, models, and supported languages.
2989
- */
2990
- speechToText: API.SpeechToText = new API.SpeechToText(this);
2991
2994
  /**
2992
2995
  * Retrieve raw Voice SDK call report stats payloads for WebRTC call troubleshooting.
2993
2996
  */
@@ -3102,6 +3105,7 @@ Telnyx.Recordings = Recordings;
3102
3105
  Telnyx.Regions = Regions;
3103
3106
  Telnyx.RegulatoryRequirements = RegulatoryRequirements;
3104
3107
  Telnyx.Reports = Reports;
3108
+ Telnyx.SpeechToText = SpeechToText;
3105
3109
  Telnyx.RequirementGroups = RequirementGroups;
3106
3110
  Telnyx.RequirementTypes = RequirementTypes;
3107
3111
  Telnyx.Requirements = Requirements;
@@ -3158,7 +3162,6 @@ Telnyx.Reputation = Reputation;
3158
3162
  Telnyx.TermsOfService = TermsOfService;
3159
3163
  Telnyx.PronunciationDicts = PronunciationDicts;
3160
3164
  Telnyx.UacConnections = UacConnections;
3161
- Telnyx.SpeechToText = SpeechToText;
3162
3165
  Telnyx.VoiceSDKCallReports = VoiceSDKCallReports;
3163
3166
 
3164
3167
  export declare namespace Telnyx {
@@ -4397,6 +4400,14 @@ export declare namespace Telnyx {
4397
4400
  type ReportListWdrsParams as ReportListWdrsParams,
4398
4401
  };
4399
4402
 
4403
+ export {
4404
+ SpeechToText as SpeechToText,
4405
+ type SpeechToTextListProvidersResponse as SpeechToTextListProvidersResponse,
4406
+ type TranscribeClientEvent as TranscribeClientEvent,
4407
+ type TranscribeServerEvent as TranscribeServerEvent,
4408
+ type SpeechToTextListProvidersParams as SpeechToTextListProvidersParams,
4409
+ };
4410
+
4400
4411
  export {
4401
4412
  RequirementGroups as RequirementGroups,
4402
4413
  type RequirementGroup as RequirementGroup,
@@ -4615,11 +4626,12 @@ export declare namespace Telnyx {
4615
4626
 
4616
4627
  export {
4617
4628
  TextToSpeech as TextToSpeech,
4618
- type TextToSpeechGenerateResponse as TextToSpeechGenerateResponse,
4629
+ type TextToSpeechCreateSpeechResponse as TextToSpeechCreateSpeechResponse,
4619
4630
  type TextToSpeechListVoicesResponse as TextToSpeechListVoicesResponse,
4620
4631
  type StreamClientEvent as StreamClientEvent,
4621
4632
  type StreamServerEvent as StreamServerEvent,
4622
- type TextToSpeechGenerateParams as TextToSpeechGenerateParams,
4633
+ type TextToSpeechCreateSpeechParams as TextToSpeechCreateSpeechParams,
4634
+ type TextToSpeechGenerateSpeechParams as TextToSpeechGenerateSpeechParams,
4623
4635
  type TextToSpeechListVoicesParams as TextToSpeechListVoicesParams,
4624
4636
  };
4625
4637
 
@@ -4942,12 +4954,6 @@ export declare namespace Telnyx {
4942
4954
  type UacConnectionListParams as UacConnectionListParams,
4943
4955
  };
4944
4956
 
4945
- export {
4946
- SpeechToText as SpeechToText,
4947
- type SpeechToTextListProvidersResponse as SpeechToTextListProvidersResponse,
4948
- type SpeechToTextListProvidersParams as SpeechToTextListProvidersParams,
4949
- };
4950
-
4951
4957
  export {
4952
4958
  VoiceSDKCallReports as VoiceSDKCallReports,
4953
4959
  type VoiceSDKCallReportLogEntry as VoiceSDKCallReportLogEntry,
@@ -180,8 +180,8 @@ export class AI extends APIResource {
180
180
  params: AICreateResponseParams,
181
181
  options?: RequestOptions,
182
182
  ): APIPromise<AICreateResponseResponse> {
183
- const { body } = params;
184
- return this._client.post('/ai/responses', { body: body, ...options });
183
+ const { input } = params;
184
+ return this._client.post('/ai/responses', { body: input, ...options });
185
185
  }
186
186
 
187
187
  /**
@@ -374,7 +374,7 @@ export namespace AISummarizeResponse {
374
374
  }
375
375
 
376
376
  export interface AICreateResponseParams {
377
- body: { [key: string]: unknown };
377
+ input: { [key: string]: unknown };
378
378
  }
379
379
 
380
380
  export interface AISummarizeParams {
@@ -1174,6 +1174,8 @@ export {
1174
1174
  export {
1175
1175
  SpeechToText,
1176
1176
  type SpeechToTextListProvidersResponse,
1177
+ type TranscribeClientEvent,
1178
+ type TranscribeServerEvent,
1177
1179
  type SpeechToTextListProvidersParams,
1178
1180
  } from './speech-to-text';
1179
1181
  export { Storage, type StorageListMigrationSourceCoverageResponse } from './storage/storage';
@@ -1234,11 +1236,12 @@ export {
1234
1236
  } from './texml-applications';
1235
1237
  export {
1236
1238
  TextToSpeech,
1237
- type TextToSpeechGenerateResponse,
1239
+ type TextToSpeechCreateSpeechResponse,
1238
1240
  type TextToSpeechListVoicesResponse,
1239
1241
  type StreamClientEvent,
1240
1242
  type StreamServerEvent,
1241
- type TextToSpeechGenerateParams,
1243
+ type TextToSpeechCreateSpeechParams,
1244
+ type TextToSpeechGenerateSpeechParams,
1242
1245
  type TextToSpeechListVoicesParams,
1243
1246
  type TextToSpeechStreamParams,
1244
1247
  } from './text-to-speech';
@@ -2,13 +2,10 @@
2
2
 
3
3
  export {
4
4
  SpeechToText,
5
- type SpeechToTextTranscribeParams,
6
- type SpeechToTextStreamParams,
7
- type SttClientEvent,
8
- type SttServerEvent,
9
- type TranscriptFrame,
10
- type SttErrorFrame,
5
+ type SpeechToTextListProvidersResponse,
6
+ type TranscribeClientEvent,
7
+ type TranscribeServerEvent,
8
+ type SpeechToTextListProvidersParams,
11
9
  } from './speech-to-text';
12
-
13
- export { SpeechToTextWS } from './ws';
14
- export { WebSocketError } from './internal-base';
10
+ export { type SpeechToTextWSClientOptions } from './ws';
11
+ export { type SpeechToTextWSReconnectOptions } from './ws-base';
@@ -2,18 +2,32 @@
2
2
 
3
3
  import * as SpeechToTextAPI from './speech-to-text';
4
4
  import { Telnyx } from '../../client';
5
-
6
5
  import { EventEmitter } from '../../core/EventEmitter';
7
6
  import { TelnyxError } from '../../core/error';
8
- import { stringifyQuery } from '../../internal/utils';
7
+
8
+ import type { RawWebSocketData, ReconnectingEvent, UnsentMessage } from '../../internal/ws';
9
+
10
+ export type SpeechToTextStreamMessage =
11
+ | { type: 'connecting' | 'open' | 'closing' }
12
+ | {
13
+ type: 'close';
14
+ code: number;
15
+ reason: string;
16
+ unsent: UnsentMessage<SpeechToTextAPI.TranscribeClientEvent>[];
17
+ }
18
+ | { type: 'reconnecting'; reconnect: ReconnectingEvent }
19
+ | { type: 'reconnected' }
20
+ | { type: 'message'; message: SpeechToTextAPI.TranscribeServerEvent }
21
+ | { type: 'raw'; data: RawWebSocketData }
22
+ | { type: 'error'; error: WebSocketError };
9
23
 
10
24
  export class WebSocketError extends TelnyxError {
11
25
  /**
12
26
  * The error data that the API sent back in an error event.
13
27
  */
14
- error?: SpeechToTextAPI.SttServerEvent.ErrorFrame | undefined;
28
+ error?: SpeechToTextAPI.TranscribeServerEvent.SttErrorFrame | undefined;
15
29
 
16
- constructor(message: string, event: SpeechToTextAPI.SttServerEvent.ErrorFrame | null) {
30
+ constructor(message: string, event: SpeechToTextAPI.TranscribeServerEvent.SttErrorFrame | null) {
17
31
  super(message);
18
32
 
19
33
  this.error = event ?? undefined;
@@ -22,32 +36,48 @@ export class WebSocketError extends TelnyxError {
22
36
 
23
37
  type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
24
38
 
25
- type WebsocketEvents = Simplify<
39
+ type WebSocketEvents = Simplify<
26
40
  {
27
- event: (event: SpeechToTextAPI.SttServerEvent) => void;
41
+ event: (event: SpeechToTextAPI.TranscribeServerEvent) => void;
42
+ raw: (data: RawWebSocketData) => void;
28
43
  error: (error: WebSocketError) => void;
44
+ close: (
45
+ code: number,
46
+ reason: string,
47
+ unsent: UnsentMessage<SpeechToTextAPI.TranscribeClientEvent>[],
48
+ ) => void;
49
+ reconnecting: (event: ReconnectingEvent) => void;
50
+ reconnected: () => void;
29
51
  } & {
30
- [EventType in Exclude<NonNullable<SpeechToTextAPI.SttServerEvent['type']>, 'error'>]: (
31
- event: Extract<SpeechToTextAPI.SttServerEvent, { type?: EventType }>,
52
+ [EventType in Exclude<NonNullable<SpeechToTextAPI.TranscribeServerEvent['type']>, 'error'>]: (
53
+ event: Extract<SpeechToTextAPI.TranscribeServerEvent, { type?: EventType }>,
32
54
  ) => unknown;
33
55
  }
34
56
  >;
35
57
 
36
- export abstract class SpeechToTextEmitter extends EventEmitter<WebsocketEvents> {
58
+ export abstract class SpeechToTextEmitter extends EventEmitter<WebSocketEvents> {
59
+ /**
60
+ * Send an event to the API.
61
+ */
62
+ abstract send(event: SpeechToTextAPI.TranscribeClientEvent): void;
63
+
37
64
  /**
38
- * Send binary audio data to the API.
65
+ * Send raw data over the WebSocket without JSON serialization.
39
66
  */
40
- abstract send(data: SpeechToTextAPI.SttClientEvent): void;
67
+ abstract sendRaw(data: RawWebSocketData): void;
41
68
 
42
69
  /**
43
- * Close the websocket connection.
70
+ * Close the WebSocket connection.
44
71
  */
45
72
  abstract close(props?: { code: number; reason: string }): void;
46
73
 
47
74
  protected _onError(event: null, message: string, cause: any): void;
48
- protected _onError(event: SpeechToTextAPI.SttServerEvent.ErrorFrame, message?: string | undefined): void;
49
75
  protected _onError(
50
- event: SpeechToTextAPI.SttServerEvent.ErrorFrame | null,
76
+ event: SpeechToTextAPI.TranscribeServerEvent.SttErrorFrame,
77
+ message?: string | undefined,
78
+ ): void;
79
+ protected _onError(
80
+ event: SpeechToTextAPI.TranscribeServerEvent.SttErrorFrame | null,
51
81
  message?: string | undefined,
52
82
  cause?: any,
53
83
  ): void {
@@ -73,14 +103,11 @@ export abstract class SpeechToTextEmitter extends EventEmitter<WebsocketEvents>
73
103
  }
74
104
  }
75
105
 
76
- export function buildURL(client: Telnyx, query?: SpeechToTextAPI.SpeechToTextStreamParams | null): URL {
77
- const path = '/speech-to-text/transcription';
78
- const baseURL = client.baseURL;
79
- const url = new URL(baseURL + (baseURL.endsWith('/') ? path.slice(1) : path));
80
- if (query) {
81
- url.search = stringifyQuery(query);
82
- }
83
- url.protocol = 'wss';
106
+ export function buildURL(client: Telnyx, parameters: Record<string, unknown>): URL {
107
+ const { ...query } = parameters;
108
+ const endpoint = '/speech-to-text/transcription';
109
+ const url = new URL(client.buildURL(endpoint, query, undefined));
110
+ url.protocol = url.protocol === 'http:' || url.protocol === 'ws:' ? 'ws:' : 'wss:';
84
111
  return url;
85
112
  }
86
113
 
@@ -2,198 +2,172 @@
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
4
  import { APIPromise } from '../../core/api-promise';
5
- import { buildHeaders } from '../../internal/headers';
5
+ import { type Uploadable } from '../../core/uploads';
6
6
  import { RequestOptions } from '../../internal/request-options';
7
7
 
8
8
  /**
9
- * Speech to text streaming operations via WebSocket
9
+ * Discover available speech-to-text providers, models, and supported languages.
10
10
  */
11
11
  export class SpeechToText extends APIResource {
12
12
  /**
13
- * Open a WebSocket connection to stream audio and receive transcriptions in
14
- * real-time. Authentication is provided via the standard
15
- * `Authorization: Bearer <API_KEY>` header.
13
+ * Retrieve the canonical list of supported speech-to-text providers, models,
14
+ * accepted language codes, and the service types each model supports.
16
15
  *
17
- * Supported engines: `Azure`, `Deepgram`, `Google`, `Telnyx`.
16
+ * Service types:
18
17
  *
19
- * **Connection flow:**
18
+ * - `streaming` — standalone WebSocket transcription via
19
+ * `/speech-to-text/transcription`.
20
+ * - `file_transcription` — file-based transcription via
21
+ * `/ai/audio/transcriptions`.
22
+ * - `in_call_transcription` — live call transcription via Call Control
23
+ * `transcription_start`.
20
24
  *
21
- * 1. Open WebSocket with query parameters specifying engine, input format, and
22
- * language.
23
- * 2. Send binary audio frames (mp3/wav format).
24
- * 3. Receive JSON transcript frames with `transcript`, `is_final`, and
25
- * `confidence` fields.
26
- * 4. Close connection when done.
27
- */
28
- transcribe(query: SpeechToTextTranscribeParams, options?: RequestOptions): APIPromise<void> {
29
- return this._client.get('/speech-to-text/transcription', {
25
+ * Use this endpoint to discover which (provider, model) combinations are available
26
+ * for the surface you need, and which language codes each accepts. `auto` in a
27
+ * `languages` array indicates the provider performs language detection.
28
+ */
29
+ listProviders(
30
+ query: SpeechToTextListProvidersParams | null | undefined = {},
31
+ options?: RequestOptions,
32
+ ): APIPromise<SpeechToTextListProvidersResponse> {
33
+ return this._client.get('/speech-to-text/providers', {
30
34
  query,
35
+ defaultBaseURL: 'https://api.telnyx.com/v2',
31
36
  ...options,
32
- headers: buildHeaders([
33
- { 'Content-Type': 'application/octet-stream', Accept: '*/*' },
34
- options?.headers,
35
- ]),
36
37
  });
37
38
  }
38
39
  }
39
40
 
40
41
  /**
41
- * Parameters for the transcribe REST endpoint.
42
+ * List of supported STT providers and models.
42
43
  */
43
- export interface SpeechToTextTranscribeParams {
44
- /**
45
- * The format of input audio stream.
46
- */
47
- input_format: 'mp3' | 'wav';
48
-
49
- /**
50
- * The transcription engine to use for processing the audio stream.
51
- */
52
- transcription_engine: 'Azure' | 'Deepgram' | 'Google' | 'Telnyx';
53
-
54
- /**
55
- * Silence duration (in milliseconds) that triggers end-of-speech detection.
56
- */
57
- endpointing?: number;
58
-
59
- /**
60
- * Whether to receive interim transcription results.
61
- */
62
- interim_results?: boolean;
63
-
64
- /**
65
- * A key term to boost in the transcription.
66
- */
67
- keyterm?: string;
44
+ export interface SpeechToTextListProvidersResponse {
45
+ data: Array<SpeechToTextListProvidersResponse.Data>;
68
46
 
69
- /**
70
- * Comma-separated list of keywords to boost in the transcription.
71
- */
72
- keywords?: string;
73
-
74
- /**
75
- * The language spoken in the audio stream.
76
- */
77
- language?: string;
78
-
79
- /**
80
- * The specific model to use within the selected transcription engine.
81
- */
82
- model?:
83
- | 'fast'
84
- | 'deepgram/nova-2'
85
- | 'deepgram/nova-3'
86
- | 'latest_long'
87
- | 'latest_short'
88
- | 'command_and_search'
89
- | 'phone_call'
90
- | 'video'
91
- | 'default'
92
- | 'medical_conversation'
93
- | 'medical_dictation'
94
- | 'openai/whisper-tiny'
95
- | 'openai/whisper-large-v3-turbo';
96
-
97
- /**
98
- * Enable redaction of sensitive information from transcription results.
99
- */
100
- redact?: string;
47
+ meta: SpeechToTextListProvidersResponse.Meta;
101
48
  }
102
49
 
103
- /**
104
- * Parameters for establishing a speech-to-text WebSocket connection.
105
- */
106
- export interface SpeechToTextStreamParams {
50
+ export namespace SpeechToTextListProvidersResponse {
107
51
  /**
108
- * The transcription engine to use for processing the audio stream.
52
+ * A (provider, model) tuple along with its supported service types and languages.
109
53
  */
110
- transcription_engine: 'Azure' | 'Deepgram' | 'Google' | 'Telnyx';
54
+ export interface Data {
55
+ /**
56
+ * Languages this (provider, model) accepts, in the provider's native code format.
57
+ * `auto` indicates the provider performs language detection.
58
+ */
59
+ languages: Array<string>;
111
60
 
112
- /**
113
- * The format of the input audio stream.
114
- */
115
- input_format?: 'mp3' | 'wav' | 'raw';
61
+ /**
62
+ * Provider-scoped model name.
63
+ */
64
+ model: string;
116
65
 
117
- /**
118
- * The language code for transcription (e.g., 'en-US', 'es-ES').
119
- */
120
- language?: string;
66
+ /**
67
+ * STT provider name.
68
+ */
69
+ provider: string;
121
70
 
122
- /**
123
- * Whether to return interim (partial) transcription results.
124
- */
125
- interim_results?: boolean;
71
+ /**
72
+ * Service surfaces this (provider, model) supports.
73
+ */
74
+ service_types: Array<'streaming' | 'file_transcription' | 'in_call_transcription'>;
75
+ }
126
76
 
127
- /**
128
- * The model to use for transcription (engine-specific).
129
- */
130
- model?: string;
77
+ export interface Meta {
78
+ /**
79
+ * Total number of entries returned.
80
+ */
81
+ total: number;
82
+ }
131
83
  }
132
84
 
133
85
  /**
134
- * Binary audio data sent from client to server.
135
- * Send raw audio bytes in mp3 or wav format.
86
+ * Binary audio data in mp3 or wav format.
136
87
  */
137
- export type SttClientEvent = ArrayBuffer | Buffer | Uint8Array;
88
+ export type TranscribeClientEvent = Uploadable;
138
89
 
139
90
  /**
140
91
  * Union of all server-to-client WebSocket events for STT streaming.
141
92
  */
142
- export type SttServerEvent = SttServerEvent.TranscriptFrame | SttServerEvent.ErrorFrame;
93
+ export type TranscribeServerEvent =
94
+ | TranscribeServerEvent.TranscriptFrame
95
+ | TranscribeServerEvent.SttErrorFrame;
143
96
 
144
- export namespace SttServerEvent {
97
+ export namespace TranscribeServerEvent {
145
98
  /**
146
99
  * Server-to-client frame containing a transcription result.
147
100
  */
148
101
  export interface TranscriptFrame {
149
- /**
150
- * Frame type identifier.
151
- */
152
- type: 'transcript';
153
-
154
102
  /**
155
103
  * The transcribed text from the audio.
156
104
  */
157
105
  transcript: string;
158
106
 
159
107
  /**
160
- * Whether this is a final transcription result.
161
- * When `false`, this is an interim result that may be refined.
108
+ * Frame type identifier.
162
109
  */
163
- is_final?: boolean;
110
+ type: 'transcript';
164
111
 
165
112
  /**
166
113
  * Confidence score of the transcription, ranging from 0 to 1.
167
114
  */
168
115
  confidence?: number;
116
+
117
+ /**
118
+ * Whether this is a final transcription result. When `false`, this is an interim
119
+ * result that may be refined.
120
+ */
121
+ is_final?: boolean;
169
122
  }
170
123
 
171
124
  /**
172
- * Server-to-client frame indicating an error during transcription.
125
+ * Server-to-client frame indicating an error during transcription. The connection
126
+ * may be closed shortly after.
173
127
  */
174
- export interface ErrorFrame {
128
+ export interface SttErrorFrame {
175
129
  /**
176
- * Frame type identifier.
130
+ * Error message describing what went wrong.
177
131
  */
178
- type: 'error';
132
+ error: string;
179
133
 
180
134
  /**
181
- * Error message describing what went wrong.
135
+ * Frame type identifier.
182
136
  */
183
- error: string;
137
+ type: 'error';
184
138
  }
185
139
  }
186
140
 
187
- /**
188
- * Transcript frame with transcription result.
189
- */
190
- export type TranscriptFrame = SttServerEvent.TranscriptFrame;
141
+ export interface SpeechToTextListProvidersParams {
142
+ /**
143
+ * Filter to entries for a specific STT provider. The enum mirrors the providers
144
+ * advertised across the speech-to-text spec (including `google` and `telnyx`,
145
+ * which are accepted as WebSocket transcription engines). A provider that has no
146
+ * models currently registered for any service type will return an empty `data`
147
+ * array rather than an error.
148
+ */
149
+ provider?:
150
+ | 'deepgram'
151
+ | 'speechmatics'
152
+ | 'assemblyai'
153
+ | 'xai'
154
+ | 'soniox'
155
+ | 'azure'
156
+ | 'openai'
157
+ | 'google'
158
+ | 'telnyx';
191
159
 
192
- /**
193
- * Error frame indicating transcription failure.
194
- */
195
- export type SttErrorFrame = SttServerEvent.ErrorFrame;
160
+ /**
161
+ * Filter to entries that support the given service type.
162
+ */
163
+ service_type?: 'streaming' | 'file_transcription' | 'in_call_transcription';
164
+ }
196
165
 
197
166
  export declare namespace SpeechToText {
198
- export { type SpeechToTextTranscribeParams as SpeechToTextTranscribeParams };
167
+ export {
168
+ type SpeechToTextListProvidersResponse as SpeechToTextListProvidersResponse,
169
+ type TranscribeClientEvent as TranscribeClientEvent,
170
+ type TranscribeServerEvent as TranscribeServerEvent,
171
+ type SpeechToTextListProvidersParams as SpeechToTextListProvidersParams,
172
+ };
199
173
  }