kugelaudio 0.2.3 → 0.4.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/CHANGELOG.md +25 -0
- package/README.md +35 -14
- package/dist/index.d.mts +518 -26
- package/dist/index.d.ts +518 -26
- package/dist/index.js +864 -111
- package/dist/index.mjs +858 -111
- package/package.json +8 -7
- package/src/client.test.ts +548 -0
- package/src/client.ts +885 -103
- package/src/errors.ts +266 -18
- package/src/index.ts +17 -2
- package/src/types.ts +215 -9
- package/src/websocket.ts +38 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## [kugelaudio-v0.4.0](https://github.com/Kugelaudio/KugelAudio/compare/js-sdk-v0.3.0...js-sdk-v0.4.0) (2026-05-14)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **web:** bump kugelaudio SDK to ^0.3.0 to enable per-project dictionary ([#640](https://github.com/Kugelaudio/KugelAudio/issues/640)) ([f503372](https://github.com/Kugelaudio/KugelAudio/commit/f5033728b2febb00cea6b021da5b5309c2c9097f))
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* **python-sdk,js-sdk,java-sdk:** update regional endpoints ([#660](https://github.com/Kugelaudio/KugelAudio/issues/660)) ([b9a32c0](https://github.com/Kugelaudio/KugelAudio/commit/b9a32c09813c3e9de34a9d0a84ed0e024e1fe158))
|
|
10
|
+
|
|
1
11
|
# Changelog
|
|
2
12
|
|
|
3
13
|
All notable changes to the KugelAudio JavaScript/TypeScript SDK will be documented in this file.
|
|
@@ -5,6 +15,21 @@ All notable changes to the KugelAudio JavaScript/TypeScript SDK will be document
|
|
|
5
15
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
16
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
17
|
|
|
18
|
+
## [0.3.0](https://github.com/Kugelaudio/KugelAudio/compare/js-sdk-v0.2.3...js-sdk-v0.3.0) (2026-05-10)
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **temperature, projectId, speed** on `tts.stream` / `tts.generate` / multi-context. Required for per-project custom dictionary replacement on the website. ([#273](https://github.com/Kugelaudio/KugelAudio/pull/273))
|
|
23
|
+
* **error classification:** unify across SDKs with actionable messages ([#315](https://github.com/Kugelaudio/KugelAudio/pull/315))
|
|
24
|
+
* **multi-region routing** for all SDKs ([#227](https://github.com/Kugelaudio/KugelAudio/pull/227))
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* **streaming session close:** per-message-quiet timeout in `StreamingSession.close()` ([#528](https://github.com/Kugelaudio/KugelAudio/pull/528))
|
|
29
|
+
* **multi-context:** remove redundant `is_final` signal from protocol ([#279](https://github.com/Kugelaudio/KugelAudio/pull/279))
|
|
30
|
+
* **websocket:** keep alive across streaming sessions ([#253](https://github.com/Kugelaudio/KugelAudio/pull/253))
|
|
31
|
+
* **release pipeline:** fix stale repo URLs blocking semantic-release ([#637](https://github.com/Kugelaudio/KugelAudio/pull/637))
|
|
32
|
+
|
|
8
33
|
## [0.1.3] - 2024-12-25
|
|
9
34
|
|
|
10
35
|
### Fixed
|
package/README.md
CHANGED
|
@@ -57,6 +57,31 @@ const client = new KugelAudio({
|
|
|
57
57
|
});
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
+
### Region Selection
|
|
61
|
+
|
|
62
|
+
By default, KugelAudio uses the canonical geo-routed API endpoint. You can
|
|
63
|
+
select the direct EU endpoint when you need to pin traffic to Europe.
|
|
64
|
+
|
|
65
|
+
| Region hint | Endpoint |
|
|
66
|
+
|-------------|----------|
|
|
67
|
+
| default | `api.kugelaudio.com` (geo-routed) |
|
|
68
|
+
| `eu` | `api.eu.kugelaudio.com` |
|
|
69
|
+
|
|
70
|
+
**Option 1 — API key prefix** (simplest, works with env vars):
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
const client = new KugelAudio({ apiKey: 'eu-ka_your_api_key' }); // → EU
|
|
74
|
+
const client = new KugelAudio({ apiKey: 'ka_your_api_key' }); // → canonical geo-routed API
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Option 2 — `region` parameter**:
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
const client = new KugelAudio({ apiKey: 'ka_your_api_key', region: 'eu' });
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The prefix is always stripped before authentication. Priority: `apiUrl` > `region` > key prefix > default.
|
|
84
|
+
|
|
60
85
|
### Single URL Architecture
|
|
61
86
|
|
|
62
87
|
The SDK uses a **single URL** for both REST API and WebSocket streaming. The TTS server provides both REST endpoints (`/v1/models`, `/v1/voices`) and WebSocket (`/ws/tts`) - no proxy needed, minimal latency.
|
|
@@ -84,10 +109,10 @@ const client = new KugelAudio({
|
|
|
84
109
|
|
|
85
110
|
## Available Models
|
|
86
111
|
|
|
87
|
-
| Model ID | Name |
|
|
88
|
-
|
|
89
|
-
| `kugel-1-turbo` | Kugel 1 Turbo |
|
|
90
|
-
| `kugel-1` | Kugel 1 |
|
|
112
|
+
| Model ID | Name | Description |
|
|
113
|
+
|----------|------|-------------|
|
|
114
|
+
| `kugel-1-turbo` | Kugel 1 Turbo | Fast, low-latency model for real-time applications |
|
|
115
|
+
| `kugel-1` | Kugel 1 | Premium quality model for pre-recorded content |
|
|
91
116
|
|
|
92
117
|
### List Available Models
|
|
93
118
|
|
|
@@ -97,7 +122,6 @@ const models = await client.models.list();
|
|
|
97
122
|
for (const model of models) {
|
|
98
123
|
console.log(`${model.id}: ${model.name}`);
|
|
99
124
|
console.log(` Description: ${model.description}`);
|
|
100
|
-
console.log(` Parameters: ${model.parameters}`);
|
|
101
125
|
console.log(` Max Input: ${model.maxInputLength} characters`);
|
|
102
126
|
console.log(` Sample Rate: ${model.sampleRate} Hz`);
|
|
103
127
|
}
|
|
@@ -213,7 +237,6 @@ await client.tts.stream(
|
|
|
213
237
|
},
|
|
214
238
|
onFinal: (stats) => {
|
|
215
239
|
console.log(`Total duration: ${stats.durationMs}ms`);
|
|
216
|
-
console.log(`Time to first audio: ${stats.ttfaMs}ms`);
|
|
217
240
|
console.log(`Generation time: ${stats.generationMs}ms`);
|
|
218
241
|
console.log(`RTF: ${stats.rtf}`);
|
|
219
242
|
},
|
|
@@ -336,10 +359,11 @@ try {
|
|
|
336
359
|
|
|
337
360
|
```typescript
|
|
338
361
|
interface KugelAudioOptions {
|
|
339
|
-
apiKey: string;
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
362
|
+
apiKey: string; // Required (can be prefixed with 'eu-' for EU)
|
|
363
|
+
region?: Region; // 'eu' selects the direct EU endpoint
|
|
364
|
+
apiUrl?: string; // Default: https://api.kugelaudio.com
|
|
365
|
+
ttsUrl?: string; // Default: same as apiUrl
|
|
366
|
+
timeout?: number; // Default: 60000 (ms)
|
|
343
367
|
}
|
|
344
368
|
```
|
|
345
369
|
|
|
@@ -394,7 +418,6 @@ interface GenerationStats {
|
|
|
394
418
|
totalSamples: number; // Total samples generated
|
|
395
419
|
durationMs: number; // Audio duration in ms
|
|
396
420
|
generationMs: number; // Generation time in ms
|
|
397
|
-
ttfaMs: number; // Time to first audio in ms
|
|
398
421
|
rtf: number; // Real-time factor
|
|
399
422
|
}
|
|
400
423
|
```
|
|
@@ -418,7 +441,6 @@ interface Model {
|
|
|
418
441
|
id: string; // 'kugel-1-turbo' or 'kugel-1'
|
|
419
442
|
name: string; // Human-readable name
|
|
420
443
|
description: string; // Model description
|
|
421
|
-
parameters: string; // Parameter count ('1.5B', '7B')
|
|
422
444
|
maxInputLength: number; // Maximum input characters
|
|
423
445
|
sampleRate: number; // Output sample rate
|
|
424
446
|
}
|
|
@@ -499,7 +521,7 @@ async function main() {
|
|
|
499
521
|
console.log('Available Models:');
|
|
500
522
|
const models = await client.models.list();
|
|
501
523
|
for (const model of models) {
|
|
502
|
-
console.log(` - ${model.id}: ${model.name}
|
|
524
|
+
console.log(` - ${model.id}: ${model.name}`);
|
|
503
525
|
}
|
|
504
526
|
|
|
505
527
|
// List available voices
|
|
@@ -547,4 +569,3 @@ The SDK works in modern browsers with WebSocket support. For Node.js, ensure you
|
|
|
547
569
|
## License
|
|
548
570
|
|
|
549
571
|
MIT
|
|
550
|
-
|