@cartesia/cartesia-js 2.0.0-alpha → 2.0.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.
package/Client.d.ts CHANGED
@@ -10,7 +10,7 @@ import { Voices } from "./api/resources/voices/client/Client";
10
10
  export declare namespace CartesiaClient {
11
11
  interface Options {
12
12
  environment?: core.Supplier<environments.CartesiaEnvironment | string>;
13
- apiKeyHeader?: core.Supplier<string | undefined>;
13
+ apiKey?: core.Supplier<string | undefined>;
14
14
  /** Override the Cartesia-Version header */
15
15
  cartesiaVersion?: "2024-06-10";
16
16
  fetcher?: core.FetchFunction;
package/README.md CHANGED
@@ -24,7 +24,7 @@ Instantiate and use the client with the following:
24
24
  ```typescript
25
25
  import { CartesiaClient } from "@cartesia/cartesia-js";
26
26
 
27
- const client = new CartesiaClient({ apiKeyHeader: "YOUR_API_KEY_HEADER" });
27
+ const client = new CartesiaClient({ apiKey: "YOUR_API_KEY_HEADER" });
28
28
  await client.tts.bytes({
29
29
  modelId: "sonic-english",
30
30
  transcript: "Hello, world!",
@@ -47,7 +47,7 @@ await client.tts.bytes({
47
47
  import { CartesiaClient } from "@cartesia/cartesia-js";
48
48
 
49
49
  const cartesia = new CartesiaClient({
50
- apiKeyHeader: "your-api-key",
50
+ apiKey: "your-api-key",
51
51
  });
52
52
 
53
53
  // Initialize the WebSocket. Make sure the output format you specify is supported.
@@ -7,7 +7,7 @@ import * as Cartesia from "../../../index";
7
7
  export declare namespace ApiStatus {
8
8
  interface Options {
9
9
  environment?: core.Supplier<environments.CartesiaEnvironment | string>;
10
- apiKeyHeader?: core.Supplier<string | undefined>;
10
+ apiKey?: core.Supplier<string | undefined>;
11
11
  /** Override the Cartesia-Version header */
12
12
  cartesiaVersion?: "2024-06-10";
13
13
  fetcher?: core.FetchFunction;
@@ -56,7 +56,7 @@ class ApiStatus {
56
56
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
57
57
  url: (_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production,
58
58
  method: "GET",
59
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
59
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
60
60
  contentType: "application/json",
61
61
  requestType: "json",
62
62
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -95,8 +95,8 @@ class ApiStatus {
95
95
  }
96
96
  _getCustomAuthorizationHeaders() {
97
97
  return __awaiter(this, void 0, void 0, function* () {
98
- const apiKeyHeaderValue = yield core.Supplier.get(this._options.apiKeyHeader);
99
- return { "X-API-Key": apiKeyHeaderValue };
98
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
99
+ return { "X-API-Key": apiKeyValue };
100
100
  });
101
101
  }
102
102
  }
@@ -9,7 +9,7 @@ import * as stream from "stream";
9
9
  export declare namespace Tts {
10
10
  interface Options {
11
11
  environment?: core.Supplier<environments.CartesiaEnvironment | string>;
12
- apiKeyHeader?: core.Supplier<string | undefined>;
12
+ apiKey?: core.Supplier<string | undefined>;
13
13
  /** Override the Cartesia-Version header */
14
14
  cartesiaVersion?: "2024-06-10";
15
15
  fetcher?: core.FetchFunction;
@@ -54,7 +54,7 @@ class Tts {
54
54
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
55
55
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/tts/bytes"),
56
56
  method: "POST",
57
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
57
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
58
58
  contentType: "application/json",
59
59
  requestType: "json",
60
60
  body: serializers.TtsRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -93,7 +93,7 @@ class Tts {
93
93
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
94
94
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/tts/sse"),
95
95
  method: "POST",
96
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
96
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
97
97
  contentType: "application/json",
98
98
  requestType: "json",
99
99
  body: serializers.TtsRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -144,8 +144,8 @@ class Tts {
144
144
  }
145
145
  _getCustomAuthorizationHeaders() {
146
146
  return __awaiter(this, void 0, void 0, function* () {
147
- const apiKeyHeaderValue = yield core.Supplier.get(this._options.apiKeyHeader);
148
- return { "X-API-Key": apiKeyHeaderValue };
147
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
148
+ return { "X-API-Key": apiKeyValue };
149
149
  });
150
150
  }
151
151
  }
@@ -11,7 +11,7 @@ import * as stream from "stream";
11
11
  export declare namespace VoiceChanger {
12
12
  interface Options {
13
13
  environment?: core.Supplier<environments.CartesiaEnvironment | string>;
14
- apiKeyHeader?: core.Supplier<string | undefined>;
14
+ apiKey?: core.Supplier<string | undefined>;
15
15
  /** Override the Cartesia-Version header */
16
16
  cartesiaVersion?: "2024-06-10";
17
17
  fetcher?: core.FetchFunction;
@@ -71,7 +71,7 @@ class VoiceChanger {
71
71
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
72
72
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voice-changer/bytes"),
73
73
  method: "POST",
74
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers),
74
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers),
75
75
  requestType: "file",
76
76
  duplex: _maybeEncodedRequest.duplex,
77
77
  body: _maybeEncodedRequest.body,
@@ -122,7 +122,7 @@ class VoiceChanger {
122
122
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
123
123
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voice-changer/sse"),
124
124
  method: "POST",
125
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers),
125
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers),
126
126
  requestType: "file",
127
127
  duplex: _maybeEncodedRequest.duplex,
128
128
  body: _maybeEncodedRequest.body,
@@ -173,8 +173,8 @@ class VoiceChanger {
173
173
  }
174
174
  _getCustomAuthorizationHeaders() {
175
175
  return __awaiter(this, void 0, void 0, function* () {
176
- const apiKeyHeaderValue = yield core.Supplier.get(this._options.apiKeyHeader);
177
- return { "X-API-Key": apiKeyHeaderValue };
176
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
177
+ return { "X-API-Key": apiKeyValue };
178
178
  });
179
179
  }
180
180
  }
@@ -10,7 +10,7 @@ import { Blob } from "buffer";
10
10
  export declare namespace Voices {
11
11
  interface Options {
12
12
  environment?: core.Supplier<environments.CartesiaEnvironment | string>;
13
- apiKeyHeader?: core.Supplier<string | undefined>;
13
+ apiKey?: core.Supplier<string | undefined>;
14
14
  /** Override the Cartesia-Version header */
15
15
  cartesiaVersion?: "2024-06-10";
16
16
  fetcher?: core.FetchFunction;
@@ -60,7 +60,7 @@ class Voices {
60
60
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
61
61
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voices/"),
62
62
  method: "GET",
63
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
63
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
64
64
  contentType: "application/json",
65
65
  requestType: "json",
66
66
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -116,7 +116,7 @@ class Voices {
116
116
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
117
117
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voices/"),
118
118
  method: "POST",
119
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
119
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
120
120
  contentType: "application/json",
121
121
  requestType: "json",
122
122
  body: serializers.CreateVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -167,7 +167,7 @@ class Voices {
167
167
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
168
168
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
169
169
  method: "DELETE",
170
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
170
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
171
171
  contentType: "application/json",
172
172
  requestType: "json",
173
173
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -215,7 +215,7 @@ class Voices {
215
215
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
216
216
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
217
217
  method: "PATCH",
218
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
218
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
219
219
  contentType: "application/json",
220
220
  requestType: "json",
221
221
  body: serializers.UpdateVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -266,7 +266,7 @@ class Voices {
266
266
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
267
267
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
268
268
  method: "GET",
269
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
269
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
270
270
  contentType: "application/json",
271
271
  requestType: "json",
272
272
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -321,7 +321,7 @@ class Voices {
321
321
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
322
322
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voices/localize"),
323
323
  method: "POST",
324
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
324
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
325
325
  contentType: "application/json",
326
326
  requestType: "json",
327
327
  body: serializers.LocalizeVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -377,7 +377,7 @@ class Voices {
377
377
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
378
378
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voices/mix"),
379
379
  method: "POST",
380
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
380
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
381
381
  contentType: "application/json",
382
382
  requestType: "json",
383
383
  body: serializers.MixVoicesRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -464,7 +464,7 @@ class Voices {
464
464
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
465
465
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voices/clone"),
466
466
  method: "POST",
467
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers),
467
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers),
468
468
  requestType: "file",
469
469
  duplex: _maybeEncodedRequest.duplex,
470
470
  body: _maybeEncodedRequest.body,
@@ -504,8 +504,8 @@ class Voices {
504
504
  }
505
505
  _getCustomAuthorizationHeaders() {
506
506
  return __awaiter(this, void 0, void 0, function* () {
507
- const apiKeyHeaderValue = yield core.Supplier.get(this._options.apiKeyHeader);
508
- return { "X-API-Key": apiKeyHeaderValue };
507
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
508
+ return { "X-API-Key": apiKeyValue };
509
509
  });
510
510
  }
511
511
  }
package/dist/Client.d.ts CHANGED
@@ -10,7 +10,7 @@ import { Voices } from "./api/resources/voices/client/Client";
10
10
  export declare namespace CartesiaClient {
11
11
  interface Options {
12
12
  environment?: core.Supplier<environments.CartesiaEnvironment | string>;
13
- apiKeyHeader?: core.Supplier<string | undefined>;
13
+ apiKey?: core.Supplier<string | undefined>;
14
14
  /** Override the Cartesia-Version header */
15
15
  cartesiaVersion?: "2024-06-10";
16
16
  fetcher?: core.FetchFunction;
@@ -7,7 +7,7 @@ import * as Cartesia from "../../../index";
7
7
  export declare namespace ApiStatus {
8
8
  interface Options {
9
9
  environment?: core.Supplier<environments.CartesiaEnvironment | string>;
10
- apiKeyHeader?: core.Supplier<string | undefined>;
10
+ apiKey?: core.Supplier<string | undefined>;
11
11
  /** Override the Cartesia-Version header */
12
12
  cartesiaVersion?: "2024-06-10";
13
13
  fetcher?: core.FetchFunction;
@@ -56,7 +56,7 @@ class ApiStatus {
56
56
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
57
57
  url: (_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production,
58
58
  method: "GET",
59
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
59
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
60
60
  contentType: "application/json",
61
61
  requestType: "json",
62
62
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -95,8 +95,8 @@ class ApiStatus {
95
95
  }
96
96
  _getCustomAuthorizationHeaders() {
97
97
  return __awaiter(this, void 0, void 0, function* () {
98
- const apiKeyHeaderValue = yield core.Supplier.get(this._options.apiKeyHeader);
99
- return { "X-API-Key": apiKeyHeaderValue };
98
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
99
+ return { "X-API-Key": apiKeyValue };
100
100
  });
101
101
  }
102
102
  }
@@ -9,7 +9,7 @@ import * as stream from "stream";
9
9
  export declare namespace Tts {
10
10
  interface Options {
11
11
  environment?: core.Supplier<environments.CartesiaEnvironment | string>;
12
- apiKeyHeader?: core.Supplier<string | undefined>;
12
+ apiKey?: core.Supplier<string | undefined>;
13
13
  /** Override the Cartesia-Version header */
14
14
  cartesiaVersion?: "2024-06-10";
15
15
  fetcher?: core.FetchFunction;
@@ -54,7 +54,7 @@ class Tts {
54
54
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
55
55
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/tts/bytes"),
56
56
  method: "POST",
57
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
57
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
58
58
  contentType: "application/json",
59
59
  requestType: "json",
60
60
  body: serializers.TtsRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -93,7 +93,7 @@ class Tts {
93
93
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
94
94
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/tts/sse"),
95
95
  method: "POST",
96
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
96
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
97
97
  contentType: "application/json",
98
98
  requestType: "json",
99
99
  body: serializers.TtsRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -144,8 +144,8 @@ class Tts {
144
144
  }
145
145
  _getCustomAuthorizationHeaders() {
146
146
  return __awaiter(this, void 0, void 0, function* () {
147
- const apiKeyHeaderValue = yield core.Supplier.get(this._options.apiKeyHeader);
148
- return { "X-API-Key": apiKeyHeaderValue };
147
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
148
+ return { "X-API-Key": apiKeyValue };
149
149
  });
150
150
  }
151
151
  }
@@ -11,7 +11,7 @@ import * as stream from "stream";
11
11
  export declare namespace VoiceChanger {
12
12
  interface Options {
13
13
  environment?: core.Supplier<environments.CartesiaEnvironment | string>;
14
- apiKeyHeader?: core.Supplier<string | undefined>;
14
+ apiKey?: core.Supplier<string | undefined>;
15
15
  /** Override the Cartesia-Version header */
16
16
  cartesiaVersion?: "2024-06-10";
17
17
  fetcher?: core.FetchFunction;
@@ -71,7 +71,7 @@ class VoiceChanger {
71
71
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
72
72
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voice-changer/bytes"),
73
73
  method: "POST",
74
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers),
74
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers),
75
75
  requestType: "file",
76
76
  duplex: _maybeEncodedRequest.duplex,
77
77
  body: _maybeEncodedRequest.body,
@@ -122,7 +122,7 @@ class VoiceChanger {
122
122
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
123
123
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voice-changer/sse"),
124
124
  method: "POST",
125
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers),
125
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers),
126
126
  requestType: "file",
127
127
  duplex: _maybeEncodedRequest.duplex,
128
128
  body: _maybeEncodedRequest.body,
@@ -173,8 +173,8 @@ class VoiceChanger {
173
173
  }
174
174
  _getCustomAuthorizationHeaders() {
175
175
  return __awaiter(this, void 0, void 0, function* () {
176
- const apiKeyHeaderValue = yield core.Supplier.get(this._options.apiKeyHeader);
177
- return { "X-API-Key": apiKeyHeaderValue };
176
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
177
+ return { "X-API-Key": apiKeyValue };
178
178
  });
179
179
  }
180
180
  }
@@ -10,7 +10,7 @@ import { Blob } from "buffer";
10
10
  export declare namespace Voices {
11
11
  interface Options {
12
12
  environment?: core.Supplier<environments.CartesiaEnvironment | string>;
13
- apiKeyHeader?: core.Supplier<string | undefined>;
13
+ apiKey?: core.Supplier<string | undefined>;
14
14
  /** Override the Cartesia-Version header */
15
15
  cartesiaVersion?: "2024-06-10";
16
16
  fetcher?: core.FetchFunction;
@@ -60,7 +60,7 @@ class Voices {
60
60
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
61
61
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voices/"),
62
62
  method: "GET",
63
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
63
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
64
64
  contentType: "application/json",
65
65
  requestType: "json",
66
66
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -116,7 +116,7 @@ class Voices {
116
116
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
117
117
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voices/"),
118
118
  method: "POST",
119
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
119
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
120
120
  contentType: "application/json",
121
121
  requestType: "json",
122
122
  body: serializers.CreateVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -167,7 +167,7 @@ class Voices {
167
167
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
168
168
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
169
169
  method: "DELETE",
170
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
170
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
171
171
  contentType: "application/json",
172
172
  requestType: "json",
173
173
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -215,7 +215,7 @@ class Voices {
215
215
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
216
216
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
217
217
  method: "PATCH",
218
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
218
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
219
219
  contentType: "application/json",
220
220
  requestType: "json",
221
221
  body: serializers.UpdateVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -266,7 +266,7 @@ class Voices {
266
266
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
267
267
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
268
268
  method: "GET",
269
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
269
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
270
270
  contentType: "application/json",
271
271
  requestType: "json",
272
272
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -321,7 +321,7 @@ class Voices {
321
321
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
322
322
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voices/localize"),
323
323
  method: "POST",
324
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
324
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
325
325
  contentType: "application/json",
326
326
  requestType: "json",
327
327
  body: serializers.LocalizeVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -377,7 +377,7 @@ class Voices {
377
377
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
378
378
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voices/mix"),
379
379
  method: "POST",
380
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
380
+ headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
381
381
  contentType: "application/json",
382
382
  requestType: "json",
383
383
  body: serializers.MixVoicesRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -464,7 +464,7 @@ class Voices {
464
464
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
465
465
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voices/clone"),
466
466
  method: "POST",
467
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0-alpha", "User-Agent": "@cartesia/cartesia-js/2.0.0-alpha", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers),
467
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.0.0", "User-Agent": "@cartesia/cartesia-js/2.0.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers),
468
468
  requestType: "file",
469
469
  duplex: _maybeEncodedRequest.duplex,
470
470
  body: _maybeEncodedRequest.body,
@@ -504,8 +504,8 @@ class Voices {
504
504
  }
505
505
  _getCustomAuthorizationHeaders() {
506
506
  return __awaiter(this, void 0, void 0, function* () {
507
- const apiKeyHeaderValue = yield core.Supplier.get(this._options.apiKeyHeader);
508
- return { "X-API-Key": apiKeyHeaderValue };
507
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
508
+ return { "X-API-Key": apiKeyValue };
509
509
  });
510
510
  }
511
511
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export * as Cartesia from "./api";
2
- export { CartesiaClient } from "./Client";
2
+ export { CartesiaClient } from "./wrapper/Client";
3
3
  export { CartesiaEnvironment } from "./environments";
4
4
  export { CartesiaError, CartesiaTimeoutError } from "./errors";
package/dist/index.js CHANGED
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.CartesiaTimeoutError = exports.CartesiaError = exports.CartesiaEnvironment = exports.CartesiaClient = exports.Cartesia = void 0;
27
27
  exports.Cartesia = __importStar(require("./api"));
28
- var Client_1 = require("./Client");
28
+ var Client_1 = require("./wrapper/Client");
29
29
  Object.defineProperty(exports, "CartesiaClient", { enumerable: true, get: function () { return Client_1.CartesiaClient; } });
30
30
  var environments_1 = require("./environments");
31
31
  Object.defineProperty(exports, "CartesiaEnvironment", { enumerable: true, get: function () { return environments_1.CartesiaEnvironment; } });
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "2.0.0-alpha";
1
+ export declare const SDK_VERSION = "2.0.0";
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "2.0.0-alpha";
4
+ exports.SDK_VERSION = "2.0.0";
@@ -170,7 +170,7 @@ class Websocket {
170
170
  var _a;
171
171
  const baseUrl = ((_a = (yield core.Supplier.get(this.options.environment))) !== null && _a !== void 0 ? _a : environments.CartesiaEnvironment.Production).replace(/^https?:\/\//, "");
172
172
  const params = {
173
- api_key: this.options.apiKeyHeader,
173
+ api_key: this.options.apiKey,
174
174
  cartesia_version: this.options.cartesiaVersion,
175
175
  };
176
176
  return `wss://${baseUrl}/tts/websocket${qs_1.default.stringify(params, { addQueryPrefix: true })}`;
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export * as Cartesia from "./api";
2
- export { CartesiaClient } from "./Client";
2
+ export { CartesiaClient } from "./wrapper/Client";
3
3
  export { CartesiaEnvironment } from "./environments";
4
4
  export { CartesiaError, CartesiaTimeoutError } from "./errors";
package/index.js CHANGED
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.CartesiaTimeoutError = exports.CartesiaError = exports.CartesiaEnvironment = exports.CartesiaClient = exports.Cartesia = void 0;
27
27
  exports.Cartesia = __importStar(require("./api"));
28
- var Client_1 = require("./Client");
28
+ var Client_1 = require("./wrapper/Client");
29
29
  Object.defineProperty(exports, "CartesiaClient", { enumerable: true, get: function () { return Client_1.CartesiaClient; } });
30
30
  var environments_1 = require("./environments");
31
31
  Object.defineProperty(exports, "CartesiaEnvironment", { enumerable: true, get: function () { return environments_1.CartesiaEnvironment; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cartesia/cartesia-js",
3
- "version": "2.0.0-alpha",
3
+ "version": "2.0.0",
4
4
  "private": false,
5
5
  "repository": "https://github.com/cartesia-ai/cartesia-js",
6
6
  "main": "./index.js",
package/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "2.0.0-alpha";
1
+ export declare const SDK_VERSION = "2.0.0";
package/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "2.0.0-alpha";
4
+ exports.SDK_VERSION = "2.0.0";
@@ -170,7 +170,7 @@ class Websocket {
170
170
  var _a;
171
171
  const baseUrl = ((_a = (yield core.Supplier.get(this.options.environment))) !== null && _a !== void 0 ? _a : environments.CartesiaEnvironment.Production).replace(/^https?:\/\//, "");
172
172
  const params = {
173
- api_key: this.options.apiKeyHeader,
173
+ api_key: this.options.apiKey,
174
174
  cartesia_version: this.options.cartesiaVersion,
175
175
  };
176
176
  return `wss://${baseUrl}/tts/websocket${qs_1.default.stringify(params, { addQueryPrefix: true })}`;