Skip to content
VDAI with VD

Self-Built Project

Self-Hosted Voice AI: A Local-First Hybrid Pipeline

A local-first, hybrid voice pipeline behind LiveKit WebRTC: VAD, STT, and LLM run locally, while default Edge-TTS sends response text to Microsoft Edge's online TTS service.

Conversational AI, privacy-sensitive deploymentsDemonstratedVoice AI

Demonstrated capabilities

Sub-2-second latency was observed in local development on Apple Silicon; it is not a controlled cross-hardware benchmark and not a guarantee.

< 2s

Voice-to-voice latency on Apple Silicon

3 local

VAD, STT, and LLM stages

Hybrid

Default Edge-TTS uses Microsoft's online service

4 stages

VAD, STT, LLM, TTS, each independently swappable

At a Glance

FieldDetail
Work typeSelf-built product
SectorVoice AI for privacy-sensitive and on-premise use cases
EngagementDesign and build a complete real-time voice assistant stack
PlatformLiveKit Agents, FastAPI, Next.js 15, Whisper, Ollama, Edge-TTS, Docker
FocusSub-2s observed in local development on Apple Silicon; not a controlled cross-hardware benchmark or guarantee
OutcomeLocal-first operation with an explicit online boundary for default speech synthesis

The Product

Voice assistants often send captured audio to someone else's cloud. For regulated industries, internal tools, and privacy-conscious deployments, reducing that exposure can be a core architectural requirement.

This project demonstrates a local-first alternative. WebRTC delivers real-time audio, and the VAD, STT, and LLM stages run locally on the host. The default Edge-TTS provider sends generated response text to Microsoft Edge's online text-to-speech service and returns synthesized audio, so the deployed system is hybrid rather than local-only.

The engagement centered on four objectives:

  • Achieve natural, low-latency voice conversation over real-time WebRTC transport.
  • Keep voice detection, transcription, and reasoning local with Silero VAD, faster-whisper, and Ollama.
  • Make the TTS provider swappable, with Edge-TTS as the online default and configuration available for other providers.
  • Make consumer hardware sufficient, with Apple Silicon GPU acceleration doing the heavy lifting.

The Challenge

The core tension of this project was latency versus data placement. Cloud voice APIs are fast because of data-center GPUs; running the compute-heavy VAD, STT, and LLM stages on local hardware means each one has to earn its milliseconds while the online TTS boundary remains visible.

  1. Four models, one deadline. A voice turn chains voice activity detection, speech-to-text, LLM inference, and text-to-speech. Their latencies add up, and past roughly two seconds, conversation stops feeling like conversation.

  2. Real-time audio is unforgiving. HTTP request-response cannot carry natural dialogue. The system needed WebRTC transport, utterance boundary detection, and interruption handling, the plumbing that separates a voice assistant from a voice memo.

  3. Local hardware, real constraints. The VAD, STT, and LLM stages had to run on a MacBook, which meant choosing models that fit in memory, exploiting Metal GPU acceleration, and resisting the temptation to solve every problem with a bigger model.

  4. Flexibility without forking. Some deployments will want Groq, OpenAI, or Cartesia for a stage. The pipeline had to swap providers through configuration, keeping one codebase across local-first and more cloud-dependent setups.

My Approach

I built the system on LiveKit Agents, with a clean separation between media transport, the agent worker, and the AI pipeline.

WebRTC transport via LiveKit. A Dockerized LiveKit server handles media routing. The browser client, built with Next.js 15 and React 19, requests a JWT from a FastAPI token service and connects over WebRTC. LiveKit dispatches each session to an agent worker that runs the conversation.

A four-stage local-first pipeline. VAD, STT, and LLM run locally: Silero detects speech segments, faster-whisper (large-v3-turbo) transcribes with Metal acceleration, and Ollama running llama3.2:3b generates responses. The default Edge-TTS provider sends response text to Microsoft Edge's online TTS service and streams the synthesized audio back into the pipeline.

Resilience wrappers on every stage. SafeSTT, SafeLLM, and SafeTTS wrappers give each stage graceful error handling, so a single model hiccup degrades the turn instead of killing the session.

Configuration-driven providers. Every stage reads its provider from environment configuration. Swap the LLM to Groq, the STT to OpenAI, or the TTS to Cartesia by editing .env; the system auto-detects provider types at startup. The TTS provider is swappable, so the online boundary is explicit rather than hidden.

Engineering Highlights

  • LiveKit Agents orchestration. SDK 1.5 voice pipeline with proper utterance detection and turn handling, not a walkie-talkie loop.
  • Local-first hybrid stack. Silero VAD, faster-whisper, and Ollama run locally; default Edge-TTS uses Microsoft Edge's online speech service.
  • Observed sub-2s conversational latency. Seen in local development on Apple Silicon with streaming handoffs and Metal acceleration; not a controlled cross-hardware benchmark or guarantee.
  • Safe wrappers per stage. Graceful degradation on STT, LLM, and TTS failures keeps sessions alive through transient errors.
  • Provider swapping via .env. Any stage moves to Groq, OpenAI, Cartesia, or any OpenAI-compatible API without code changes.
  • JWT-secured sessions. FastAPI service issuing tokens and health checks, keeping room access controlled.
  • One-command media layer. Dockerized LiveKit server for reproducible WebRTC infrastructure.
  • Modern web client. Next.js 15, React 19, and Tailwind CSS 4 frontend with live conversation UI.

Results

MetricResult
Response latencySub-2s observed in local development on Apple Silicon; not a controlled cross-hardware benchmark or guarantee
Local executionVAD, STT, and LLM run on the host
Online boundaryDefault Edge-TTS sends generated response text to Microsoft's service
Pipeline4 stages (VAD, STT, LLM, TTS), each independently swappable

Tech Stack and Deliverables

  • Platform: LiveKit Agents SDK 1.5, FastAPI, Python 3.12, Docker, WebRTC
  • AI pipeline: Silero VAD, faster-whisper (large-v3-turbo), Ollama (llama3.2:3b), Edge-TTS
  • Frontend: Next.js 15, React 19, Tailwind CSS 4
  • Deliverables: Complete voice assistant stack, local-first hybrid pipeline, provider-swapping configuration system, resilience wrappers, JWT token service, Dockerized media infrastructure, web client

Work

Related project

Voice AI Demo

Local-First Hybrid Conversational Voice AI Assistant

Self-Built ProjectDemonstrated

A local-first, hybrid conversational voice AI assistant powered by LiveKit Agents. VAD, STT, and LLM run locally with Apple Silicon acceleration; default Edge-TTS sends response text to Microsoft Edge's online text-to-speech service.

LiveKit AgentsFastAPIPython 3.12

More

More case studies

Independent Product R&D

TargetTarget Reference Architecture

Designing Secure Agent Transaction Infrastructure

A protocol-neutral reference design for giving AI agents bounded authority, exact approvals, isolated credentials, safe outcome handling and auditable transaction evidence.

Design outputs

The counts below describe elements in this target reference design and its public documentation; they are not observed production results or performance measurements.

7 controls

Risks, enforcement points and validation methods mapped

4 identities

Human, agent, workload and downstream credential kept distinct

Read case study

hypREspace

Measured

hypREspace: Cutting Token Costs 90% While Raising Tool-Calling Accuracy to 95%

Dynamic prompt injection, a gold evaluation set and Amazon Nova fine-tuning cut a live agent's token spend by 90% and lifted tool-calling accuracy from 75.8% to 95%.

Measured outcomes

Measured with before-and-after per-query token counts and tool-call accuracy scored against the gold evaluation set.

90%

Token cost reduction, measured per query

75.8% to 95%

Tool-calling accuracy on the gold eval set

Read case study

hypREspace

Production

hypREspace: Rearchitecting NL-to-SQL into an Agentic Analytics Engine

A brittle multi-hop prompt chain became one observable LangGraph ReAct agent with a custom MCP layer over the existing FastAPI backend and Claude on Bedrock.

Production outcomes

Production status reflects the deployed client workflow and its live traceability; no comparative performance figure is claimed.

One agent

Replaced a multi-hop prompt chain end to end

Every step traced

Failures diagnosed from the exact step trace

Read case study

Have a problem that looks like this?

Tell me about it. I reply within one working day with a first take and no sales pitch.