@cartesia/cartesia-js 3.0.0-b3 → 3.0.0-b5

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 (116) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +17 -13
  3. package/backcompat/index.d.mts +36 -0
  4. package/backcompat/index.d.mts.map +1 -0
  5. package/backcompat/index.d.ts +36 -0
  6. package/backcompat/index.d.ts.map +1 -0
  7. package/backcompat/index.js +266 -0
  8. package/backcompat/index.js.map +1 -0
  9. package/backcompat/index.mjs +261 -0
  10. package/backcompat/index.mjs.map +1 -0
  11. package/client.d.mts +2 -2
  12. package/client.d.mts.map +1 -1
  13. package/client.d.ts +2 -2
  14. package/client.d.ts.map +1 -1
  15. package/client.js.map +1 -1
  16. package/client.mjs.map +1 -1
  17. package/index.d.mts +1 -0
  18. package/index.d.mts.map +1 -1
  19. package/index.d.ts +1 -0
  20. package/index.d.ts.map +1 -1
  21. package/index.js +3 -1
  22. package/index.js.map +1 -1
  23. package/index.mjs +1 -0
  24. package/index.mjs.map +1 -1
  25. package/internal/tslib.js +4 -0
  26. package/package.json +11 -1
  27. package/resources/access-token.d.mts +5 -0
  28. package/resources/access-token.d.mts.map +1 -1
  29. package/resources/access-token.d.ts +5 -0
  30. package/resources/access-token.d.ts.map +1 -1
  31. package/resources/agents/agents.js +1 -1
  32. package/resources/agents/agents.js.map +1 -1
  33. package/resources/agents/agents.mjs +1 -1
  34. package/resources/agents/agents.mjs.map +1 -1
  35. package/resources/agents/metrics/index.d.mts +1 -1
  36. package/resources/agents/metrics/index.d.mts.map +1 -1
  37. package/resources/agents/metrics/index.d.ts +1 -1
  38. package/resources/agents/metrics/index.d.ts.map +1 -1
  39. package/resources/agents/metrics/index.js.map +1 -1
  40. package/resources/agents/metrics/index.mjs.map +1 -1
  41. package/resources/agents/metrics/metrics.d.mts +2 -2
  42. package/resources/agents/metrics/metrics.d.mts.map +1 -1
  43. package/resources/agents/metrics/metrics.d.ts +2 -2
  44. package/resources/agents/metrics/metrics.d.ts.map +1 -1
  45. package/resources/agents/metrics/metrics.js.map +1 -1
  46. package/resources/agents/metrics/metrics.mjs.map +1 -1
  47. package/resources/agents/metrics/results.d.mts +23 -22
  48. package/resources/agents/metrics/results.d.mts.map +1 -1
  49. package/resources/agents/metrics/results.d.ts +23 -22
  50. package/resources/agents/metrics/results.d.ts.map +1 -1
  51. package/resources/agents/metrics/results.js +4 -5
  52. package/resources/agents/metrics/results.js.map +1 -1
  53. package/resources/agents/metrics/results.mjs +4 -5
  54. package/resources/agents/metrics/results.mjs.map +1 -1
  55. package/resources/index.d.mts +1 -1
  56. package/resources/index.d.mts.map +1 -1
  57. package/resources/index.d.ts +1 -1
  58. package/resources/index.d.ts.map +1 -1
  59. package/resources/index.js.map +1 -1
  60. package/resources/index.mjs.map +1 -1
  61. package/resources/infill.d.mts +3 -4
  62. package/resources/infill.d.mts.map +1 -1
  63. package/resources/infill.d.ts +3 -4
  64. package/resources/infill.d.ts.map +1 -1
  65. package/resources/infill.js +0 -2
  66. package/resources/infill.js.map +1 -1
  67. package/resources/infill.mjs +0 -2
  68. package/resources/infill.mjs.map +1 -1
  69. package/resources/pronunciation-dicts.d.mts +0 -8
  70. package/resources/pronunciation-dicts.d.mts.map +1 -1
  71. package/resources/pronunciation-dicts.d.ts +0 -8
  72. package/resources/pronunciation-dicts.d.ts.map +1 -1
  73. package/resources/pronunciation-dicts.js +0 -18
  74. package/resources/pronunciation-dicts.js.map +1 -1
  75. package/resources/pronunciation-dicts.mjs +0 -18
  76. package/resources/pronunciation-dicts.mjs.map +1 -1
  77. package/resources/stt.d.mts +1 -104
  78. package/resources/stt.d.mts.map +1 -1
  79. package/resources/stt.d.ts +1 -104
  80. package/resources/stt.d.ts.map +1 -1
  81. package/resources/tts/tts.d.mts +79 -115
  82. package/resources/tts/tts.d.mts.map +1 -1
  83. package/resources/tts/tts.d.ts +79 -115
  84. package/resources/tts/tts.d.ts.map +1 -1
  85. package/resources/voice-changer.d.mts +2 -2
  86. package/resources/voice-changer.d.mts.map +1 -1
  87. package/resources/voice-changer.d.ts +2 -2
  88. package/resources/voice-changer.d.ts.map +1 -1
  89. package/resources/voices.d.mts +70 -34
  90. package/resources/voices.d.mts.map +1 -1
  91. package/resources/voices.d.ts +70 -34
  92. package/resources/voices.d.ts.map +1 -1
  93. package/resources/voices.js +45 -3
  94. package/resources/voices.js.map +1 -1
  95. package/resources/voices.mjs +45 -3
  96. package/resources/voices.mjs.map +1 -1
  97. package/src/backcompat/index.ts +302 -0
  98. package/src/client.ts +2 -0
  99. package/src/index.ts +1 -0
  100. package/src/resources/access-token.ts +6 -0
  101. package/src/resources/agents/agents.ts +1 -1
  102. package/src/resources/agents/metrics/index.ts +1 -0
  103. package/src/resources/agents/metrics/metrics.ts +2 -0
  104. package/src/resources/agents/metrics/results.ts +27 -23
  105. package/src/resources/index.ts +1 -0
  106. package/src/resources/infill.ts +3 -4
  107. package/src/resources/pronunciation-dicts.ts +0 -20
  108. package/src/resources/stt.ts +102 -104
  109. package/src/resources/tts/tts.ts +146 -128
  110. package/src/resources/voice-changer.ts +2 -2
  111. package/src/resources/voices.ts +105 -38
  112. package/src/version.ts +1 -1
  113. package/version.d.mts +1 -1
  114. package/version.d.ts +1 -1
  115. package/version.js +1 -1
  116. package/version.mjs +1 -1
@@ -0,0 +1,302 @@
1
+ import WebSocket from "ws";
2
+ import { Cartesia } from "../client";
3
+
4
+ class AudioSource {
5
+ private buffers: Buffer[] = [];
6
+ private waiter: ((val?: any) => void) | null = null;
7
+ public isDone = false;
8
+
9
+ push(data: Buffer) {
10
+ this.buffers.push(data);
11
+ if (this.waiter) {
12
+ this.waiter();
13
+ this.waiter = null;
14
+ }
15
+ }
16
+
17
+ markDone() {
18
+ this.isDone = true;
19
+ if (this.waiter) {
20
+ this.waiter();
21
+ this.waiter = null;
22
+ }
23
+ }
24
+
25
+ async read(outBuffer: Float32Array): Promise<number> {
26
+ if (this.buffers.length === 0 && !this.isDone) {
27
+ await new Promise<void>((resolve) => { this.waiter = resolve; });
28
+ }
29
+
30
+ if (this.buffers.length === 0 && this.isDone) {
31
+ return 0;
32
+ }
33
+
34
+ let totalFloatsRead = 0;
35
+ let outOffset = 0;
36
+ const maxFloats = outBuffer.length;
37
+
38
+ while (this.buffers.length > 0 && totalFloatsRead < maxFloats) {
39
+ const buf = this.buffers[0] as Buffer; // ts not smart enough to check loop condition
40
+ const floatsInBuf = buf.length / 4;
41
+ const floatsNeeded = maxFloats - totalFloatsRead;
42
+
43
+ const floatsToCopy = Math.min(floatsInBuf, floatsNeeded);
44
+ const bytesToCopy = floatsToCopy * 4;
45
+
46
+ // Copy to outBuffer.
47
+ // Create a view on the buffer to read floats.
48
+
49
+ // We need to ensure byteOffset is a multiple of 4.
50
+ // If not, we must copy the buffer to a new one.
51
+ let srcFloats: Float32Array;
52
+ if (buf.byteOffset % 4 === 0) {
53
+ srcFloats = new Float32Array(buf.buffer, buf.byteOffset, floatsInBuf);
54
+ } else {
55
+ const alignedBuf = new Uint8Array(buf);
56
+ srcFloats = new Float32Array(alignedBuf.buffer, alignedBuf.byteOffset, floatsInBuf);
57
+ }
58
+
59
+ outBuffer.set(srcFloats.subarray(0, floatsToCopy), outOffset);
60
+
61
+ totalFloatsRead += floatsToCopy;
62
+ outOffset += floatsToCopy;
63
+
64
+ if (floatsToCopy < floatsInBuf) {
65
+ // We didn't use the whole buffer. Update it.
66
+ this.buffers[0] = buf.subarray(bytesToCopy);
67
+ } else {
68
+ // We used the whole buffer. Remove it.
69
+ this.buffers.shift();
70
+ }
71
+ }
72
+
73
+ return totalFloatsRead;
74
+ }
75
+ }
76
+
77
+ class WebSocketWrapper {
78
+ private client: Cartesia;
79
+ private config: any;
80
+ private socket: WebSocket | null = null;
81
+ private sources: Map<string, AudioSource> = new Map();
82
+ // Fallback source for messages without context_id or if we just want to capture everything (legacy behavior?)
83
+ // The original test didn't use context_id explicitly in send() but expected a response source.
84
+ // We'll map context_id to source.
85
+ private defaultSource: AudioSource | null = null;
86
+
87
+ constructor(client: Cartesia, config: any) {
88
+ this.client = client;
89
+ this.config = config;
90
+ }
91
+
92
+ async connect() {
93
+ const baseURL = this.client.baseURL;
94
+ // Construct WebSocket URL
95
+ // baseURL is like https://api.cartesia.ai
96
+ let urlStr = baseURL.replace(/^http/, "ws");
97
+ if (!urlStr.includes("/tts/websocket")) {
98
+ if (urlStr.endsWith("/")) {
99
+ urlStr += "tts/websocket";
100
+ } else {
101
+ urlStr += "/tts/websocket";
102
+ }
103
+ }
104
+
105
+ const url = new URL(urlStr);
106
+
107
+ const headers: any = {
108
+ "cartesia-version": "2025-04-16",
109
+ };
110
+ if (this.client.apiKey) {
111
+ headers["Authorization"] = `Bearer ${this.client.apiKey}`;
112
+ }
113
+
114
+ this.socket = new WebSocket(url.toString(), {
115
+ headers: headers,
116
+ });
117
+
118
+ return new Promise<void>((resolve, reject) => {
119
+ this.socket!.on("open", () => {
120
+ console.log("WebSocket connected.");
121
+ resolve();
122
+ });
123
+
124
+ this.socket!.on("error", (err) => {
125
+ console.error("WebSocket error:", err);
126
+ reject(err);
127
+ });
128
+
129
+ this.socket!.on("message", (data) => {
130
+ this.handleMessage(data);
131
+ });
132
+
133
+ this.socket!.on("close", () => {
134
+ console.log("WebSocket closed.");
135
+ this.sources.forEach((s) => { s.markDone(); });
136
+ if (this.defaultSource) this.defaultSource.markDone();
137
+ });
138
+ });
139
+ }
140
+
141
+ private handleMessage(data: WebSocket.Data) {
142
+ try {
143
+ const str = data.toString();
144
+ const msg = JSON.parse(str);
145
+
146
+ const contextId = msg.context_id;
147
+ let source = contextId ? this.sources.get(contextId) : this.defaultSource;
148
+
149
+ // If we received a message for a context we don't know about, and we have a default source, use it
150
+ if (!source && this.defaultSource) {
151
+ source = this.defaultSource;
152
+ }
153
+
154
+ if (msg.type === "chunk" && msg.data) {
155
+ const audioData = Buffer.from(msg.data, "base64");
156
+ if (source) source.push(audioData);
157
+ } else if (msg.type === "done") {
158
+ if (source) source.markDone();
159
+ } else if (msg.type === "error") {
160
+ console.error("Server error:", msg);
161
+ if (source) source.markDone(); // Fail the stream?
162
+ }
163
+ } catch (e) {
164
+ console.error("Error parsing message:", e);
165
+ }
166
+ }
167
+
168
+ async send(request: any) {
169
+ if (!this.socket) {
170
+ throw new Error("WebSocket not connected");
171
+ }
172
+
173
+ // Ensure request has a context_id so we can route the response
174
+ if (!request.context_id) {
175
+ request.context_id = uuidv4();
176
+ }
177
+
178
+ const source = new AudioSource();
179
+ this.sources.set(request.context_id, source);
180
+ // Also set as default source if none exists, for compatibility with simple tests
181
+ if (!this.defaultSource) {
182
+ this.defaultSource = source;
183
+ }
184
+
185
+ // Add output format from config if not present
186
+ if (!request.output_format && this.config) {
187
+ request.output_format = {
188
+ container: this.config.container,
189
+ encoding: this.config.encoding,
190
+ sample_rate: this.config.sampleRate,
191
+ };
192
+ }
193
+ // Fix camelCase to snake_case for output_format if needed
194
+ // The new API expects snake_case keys in JSON usually, but let's check.
195
+ // The GenerationRequest interface has `output_format`.
196
+ // The config passed to .websocket() uses `sampleRate`.
197
+ // We might need to map it.
198
+
199
+ if (request.output_format) {
200
+ // Ensure sample_rate is set (mapping from sampleRate)
201
+ if (request.output_format.sampleRate && !request.output_format.sample_rate) {
202
+ request.output_format.sample_rate = request.output_format.sampleRate;
203
+ delete request.output_format.sampleRate;
204
+ }
205
+ }
206
+
207
+ // Map camelCase request fields to snake_case if necessary?
208
+ // The old test uses `modelId`, `generationConfig`.
209
+ // The new API expects `model_id`, `generation_config`.
210
+ const payload = {
211
+ ...request,
212
+ model_id: request.modelId || request.model_id,
213
+ generation_config: request.generationConfig || request.generation_config,
214
+ context_id: request.context_id,
215
+ };
216
+ // Remove camelCase keys if they persist?
217
+ // JSON.stringify handles it, but we should clean up if we want to be strict.
218
+
219
+ // Also `voice` object. Old test: `voice: { mode: 'id', id: ... }`. New API: same.
220
+
221
+ this.socket.send(JSON.stringify(payload));
222
+
223
+ return {
224
+ source: source
225
+ };
226
+ }
227
+
228
+ disconnect() {
229
+ if (this.socket) {
230
+ this.socket.close();
231
+ }
232
+ }
233
+ }
234
+
235
+ class TTSWrapper {
236
+ private client: Cartesia;
237
+
238
+ constructor(client: Cartesia) {
239
+ this.client = client;
240
+ }
241
+
242
+ websocket(config: any) {
243
+ return new WebSocketWrapper(this.client, config);
244
+ }
245
+
246
+ async bytes(request: any, requestOptions?: any) {
247
+ const params: any = {
248
+ model_id: request.modelId,
249
+ transcript: request.transcript,
250
+ voice: request.voice,
251
+ generation_config: request.generationConfig,
252
+ context_id: request.contextId,
253
+ };
254
+
255
+ if (request.outputFormat) {
256
+ params.output_format = {
257
+ ...request.outputFormat,
258
+ sample_rate: request.outputFormat.sampleRate,
259
+ bit_rate: request.outputFormat.bitRate,
260
+ };
261
+ // Remove camelCase keys
262
+ delete params.output_format.sampleRate;
263
+ delete params.output_format.bitRate;
264
+ }
265
+
266
+ const options: any = {};
267
+ if (requestOptions) {
268
+ if (requestOptions.timeoutInSeconds) {
269
+ options.timeout = requestOptions.timeoutInSeconds * 1000;
270
+ }
271
+ options.maxRetries = requestOptions.maxRetries;
272
+ options.headers = requestOptions.headers;
273
+ options.signal = requestOptions.abortSignal;
274
+ }
275
+
276
+ // @ts-ignore
277
+ return this.client.tts.synthesizeBytes(params, options);
278
+ }
279
+ }
280
+
281
+ /*
282
+ * CartesiaClient - deprecated backcompat class.
283
+ * New code should use Cartesia class directly instead.
284
+ */
285
+ export class CartesiaClient {
286
+ private client: Cartesia;
287
+ public tts: TTSWrapper;
288
+
289
+ constructor(options: any) {
290
+ this.client = new Cartesia(options);
291
+ this.tts = new TTSWrapper(this.client);
292
+ }
293
+ }
294
+
295
+
296
+ // Helper for generating UUIDs. Not cryptographically secure.
297
+ function uuidv4() {
298
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
299
+ var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
300
+ return v.toString(16);
301
+ });
302
+ }
package/src/client.ts CHANGED
@@ -51,6 +51,7 @@ import {
51
51
  SupportedLanguage,
52
52
  Voice,
53
53
  VoiceCloneParams,
54
+ VoiceGetParams,
54
55
  VoiceListParams,
55
56
  VoiceLocalizeParams,
56
57
  VoiceMetadata,
@@ -942,6 +943,7 @@ export declare namespace Cartesia {
942
943
  type VoiceUpdateParams as VoiceUpdateParams,
943
944
  type VoiceListParams as VoiceListParams,
944
945
  type VoiceCloneParams as VoiceCloneParams,
946
+ type VoiceGetParams as VoiceGetParams,
945
947
  type VoiceLocalizeParams as VoiceLocalizeParams,
946
948
  };
947
949
  }
package/src/index.ts CHANGED
@@ -5,6 +5,7 @@ export { Cartesia as default } from './client';
5
5
  export { type Uploadable, toFile } from './core/uploads';
6
6
  export { APIPromise } from './core/api-promise';
7
7
  export { Cartesia, type ClientOptions } from './client';
8
+ export { CartesiaClient } from './backcompat';
8
9
  export { PagePromise } from './core/pagination';
9
10
  export {
10
11
  CartesiaError,
@@ -41,6 +41,12 @@ export namespace AccessTokenCreateParams {
41
41
  * optional - specify only the capabilities you need.
42
42
  */
43
43
  export interface Grants {
44
+ /**
45
+ * The `agent` grant allows the token to be used to access the Agent websocket
46
+ * calling [endpoint](/line/integrations/web-calls#connection).
47
+ */
48
+ agent?: boolean | null;
49
+
44
50
  /**
45
51
  * The `stt` grant allows the token to be used to access any STT endpoint.
46
52
  */
@@ -44,7 +44,7 @@ export class Agents extends APIResource {
44
44
  * Lists all agents associated with your account.
45
45
  */
46
46
  list(options?: RequestOptions): APIPromise<AgentListResponse> {
47
- return this._client.get('/agents/', options);
47
+ return this._client.get('/agents', options);
48
48
  }
49
49
 
50
50
  /**
@@ -12,6 +12,7 @@ export {
12
12
  export {
13
13
  Results,
14
14
  type ResultListResponse,
15
+ type ResultExportResponse,
15
16
  type ResultListParams,
16
17
  type ResultExportParams,
17
18
  type ResultListResponsesCursorIDPage,
@@ -4,6 +4,7 @@ import { APIResource } from '../../../core/resource';
4
4
  import * as ResultsAPI from './results';
5
5
  import {
6
6
  ResultExportParams,
7
+ ResultExportResponse,
7
8
  ResultListParams,
8
9
  ResultListResponse,
9
10
  ResultListResponsesCursorIDPage,
@@ -179,6 +180,7 @@ export declare namespace Metrics {
179
180
  export {
180
181
  Results as Results,
181
182
  type ResultListResponse as ResultListResponse,
183
+ type ResultExportResponse as ResultExportResponse,
182
184
  type ResultListResponsesCursorIDPage as ResultListResponsesCursorIDPage,
183
185
  type ResultListParams as ResultListParams,
184
186
  type ResultExportParams as ResultExportParams,
@@ -4,6 +4,7 @@ import { APIResource } from '../../../core/resource';
4
4
  import * as CallsAPI from '../calls';
5
5
  import { APIPromise } from '../../../core/api-promise';
6
6
  import { CursorIDPage, type CursorIDPageParams, PagePromise } from '../../../core/pagination';
7
+ import { type Uploadable } from '../../../core/uploads';
7
8
  import { buildHeaders } from '../../../internal/headers';
8
9
  import { RequestOptions } from '../../../internal/request-options';
9
10
 
@@ -22,16 +23,15 @@ export class Results extends APIResource {
22
23
  }
23
24
 
24
25
  /**
25
- * Export metric results to a CSV file. This endpoint is paginated with a default
26
- * of 10 results per page and maximum of 100 results per page. Information on
27
- * pagination can be found in the headers `x-has-more`, `x-limit`, and
28
- * `x-next-page`.
26
+ * Export metric results to a CSV file. This endpoint streams at most 100k results
27
+ * as the CSV file directly to the client. Use the optional filters to narrow down
28
+ * the results to export.
29
29
  */
30
- export(query: ResultExportParams | null | undefined = {}, options?: RequestOptions): APIPromise<void> {
30
+ export(query: ResultExportParams | null | undefined = {}, options?: RequestOptions): APIPromise<string> {
31
31
  return this._client.get('/agents/metrics/results/export', {
32
32
  query,
33
33
  ...options,
34
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
34
+ headers: buildHeaders([{ Accept: 'text/csv' }, options?.headers]),
35
35
  });
36
36
  }
37
37
  }
@@ -110,6 +110,8 @@ export interface ResultListResponse {
110
110
  value?: unknown;
111
111
  }
112
112
 
113
+ export type ResultExportResponse = Uploadable;
114
+
113
115
  export interface ResultListParams extends CursorIDPageParams {
114
116
  /**
115
117
  * The ID of the agent.
@@ -126,6 +128,12 @@ export interface ResultListParams extends CursorIDPageParams {
126
128
  */
127
129
  deployment_id?: string | null;
128
130
 
131
+ /**
132
+ * Filter metric results created before or at this ISO 8601 date/time (e.g.
133
+ * 2024-04-30T23:59:59Z).
134
+ */
135
+ end_date?: string | null;
136
+
129
137
  /**
130
138
  * The number of metric results to return per page, ranging between 1 and 100.
131
139
  */
@@ -135,6 +143,12 @@ export interface ResultListParams extends CursorIDPageParams {
135
143
  * The ID of the metric.
136
144
  */
137
145
  metric_id?: string | null;
146
+
147
+ /**
148
+ * Filter metric results created at or after this ISO 8601 date/time (e.g.
149
+ * 2024-04-01T00:00:00Z).
150
+ */
151
+ start_date?: string | null;
138
152
  }
139
153
 
140
154
  export interface ResultExportParams {
@@ -154,18 +168,10 @@ export interface ResultExportParams {
154
168
  deployment_id?: string | null;
155
169
 
156
170
  /**
157
- * A cursor to use in pagination. `ending_before` is a metric result ID that
158
- * defines your place in the list. For example, if you make a /metrics/results
159
- * request and receive 100 objects, starting with `metric_result_abc123`, your
160
- * subsequent call can include `ending_before=metric_result_abc123` to fetch the
161
- * previous page of the list.
162
- */
163
- ending_before?: string | null;
164
-
165
- /**
166
- * The number of metric results to return per page, ranging between 1 and 100.
171
+ * Filter metric results created before or at this ISO 8601 date/time (e.g.
172
+ * 2024-04-30T23:59:59Z).
167
173
  */
168
- limit?: number | null;
174
+ end_date?: string | null;
169
175
 
170
176
  /**
171
177
  * The ID of the metric.
@@ -173,18 +179,16 @@ export interface ResultExportParams {
173
179
  metric_id?: string | null;
174
180
 
175
181
  /**
176
- * A cursor to use in pagination. `starting_after` is a metric result ID that
177
- * defines your place in the list. For example, if you make a /metrics/results
178
- * request and receive 100 objects, ending with `metric_result_abc123`, your
179
- * subsequent call can include `starting_after=metric_result_abc123` to fetch the
180
- * next page of the list.
182
+ * Filter metric results created at or after this ISO 8601 date/time (e.g.
183
+ * 2024-04-01T00:00:00Z).
181
184
  */
182
- starting_after?: string | null;
185
+ start_date?: string | null;
183
186
  }
184
187
 
185
188
  export declare namespace Results {
186
189
  export {
187
190
  type ResultListResponse as ResultListResponse,
191
+ type ResultExportResponse as ResultExportResponse,
188
192
  type ResultListResponsesCursorIDPage as ResultListResponsesCursorIDPage,
189
193
  type ResultListParams as ResultListParams,
190
194
  type ResultExportParams as ResultExportParams,
@@ -62,6 +62,7 @@ export {
62
62
  type VoiceUpdateParams,
63
63
  type VoiceListParams,
64
64
  type VoiceCloneParams,
65
+ type VoiceGetParams,
65
66
  type VoiceLocalizeParams,
66
67
  type VoicesCursorIDPage,
67
68
  } from './voices';
@@ -16,8 +16,6 @@ export class Infill extends APIResource {
16
16
  * **The cost is 1 credit per character of the infill text plus a fixed cost of 300
17
17
  * credits.**
18
18
  *
19
- * Infilling is only available on `sonic-2` at this time.
20
- *
21
19
  * At least one of `left_audio` or `right_audio` must be provided.
22
20
  *
23
21
  * As with all generative models, there's some inherent variability, but here's
@@ -55,7 +53,8 @@ export interface InfillCreateParams {
55
53
  left_audio?: Uploadable;
56
54
 
57
55
  /**
58
- * The ID of the model to use for generating audio
56
+ * The ID of the model to use for generating audio. Any model other than the first
57
+ * `"sonic"` model is supported.
59
58
  */
60
59
  model_id?: string;
61
60
 
@@ -77,7 +76,7 @@ export interface InfillCreateParams {
77
76
  /**
78
77
  * The sample rate of the output audio
79
78
  */
80
- 'output_format[sample_rate]'?: number;
79
+ 'output_format[sample_rate]'?: 8000 | 16000 | 22050 | 24000 | 44100 | 48000;
81
80
 
82
81
  right_audio?: Uploadable;
83
82
 
@@ -55,26 +55,6 @@ export class PronunciationDicts extends APIResource {
55
55
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
56
56
  });
57
57
  }
58
-
59
- /**
60
- * Pin a pronunciation dictionary for the authenticated user
61
- */
62
- pin(id: string, options?: RequestOptions): APIPromise<void> {
63
- return this._client.post(path`/pronunciation-dicts/${id}/pin`, {
64
- ...options,
65
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
66
- });
67
- }
68
-
69
- /**
70
- * Unpin a pronunciation dictionary for the authenticated user
71
- */
72
- unpin(id: string, options?: RequestOptions): APIPromise<void> {
73
- return this._client.post(path`/pronunciation-dicts/${id}/unpin`, {
74
- ...options,
75
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
76
- });
77
- }
78
58
  }
79
59
 
80
60
  export type PronunciationDictsCursorIDPage = CursorIDPage<PronunciationDict>;