@spekoai/adapter-livekit bridges a LiveKit Agents worker to the Speko proxy. Drop it into a standard agent entry file and the router picks the best STT, LLM, and TTS provider per call. Failover is server-side; you don’t ship provider API keys.
Install
@livekit/agents and @livekit/rtc-node are peer dependencies — pin the versions you actually run against in your own package.json.
Quickstart
Architecture
The adapter exports three@livekit/agents-compatible classes — SpekoSTT, SpekoLLM, SpekoTTS — and a convenience factory createSpekoComponents() that wraps STT and TTS with StreamAdapter helpers so the buffered Speko proxy can participate in a streaming voice.AgentSession:
SpekoSTTdeclares{ streaming: false }, so it must be wrapped withnew stt.StreamAdapter(spekoSTT, vad)to segment utterances with VAD before calling/v1/transcribe.SpekoTTSis buffered, so it must be wrapped withnew tts.StreamAdapter(spekoTTS, sentenceTokenizer)so completion text is split sentence-by-sentence before each/v1/synthesizecall.SpekoLLMis used directly — it’s allm.LLMthat returns a single-chunkLLMStreamper call.
createSpekoComponents handles the wrapping for you and returns { stt, llm, tts } ready to pass to voice.AgentSession.
v1 limitations
- Non-streaming end-to-end. STT waits for end-of-utterance, LLM returns a single chunk, TTS synthesizes an entire sentence before emitting audio. Latency is acceptable for interactive voice; interruption detection is less responsive than a fully-streaming plugin.
- No tool / function calls.
/v1/completedoesn’t expose tool invocation yet. Passing a non-emptytoolCtxlogs a warning once and then ignores it. - TTS output format. Accepts
audio/pcm;rate=NNNN(Cartesia) andaudio/wav. Throws onaudio/mpeg(ElevenLabs MP3) — pick a routing intent that prefers Cartesia, or pin a PCM-capable provider viaconstraints.allowedProviders.tts. - STT input format. Mono PCM16, encoded into a WAV wrapper per utterance. Multi-channel frames throw. Speko handles sample-rate conversion downstream — whatever the
AudioFramecarries is what’s uploaded.
Reference
createSpekoComponents— convenience factory.SpekoSTT— STT class.SpekoLLM— LLM class.SpekoTTS— TTS class.Intent— routing hint type and validator.- Audio helpers — WAV encode/decode utilities.