Hands-free AI assistant with free (Ollama) and premium (OpenAI + ElevenLabs) options
[π€ Demo Coming Soon]
A Python-based voice assistant with two implementations:
- Free version - Uses Ollama (local AI) + macOS Text-to-Speech (completely free!)
- Premium version - Uses ElevenLabs (realistic voices) + OpenAI GPT (paid APIs)
- π€ Speech recognition using Google Speech Recognition
- π€ AI-powered conversational responses
- π Natural-sounding voice output
- π¬ Maintains conversation context
- π― Simple voice commands
- π 100% free option with local AI
The free version runs completely locally with no API costs!
- Python 3.8 or higher
- macOS (for built-in TTS)
- Microphone and speakers/headphones
- Ollama for local AI
-
Install Python dependencies:
pip3 install SpeechRecognition requests
Note for macOS users: If you encounter issues installing PyAudio:
brew install portaudio pip3 install pyaudio
-
Install Ollama (local AI):
brew install ollama
-
Download AI model:
ollama pull llama2
-
Start Ollama service:
brew services start ollama
-
Install all dependencies:
pip3 install -r requirements.txt
-
Set up environment variables:
cp .env.example .env
Edit
.envand add your API keys:ELEVENLABS_API_KEY=your_elevenlabs_api_key_here OPENAI_API_KEY=your_openai_api_key_here ELEVENLABS_VOICE_ID=21m00Tcm4TlvDq8ikWAMGet API keys:
- ElevenLabs: https://elevenlabs.io/ (requires payment)
- OpenAI: https://platform.openai.com/ (requires payment)
Run the free assistant:
python3 assistant_free.pyRun the premium assistant (requires API keys):
python3 assistant.py- Speak naturally to ask questions or have conversations
- Say "exit", "quit", or "goodbye" to stop the assistant
- Say "list voices" to see available ElevenLabs voices (premium only)
- Press Ctrl+C to force exit
Change AI Model:
Edit assistant_free.py line 68 to use a different model:
"model": "llama3.2", # Options: llama2, llama3.2, mistral, codellama, etc.Install new models with:
ollama pull llama3.2
ollama pull mistralAdjust Voice:
The free version uses macOS say command. Change the voice:
say -v "?" # List available voicesEdit line 97 in assistant_free.py:
subprocess.run(["say", "-v", "Samantha", text], check=True)Change Voice:
- Run the assistant and say "list voices" to see available options
- Copy the desired voice ID
- Update
ELEVENLABS_VOICE_IDin your.envfile
Adjust AI Model:
Edit assistant.py line 71 to change the model:
model="gpt-4o-mini", # Options: gpt-4o-mini, gpt-4o, gpt-3.5-turbo, etc.Modify System Prompt:
Edit the conversation_history initialization in assistant.py to change the assistant's personality:
conversation_history = [
{"role": "system", "content": "Your custom prompt here"}
]"Ollama is not installed or not running":
brew services start ollama
# Wait a few seconds, then try again"API returned status code: 404": The AI model isn't downloaded:
ollama pull llama2Slow AI responses:
- First response is always slower (model loading)
- Use a smaller/faster model:
ollama pull llama3.2:1b - Upgrade your Mac's RAM or use a smaller model
Microphone Issues:
- Ensure your microphone is connected and selected as the default input device
- Grant microphone permissions: System Settings β Privacy & Security β Microphone β Enable for Terminal
- Speak closer to the microphone
- Reduce background noise
"Could not understand audio":
- Speak more clearly and slowly
- Check that your microphone is working:
say "test" - Try adjusting
energy_thresholdin the code (line 39)
Audio Playback Issues:
- Ensure speakers/headphones are connected
- Check system audio settings
- Test with:
say "test"
API Errors:
- Verify your API keys are correct and have available credits
- Add payment method to OpenAI and ElevenLabs accounts
- Check your internet connection
- β $0 - Completely free!
- Uses local AI (Ollama)
- Uses macOS built-in TTS
- Google Speech Recognition (free tier)
- π° OpenAI: ~$0.01-0.03 per conversation (GPT-4o-mini)
- π° ElevenLabs: ~$0.01-0.05 per response (depends on length)
- β Google Speech Recognition: Free for basic usage
Estimated cost per 10-minute conversation: $0.50-$2.00
- Add wake word detection ("Hey Assistant")
- Implement conversation memory across sessions
- Add web UI for configuration
- Support for other languages
- Integration with smart home devices
- Better formant preservation for voice responses
- Context-aware responses with RAG (Retrieval Augmented Generation)
You: What is the capital of France?
Assistant: The capital of France is Paris, which is also the country's largest city...
You: What's the population?
Assistant: Paris has a population of approximately 2.2 million within the city limits...
You: Remind me to call John at 3 PM
Assistant: I've set a reminder for you to call John at 3 PM today.
You: What's the weather like?
Assistant: I can help with that! However, weather integration isn't enabled yet...
You: My name is Sarah
Assistant: Nice to meet you, Sarah! How can I help you today?
You: What's my name?
Assistant: Your name is Sarah.
- π» Hands-free computing - Control your computer while multitasking
- π― Learning assistant - Ask questions while studying
- βΏ Accessibility - Voice interface for those who need it
- π Smart home - Voice control (with future integrations)
- π Note-taking - Dictate notes and ideas
- π¨βπ» Productivity - Quick answers without leaving your workflow
- π Language learning - Practice conversation skills
| Feature | Free Version | Premium Version |
|---|---|---|
| Cost | $0 | ~$0.50-$2/conversation |
| AI Quality | Good (Llama2) | Excellent (GPT-4o-mini) |
| Voice Quality | Natural (macOS TTS) | Highly realistic (ElevenLabs) |
| Response Speed | 2-5 seconds | 1-3 seconds |
| Privacy | 100% local | Data sent to APIs |
| Setup Complexity | Easy | Medium (API keys) |
| Internet Required | No (after model download) | Yes |
MIT License - Feel free to modify and use for your projects!