API Reference
Main entry point for the CompositeVoice SDK.
Main entry point for the CompositeVoice SDK.
Remarks
Re-exports all public classes, interfaces, types, and utilities from the SDK. This is the primary module consumers import from when using the SDK.
The SDK provides a 5-role audio pipeline with pluggable providers for Audio Input, Speech-to-Text (STT), Large Language Models (LLM), Text-to-Speech (TTS), and Audio Output. Providers declare their roles via a roles property, and multi-role providers (e.g., NativeSTT covering both input and stt) are supported via array-based config.
Pipeline: [InputProvider] → InputQueue → [STT] → [LLM] → [TTS] → OutputQueue → [OutputProvider]
It features an event-driven architecture, conversation history management, eager LLM pipeline support, configurable turn-taking strategies, audio buffering between pipeline stages, format detection with header caching, and WebSocket reconnection with exponential backoff.
Examples
import {
CompositeVoice,
NativeSTT,
AnthropicLLM,
NativeTTS,
} from '@lukeocodes/composite-voice';
const voice = new CompositeVoice({
providers: [
new NativeSTT(),
new AnthropicLLM({ proxyUrl: '/api/proxy/anthropic', model: 'claude-haiku-4-5' }),
new NativeTTS(),
],
});
voice.on('agent.stateChange', ({ state }) => console.log('State:', state));
voice.on('transcription.speechFinal', ({ text }) => console.log('User:', text));
voice.on('tts.audio', ({ audio }) => console.log('Audio chunk received'));
await voice.initialize();
await voice.startListening();
import { BaseLLMProvider } from '@lukeocodes/composite-voice';
class MyCustomLLM extends BaseLLMProvider {
// ... implement abstract methods
}
See
- CompositeVoice for the main orchestrator class
- GitHub repository for full documentation
Browse by category
- Classes — Concrete class implementations — providers, orchestrators, and core SDK components. (30)
- Abstract Classes — Base classes for building custom STT, LLM, and TTS providers. (4)
- Interfaces — Configuration types, provider contracts, and event structures. (58)
- Types — Type aliases, union types, and utility types. (30)
- Functions — Utility functions for audio processing, logging, and more. (18)
- Errors — Error classes with machine-readable codes and recovery flags. (11)
- Enumerations — Enum types used across the SDK. (1)