Skip to main content
The official TypeScript/JavaScript SDK for KugelAudio provides a modern, type-safe interface for text-to-speech generation in Node.js and browsers.

Installation

Or with yarn/pnpm:
TypeScript types ship inside the package. There is no @types/kugelaudio to install, and no extra configuration is required.

Module systems

The SDK ships both an ESM and a CommonJS build, each with its own type declarations, so it works from either module system without a bundler or transpiler.
Use named imports. The package intentionally has no default export, so import KugelAudio from 'kugelaudio' is a type error. Types resolve correctly under every TypeScript moduleResolution setting — node, node16, nodenext, and bundler — for the main entry point and for the kugelaudio/livekit subpath.

Quick Start

Pre-connecting for Low Latency

For latency-sensitive applications, pre-establish the WebSocket connection at startup to keep the handshake out of your first TTS request — see Latency.

Manual Connection

Without pre-connecting, the first TTS request includes WebSocket connection setup. Subsequent requests reuse the connection. See Latency for typical numbers. Pre-connecting moves this overhead to application startup.

Complete Example

Browser Support

The SDK works in modern browsers with WebSocket support. For Node.js, ensure you have a WebSocket implementation available.

Next Steps