@cartesia/cartesia-js 3.0.0-b3 → 3.0.0-b5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +17 -13
- package/backcompat/index.d.mts +36 -0
- package/backcompat/index.d.mts.map +1 -0
- package/backcompat/index.d.ts +36 -0
- package/backcompat/index.d.ts.map +1 -0
- package/backcompat/index.js +266 -0
- package/backcompat/index.js.map +1 -0
- package/backcompat/index.mjs +261 -0
- package/backcompat/index.mjs.map +1 -0
- package/client.d.mts +2 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +2 -2
- package/client.d.ts.map +1 -1
- package/client.js.map +1 -1
- package/client.mjs.map +1 -1
- package/index.d.mts +1 -0
- package/index.d.mts.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/index.mjs +1 -0
- package/index.mjs.map +1 -1
- package/internal/tslib.js +4 -0
- package/package.json +11 -1
- package/resources/access-token.d.mts +5 -0
- package/resources/access-token.d.mts.map +1 -1
- package/resources/access-token.d.ts +5 -0
- package/resources/access-token.d.ts.map +1 -1
- package/resources/agents/agents.js +1 -1
- package/resources/agents/agents.js.map +1 -1
- package/resources/agents/agents.mjs +1 -1
- package/resources/agents/agents.mjs.map +1 -1
- package/resources/agents/metrics/index.d.mts +1 -1
- package/resources/agents/metrics/index.d.mts.map +1 -1
- package/resources/agents/metrics/index.d.ts +1 -1
- package/resources/agents/metrics/index.d.ts.map +1 -1
- package/resources/agents/metrics/index.js.map +1 -1
- package/resources/agents/metrics/index.mjs.map +1 -1
- package/resources/agents/metrics/metrics.d.mts +2 -2
- package/resources/agents/metrics/metrics.d.mts.map +1 -1
- package/resources/agents/metrics/metrics.d.ts +2 -2
- package/resources/agents/metrics/metrics.d.ts.map +1 -1
- package/resources/agents/metrics/metrics.js.map +1 -1
- package/resources/agents/metrics/metrics.mjs.map +1 -1
- package/resources/agents/metrics/results.d.mts +23 -22
- package/resources/agents/metrics/results.d.mts.map +1 -1
- package/resources/agents/metrics/results.d.ts +23 -22
- package/resources/agents/metrics/results.d.ts.map +1 -1
- package/resources/agents/metrics/results.js +4 -5
- package/resources/agents/metrics/results.js.map +1 -1
- package/resources/agents/metrics/results.mjs +4 -5
- package/resources/agents/metrics/results.mjs.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/infill.d.mts +3 -4
- package/resources/infill.d.mts.map +1 -1
- package/resources/infill.d.ts +3 -4
- package/resources/infill.d.ts.map +1 -1
- package/resources/infill.js +0 -2
- package/resources/infill.js.map +1 -1
- package/resources/infill.mjs +0 -2
- package/resources/infill.mjs.map +1 -1
- package/resources/pronunciation-dicts.d.mts +0 -8
- package/resources/pronunciation-dicts.d.mts.map +1 -1
- package/resources/pronunciation-dicts.d.ts +0 -8
- package/resources/pronunciation-dicts.d.ts.map +1 -1
- package/resources/pronunciation-dicts.js +0 -18
- package/resources/pronunciation-dicts.js.map +1 -1
- package/resources/pronunciation-dicts.mjs +0 -18
- package/resources/pronunciation-dicts.mjs.map +1 -1
- package/resources/stt.d.mts +1 -104
- package/resources/stt.d.mts.map +1 -1
- package/resources/stt.d.ts +1 -104
- package/resources/stt.d.ts.map +1 -1
- package/resources/tts/tts.d.mts +79 -115
- package/resources/tts/tts.d.mts.map +1 -1
- package/resources/tts/tts.d.ts +79 -115
- package/resources/tts/tts.d.ts.map +1 -1
- package/resources/voice-changer.d.mts +2 -2
- package/resources/voice-changer.d.mts.map +1 -1
- package/resources/voice-changer.d.ts +2 -2
- package/resources/voice-changer.d.ts.map +1 -1
- package/resources/voices.d.mts +70 -34
- package/resources/voices.d.mts.map +1 -1
- package/resources/voices.d.ts +70 -34
- package/resources/voices.d.ts.map +1 -1
- package/resources/voices.js +45 -3
- package/resources/voices.js.map +1 -1
- package/resources/voices.mjs +45 -3
- package/resources/voices.mjs.map +1 -1
- package/src/backcompat/index.ts +302 -0
- package/src/client.ts +2 -0
- package/src/index.ts +1 -0
- package/src/resources/access-token.ts +6 -0
- package/src/resources/agents/agents.ts +1 -1
- package/src/resources/agents/metrics/index.ts +1 -0
- package/src/resources/agents/metrics/metrics.ts +2 -0
- package/src/resources/agents/metrics/results.ts +27 -23
- package/src/resources/index.ts +1 -0
- package/src/resources/infill.ts +3 -4
- package/src/resources/pronunciation-dicts.ts +0 -20
- package/src/resources/stt.ts +102 -104
- package/src/resources/tts/tts.ts +146 -128
- package/src/resources/voice-changer.ts +2 -2
- package/src/resources/voices.ts +105 -38
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.0.0-b5 (2026-01-07)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v3.0.0-b4...v3.0.0-b5](https://github.com/cartesia-ai/cartesia-js-internal/compare/v3.0.0-b4...v3.0.0-b5)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** fix readme ([91bd83c](https://github.com/cartesia-ai/cartesia-js-internal/commit/91bd83cb75d8b92778928cf7aebab908f7723b79))
|
|
10
|
+
|
|
11
|
+
## 3.0.0-b4 (2026-01-07)
|
|
12
|
+
|
|
13
|
+
Full Changelog: [v3.0.0-b3...v3.0.0-b4](https://github.com/cartesia-ai/cartesia-js-internal/compare/v3.0.0-b3...v3.0.0-b4)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **api:** fix list/get uri mismatch ([cf74b40](https://github.com/cartesia-ai/cartesia-js-internal/commit/cf74b40daedb940dec1740d8c2c8d63d9a758e33))
|
|
18
|
+
* **api:** sync openapi spec ([d4def66](https://github.com/cartesia-ai/cartesia-js-internal/commit/d4def66cab22c20f2433f502b06c05eb622105ad))
|
|
19
|
+
|
|
3
20
|
## 3.0.0-b3 (2026-01-06)
|
|
4
21
|
|
|
5
22
|
Full Changelog: [v3.0.0-b2...v3.0.0-b3](https://github.com/cartesia-ai/cartesia-js-internal/compare/v3.0.0-b2...v3.0.0-b3)
|
package/README.md
CHANGED
|
@@ -26,9 +26,10 @@ const client = new Cartesia({
|
|
|
26
26
|
apiKey: 'My API Key',
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
const
|
|
29
|
+
const page = await client.voices.list();
|
|
30
|
+
const voice = page.data[0];
|
|
30
31
|
|
|
31
|
-
console.log(
|
|
32
|
+
console.log(voice.id);
|
|
32
33
|
```
|
|
33
34
|
|
|
34
35
|
### Request & Response types
|
|
@@ -43,7 +44,7 @@ const client = new Cartesia({
|
|
|
43
44
|
apiKey: 'My API Key',
|
|
44
45
|
});
|
|
45
46
|
|
|
46
|
-
const
|
|
47
|
+
const [voice]: [Cartesia.Voice] = await client.voices.list();
|
|
47
48
|
```
|
|
48
49
|
|
|
49
50
|
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
|
|
@@ -85,7 +86,7 @@ a subclass of `APIError` will be thrown:
|
|
|
85
86
|
|
|
86
87
|
<!-- prettier-ignore -->
|
|
87
88
|
```ts
|
|
88
|
-
const
|
|
89
|
+
const page = await client.voices.list().catch(async (err) => {
|
|
89
90
|
if (err instanceof Cartesia.APIError) {
|
|
90
91
|
console.log(err.status); // 400
|
|
91
92
|
console.log(err.name); // BadRequestError
|
|
@@ -125,7 +126,7 @@ const client = new Cartesia({
|
|
|
125
126
|
});
|
|
126
127
|
|
|
127
128
|
// Or, configure per-request:
|
|
128
|
-
await client.
|
|
129
|
+
await client.voices.list({
|
|
129
130
|
maxRetries: 5,
|
|
130
131
|
});
|
|
131
132
|
```
|
|
@@ -142,7 +143,7 @@ const client = new Cartesia({
|
|
|
142
143
|
});
|
|
143
144
|
|
|
144
145
|
// Override per-request:
|
|
145
|
-
await client.
|
|
146
|
+
await client.voices.list({
|
|
146
147
|
timeout: 5 * 1000,
|
|
147
148
|
});
|
|
148
149
|
```
|
|
@@ -160,7 +161,7 @@ You can use the `for await … of` syntax to iterate through items across all pa
|
|
|
160
161
|
async function fetchAllVoices(params) {
|
|
161
162
|
const allVoices = [];
|
|
162
163
|
// Automatically fetches more pages as needed.
|
|
163
|
-
for await (const voice of client.voices.list(
|
|
164
|
+
for await (const voice of client.voices.list()) {
|
|
164
165
|
allVoices.push(voice);
|
|
165
166
|
}
|
|
166
167
|
return allVoices;
|
|
@@ -170,7 +171,7 @@ async function fetchAllVoices(params) {
|
|
|
170
171
|
Alternatively, you can request a single page at a time:
|
|
171
172
|
|
|
172
173
|
```ts
|
|
173
|
-
let page = await client.voices.list(
|
|
174
|
+
let page = await client.voices.list();
|
|
174
175
|
for (const voice of page.data) {
|
|
175
176
|
console.log(voice);
|
|
176
177
|
}
|
|
@@ -193,7 +194,8 @@ import Cartesia from '@cartesia/cartesia-js';
|
|
|
193
194
|
|
|
194
195
|
const client = new Cartesia();
|
|
195
196
|
|
|
196
|
-
const
|
|
197
|
+
const page = await client.voices.list({ headers: { 'cartesia-version': 'My-Custom-Value' } });
|
|
198
|
+
const voice = page.data[0];
|
|
197
199
|
```
|
|
198
200
|
|
|
199
201
|
## Advanced Usage
|
|
@@ -210,13 +212,15 @@ Unlike `.asResponse()` this method consumes the body, returning once it is parse
|
|
|
210
212
|
```ts
|
|
211
213
|
const client = new Cartesia();
|
|
212
214
|
|
|
213
|
-
const response = await client.
|
|
215
|
+
const response = await client.voices.list().asResponse();
|
|
214
216
|
console.log(response.headers.get('X-My-Header'));
|
|
215
217
|
console.log(response.statusText); // access the underlying Response object
|
|
216
218
|
|
|
217
|
-
const { data:
|
|
219
|
+
const { data: page, response: raw } = await client.voices.list().withResponse();
|
|
218
220
|
console.log(raw.headers.get('X-My-Header'));
|
|
219
|
-
|
|
221
|
+
for await (const voice of page) {
|
|
222
|
+
console.log(voice.id);
|
|
223
|
+
}
|
|
220
224
|
```
|
|
221
225
|
|
|
222
226
|
### Logging
|
|
@@ -296,7 +300,7 @@ parameter. This library doesn't validate at runtime that the request matches the
|
|
|
296
300
|
send will be sent as-is.
|
|
297
301
|
|
|
298
302
|
```ts
|
|
299
|
-
client.
|
|
303
|
+
client.voices.list({
|
|
300
304
|
// ...
|
|
301
305
|
// @ts-expect-error baz is not yet public
|
|
302
306
|
baz: 'undocumented option',
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Cartesia } from "../client.mjs";
|
|
2
|
+
declare class AudioSource {
|
|
3
|
+
private buffers;
|
|
4
|
+
private waiter;
|
|
5
|
+
isDone: boolean;
|
|
6
|
+
push(data: Buffer): void;
|
|
7
|
+
markDone(): void;
|
|
8
|
+
read(outBuffer: Float32Array): Promise<number>;
|
|
9
|
+
}
|
|
10
|
+
declare class WebSocketWrapper {
|
|
11
|
+
private client;
|
|
12
|
+
private config;
|
|
13
|
+
private socket;
|
|
14
|
+
private sources;
|
|
15
|
+
private defaultSource;
|
|
16
|
+
constructor(client: Cartesia, config: any);
|
|
17
|
+
connect(): Promise<void>;
|
|
18
|
+
private handleMessage;
|
|
19
|
+
send(request: any): Promise<{
|
|
20
|
+
source: AudioSource;
|
|
21
|
+
}>;
|
|
22
|
+
disconnect(): void;
|
|
23
|
+
}
|
|
24
|
+
declare class TTSWrapper {
|
|
25
|
+
private client;
|
|
26
|
+
constructor(client: Cartesia);
|
|
27
|
+
websocket(config: any): WebSocketWrapper;
|
|
28
|
+
bytes(request: any, requestOptions?: any): Promise<any>;
|
|
29
|
+
}
|
|
30
|
+
export declare class CartesiaClient {
|
|
31
|
+
private client;
|
|
32
|
+
tts: TTSWrapper;
|
|
33
|
+
constructor(options: any);
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/backcompat/index.ts"],"names":[],"mappings":"OACO,EAAE,QAAQ,EAAE;AAEnB,cAAM,WAAW;IAChB,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,MAAM,CAAsC;IAC7C,MAAM,UAAS;IAEtB,IAAI,CAAC,IAAI,EAAE,MAAM;IAQjB,QAAQ;IAQF,IAAI,CAAC,SAAS,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;CAkDpD;AAED,cAAM,gBAAgB;IACrB,OAAO,CAAC,MAAM,CAAW;IACzB,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,OAAO,CAAuC;IAItD,OAAO,CAAC,aAAa,CAA4B;gBAErC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG;IAKnC,OAAO;IAiDb,OAAO,CAAC,aAAa;IA2Bf,IAAI,CAAC,OAAO,EAAE,GAAG;;;IA4DvB,UAAU;CAKV;AAED,cAAM,UAAU;IACf,OAAO,CAAC,MAAM,CAAW;gBAEb,MAAM,EAAE,QAAQ;IAI5B,SAAS,CAAC,MAAM,EAAE,GAAG;IAIf,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,cAAc,CAAC,EAAE,GAAG;CAiC9C;AAMD,qBAAa,cAAc;IAC1B,OAAO,CAAC,MAAM,CAAW;IAClB,GAAG,EAAE,UAAU,CAAC;gBAEX,OAAO,EAAE,GAAG;CAIxB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Cartesia } from "../client.js";
|
|
2
|
+
declare class AudioSource {
|
|
3
|
+
private buffers;
|
|
4
|
+
private waiter;
|
|
5
|
+
isDone: boolean;
|
|
6
|
+
push(data: Buffer): void;
|
|
7
|
+
markDone(): void;
|
|
8
|
+
read(outBuffer: Float32Array): Promise<number>;
|
|
9
|
+
}
|
|
10
|
+
declare class WebSocketWrapper {
|
|
11
|
+
private client;
|
|
12
|
+
private config;
|
|
13
|
+
private socket;
|
|
14
|
+
private sources;
|
|
15
|
+
private defaultSource;
|
|
16
|
+
constructor(client: Cartesia, config: any);
|
|
17
|
+
connect(): Promise<void>;
|
|
18
|
+
private handleMessage;
|
|
19
|
+
send(request: any): Promise<{
|
|
20
|
+
source: AudioSource;
|
|
21
|
+
}>;
|
|
22
|
+
disconnect(): void;
|
|
23
|
+
}
|
|
24
|
+
declare class TTSWrapper {
|
|
25
|
+
private client;
|
|
26
|
+
constructor(client: Cartesia);
|
|
27
|
+
websocket(config: any): WebSocketWrapper;
|
|
28
|
+
bytes(request: any, requestOptions?: any): Promise<any>;
|
|
29
|
+
}
|
|
30
|
+
export declare class CartesiaClient {
|
|
31
|
+
private client;
|
|
32
|
+
tts: TTSWrapper;
|
|
33
|
+
constructor(options: any);
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/backcompat/index.ts"],"names":[],"mappings":"OACO,EAAE,QAAQ,EAAE;AAEnB,cAAM,WAAW;IAChB,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,MAAM,CAAsC;IAC7C,MAAM,UAAS;IAEtB,IAAI,CAAC,IAAI,EAAE,MAAM;IAQjB,QAAQ;IAQF,IAAI,CAAC,SAAS,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;CAkDpD;AAED,cAAM,gBAAgB;IACrB,OAAO,CAAC,MAAM,CAAW;IACzB,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,OAAO,CAAuC;IAItD,OAAO,CAAC,aAAa,CAA4B;gBAErC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG;IAKnC,OAAO;IAiDb,OAAO,CAAC,aAAa;IA2Bf,IAAI,CAAC,OAAO,EAAE,GAAG;;;IA4DvB,UAAU;CAKV;AAED,cAAM,UAAU;IACf,OAAO,CAAC,MAAM,CAAW;gBAEb,MAAM,EAAE,QAAQ;IAI5B,SAAS,CAAC,MAAM,EAAE,GAAG;IAIf,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,cAAc,CAAC,EAAE,GAAG;CAiC9C;AAMD,qBAAa,cAAc;IAC1B,OAAO,CAAC,MAAM,CAAW;IAClB,GAAG,EAAE,UAAU,CAAC;gBAEX,OAAO,EAAE,GAAG;CAIxB"}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CartesiaClient = void 0;
|
|
4
|
+
const tslib_1 = require("../internal/tslib.js");
|
|
5
|
+
const ws_1 = tslib_1.__importDefault(require("ws"));
|
|
6
|
+
const client_1 = require("../client.js");
|
|
7
|
+
class AudioSource {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.buffers = [];
|
|
10
|
+
this.waiter = null;
|
|
11
|
+
this.isDone = false;
|
|
12
|
+
}
|
|
13
|
+
push(data) {
|
|
14
|
+
this.buffers.push(data);
|
|
15
|
+
if (this.waiter) {
|
|
16
|
+
this.waiter();
|
|
17
|
+
this.waiter = null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
markDone() {
|
|
21
|
+
this.isDone = true;
|
|
22
|
+
if (this.waiter) {
|
|
23
|
+
this.waiter();
|
|
24
|
+
this.waiter = null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async read(outBuffer) {
|
|
28
|
+
if (this.buffers.length === 0 && !this.isDone) {
|
|
29
|
+
await new Promise((resolve) => { this.waiter = resolve; });
|
|
30
|
+
}
|
|
31
|
+
if (this.buffers.length === 0 && this.isDone) {
|
|
32
|
+
return 0;
|
|
33
|
+
}
|
|
34
|
+
let totalFloatsRead = 0;
|
|
35
|
+
let outOffset = 0;
|
|
36
|
+
const maxFloats = outBuffer.length;
|
|
37
|
+
while (this.buffers.length > 0 && totalFloatsRead < maxFloats) {
|
|
38
|
+
const buf = this.buffers[0]; // ts not smart enough to check loop condition
|
|
39
|
+
const floatsInBuf = buf.length / 4;
|
|
40
|
+
const floatsNeeded = maxFloats - totalFloatsRead;
|
|
41
|
+
const floatsToCopy = Math.min(floatsInBuf, floatsNeeded);
|
|
42
|
+
const bytesToCopy = floatsToCopy * 4;
|
|
43
|
+
// Copy to outBuffer.
|
|
44
|
+
// Create a view on the buffer to read floats.
|
|
45
|
+
// We need to ensure byteOffset is a multiple of 4.
|
|
46
|
+
// If not, we must copy the buffer to a new one.
|
|
47
|
+
let srcFloats;
|
|
48
|
+
if (buf.byteOffset % 4 === 0) {
|
|
49
|
+
srcFloats = new Float32Array(buf.buffer, buf.byteOffset, floatsInBuf);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
const alignedBuf = new Uint8Array(buf);
|
|
53
|
+
srcFloats = new Float32Array(alignedBuf.buffer, alignedBuf.byteOffset, floatsInBuf);
|
|
54
|
+
}
|
|
55
|
+
outBuffer.set(srcFloats.subarray(0, floatsToCopy), outOffset);
|
|
56
|
+
totalFloatsRead += floatsToCopy;
|
|
57
|
+
outOffset += floatsToCopy;
|
|
58
|
+
if (floatsToCopy < floatsInBuf) {
|
|
59
|
+
// We didn't use the whole buffer. Update it.
|
|
60
|
+
this.buffers[0] = buf.subarray(bytesToCopy);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
// We used the whole buffer. Remove it.
|
|
64
|
+
this.buffers.shift();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return totalFloatsRead;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
class WebSocketWrapper {
|
|
71
|
+
constructor(client, config) {
|
|
72
|
+
this.socket = null;
|
|
73
|
+
this.sources = new Map();
|
|
74
|
+
// Fallback source for messages without context_id or if we just want to capture everything (legacy behavior?)
|
|
75
|
+
// The original test didn't use context_id explicitly in send() but expected a response source.
|
|
76
|
+
// We'll map context_id to source.
|
|
77
|
+
this.defaultSource = null;
|
|
78
|
+
this.client = client;
|
|
79
|
+
this.config = config;
|
|
80
|
+
}
|
|
81
|
+
async connect() {
|
|
82
|
+
const baseURL = this.client.baseURL;
|
|
83
|
+
// Construct WebSocket URL
|
|
84
|
+
// baseURL is like https://api.cartesia.ai
|
|
85
|
+
let urlStr = baseURL.replace(/^http/, "ws");
|
|
86
|
+
if (!urlStr.includes("/tts/websocket")) {
|
|
87
|
+
if (urlStr.endsWith("/")) {
|
|
88
|
+
urlStr += "tts/websocket";
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
urlStr += "/tts/websocket";
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const url = new URL(urlStr);
|
|
95
|
+
const headers = {
|
|
96
|
+
"cartesia-version": "2025-04-16",
|
|
97
|
+
};
|
|
98
|
+
if (this.client.apiKey) {
|
|
99
|
+
headers["Authorization"] = `Bearer ${this.client.apiKey}`;
|
|
100
|
+
}
|
|
101
|
+
this.socket = new ws_1.default(url.toString(), {
|
|
102
|
+
headers: headers,
|
|
103
|
+
});
|
|
104
|
+
return new Promise((resolve, reject) => {
|
|
105
|
+
this.socket.on("open", () => {
|
|
106
|
+
console.log("WebSocket connected.");
|
|
107
|
+
resolve();
|
|
108
|
+
});
|
|
109
|
+
this.socket.on("error", (err) => {
|
|
110
|
+
console.error("WebSocket error:", err);
|
|
111
|
+
reject(err);
|
|
112
|
+
});
|
|
113
|
+
this.socket.on("message", (data) => {
|
|
114
|
+
this.handleMessage(data);
|
|
115
|
+
});
|
|
116
|
+
this.socket.on("close", () => {
|
|
117
|
+
console.log("WebSocket closed.");
|
|
118
|
+
this.sources.forEach((s) => { s.markDone(); });
|
|
119
|
+
if (this.defaultSource)
|
|
120
|
+
this.defaultSource.markDone();
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
handleMessage(data) {
|
|
125
|
+
try {
|
|
126
|
+
const str = data.toString();
|
|
127
|
+
const msg = JSON.parse(str);
|
|
128
|
+
const contextId = msg.context_id;
|
|
129
|
+
let source = contextId ? this.sources.get(contextId) : this.defaultSource;
|
|
130
|
+
// If we received a message for a context we don't know about, and we have a default source, use it
|
|
131
|
+
if (!source && this.defaultSource) {
|
|
132
|
+
source = this.defaultSource;
|
|
133
|
+
}
|
|
134
|
+
if (msg.type === "chunk" && msg.data) {
|
|
135
|
+
const audioData = Buffer.from(msg.data, "base64");
|
|
136
|
+
if (source)
|
|
137
|
+
source.push(audioData);
|
|
138
|
+
}
|
|
139
|
+
else if (msg.type === "done") {
|
|
140
|
+
if (source)
|
|
141
|
+
source.markDone();
|
|
142
|
+
}
|
|
143
|
+
else if (msg.type === "error") {
|
|
144
|
+
console.error("Server error:", msg);
|
|
145
|
+
if (source)
|
|
146
|
+
source.markDone(); // Fail the stream?
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
catch (e) {
|
|
150
|
+
console.error("Error parsing message:", e);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
async send(request) {
|
|
154
|
+
if (!this.socket) {
|
|
155
|
+
throw new Error("WebSocket not connected");
|
|
156
|
+
}
|
|
157
|
+
// Ensure request has a context_id so we can route the response
|
|
158
|
+
if (!request.context_id) {
|
|
159
|
+
request.context_id = uuidv4();
|
|
160
|
+
}
|
|
161
|
+
const source = new AudioSource();
|
|
162
|
+
this.sources.set(request.context_id, source);
|
|
163
|
+
// Also set as default source if none exists, for compatibility with simple tests
|
|
164
|
+
if (!this.defaultSource) {
|
|
165
|
+
this.defaultSource = source;
|
|
166
|
+
}
|
|
167
|
+
// Add output format from config if not present
|
|
168
|
+
if (!request.output_format && this.config) {
|
|
169
|
+
request.output_format = {
|
|
170
|
+
container: this.config.container,
|
|
171
|
+
encoding: this.config.encoding,
|
|
172
|
+
sample_rate: this.config.sampleRate,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
// Fix camelCase to snake_case for output_format if needed
|
|
176
|
+
// The new API expects snake_case keys in JSON usually, but let's check.
|
|
177
|
+
// The GenerationRequest interface has `output_format`.
|
|
178
|
+
// The config passed to .websocket() uses `sampleRate`.
|
|
179
|
+
// We might need to map it.
|
|
180
|
+
if (request.output_format) {
|
|
181
|
+
// Ensure sample_rate is set (mapping from sampleRate)
|
|
182
|
+
if (request.output_format.sampleRate && !request.output_format.sample_rate) {
|
|
183
|
+
request.output_format.sample_rate = request.output_format.sampleRate;
|
|
184
|
+
delete request.output_format.sampleRate;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
// Map camelCase request fields to snake_case if necessary?
|
|
188
|
+
// The old test uses `modelId`, `generationConfig`.
|
|
189
|
+
// The new API expects `model_id`, `generation_config`.
|
|
190
|
+
const payload = {
|
|
191
|
+
...request,
|
|
192
|
+
model_id: request.modelId || request.model_id,
|
|
193
|
+
generation_config: request.generationConfig || request.generation_config,
|
|
194
|
+
context_id: request.context_id,
|
|
195
|
+
};
|
|
196
|
+
// Remove camelCase keys if they persist?
|
|
197
|
+
// JSON.stringify handles it, but we should clean up if we want to be strict.
|
|
198
|
+
// Also `voice` object. Old test: `voice: { mode: 'id', id: ... }`. New API: same.
|
|
199
|
+
this.socket.send(JSON.stringify(payload));
|
|
200
|
+
return {
|
|
201
|
+
source: source
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
disconnect() {
|
|
205
|
+
if (this.socket) {
|
|
206
|
+
this.socket.close();
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
class TTSWrapper {
|
|
211
|
+
constructor(client) {
|
|
212
|
+
this.client = client;
|
|
213
|
+
}
|
|
214
|
+
websocket(config) {
|
|
215
|
+
return new WebSocketWrapper(this.client, config);
|
|
216
|
+
}
|
|
217
|
+
async bytes(request, requestOptions) {
|
|
218
|
+
const params = {
|
|
219
|
+
model_id: request.modelId,
|
|
220
|
+
transcript: request.transcript,
|
|
221
|
+
voice: request.voice,
|
|
222
|
+
generation_config: request.generationConfig,
|
|
223
|
+
context_id: request.contextId,
|
|
224
|
+
};
|
|
225
|
+
if (request.outputFormat) {
|
|
226
|
+
params.output_format = {
|
|
227
|
+
...request.outputFormat,
|
|
228
|
+
sample_rate: request.outputFormat.sampleRate,
|
|
229
|
+
bit_rate: request.outputFormat.bitRate,
|
|
230
|
+
};
|
|
231
|
+
// Remove camelCase keys
|
|
232
|
+
delete params.output_format.sampleRate;
|
|
233
|
+
delete params.output_format.bitRate;
|
|
234
|
+
}
|
|
235
|
+
const options = {};
|
|
236
|
+
if (requestOptions) {
|
|
237
|
+
if (requestOptions.timeoutInSeconds) {
|
|
238
|
+
options.timeout = requestOptions.timeoutInSeconds * 1000;
|
|
239
|
+
}
|
|
240
|
+
options.maxRetries = requestOptions.maxRetries;
|
|
241
|
+
options.headers = requestOptions.headers;
|
|
242
|
+
options.signal = requestOptions.abortSignal;
|
|
243
|
+
}
|
|
244
|
+
// @ts-ignore
|
|
245
|
+
return this.client.tts.synthesizeBytes(params, options);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
/*
|
|
249
|
+
* CartesiaClient - deprecated backcompat class.
|
|
250
|
+
* New code should use Cartesia class directly instead.
|
|
251
|
+
*/
|
|
252
|
+
class CartesiaClient {
|
|
253
|
+
constructor(options) {
|
|
254
|
+
this.client = new client_1.Cartesia(options);
|
|
255
|
+
this.tts = new TTSWrapper(this.client);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
exports.CartesiaClient = CartesiaClient;
|
|
259
|
+
// Helper for generating UUIDs. Not cryptographically secure.
|
|
260
|
+
function uuidv4() {
|
|
261
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
262
|
+
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
|
263
|
+
return v.toString(16);
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+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