ElevenLabsTTSError (providers/elevenlabs-ws-tts.ts)

Patter · libraries/typescript/src/providers/elevenlabs-ws-tts.ts · typescript · MIT
voice, Voice / Speech

TypeScript provider for low‑latency ElevenLabs TTS over WebSocket, with error handling.

// Source: https://github.com/PatterAI/Patter | License: MIT | Copyright 2026 Patter Contributors
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * WebSocket-based ElevenLabs TTS provider — opt-in low-latency variant.
 *
 * Targets the ElevenLabs streaming-input WebSocket endpoint
 * (`/v1/text-to-speech/{voice_id}/stream-input`) instead of the HTTP
 * `/stream` endpoint used by `ElevenLabsTTS`. Saves the HTTP request setup
 * time per utterance (~50 ms) and avoids the HTTP cold-start TLS handshake
 * when calls are bursty.
 *
 * API matches `ElevenLabsTTS` (`synthesizeStream(text)` returns an
 * `AsyncGenerator<Buffer>`) so it can be passed anywhere a TTSAdapter is
 * expected.
 *
 * Behaviour notes
 * - WebSocket is opened **per-utterance** (matches HTTP semantics).

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key