@cartesia/cartesia-js 3.0.0-b11 → 3.0.0-b13

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 (82) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/backcompat/errors.d.mts +1 -1
  3. package/backcompat/errors.d.mts.map +1 -1
  4. package/backcompat/errors.d.ts +1 -1
  5. package/backcompat/errors.d.ts.map +1 -1
  6. package/backcompat/errors.js +1 -1
  7. package/backcompat/errors.js.map +1 -1
  8. package/backcompat/errors.mjs +1 -1
  9. package/backcompat/errors.mjs.map +1 -1
  10. package/backcompat/index.d.mts.map +1 -1
  11. package/backcompat/index.d.ts.map +1 -1
  12. package/backcompat/index.js +5 -5
  13. package/backcompat/index.js.map +1 -1
  14. package/backcompat/index.mjs +5 -5
  15. package/backcompat/index.mjs.map +1 -1
  16. package/backcompat/tts-wrapper.d.mts +33 -10
  17. package/backcompat/tts-wrapper.d.mts.map +1 -1
  18. package/backcompat/tts-wrapper.d.ts +33 -10
  19. package/backcompat/tts-wrapper.d.ts.map +1 -1
  20. package/backcompat/tts-wrapper.js +83 -26
  21. package/backcompat/tts-wrapper.js.map +1 -1
  22. package/backcompat/tts-wrapper.mjs +85 -28
  23. package/backcompat/tts-wrapper.mjs.map +1 -1
  24. package/backcompat/types.d.mts +1 -1
  25. package/backcompat/types.d.mts.map +1 -1
  26. package/backcompat/types.d.ts +1 -1
  27. package/backcompat/types.d.ts.map +1 -1
  28. package/backcompat/voice-changer-wrapper.d.mts +4 -4
  29. package/backcompat/voice-changer-wrapper.d.mts.map +1 -1
  30. package/backcompat/voice-changer-wrapper.d.ts +4 -4
  31. package/backcompat/voice-changer-wrapper.d.ts.map +1 -1
  32. package/backcompat/voice-changer-wrapper.js +6 -6
  33. package/backcompat/voice-changer-wrapper.js.map +1 -1
  34. package/backcompat/voice-changer-wrapper.mjs +7 -7
  35. package/backcompat/voice-changer-wrapper.mjs.map +1 -1
  36. package/backcompat/voices-wrapper.d.mts +18 -5
  37. package/backcompat/voices-wrapper.d.mts.map +1 -1
  38. package/backcompat/voices-wrapper.d.ts +18 -5
  39. package/backcompat/voices-wrapper.d.ts.map +1 -1
  40. package/backcompat/voices-wrapper.js +63 -0
  41. package/backcompat/voices-wrapper.js.map +1 -1
  42. package/backcompat/voices-wrapper.mjs +63 -0
  43. package/backcompat/voices-wrapper.mjs.map +1 -1
  44. package/package.json +1 -1
  45. package/resources/agents/calls.d.mts +1 -1
  46. package/resources/agents/calls.d.mts.map +1 -1
  47. package/resources/agents/calls.d.ts +1 -1
  48. package/resources/agents/calls.d.ts.map +1 -1
  49. package/resources/agents/calls.js +1 -2
  50. package/resources/agents/calls.js.map +1 -1
  51. package/resources/agents/calls.mjs +1 -2
  52. package/resources/agents/calls.mjs.map +1 -1
  53. package/resources/infill.d.mts +1 -1
  54. package/resources/infill.d.mts.map +1 -1
  55. package/resources/infill.d.ts +1 -1
  56. package/resources/infill.d.ts.map +1 -1
  57. package/resources/infill.js +1 -6
  58. package/resources/infill.js.map +1 -1
  59. package/resources/infill.mjs +1 -6
  60. package/resources/infill.mjs.map +1 -1
  61. package/resources/voice-changer.d.mts +1 -1
  62. package/resources/voice-changer.d.mts.map +1 -1
  63. package/resources/voice-changer.d.ts +1 -1
  64. package/resources/voice-changer.d.ts.map +1 -1
  65. package/resources/voice-changer.js +1 -6
  66. package/resources/voice-changer.js.map +1 -1
  67. package/resources/voice-changer.mjs +1 -6
  68. package/resources/voice-changer.mjs.map +1 -1
  69. package/src/backcompat/errors.ts +32 -40
  70. package/src/backcompat/index.ts +64 -67
  71. package/src/backcompat/tts-wrapper.ts +405 -322
  72. package/src/backcompat/types.ts +13 -13
  73. package/src/backcompat/voice-changer-wrapper.ts +58 -56
  74. package/src/backcompat/voices-wrapper.ts +217 -150
  75. package/src/resources/agents/calls.ts +2 -3
  76. package/src/resources/infill.ts +2 -7
  77. package/src/resources/voice-changer.ts +2 -7
  78. package/src/version.ts +1 -1
  79. package/version.d.mts +1 -1
  80. package/version.d.ts +1 -1
  81. package/version.js +1 -1
  82. package/version.mjs +1 -1
@@ -1,19 +1,19 @@
1
1
  export type Supplier<T> = T | Promise<T> | (() => T | Promise<T>);
2
2
 
3
3
  export interface CartesiaClientOptions {
4
- environment?: Supplier<"https://api.cartesia.ai" | string>;
5
- /** Specify a custom URL to connect the client to. */
6
- baseUrl?: Supplier<string>;
7
- apiKey?: Supplier<string | undefined>;
8
- /** Override the Cartesia-Version header */
9
- cartesiaVersion?: string;
10
- fetcher?: any;
4
+ environment?: Supplier<'https://api.cartesia.ai' | string>;
5
+ /** Specify a custom URL to connect the client to. */
6
+ baseUrl?: Supplier<string>;
7
+ apiKey?: Supplier<string | undefined>;
8
+ /** Override the Cartesia-Version header */
9
+ cartesiaVersion?: string;
10
+ fetcher?: any;
11
11
  }
12
12
 
13
13
  export interface BackCompatRequestOptions {
14
- timeoutInSeconds?: number;
15
- maxRetries?: number;
16
- abortSignal?: AbortSignal;
17
- cartesiaVersion?: string;
18
- headers?: Record<string, string>;
19
- }
14
+ timeoutInSeconds?: number;
15
+ maxRetries?: number;
16
+ abortSignal?: AbortSignal;
17
+ cartesiaVersion?: string;
18
+ headers?: Record<string, string>;
19
+ }
@@ -1,71 +1,73 @@
1
- import * as fs from "fs";
2
- import { Cartesia } from "../client";
3
- import { type Uploadable } from "../core/uploads";
4
- import { type RequestOptions as InternalRequestOptions } from "../internal/request-options";
5
- import { Readable } from "stream";
6
- import { BackCompatRequestOptions } from "./types";
7
- import { wrap } from "./errors";
1
+ import * as fs from 'fs';
2
+ import { Cartesia } from '../client';
3
+ import { type Uploadable } from '../core/uploads';
4
+ import { type RequestOptions as InternalRequestOptions } from '../internal/request-options';
5
+ import { Readable } from 'stream';
6
+ import { BackCompatRequestOptions } from './types';
7
+ import { wrap } from './errors';
8
8
 
9
9
  export interface BackCompatVoiceChangerBytesRequest {
10
- voiceId: string;
11
- outputFormatContainer: "raw" | "wav" | "mp3";
12
- outputFormatSampleRate: 8000 | 16000 | 22050 | 24000 | 44100 | 48000;
13
- outputFormatEncoding?: "pcm_f32le" | "pcm_s16le" | "mulaw" | "alaw";
14
- outputFormatBitRate?: 32000 | 64000 | 96000 | 128000 | 192000;
10
+ voiceId: string;
11
+ outputFormatContainer: 'raw' | 'wav' | 'mp3';
12
+ outputFormatSampleRate: 8000 | 16000 | 22050 | 24000 | 44100 | 48000;
13
+ outputFormatEncoding?: 'pcm_f32le' | 'pcm_s16le' | 'mulaw' | 'alaw';
14
+ outputFormatBitRate?: 32000 | 64000 | 96000 | 128000 | 192000;
15
15
  }
16
16
 
17
17
  /** @deprecated Use the new SDK's voice changer methods on the {@link Cartesia} instance instead. */
18
18
  export class VoiceChangerWrapper {
19
- private client: Cartesia;
19
+ private client: Cartesia;
20
20
 
21
- constructor(client: Cartesia) {
22
- this.client = client;
23
- }
21
+ constructor(client: Cartesia) {
22
+ this.client = client;
23
+ }
24
24
 
25
- /** @deprecated Use {@link Cartesia.voiceChanger.changeVoiceBytes} instead. */
26
- async bytes(
27
- clip: File | fs.ReadStream | Blob,
28
- request: BackCompatVoiceChangerBytesRequest,
29
- requestOptions?: BackCompatRequestOptions
30
- ): Promise<Readable> {
31
- const params: any = {
32
- clip: clip as Uploadable,
33
- "voice[id]": request.voiceId,
34
- "output_format[container]": request.outputFormatContainer,
35
- "output_format[sample_rate]": request.outputFormatSampleRate,
36
- };
25
+ /** @deprecated Use {@link Cartesia.voiceChanger.changeVoiceBytes} instead. */
26
+ async bytes(
27
+ clip: File | fs.ReadStream | Blob,
28
+ request: BackCompatVoiceChangerBytesRequest,
29
+ requestOptions?: BackCompatRequestOptions,
30
+ ): Promise<Readable> {
31
+ const params: any = {
32
+ clip: clip as Uploadable,
33
+ 'voice[id]': request.voiceId,
34
+ 'output_format[container]': request.outputFormatContainer,
35
+ 'output_format[sample_rate]': request.outputFormatSampleRate,
36
+ };
37
37
 
38
- if (request.outputFormatEncoding) {
39
- params["output_format[encoding]"] = request.outputFormatEncoding;
40
- }
41
- if (request.outputFormatBitRate) {
42
- params["output_format[bit_rate]"] = request.outputFormatBitRate;
43
- }
38
+ if (request.outputFormatEncoding) {
39
+ params['output_format[encoding]'] = request.outputFormatEncoding;
40
+ }
41
+ if (request.outputFormatBitRate) {
42
+ params['output_format[bit_rate]'] = request.outputFormatBitRate;
43
+ }
44
44
 
45
- const options: InternalRequestOptions = {};
46
- if (requestOptions) {
47
- if (requestOptions.timeoutInSeconds) {
48
- options.timeout = requestOptions.timeoutInSeconds * 1000;
49
- }
50
- if (requestOptions.maxRetries !== undefined) {
51
- options.maxRetries = requestOptions.maxRetries;
52
- }
53
- options.headers = requestOptions.headers;
54
- options.signal = requestOptions.abortSignal;
55
- }
45
+ const options: InternalRequestOptions = {};
46
+ if (requestOptions) {
47
+ if (requestOptions.timeoutInSeconds) {
48
+ options.timeout = requestOptions.timeoutInSeconds * 1000;
49
+ }
50
+ if (requestOptions.maxRetries !== undefined) {
51
+ options.maxRetries = requestOptions.maxRetries;
52
+ }
53
+ options.headers = requestOptions.headers;
54
+ options.signal = requestOptions.abortSignal;
55
+ }
56
56
 
57
- const response = await wrap(this.client.voiceChanger.changeVoiceBytes(params, {
58
- ...options,
59
- __binaryResponse: true,
60
- } as any));
57
+ const response = await wrap(
58
+ this.client.voiceChanger.changeVoiceBytes(params, {
59
+ ...options,
60
+ __binaryResponse: true,
61
+ } as any),
62
+ );
61
63
 
62
- const responseAny = response as any;
64
+ const responseAny = response as any;
63
65
 
64
- if (!responseAny.body) {
65
- throw new Error("Response body is null");
66
- }
66
+ if (!responseAny.body) {
67
+ throw new Error('Response body is null');
68
+ }
67
69
 
68
- // @ts-ignore
69
- return Readable.fromWeb(responseAny.body);
70
- }
70
+ // @ts-ignore
71
+ return Readable.fromWeb(responseAny.body);
72
+ }
71
73
  }
@@ -1,163 +1,230 @@
1
- import * as fs from "fs";
2
- import { Cartesia } from "../client";
3
- import { type Uploadable } from "../core/uploads";
1
+ import * as fs from 'fs';
2
+ import { Cartesia } from '../client';
3
+ import { type Uploadable } from '../core/uploads';
4
4
  import {
5
- type VoiceCloneParams,
6
- type VoiceMetadata,
7
- type SupportedLanguage,
8
- type VoiceUpdateParams,
9
- type Voice,
10
- type VoiceLocalizeParams,
11
- } from "../resources/voices";
12
- import { type RequestOptions as InternalRequestOptions } from "../internal/request-options";
13
- import { BackCompatRequestOptions } from "./types";
14
- import { wrap } from "./errors";
5
+ type VoiceCloneParams,
6
+ type VoiceMetadata,
7
+ type SupportedLanguage,
8
+ type VoiceUpdateParams,
9
+ type Voice,
10
+ type VoiceLocalizeParams,
11
+ type VoiceListParams,
12
+ } from '../resources/voices';
13
+ import { type RequestOptions as InternalRequestOptions } from '../internal/request-options';
14
+ import { BackCompatRequestOptions } from './types';
15
+ import { wrap } from './errors';
16
+
17
+ export interface BackCompatVoiceListOptions {
18
+ gender?: 'masculine' | 'feminine' | 'gender_neutral' | null;
19
+ isOwner?: boolean | null;
20
+ limit?: number | null;
21
+ q?: string | null;
22
+ expand?: Array<'preview_file_url'> | null;
23
+ }
15
24
 
16
25
  export interface BackCompatCloneVoiceRequest {
17
- name: string;
18
- description?: string;
19
- language: string;
20
- mode: "similarity" | "stability";
21
- enhance?: boolean;
22
- baseVoiceId?: string;
26
+ name: string;
27
+ description?: string;
28
+ language: string;
29
+ mode: 'similarity' | 'stability';
30
+ enhance?: boolean;
31
+ baseVoiceId?: string;
23
32
  }
24
33
 
25
34
  export interface BackCompatUpdateVoiceRequest {
26
- name: string;
27
- description: string;
35
+ name: string;
36
+ description: string;
28
37
  }
29
38
 
30
39
  export interface BackCompatLocalizeVoiceRequest {
31
- voiceId: string;
32
- name: string;
33
- description: string;
34
- language:
35
- | "en"
36
- | "de"
37
- | "es"
38
- | "fr"
39
- | "ja"
40
- | "pt"
41
- | "zh"
42
- | "hi"
43
- | "it"
44
- | "ko"
45
- | "nl"
46
- | "pl"
47
- | "ru"
48
- | "sv"
49
- | "tr";
50
- originalSpeakerGender: "male" | "female";
51
- dialect?:
52
- | "au"
53
- | "in"
54
- | "so"
55
- | "uk"
56
- | "us"
57
- | "mx"
58
- | "pe"
59
- | "br"
60
- | "eu"
61
- | "ca";
40
+ voiceId: string;
41
+ name: string;
42
+ description: string;
43
+ language:
44
+ | 'en'
45
+ | 'de'
46
+ | 'es'
47
+ | 'fr'
48
+ | 'ja'
49
+ | 'pt'
50
+ | 'zh'
51
+ | 'hi'
52
+ | 'it'
53
+ | 'ko'
54
+ | 'nl'
55
+ | 'pl'
56
+ | 'ru'
57
+ | 'sv'
58
+ | 'tr';
59
+ originalSpeakerGender: 'male' | 'female';
60
+ dialect?: 'au' | 'in' | 'so' | 'uk' | 'us' | 'mx' | 'pe' | 'br' | 'eu' | 'ca';
62
61
  }
63
62
 
64
63
  /** @deprecated Use the new SDK's voices methods on the {@link Cartesia} instance instead. */
65
64
  export class VoicesWrapper {
66
- private client: Cartesia;
67
-
68
- constructor(client: Cartesia) {
69
- this.client = client;
70
- }
71
-
72
- /** @deprecated Use {@link Cartesia.voices.clone} instead. */
73
- async clone(
74
- clip: File | fs.ReadStream | Blob,
75
- request: BackCompatCloneVoiceRequest,
76
- requestOptions?: BackCompatRequestOptions
77
- ): Promise<VoiceMetadata> {
78
- const params: VoiceCloneParams = {
79
- clip: clip as Uploadable,
80
- name: request.name,
81
- language: request.language as SupportedLanguage,
82
- };
83
-
84
- if (request.description !== undefined) {
85
- params.description = request.description;
86
- }
87
- if (request.baseVoiceId !== undefined) {
88
- params.base_voice_id = request.baseVoiceId;
89
- }
90
-
91
- const options: InternalRequestOptions = {};
92
- if (requestOptions) {
93
- if (requestOptions.timeoutInSeconds) {
94
- options.timeout = requestOptions.timeoutInSeconds * 1000;
95
- }
96
- if (requestOptions.maxRetries !== undefined) {
97
- options.maxRetries = requestOptions.maxRetries;
98
- }
99
- options.headers = requestOptions.headers;
100
- options.signal = requestOptions.abortSignal;
101
- }
102
-
103
- return wrap(this.client.voices.clone(params, options));
104
- }
105
-
106
- /** @deprecated Use {@link Cartesia.voices.update} instead. */
107
- async update(
108
- id: string,
109
- request: BackCompatUpdateVoiceRequest,
110
- requestOptions?: BackCompatRequestOptions
111
- ): Promise<Voice> {
112
- const params: VoiceUpdateParams = {
113
- name: request.name,
114
- description: request.description,
115
- };
116
-
117
- const options: InternalRequestOptions = {};
118
- if (requestOptions) {
119
- if (requestOptions.timeoutInSeconds) {
120
- options.timeout = requestOptions.timeoutInSeconds * 1000;
121
- }
122
- if (requestOptions.maxRetries !== undefined) {
123
- options.maxRetries = requestOptions.maxRetries;
124
- }
125
- options.headers = requestOptions.headers;
126
- options.signal = requestOptions.abortSignal;
127
- }
128
-
129
- return wrap(this.client.voices.update(id, params, options));
130
- }
131
-
132
- /** @deprecated Use {@link Cartesia.voices.localize} instead. */
133
- async localize(
134
- request: BackCompatLocalizeVoiceRequest,
135
- requestOptions?: BackCompatRequestOptions
136
- ): Promise<VoiceMetadata> {
137
- const params: VoiceLocalizeParams = {
138
- voice_id: request.voiceId,
139
- name: request.name,
140
- description: request.description,
141
- language: request.language as any,
142
- original_speaker_gender: request.originalSpeakerGender,
143
- };
144
-
145
- if (request.dialect) {
146
- params.dialect = request.dialect as any; // Cast dialect as list might vary slightly or be strict
147
- }
148
-
149
- const options: InternalRequestOptions = {};
150
- if (requestOptions) {
151
- if (requestOptions.timeoutInSeconds) {
152
- options.timeout = requestOptions.timeoutInSeconds * 1000;
153
- }
154
- if (requestOptions.maxRetries !== undefined) {
155
- options.maxRetries = requestOptions.maxRetries;
156
- }
157
- options.headers = requestOptions.headers;
158
- options.signal = requestOptions.abortSignal;
159
- }
160
-
161
- return wrap(this.client.voices.localize(params, options));
162
- }
163
- }
65
+ private client: Cartesia;
66
+
67
+ constructor(client: Cartesia) {
68
+ this.client = client;
69
+ }
70
+
71
+ /** @deprecated Use {@link Cartesia.voices.clone} instead. */
72
+ async clone(
73
+ clip: File | fs.ReadStream | Blob,
74
+ request: BackCompatCloneVoiceRequest,
75
+ requestOptions?: BackCompatRequestOptions,
76
+ ): Promise<VoiceMetadata> {
77
+ const params: VoiceCloneParams = {
78
+ clip: clip as Uploadable,
79
+ name: request.name,
80
+ language: request.language as SupportedLanguage,
81
+ };
82
+
83
+ if (request.description !== undefined) {
84
+ params.description = request.description;
85
+ }
86
+ if (request.baseVoiceId !== undefined) {
87
+ params.base_voice_id = request.baseVoiceId;
88
+ }
89
+
90
+ const options: InternalRequestOptions = {};
91
+ if (requestOptions) {
92
+ if (requestOptions.timeoutInSeconds) {
93
+ options.timeout = requestOptions.timeoutInSeconds * 1000;
94
+ }
95
+ if (requestOptions.maxRetries !== undefined) {
96
+ options.maxRetries = requestOptions.maxRetries;
97
+ }
98
+ options.headers = requestOptions.headers;
99
+ options.signal = requestOptions.abortSignal;
100
+ }
101
+
102
+ return wrap(this.client.voices.clone(params, options));
103
+ }
104
+
105
+ /** @deprecated Use {@link Cartesia.voices.update} instead. */
106
+ async update(
107
+ id: string,
108
+ request: BackCompatUpdateVoiceRequest,
109
+ requestOptions?: BackCompatRequestOptions,
110
+ ): Promise<Voice> {
111
+ const params: VoiceUpdateParams = {
112
+ name: request.name,
113
+ description: request.description,
114
+ };
115
+
116
+ const options: InternalRequestOptions = {};
117
+ if (requestOptions) {
118
+ if (requestOptions.timeoutInSeconds) {
119
+ options.timeout = requestOptions.timeoutInSeconds * 1000;
120
+ }
121
+ if (requestOptions.maxRetries !== undefined) {
122
+ options.maxRetries = requestOptions.maxRetries;
123
+ }
124
+ options.headers = requestOptions.headers;
125
+ options.signal = requestOptions.abortSignal;
126
+ }
127
+
128
+ return wrap(this.client.voices.update(id, params, options));
129
+ }
130
+
131
+ /** @deprecated Use {@link Cartesia.voices.localize} instead. */
132
+ async localize(
133
+ request: BackCompatLocalizeVoiceRequest,
134
+ requestOptions?: BackCompatRequestOptions,
135
+ ): Promise<VoiceMetadata> {
136
+ const params: VoiceLocalizeParams = {
137
+ voice_id: request.voiceId,
138
+ name: request.name,
139
+ description: request.description,
140
+ language: request.language as any,
141
+ original_speaker_gender: request.originalSpeakerGender,
142
+ };
143
+
144
+ if (request.dialect) {
145
+ params.dialect = request.dialect as any; // Cast dialect as list might vary slightly or be strict
146
+ }
147
+
148
+ const options: InternalRequestOptions = {};
149
+ if (requestOptions) {
150
+ if (requestOptions.timeoutInSeconds) {
151
+ options.timeout = requestOptions.timeoutInSeconds * 1000;
152
+ }
153
+ if (requestOptions.maxRetries !== undefined) {
154
+ options.maxRetries = requestOptions.maxRetries;
155
+ }
156
+ options.headers = requestOptions.headers;
157
+ options.signal = requestOptions.abortSignal;
158
+ }
159
+
160
+ return wrap(this.client.voices.localize(params, options));
161
+ }
162
+
163
+ /** @deprecated Use {@link Cartesia.voices.get} instead. */
164
+ async get(id: string, requestOptions?: BackCompatRequestOptions): Promise<Voice> {
165
+ const options: InternalRequestOptions = {};
166
+ if (requestOptions) {
167
+ if (requestOptions.timeoutInSeconds) {
168
+ options.timeout = requestOptions.timeoutInSeconds * 1000;
169
+ }
170
+ if (requestOptions.maxRetries !== undefined) {
171
+ options.maxRetries = requestOptions.maxRetries;
172
+ }
173
+ options.headers = requestOptions.headers;
174
+ options.signal = requestOptions.abortSignal;
175
+ }
176
+
177
+ return wrap(this.client.voices.get(id, {}, options));
178
+ }
179
+
180
+ /** @deprecated Use {@link Cartesia.voices.list} instead. */
181
+ async list(
182
+ listOptions?: BackCompatVoiceListOptions,
183
+ requestOptions?: BackCompatRequestOptions,
184
+ ): Promise<Voice[]> {
185
+ const params: VoiceListParams = {};
186
+ if (listOptions) {
187
+ if (listOptions.gender !== undefined) params.gender = listOptions.gender;
188
+ if (listOptions.isOwner !== undefined) params.is_owner = listOptions.isOwner;
189
+ if (listOptions.limit !== undefined) params.limit = listOptions.limit;
190
+ if (listOptions.q !== undefined) params.q = listOptions.q;
191
+ if (listOptions.expand !== undefined) params.expand = listOptions.expand;
192
+ }
193
+
194
+ const options: InternalRequestOptions = {};
195
+ if (requestOptions) {
196
+ if (requestOptions.timeoutInSeconds) {
197
+ options.timeout = requestOptions.timeoutInSeconds * 1000;
198
+ }
199
+ if (requestOptions.maxRetries !== undefined) {
200
+ options.maxRetries = requestOptions.maxRetries;
201
+ }
202
+ options.headers = requestOptions.headers;
203
+ options.signal = requestOptions.abortSignal;
204
+ }
205
+
206
+ // The new SDK returns a paginated result, we collect all pages
207
+ const voices: Voice[] = [];
208
+ for await (const voice of this.client.voices.list(params, options)) {
209
+ voices.push(voice);
210
+ }
211
+ return voices;
212
+ }
213
+
214
+ /** @deprecated Use {@link Cartesia.voices.delete} instead. */
215
+ async delete(id: string, requestOptions?: BackCompatRequestOptions): Promise<void> {
216
+ const options: InternalRequestOptions = {};
217
+ if (requestOptions) {
218
+ if (requestOptions.timeoutInSeconds) {
219
+ options.timeout = requestOptions.timeoutInSeconds * 1000;
220
+ }
221
+ if (requestOptions.maxRetries !== undefined) {
222
+ options.maxRetries = requestOptions.maxRetries;
223
+ }
224
+ options.headers = requestOptions.headers;
225
+ options.signal = requestOptions.abortSignal;
226
+ }
227
+
228
+ return wrap(this.client.voices.delete(id, options));
229
+ }
230
+ }
@@ -28,11 +28,10 @@ export class Calls extends APIResource {
28
28
  * The downloaded audio file is in .wav format. This endpoint streams the audio
29
29
  * file content (WAV format) to the client.
30
30
  */
31
- downloadAudio(callID: string, options?: RequestOptions): APIPromise<Response> {
31
+ downloadAudio(callID: string, options?: RequestOptions): APIPromise<void> {
32
32
  return this._client.get(path`/agents/calls/${callID}/audio`, {
33
33
  ...options,
34
- headers: buildHeaders([{ Accept: 'audio/wav' }, options?.headers]),
35
- __binaryResponse: true,
34
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
36
35
  });
37
36
  }
38
37
  }
@@ -29,16 +29,11 @@ export class Infill extends APIResource {
29
29
  * keeping as much silence in the left/right audio segments as possible
30
30
  * - This helps the model generate more natural transitions
31
31
  */
32
- create(body: InfillCreateParams, options?: RequestOptions): APIPromise<Response> {
32
+ create(body: InfillCreateParams, options?: RequestOptions): APIPromise<void> {
33
33
  return this._client.post(
34
34
  '/infill/bytes',
35
35
  multipartFormRequestOptions(
36
- {
37
- body,
38
- ...options,
39
- headers: buildHeaders([{ Accept: 'audio/wav' }, options?.headers]),
40
- __binaryResponse: true,
41
- },
36
+ { body, ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]) },
42
37
  this._client,
43
38
  ),
44
39
  );
@@ -15,16 +15,11 @@ export class VoiceChanger extends APIResource {
15
15
  *
16
16
  * This endpoint is priced at 15 characters per second of input audio.
17
17
  */
18
- changeVoiceBytes(body: VoiceChangerChangeVoiceBytesParams, options?: RequestOptions): APIPromise<Response> {
18
+ changeVoiceBytes(body: VoiceChangerChangeVoiceBytesParams, options?: RequestOptions): APIPromise<void> {
19
19
  return this._client.post(
20
20
  '/voice-changer/bytes',
21
21
  multipartFormRequestOptions(
22
- {
23
- body,
24
- ...options,
25
- headers: buildHeaders([{ Accept: 'audio/wav' }, options?.headers]),
26
- __binaryResponse: true,
27
- },
22
+ { body, ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]) },
28
23
  this._client,
29
24
  ),
30
25
  );
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '3.0.0-b11'; // x-release-please-version
1
+ export const VERSION = '3.0.0-b13'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.0.0-b11";
1
+ export declare const VERSION = "3.0.0-b13";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.0.0-b11";
1
+ export declare const VERSION = "3.0.0-b13";
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 = '3.0.0-b11'; // x-release-please-version
4
+ exports.VERSION = '3.0.0-b13'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '3.0.0-b11'; // x-release-please-version
1
+ export const VERSION = '3.0.0-b13'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map