A full-stack voice assistant with a real-time Speech → Intelligence → Speech pipeline.
🎤 Browser Mic → /transcribe (Whisper) → /chat (GPT-4o) → /speak (ElevenLabs) → 🔊 Browser Speaker
| Layer | Technology | Purpose |
|---|---|---|
| STT | OpenAI Whisper (whisper-1) |
Convert speech to text |
| LLM | OpenAI GPT-4o | Conversational reasoning |
| TTS | ElevenLabs (eleven_multilingual_v2) |
Natural voice synthesis |
| Backend | Python FastAPI | API orchestration & streaming |
| Frontend | Single HTML file (vanilla JS) | Push-to-talk UI |
- Python 3.9+
- OpenAI API key — Get one here
- ElevenLabs API key — Get one here
- A modern browser with microphone access (Chrome, Edge, Firefox)
pip install -r requirements.txtCopy the example env file and fill in your keys:
cp .env.example .envThen edit .env:
OPENAI_API_KEY=sk-your-key-here
ELEVENLABS_API_KEY=xi_your-key-here
ELEVENLABS_VOICE_ID=21m00Tcm4TlvDq8ikWAM # Optional: defaults to "Rachel"uvicorn main:app --reloadNavigate to http://localhost:8000
- Hold the microphone button and speak your message
- Release the button — the pipeline runs automatically:
- 🟡 Transcribing — your speech is converted to text via Whisper
- 🔵 Thinking — GPT-4o generates a response
- 🟢 Speaking — ElevenLabs reads the response aloud
- The conversation history is maintained (last 10 turns)
- Use the voice dropdown to switch ElevenLabs voices
- Toggle 🔇 mute to skip audio playback
- Press 🗑️ clear to reset the conversation
| Method | Path | Description |
|---|---|---|
| POST | /transcribe |
Audio blob → transcript text (Whisper) |
| POST | /chat |
Transcript + history → LLM reply |
| POST | /speak |
Text → streamed audio/mpeg (ElevenLabs) |
| GET | /voices |
List available ElevenLabs voices |
| GET | / |
Serve the frontend |
- Change Nova's personality: Edit the
SYSTEM_PROMPTinmain.py - Switch LLM model: Change
"gpt-4o"in the/chatendpoint - Adjust TTS quality: Modify
stabilityandsimilarity_boostin/speak - Token limit: Adjust
max_tokensin the/chatendpoint (default: 512)
voice-agent/
├── main.py # FastAPI backend (< 200 lines)
├── index.html # Single-file frontend (HTML + CSS + JS)
├── requirements.txt # Python dependencies
├── .env.example # API key template
├── .env # Your actual API keys (git-ignored)
└── README.md # This file