This Python project is a voice-activated desktop assistant that listens to your speech and performs smart actions — such as opening websites, playing music, fetching news, reporting weather, or chatting using OpenAI’s GPT model.
It combines speech recognition, API integrations, and OpenAI’s conversational power to act as an all-in-one personal AI helper.
- 🎤 Voice Commands — Speak naturally, and the assistant will recognize your request using Google’s speech-to-text.
- 💬 Conversational Chatbot — Uses GPT-4o-mini to respond intelligently to anything you say.
- 🌦 Weather Reports — Fetches real-time weather data for any city via the Open-Meteo API and has GPT summarize it nicely.
- 📰 News Headlines — Displays the latest trending news using the NewsAPI (currently Bitcoin-related by default, but easily customizable).
- 🎵 Music Playback — Opens a local MP3 file or your preferred media when you say “Open music.”
- 🌐 Website Access — Instantly opens sites like YouTube, Google, or Wikipedia by voice.
- 🕒 Time Updates — Speaks the current time when you ask for it.
| Category | Technology |
|---|---|
| Voice Recognition | speech_recognition |
| Text-to-Speech | macOS say command |
| Language Model | openai (GPT-4o-mini) |
| News Feed | newsapi-python |
| Weather | open-meteo API |
| Misc | requests, datetime, os, webbrowser |
- The assistant listens through your microphone using SpeechRecognition.
- Recognized text is matched against known commands (like “open YouTube” or “weather in Delhi”).
- Depending on the command:
- It may open a website
- Play music
- Fetch the weather or news
- Or chat with you through OpenAI’s API
- Voice feedback is given via macOS’s
sayfunction.
- Clone this repository:
git clone https://github.com/yourusername/voice-desktop-assistant.git cd voice-desktop-assistant - Install dependencies:
pip install openai newsapi-python SpeechRecognition requests
- Add your API keys:
-
Create a file called keys.py
apikey = "Insert your api key here"
-
Replace 'Insert your api key here' inside getNews() with your OpenAI API key.
-
Also, replace this with your News api key
newsapi = NewsApiClient(api_key='Insert your api key here')
- Run the assistant:
python main.py
| Voice Command | Action |
|---|---|
| “Open YouTube” | Opens YouTube in browser |
| “Play music” | Plays a local song file |
| “What’s the weather in New York” | Fetches and reports weather |
| “Show me news today” | Lists top news headlines |
| “Write an email using artificial intelligence” | Uses GPT to generate an email |
| “What time is it” | Speaks the current time |
| “Exit” | Closes the program |
. ├── assistant.py # Main assistant script ├── keys.py # Stores your OpenAI API key ├── OpenAI/ # Folder where GPT responses are saved └── README.md
-
🎶 Add YouTube or Spotify API integration for song playback
-
🌍 Dynamic weather and news by voice input
-
💬 Continuous conversation context memory
-
🎛 GUI version for better visualization
🧑💻 Author
Saksham Dhakal Built with Python, APIs, and curiosity 🔥