What is the ideal way to create a livekit agent th...
# ask-ai
f
What is the ideal way to create a livekit agent that has entire stt llm tts in under actual 500ms over telephone sip? Share best practices and model names. Except cartesia for tts.
t
Thanks for reaching out, Manav. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Acknowledging your request: you want best practices and model names (excluding Cartesia TTS) to build a LiveKit agent (STT → LLM → TTS) that achieves end-to-end latency under ~500 ms over telephone SIP. Quick summary and target split • Aim for ~450 ms end-to-end to allow SIP/audio overhead. ◦ STT: ≤100 ms (time-to-first-transcript) ◦ LLM: ≤200 ms (time-to-first-token) ◦ TTS: ≤150 ms (time-to-first-byte) ◦ Keep buffers, network, and SIP codec overhead minimal. Recommended stack (fast, streaming-capable) • STT (streaming, low-latency) ◦ deepgram/nova-3 (streaming) ◦ assemblyai/universal-streaming • LLM (very low TTFT, streaming) ◦ openai/gpt-4.1-mini ◦ google/gemini-2.5-flash ◦ Use streaming token output and low reasoning settings where supported. • TTS (fast alternatives to Cartesia) ◦ inworld/inworld-tts-1 (e.g.,
ashley
,
james
) ◦ elevenlabs/eleven_turbo_v2_5 ◦ rime family (e.g.,
rime/arcana
,
rime/mistv2
) ◦ Choose voices with streaming chunk output and minimal TTFB. Architecture & pipeline best practices • Use LiveKit Inference (edge co-location) so STT, LLM, TTS and your agent run in same region to remove inter-region RTT. • Fully stream the pipeline: ◦ STT: send small frames (e.g., 20 ms) and emit partial transcripts immediately. ◦ LLM: stream tokens as generated; start downstream processing on first tokens. ◦ TTS: synthesize audio incrementally from partial tokens/phrases rather than waiting for full reply. • Turn-taking & VAD: ◦ Use aggressive VAD/short end-of-utterance detection to avoid long silence waits. ◦ Start LLM generation on short end-of-utterance triggers or on partial transcripts when possible. • SIP/codec tuning: ◦ Keep G.711 passthrough (no extra transcoding) and locate SIP trunking edge near agent. ◦ Minimize jitter buffer sizes consistent with voice quality constraints. • Model/use-case tuning: ◦ Use smaller, low-latency LLM variants for routine conversational responses; fall back to larger models only when needed. ◦ Keep prompts short and structured to reduce LLM generation time. • Observability and routing: ◦ Measure STT transcription_delay, LLM ttft, TTS ttfb per session. ◦ Route to faster models or provision capacity during high load. • Optional performance improvements: ◦ Host lightweight STT/LLM/TTS models locally (self-host) if you can run them on nearby inference hardware to shave network hops. ◦ Use real‑time inference APIs (OpenAI Realtime or similar) if they reduce handshake/queue latency. Concrete implementation notes • Start streaming TTS as soon as first LLM tokens arrive (don’t wait for full completion). • Use incremental TTS chunking sized for SIP-friendly packets to keep mouth-to-ear latency low. • Prefer model providers via LiveKit Inference to avoid public API queueing and get provisioned capacity. If you’d like, I can: • Propose a concrete streaming flow diagram and pseudocode for STT→LLM→TTS with VAD triggers. • Recommend specific VAD settings, buffer sizes, and chunk sizes for SIP/G.711 to target 500 ms. Which follow-up would you prefer? (flow pseudocode / VAD & buffer settings / example model config) Sources: Introducing LiveKit Inference: A unified model interface for voice AI | Speech-to-text (STT) models | LiveKit Docs | Large language models (LLM) | LiveKit Docs | OpenAI LLM models | LiveKit Docs | Text-to-speech (TTS) models | LiveKit Docs