Composable Pipeline
Five-role pipeline with swappable input, STT, LLM, TTS, and output providers. Swap Deepgram for AssemblyAI or Anthropic for OpenAI — your pipeline, your choice.
A composable SDK for speech-to-text, LLM, and text-to-speech pipelines. Mix providers, stream responses, and ship conversational AI — all from the browser.
pnpm i @lukeocodes/composite-voice@0.0.5Event-driven architecture, typed APIs, and production-ready defaults.
Five-role pipeline with swappable input, STT, LLM, TTS, and output providers. Swap Deepgram for AssemblyAI or Anthropic for OpenAI — your pipeline, your choice.
Speculative LLM generation begins during speech recognition. Responses start before the user finishes speaking.
Pipeline-level error recovery and WebSocket reconnection with exponential backoff. Configurable retry strategies keep voice sessions alive.
Automatic barge-in, plus conservative, aggressive, or detect strategies. Users can interrupt mid-speech and the SDK handles generation tracking seamlessly.
LLM output is split into visual and spoken streams. Code fences are buffered and never read aloud. Markdown is stripped for natural TTS while the UI gets full formatting.
LLM and TTS providers use native fetch — no @anthropic-ai/sdk or openai packages to install. WebSocket providers use native WebSocket. Only WebLLM needs a peer dep.
Express, Next.js, and plain Node adapters with built-in rate limiting, body size limits, and auth hooks. API keys stay server-side.
Abstract base classes for STT, LLM, and TTS. Build custom providers for any service with a clean, typed interface.
First-class support for leading AI services — or bring your own with extensible base classes.
Three providers, a few lines of code, and you have a working voice pipeline.
import { CompositeVoice, DeepgramSTT, AnthropicLLM, DeepgramTTS,} from "@lukeocodes/composite-voice";
const voice = new CompositeVoice({ providers: [ new DeepgramSTT({ proxyUrl: "/api/proxy/deepgram" }), new AnthropicLLM({ proxyUrl: "/api/proxy/anthropic", model: "claude-sonnet-4-20250514" }), new DeepgramTTS({ proxyUrl: "/api/proxy/deepgram" }), ],});
voice.on("transcription.speechFinal", ({ text }) => console.log("User:", text));voice.on("llm.complete", ({ text }) => console.log("AI:", text));
await voice.initialize();await voice.startListening();Get started with the documentation, explore the design system, or jump straight into the code.