kvxunz/sona

On-device voice AI + RAG for macOS — STT, LLM, TTS, all local

C++

4

15 commits

updated Mar 25, 2026

See the code

README

Sona

On-device voice AI + RAG for macOS. Ask questions about your documents by voice — 100% local.

Features

  • Voice in/out — Parakeet TDT STT (1.9% WER) + Piper/Kokoro TTS
  • Document RAG — upload PDF, DOCX, XLSX, PPTX, CSV, HTML, TXT and ask questions grounded in your files
  • Local LLM — 4-bit quantized models (Llama 3.2, Qwen3/3.5, Liquid LFM2/2.5)
  • GPU acceleration — MetalRT on Apple M3+ (~486 tokens/s)
  • Web UI — browser interface at localhost:8080
  • Shareable — expose via Cloudflare Tunnel with built-in auth

Everything runs on your machine. No API keys, no cloud, no data leaves the device.

Quick start

# Prerequisites
xcode-select --install
brew install cmake

# Build
git clone https://github.com/user/sona.git && cd sona
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . -j$(sysctl -n hw.ncpu)

# Download AI models (~1GB, first time only)
./sona setup

# Start
./sona
# Open http://localhost:8080

Commands

CommandDescription
sonaStart web server on port 8080
sona setupDownload default AI models
sona cleanupRemove unused models to free disk space
sona upgrade-sttUpgrade to Parakeet TDT (better transcription)
sona upgrade-llmSwitch to a different LLM
sona voicesChange TTS voice
sona metalrt installInstall MetalRT engine (M3+ only)

Options

--port <n>          Server port (default: 8080)
--gpu-layers <n>    GPU layers for LLM (default: 99 = all)
--models <dir>      Models directory (default: ~/Library/Sona/models)
--verbose, -v       Debug logs

API

MethodEndpointDescription
GET/Web UI
POST/api/uploadUpload document (multipart)
POST/api/queryAsk a question (JSON {query})
POST/api/transcribeTranscribe audio (WAV body)
POST/api/speakText-to-speech (JSON {text})
POST/api/clearClear conversation history
GET/api/statusEngine info

All POST endpoints require X-Sona-Token header when accessed remotely. The token is printed to stderr on startup and auto-injected into the web UI.

Remote access

Share your instance with others via Cloudflare Tunnel:

brew install cloudflared
cloudflared tunnel --url http://localhost:8080 --protocol http2

The generated https://xxx.trycloudflare.com link includes auth — send it to anyone.

Models

LLM

ModelSizeSpeedNotes
Llama 3.2 3B Instruct1.8 GB~100 t/sDefault
Qwen3.5 4B2.7 GB~75 t/sBest small model, 262K context
Liquid LFM2 1.2B731 MB~180 t/sRecommended
Qwen3 0.6B456 MB~250 t/sMetalRT: ~486 t/s
Liquid LFM2 350M219 MB~350 t/sFastest, 128K context

STT

ModelWERNotes
Parakeet TDT 0.6B v3~1.9%Best accuracy (sona upgrade-stt)
Whisper base.en~5%Default fallback
ZipformerStreaming (always active for live mic)

TTS

ModelNotes
Piper LessacDefault, low latency
Kokoro v0.19Multiple speakers

Architecture

                         ┌─────────────────────────────────┐
                         │          Web UI / API            │
                         │    localhost:8080 (cpp-httplib)   │
                         └──────────┬──────────┬────────────┘
                                    │          │
                            voice   │          │  document
                            query   │          │  upload
                                    ▼          ▼
┌───────────────────────────────────────┐  ┌──────────────────────────┐
│         Voice Pipeline                │  │     RAG Pipeline         │
│                                       │  │                          │
│  ┌─────┐   ┌─────┐   ┌─────────┐     │  │  ┌────────┐  ┌───────┐  │
│  │ VAD ├──▶│ STT ├──▶│   LLM   │     │  │  │ Doc    ├─▶│Embed  │  │
│  └─────┘   └─────┘   │         │◀────┼──┼──│Processor│  │Engine │  │
│                       │ llama.cpp│     │  │  └────────┘  └──┬────┘  │
│  ┌─────┐              │    or   │     │  │               ┌──▼────┐  │
│  │ TTS │◀─────────────│ MetalRT │     │  │  ┌────────┐  │Vector │  │
│  └──┬──┘              └─────────┘     │  │  │ BM25   │  │Index  │  │
│     │                                 │  │  └───┬────┘  └──┬────┘  │
└─────┼─────────────────────────────────┘  │      │    RRF   │       │
      ▼                                    │      └────┬─────┘       │
 ┌─────────┐                               │           ▼             │
 │CoreAudio│                               │      top-K chunks       │
 │  Output  │                               └──────────────────────────┘
 └─────────┘

 Engines: sherpa-onnx (STT/TTS/VAD) · llama.cpp (LLM) · MetalRT (M3+ GPU)
 Storage: USearch HNSW (vectors) · BM25 (term index) · mmap'd chunks
src/
  api/        C API — public interface for embedding Sona
  audio/      CoreAudio I/O, WAV encoding
  cli/        Web server, embedded frontend, CLI commands
  core/       Lock-free ring buffer, types, config
  engines/    STT, TTS, LLM, embedding, MetalRT backends
  models/     Model registry, download, priority-based auto-selection
  pipeline/   Voice pipeline orchestrator (STT → LLM → TTS)
  rag/        Hybrid retrieval: USearch HNSW + BM25 + RRF fusion

Dependencies: llama.cpp (LLM + Metal GPU), sherpa-onnx (STT/TTS/VAD), USearch (vector index), cpp-httplib (HTTP server)

License

MIT

Contributors

kvxunz

15 commits

kvxunz/sona

On-device voice AI + RAG for macOS — STT, LLM, TTS, all local

C++

4

15 commits

updated Mar 25, 2026

See the code

README

Sona

On-device voice AI + RAG for macOS. Ask questions about your documents by voice — 100% local.

Features

  • Voice in/out — Parakeet TDT STT (1.9% WER) + Piper/Kokoro TTS
  • Document RAG — upload PDF, DOCX, XLSX, PPTX, CSV, HTML, TXT and ask questions grounded in your files
  • Local LLM — 4-bit quantized models (Llama 3.2, Qwen3/3.5, Liquid LFM2/2.5)
  • GPU acceleration — MetalRT on Apple M3+ (~486 tokens/s)
  • Web UI — browser interface at localhost:8080
  • Shareable — expose via Cloudflare Tunnel with built-in auth

Everything runs on your machine. No API keys, no cloud, no data leaves the device.

Quick start

# Prerequisites
xcode-select --install
brew install cmake

# Build
git clone https://github.com/user/sona.git && cd sona
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . -j$(sysctl -n hw.ncpu)

# Download AI models (~1GB, first time only)
./sona setup

# Start
./sona
# Open http://localhost:8080

Commands

CommandDescription
sonaStart web server on port 8080
sona setupDownload default AI models
sona cleanupRemove unused models to free disk space
sona upgrade-sttUpgrade to Parakeet TDT (better transcription)
sona upgrade-llmSwitch to a different LLM
sona voicesChange TTS voice
sona metalrt installInstall MetalRT engine (M3+ only)

Options

--port <n>          Server port (default: 8080)
--gpu-layers <n>    GPU layers for LLM (default: 99 = all)
--models <dir>      Models directory (default: ~/Library/Sona/models)
--verbose, -v       Debug logs

API

MethodEndpointDescription
GET/Web UI
POST/api/uploadUpload document (multipart)
POST/api/queryAsk a question (JSON {query})
POST/api/transcribeTranscribe audio (WAV body)
POST/api/speakText-to-speech (JSON {text})
POST/api/clearClear conversation history
GET/api/statusEngine info

All POST endpoints require X-Sona-Token header when accessed remotely. The token is printed to stderr on startup and auto-injected into the web UI.

Remote access

Share your instance with others via Cloudflare Tunnel:

brew install cloudflared
cloudflared tunnel --url http://localhost:8080 --protocol http2

The generated https://xxx.trycloudflare.com link includes auth — send it to anyone.

Models

LLM

ModelSizeSpeedNotes
Llama 3.2 3B Instruct1.8 GB~100 t/sDefault
Qwen3.5 4B2.7 GB~75 t/sBest small model, 262K context
Liquid LFM2 1.2B731 MB~180 t/sRecommended
Qwen3 0.6B456 MB~250 t/sMetalRT: ~486 t/s
Liquid LFM2 350M219 MB~350 t/sFastest, 128K context

STT

ModelWERNotes
Parakeet TDT 0.6B v3~1.9%Best accuracy (sona upgrade-stt)
Whisper base.en~5%Default fallback
ZipformerStreaming (always active for live mic)

TTS

ModelNotes
Piper LessacDefault, low latency
Kokoro v0.19Multiple speakers

Architecture

                         ┌─────────────────────────────────┐
                         │          Web UI / API            │
                         │    localhost:8080 (cpp-httplib)   │
                         └──────────┬──────────┬────────────┘
                                    │          │
                            voice   │          │  document
                            query   │          │  upload
                                    ▼          ▼
┌───────────────────────────────────────┐  ┌──────────────────────────┐
│         Voice Pipeline                │  │     RAG Pipeline         │
│                                       │  │                          │
│  ┌─────┐   ┌─────┐   ┌─────────┐     │  │  ┌────────┐  ┌───────┐  │
│  │ VAD ├──▶│ STT ├──▶│   LLM   │     │  │  │ Doc    ├─▶│Embed  │  │
│  └─────┘   └─────┘   │         │◀────┼──┼──│Processor│  │Engine │  │
│                       │ llama.cpp│     │  │  └────────┘  └──┬────┘  │
│  ┌─────┐              │    or   │     │  │               ┌──▼────┐  │
│  │ TTS │◀─────────────│ MetalRT │     │  │  ┌────────┐  │Vector │  │
│  └──┬──┘              └─────────┘     │  │  │ BM25   │  │Index  │  │
│     │                                 │  │  └───┬────┘  └──┬────┘  │
└─────┼─────────────────────────────────┘  │      │    RRF   │       │
      ▼                                    │      └────┬─────┘       │
 ┌─────────┐                               │           ▼             │
 │CoreAudio│                               │      top-K chunks       │
 │  Output  │                               └──────────────────────────┘
 └─────────┘

 Engines: sherpa-onnx (STT/TTS/VAD) · llama.cpp (LLM) · MetalRT (M3+ GPU)
 Storage: USearch HNSW (vectors) · BM25 (term index) · mmap'd chunks
src/
  api/        C API — public interface for embedding Sona
  audio/      CoreAudio I/O, WAV encoding
  cli/        Web server, embedded frontend, CLI commands
  core/       Lock-free ring buffer, types, config
  engines/    STT, TTS, LLM, embedding, MetalRT backends
  models/     Model registry, download, priority-based auto-selection
  pipeline/   Voice pipeline orchestrator (STT → LLM → TTS)
  rag/        Hybrid retrieval: USearch HNSW + BM25 + RRF fusion

Dependencies: llama.cpp (LLM + Metal GPU), sherpa-onnx (STT/TTS/VAD), USearch (vector index), cpp-httplib (HTTP server)

License

MIT

Contributors

kvxunz

15 commits

Languages

C++

97.3%

C

1.5%