@cartesia/cartesia-js 1.2.1 → 1.2.2-alpha.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.
@@ -54,6 +54,43 @@ var Voices = class extends Client {
54
54
  throw new Error("Invalid mode for clone()");
55
55
  });
56
56
  }
57
+ hifiClone(options) {
58
+ return __async(this, null, function* () {
59
+ var _a;
60
+ if (options.mode !== "clip") {
61
+ throw new Error("Invalid mode for hifiClone()");
62
+ }
63
+ const formData = new FormData();
64
+ formData.append("clip", options.clip);
65
+ formData.append("name", options.name);
66
+ formData.append("description", options.description);
67
+ formData.append("language", options.language);
68
+ formData.append("model_id", options.model_id);
69
+ if (options.enhance !== void 0) {
70
+ formData.append("enhance", options.enhance.toString());
71
+ }
72
+ if (options.transcript) {
73
+ formData.append("transcript", options.transcript);
74
+ }
75
+ if (options.base_voice_id) {
76
+ formData.append("base_voice_id", options.base_voice_id);
77
+ }
78
+ const response = yield this._fetch("/voices/clone/hifi", {
79
+ method: "POST",
80
+ body: formData
81
+ });
82
+ if (!response.ok) {
83
+ if ((_a = response.headers.get("content-type")) == null ? void 0 : _a.includes("application/json")) {
84
+ const errorData = yield response.json();
85
+ throw new Error(errorData.message || "HiFi clone failed");
86
+ }
87
+ const errorText = yield response.text();
88
+ throw new Error(errorText || "HiFi clone failed");
89
+ }
90
+ const data = yield response.json();
91
+ return data;
92
+ });
93
+ }
57
94
  mix(options) {
58
95
  return __async(this, null, function* () {
59
96
  const response = yield this._fetch("/voices/mix", {
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-EYRYHK3X.js";
4
4
  import {
5
5
  Voices
6
- } from "./chunk-RJICGVPL.js";
6
+ } from "./chunk-62LXGS65.js";
7
7
  import {
8
8
  VoiceChanger
9
9
  } from "./chunk-WLEVU3HN.js";
package/dist/index.cjs CHANGED
@@ -717,6 +717,43 @@ var Voices = class extends Client {
717
717
  throw new Error("Invalid mode for clone()");
718
718
  });
719
719
  }
720
+ hifiClone(options) {
721
+ return __async(this, null, function* () {
722
+ var _a;
723
+ if (options.mode !== "clip") {
724
+ throw new Error("Invalid mode for hifiClone()");
725
+ }
726
+ const formData = new FormData();
727
+ formData.append("clip", options.clip);
728
+ formData.append("name", options.name);
729
+ formData.append("description", options.description);
730
+ formData.append("language", options.language);
731
+ formData.append("model_id", options.model_id);
732
+ if (options.enhance !== void 0) {
733
+ formData.append("enhance", options.enhance.toString());
734
+ }
735
+ if (options.transcript) {
736
+ formData.append("transcript", options.transcript);
737
+ }
738
+ if (options.base_voice_id) {
739
+ formData.append("base_voice_id", options.base_voice_id);
740
+ }
741
+ const response = yield this._fetch("/voices/clone/hifi", {
742
+ method: "POST",
743
+ body: formData
744
+ });
745
+ if (!response.ok) {
746
+ if ((_a = response.headers.get("content-type")) == null ? void 0 : _a.includes("application/json")) {
747
+ const errorData = yield response.json();
748
+ throw new Error(errorData.message || "HiFi clone failed");
749
+ }
750
+ const errorText = yield response.text();
751
+ throw new Error(errorText || "HiFi clone failed");
752
+ }
753
+ const data = yield response.json();
754
+ return data;
755
+ });
756
+ }
720
757
  mix(options) {
721
758
  return __async(this, null, function* () {
722
759
  const response = yield this._fetch("/voices/mix", {
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { Cartesia, Cartesia as default } from './lib/index.cjs';
2
- export { BytesRequest, Chunk, ClientOptions, CloneOptions, CloneResponse, ConnectionEventData, ContinueRequest, CreateVoice, EmitteryCallbacks, Emotion, EmotionControl, Encoding, Intensity, Language, LocalizeOptions, LocalizeResponse, MixVoicesOptions, MixVoicesResponse, Sentinel, SourceEventData, StreamOptions, StreamRequest, TypedArray, UpdateVoice, Voice, VoiceChangerBytesResponse, VoiceChangerOptions, VoiceOptions, VoiceSpecifier, VoiceToMix, WebSocketBaseResponse, WebSocketChunkResponse, WebSocketErrorResponse, WebSocketOptions, WebSocketResponse, WebSocketTimestampsResponse, WordTimestamps } from './types/index.cjs';
2
+ export { BytesRequest, Chunk, ClientOptions, CloneOptions, CloneResponse, ConnectionEventData, ContinueRequest, CreateVoice, EmitteryCallbacks, Emotion, EmotionControl, Encoding, HifiCloneOptions, Intensity, Language, LocalizeOptions, LocalizeResponse, MixVoicesOptions, MixVoicesResponse, Sentinel, SourceEventData, StreamOptions, StreamRequest, TypedArray, UpdateVoice, Voice, VoiceChangerBytesResponse, VoiceChangerOptions, VoiceOptions, VoiceSpecifier, VoiceToMix, WebSocketBaseResponse, WebSocketChunkResponse, WebSocketErrorResponse, WebSocketOptions, WebSocketResponse, WebSocketTimestampsResponse, WordTimestamps } from './types/index.cjs';
3
3
  export { default as WebPlayer } from './tts/player.cjs';
4
4
  export { default as Source } from './tts/source.cjs';
5
5
  export { default as WebSocket } from './tts/websocket.cjs';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { Cartesia, Cartesia as default } from './lib/index.js';
2
- export { BytesRequest, Chunk, ClientOptions, CloneOptions, CloneResponse, ConnectionEventData, ContinueRequest, CreateVoice, EmitteryCallbacks, Emotion, EmotionControl, Encoding, Intensity, Language, LocalizeOptions, LocalizeResponse, MixVoicesOptions, MixVoicesResponse, Sentinel, SourceEventData, StreamOptions, StreamRequest, TypedArray, UpdateVoice, Voice, VoiceChangerBytesResponse, VoiceChangerOptions, VoiceOptions, VoiceSpecifier, VoiceToMix, WebSocketBaseResponse, WebSocketChunkResponse, WebSocketErrorResponse, WebSocketOptions, WebSocketResponse, WebSocketTimestampsResponse, WordTimestamps } from './types/index.js';
2
+ export { BytesRequest, Chunk, ClientOptions, CloneOptions, CloneResponse, ConnectionEventData, ContinueRequest, CreateVoice, EmitteryCallbacks, Emotion, EmotionControl, Encoding, HifiCloneOptions, Intensity, Language, LocalizeOptions, LocalizeResponse, MixVoicesOptions, MixVoicesResponse, Sentinel, SourceEventData, StreamOptions, StreamRequest, TypedArray, UpdateVoice, Voice, VoiceChangerBytesResponse, VoiceChangerOptions, VoiceOptions, VoiceSpecifier, VoiceToMix, WebSocketBaseResponse, WebSocketChunkResponse, WebSocketErrorResponse, WebSocketOptions, WebSocketResponse, WebSocketTimestampsResponse, WordTimestamps } from './types/index.js';
3
3
  export { default as WebPlayer } from './tts/player.js';
4
4
  export { default as Source } from './tts/source.js';
5
5
  export { default as WebSocket } from './tts/websocket.js';
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-CSOXALSC.js";
4
4
  import {
5
5
  Cartesia
6
- } from "./chunk-YUGIYUMT.js";
6
+ } from "./chunk-MGVQHO25.js";
7
7
  import "./chunk-EYRYHK3X.js";
8
8
  import {
9
9
  WebSocket
@@ -12,7 +12,7 @@ import "./chunk-5SBAQNWQ.js";
12
12
  import {
13
13
  Source
14
14
  } from "./chunk-I5YVYTNK.js";
15
- import "./chunk-RJICGVPL.js";
15
+ import "./chunk-62LXGS65.js";
16
16
  import "./chunk-FXPGR372.js";
17
17
  import "./chunk-WLEVU3HN.js";
18
18
  import "./chunk-FLWYXP5Z.js";
@@ -700,6 +700,43 @@ var Voices = class extends Client {
700
700
  throw new Error("Invalid mode for clone()");
701
701
  });
702
702
  }
703
+ hifiClone(options) {
704
+ return __async(this, null, function* () {
705
+ var _a;
706
+ if (options.mode !== "clip") {
707
+ throw new Error("Invalid mode for hifiClone()");
708
+ }
709
+ const formData = new FormData();
710
+ formData.append("clip", options.clip);
711
+ formData.append("name", options.name);
712
+ formData.append("description", options.description);
713
+ formData.append("language", options.language);
714
+ formData.append("model_id", options.model_id);
715
+ if (options.enhance !== void 0) {
716
+ formData.append("enhance", options.enhance.toString());
717
+ }
718
+ if (options.transcript) {
719
+ formData.append("transcript", options.transcript);
720
+ }
721
+ if (options.base_voice_id) {
722
+ formData.append("base_voice_id", options.base_voice_id);
723
+ }
724
+ const response = yield this._fetch("/voices/clone/hifi", {
725
+ method: "POST",
726
+ body: formData
727
+ });
728
+ if (!response.ok) {
729
+ if ((_a = response.headers.get("content-type")) == null ? void 0 : _a.includes("application/json")) {
730
+ const errorData = yield response.json();
731
+ throw new Error(errorData.message || "HiFi clone failed");
732
+ }
733
+ const errorText = yield response.text();
734
+ throw new Error(errorText || "HiFi clone failed");
735
+ }
736
+ const data = yield response.json();
737
+ return data;
738
+ });
739
+ }
703
740
  mix(options) {
704
741
  return __async(this, null, function* () {
705
742
  const response = yield this._fetch("/voices/mix", {
package/dist/lib/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  Cartesia
3
- } from "../chunk-YUGIYUMT.js";
3
+ } from "../chunk-MGVQHO25.js";
4
4
  import "../chunk-EYRYHK3X.js";
5
5
  import "../chunk-HQOC2S6C.js";
6
6
  import "../chunk-5SBAQNWQ.js";
7
7
  import "../chunk-I5YVYTNK.js";
8
- import "../chunk-RJICGVPL.js";
8
+ import "../chunk-62LXGS65.js";
9
9
  import "../chunk-WLEVU3HN.js";
10
10
  import "../chunk-FLWYXP5Z.js";
11
11
  import "../chunk-2BFEKY3F.js";
@@ -714,6 +714,43 @@ var Voices = class extends Client {
714
714
  throw new Error("Invalid mode for clone()");
715
715
  });
716
716
  }
717
+ hifiClone(options) {
718
+ return __async(this, null, function* () {
719
+ var _a;
720
+ if (options.mode !== "clip") {
721
+ throw new Error("Invalid mode for hifiClone()");
722
+ }
723
+ const formData = new FormData();
724
+ formData.append("clip", options.clip);
725
+ formData.append("name", options.name);
726
+ formData.append("description", options.description);
727
+ formData.append("language", options.language);
728
+ formData.append("model_id", options.model_id);
729
+ if (options.enhance !== void 0) {
730
+ formData.append("enhance", options.enhance.toString());
731
+ }
732
+ if (options.transcript) {
733
+ formData.append("transcript", options.transcript);
734
+ }
735
+ if (options.base_voice_id) {
736
+ formData.append("base_voice_id", options.base_voice_id);
737
+ }
738
+ const response = yield this._fetch("/voices/clone/hifi", {
739
+ method: "POST",
740
+ body: formData
741
+ });
742
+ if (!response.ok) {
743
+ if ((_a = response.headers.get("content-type")) == null ? void 0 : _a.includes("application/json")) {
744
+ const errorData = yield response.json();
745
+ throw new Error(errorData.message || "HiFi clone failed");
746
+ }
747
+ const errorText = yield response.text();
748
+ throw new Error(errorText || "HiFi clone failed");
749
+ }
750
+ const data = yield response.json();
751
+ return data;
752
+ });
753
+ }
717
754
  mix(options) {
718
755
  return __async(this, null, function* () {
719
756
  const response = yield this._fetch("/voices/mix", {
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  Player
3
3
  } from "../chunk-CSOXALSC.js";
4
+ import {
5
+ pingServer
6
+ } from "../chunk-LKKWJLUG.js";
4
7
  import {
5
8
  Cartesia
6
- } from "../chunk-YUGIYUMT.js";
9
+ } from "../chunk-MGVQHO25.js";
7
10
  import "../chunk-EYRYHK3X.js";
8
11
  import "../chunk-HQOC2S6C.js";
9
12
  import "../chunk-5SBAQNWQ.js";
10
13
  import "../chunk-I5YVYTNK.js";
11
- import "../chunk-RJICGVPL.js";
12
- import {
13
- pingServer
14
- } from "../chunk-LKKWJLUG.js";
14
+ import "../chunk-62LXGS65.js";
15
15
  import "../chunk-WLEVU3HN.js";
16
16
  import "../chunk-FLWYXP5Z.js";
17
17
  import "../chunk-2BFEKY3F.js";
@@ -88,6 +88,14 @@ type CloneOptions = {
88
88
  clip: Blob;
89
89
  enhance?: boolean;
90
90
  };
91
+ type HifiCloneOptions = CloneOptions & {
92
+ name: string;
93
+ description: string;
94
+ language: Language;
95
+ model_id: string;
96
+ transcript?: string;
97
+ base_voice_id?: string;
98
+ };
91
99
  type VoiceChangerOptions = {
92
100
  clip: File;
93
101
  voice: {
@@ -162,4 +170,4 @@ type SourceEventData = {
162
170
  type TypedArray = Float32Array | Int16Array | Uint8Array;
163
171
  type Encoding = "pcm_f32le" | "pcm_s16le" | "pcm_alaw" | "pcm_mulaw";
164
172
 
165
- export type { BytesRequest, Chunk, ClientOptions, CloneOptions, CloneResponse, ConnectionEventData, ContinueRequest, CreateVoice, EmitteryCallbacks, Emotion, EmotionControl, Encoding, Intensity, Language, LocalizeOptions, LocalizeResponse, MixVoicesOptions, MixVoicesResponse, Sentinel, SourceEventData, StreamOptions, StreamRequest, TypedArray, UpdateVoice, Voice, VoiceChangerBytesResponse, VoiceChangerOptions, VoiceOptions, VoiceSpecifier, VoiceToMix, WebSocketBaseResponse, WebSocketChunkResponse, WebSocketErrorResponse, WebSocketOptions, WebSocketResponse, WebSocketTimestampsResponse, WordTimestamps };
173
+ export type { BytesRequest, Chunk, ClientOptions, CloneOptions, CloneResponse, ConnectionEventData, ContinueRequest, CreateVoice, EmitteryCallbacks, Emotion, EmotionControl, Encoding, HifiCloneOptions, Intensity, Language, LocalizeOptions, LocalizeResponse, MixVoicesOptions, MixVoicesResponse, Sentinel, SourceEventData, StreamOptions, StreamRequest, TypedArray, UpdateVoice, Voice, VoiceChangerBytesResponse, VoiceChangerOptions, VoiceOptions, VoiceSpecifier, VoiceToMix, WebSocketBaseResponse, WebSocketChunkResponse, WebSocketErrorResponse, WebSocketOptions, WebSocketResponse, WebSocketTimestampsResponse, WordTimestamps };
@@ -88,6 +88,14 @@ type CloneOptions = {
88
88
  clip: Blob;
89
89
  enhance?: boolean;
90
90
  };
91
+ type HifiCloneOptions = CloneOptions & {
92
+ name: string;
93
+ description: string;
94
+ language: Language;
95
+ model_id: string;
96
+ transcript?: string;
97
+ base_voice_id?: string;
98
+ };
91
99
  type VoiceChangerOptions = {
92
100
  clip: File;
93
101
  voice: {
@@ -162,4 +170,4 @@ type SourceEventData = {
162
170
  type TypedArray = Float32Array | Int16Array | Uint8Array;
163
171
  type Encoding = "pcm_f32le" | "pcm_s16le" | "pcm_alaw" | "pcm_mulaw";
164
172
 
165
- export type { BytesRequest, Chunk, ClientOptions, CloneOptions, CloneResponse, ConnectionEventData, ContinueRequest, CreateVoice, EmitteryCallbacks, Emotion, EmotionControl, Encoding, Intensity, Language, LocalizeOptions, LocalizeResponse, MixVoicesOptions, MixVoicesResponse, Sentinel, SourceEventData, StreamOptions, StreamRequest, TypedArray, UpdateVoice, Voice, VoiceChangerBytesResponse, VoiceChangerOptions, VoiceOptions, VoiceSpecifier, VoiceToMix, WebSocketBaseResponse, WebSocketChunkResponse, WebSocketErrorResponse, WebSocketOptions, WebSocketResponse, WebSocketTimestampsResponse, WordTimestamps };
173
+ export type { BytesRequest, Chunk, ClientOptions, CloneOptions, CloneResponse, ConnectionEventData, ContinueRequest, CreateVoice, EmitteryCallbacks, Emotion, EmotionControl, Encoding, HifiCloneOptions, Intensity, Language, LocalizeOptions, LocalizeResponse, MixVoicesOptions, MixVoicesResponse, Sentinel, SourceEventData, StreamOptions, StreamRequest, TypedArray, UpdateVoice, Voice, VoiceChangerBytesResponse, VoiceChangerOptions, VoiceOptions, VoiceSpecifier, VoiceToMix, WebSocketBaseResponse, WebSocketChunkResponse, WebSocketErrorResponse, WebSocketOptions, WebSocketResponse, WebSocketTimestampsResponse, WordTimestamps };
@@ -159,6 +159,43 @@ var Voices = class extends Client {
159
159
  throw new Error("Invalid mode for clone()");
160
160
  });
161
161
  }
162
+ hifiClone(options) {
163
+ return __async(this, null, function* () {
164
+ var _a;
165
+ if (options.mode !== "clip") {
166
+ throw new Error("Invalid mode for hifiClone()");
167
+ }
168
+ const formData = new FormData();
169
+ formData.append("clip", options.clip);
170
+ formData.append("name", options.name);
171
+ formData.append("description", options.description);
172
+ formData.append("language", options.language);
173
+ formData.append("model_id", options.model_id);
174
+ if (options.enhance !== void 0) {
175
+ formData.append("enhance", options.enhance.toString());
176
+ }
177
+ if (options.transcript) {
178
+ formData.append("transcript", options.transcript);
179
+ }
180
+ if (options.base_voice_id) {
181
+ formData.append("base_voice_id", options.base_voice_id);
182
+ }
183
+ const response = yield this._fetch("/voices/clone/hifi", {
184
+ method: "POST",
185
+ body: formData
186
+ });
187
+ if (!response.ok) {
188
+ if ((_a = response.headers.get("content-type")) == null ? void 0 : _a.includes("application/json")) {
189
+ const errorData = yield response.json();
190
+ throw new Error(errorData.message || "HiFi clone failed");
191
+ }
192
+ const errorText = yield response.text();
193
+ throw new Error(errorText || "HiFi clone failed");
194
+ }
195
+ const data = yield response.json();
196
+ return data;
197
+ });
198
+ }
162
199
  mix(options) {
163
200
  return __async(this, null, function* () {
164
201
  const response = yield this._fetch("/voices/mix", {
@@ -1,5 +1,5 @@
1
1
  import { Client } from '../lib/client.cjs';
2
- import { Voice, CreateVoice, UpdateVoice, CloneOptions, CloneResponse, MixVoicesOptions, MixVoicesResponse, LocalizeOptions, LocalizeResponse } from '../types/index.cjs';
2
+ import { Voice, CreateVoice, UpdateVoice, CloneOptions, CloneResponse, HifiCloneOptions, MixVoicesOptions, MixVoicesResponse, LocalizeOptions, LocalizeResponse } from '../types/index.cjs';
3
3
  import 'emittery';
4
4
 
5
5
  declare class Voices extends Client {
@@ -8,6 +8,7 @@ declare class Voices extends Client {
8
8
  create(voice: CreateVoice): Promise<Voice>;
9
9
  update(id: string, voice: UpdateVoice): Promise<Voice>;
10
10
  clone(options: CloneOptions): Promise<CloneResponse>;
11
+ hifiClone(options: HifiCloneOptions): Promise<Voice>;
11
12
  mix(options: MixVoicesOptions): Promise<MixVoicesResponse>;
12
13
  localize(options: LocalizeOptions): Promise<LocalizeResponse>;
13
14
  }
@@ -1,5 +1,5 @@
1
1
  import { Client } from '../lib/client.js';
2
- import { Voice, CreateVoice, UpdateVoice, CloneOptions, CloneResponse, MixVoicesOptions, MixVoicesResponse, LocalizeOptions, LocalizeResponse } from '../types/index.js';
2
+ import { Voice, CreateVoice, UpdateVoice, CloneOptions, CloneResponse, HifiCloneOptions, MixVoicesOptions, MixVoicesResponse, LocalizeOptions, LocalizeResponse } from '../types/index.js';
3
3
  import 'emittery';
4
4
 
5
5
  declare class Voices extends Client {
@@ -8,6 +8,7 @@ declare class Voices extends Client {
8
8
  create(voice: CreateVoice): Promise<Voice>;
9
9
  update(id: string, voice: UpdateVoice): Promise<Voice>;
10
10
  clone(options: CloneOptions): Promise<CloneResponse>;
11
+ hifiClone(options: HifiCloneOptions): Promise<Voice>;
11
12
  mix(options: MixVoicesOptions): Promise<MixVoicesResponse>;
12
13
  localize(options: LocalizeOptions): Promise<LocalizeResponse>;
13
14
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Voices
3
- } from "../chunk-RJICGVPL.js";
3
+ } from "../chunk-62LXGS65.js";
4
4
  import "../chunk-FLWYXP5Z.js";
5
5
  import "../chunk-2BFEKY3F.js";
6
6
  import "../chunk-NJDRWDQ3.js";
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Cartesia",
5
5
  "url": "https://cartesia.ai"
6
6
  },
7
- "version": "1.2.1",
7
+ "version": "1.2.2-alpha.0",
8
8
  "description": "Client for the Cartesia API.",
9
9
  "type": "module",
10
10
  "module": "./dist/index.js",
@@ -131,6 +131,15 @@ export type CloneOptions =
131
131
  enhance?: boolean;
132
132
  };
133
133
 
134
+ export type HifiCloneOptions = CloneOptions & {
135
+ name: string;
136
+ description: string;
137
+ language: Language;
138
+ model_id: string;
139
+ transcript?: string;
140
+ base_voice_id?: string;
141
+ };
142
+
134
143
  export type VoiceChangerOptions = {
135
144
  clip: File;
136
145
  voice: { id: string }; // match VoiceSpecifier shape, but only id is supported for now
@@ -3,6 +3,7 @@ import type {
3
3
  CloneOptions,
4
4
  CloneResponse,
5
5
  CreateVoice,
6
+ HifiCloneOptions,
6
7
  LocalizeOptions,
7
8
  LocalizeResponse,
8
9
  MixVoicesOptions,
@@ -56,6 +57,45 @@ export default class Voices extends Client {
56
57
  throw new Error("Invalid mode for clone()");
57
58
  }
58
59
 
60
+ async hifiClone(options: HifiCloneOptions): Promise<Voice> {
61
+ if (options.mode !== "clip") {
62
+ throw new Error("Invalid mode for hifiClone()");
63
+ }
64
+
65
+ const formData = new FormData();
66
+ formData.append("clip", options.clip);
67
+ formData.append("name", options.name);
68
+ formData.append("description", options.description);
69
+ formData.append("language", options.language);
70
+ formData.append("model_id", options.model_id);
71
+ if (options.enhance !== undefined) {
72
+ formData.append("enhance", options.enhance.toString());
73
+ }
74
+ if (options.transcript) {
75
+ formData.append("transcript", options.transcript);
76
+ }
77
+ if (options.base_voice_id) {
78
+ formData.append("base_voice_id", options.base_voice_id);
79
+ }
80
+
81
+ const response = await this._fetch("/voices/clone/hifi", {
82
+ method: "POST",
83
+ body: formData,
84
+ });
85
+
86
+ if (!response.ok) {
87
+ if (response.headers.get("content-type")?.includes("application/json")) {
88
+ const errorData = await response.json();
89
+ throw new Error(errorData.message || "HiFi clone failed");
90
+ }
91
+ const errorText = await response.text();
92
+ throw new Error(errorText || "HiFi clone failed");
93
+ }
94
+
95
+ const data = await response.json();
96
+ return data as Voice;
97
+ }
98
+
59
99
  async mix(options: MixVoicesOptions): Promise<MixVoicesResponse> {
60
100
  const response = await this._fetch("/voices/mix", {
61
101
  method: "POST",