YouTuber-AI is a Python application that reads live chat messages from a specified YouTube or Twitch livestream and generates AI-driven responses using OpenAI's gpt-4o-mini model, remembers previous messages from users, and saves the chat logs for future reference. It also generate spoken responses using text-to-speech (TTS) systems. The program includes both command-line and graphical user interface (GUI).
- AI-Powered Responses: Uses OpenAI’s API to generate conversational responses from live chat messages in real time.
- Chat History: Remembers chat history for context-aware responses.
- Chat Logging: Saves chat logs for later review.
- Text-to-Speech Output: Converts responses to audio using either
pyttsx3orOpenAI's TTSoptions, making the interaction vocal and dynamic. - Multi-Platform: Choose between different platforms:
youtubeortwitch. - Live Chat Processing: Reads and processes messages from YouTube or Twitch livestreams.
- Configurable TTS Options: Choose between different TTS engines.
- UI interface: Provides an intuitive interface (
ui_app.py) for setting configurations and running the program.
- Python: 3.x
- API Key: OpenAI API key (required for AI-driven responses)
- FFmpeg: Required for handling audio processing
- Dependencies: Install via
requirements.txt - Twitch token: Can be generated on this website by setting the flag on
chat:readandchat:edit.
-
Clone the repository and navigate to the project folder:
git clone https://github.com/artur3333/YouTuber-AI.git cd YouTuber-AI -
Install the required Python packages:
pip install -r requirements.txt
-
Install FFmpeg: FFmpeg is needed for audio processing. Follow the instructions below based on your operating system:
- Ubuntu or Debian-based systems:
sudo apt update && sudo apt install ffmpeg - macOS (using Homebrew):
brew install ffmpeg
- Windows:
- Download FFmpeg from FFmpeg's official site.
- Unzip the downloaded file, and add the files (ffmpeg.exe and ffprobe.exe) contained in FFmpeg
bindirectory to the project's PATH.
- Ubuntu or Debian-based systems:
-
Configure your OpenAI API key:
- Open the
config.jsonfile in a text editor. - Replace
YOUR_OpenAI_KEYwith your actual OpenAI API key as shown below:{ "apikeys": [ { "OAI_key": "YOUR_OpenAI_KEY" } ] }
- Open the
-
Configure your Twitch Token and Channel:
- Open the
config.jsonfile in a text editor. - Replace
YOUR_TWITCH_TOKENwith your Twitch token which can be generated on this website. - Replace
YOUR_NICKNAMEwith your nickname. - Replace
YOUR_CHANNELwith the name of your Twitch Channel.{ "apikeys": [ { "OAI_key": "YOUR_OpenAI_KEY" } ], "twitch": [ { "token": "YOUR_TWITCH_TOKEN", "nickname": "YOUR_NICKNAME", "channel": "YOUR_CHANNEL" } ] }
- Open the
YouTuber-AI
├── main.py # Main script to run the application
├── ui_app.py # GUI application for easier configuration and management
├── config.json # Configuration file for storing API keys and settings
├── conversation.json # Stores the conversation history used for generating responses
├── conversation_log.txt # Saves all chat logs and AI responses
├── ffmpeg.exe # FFmpeg executable for audio processing (Windows)
├── ffprobe.exe # FFprobe executable for media information (Windows)
├── icon.ico # The Icon
├── requirements.txt # List of Python dependencies
└── README.md # Project readme with usage instructions and details
To start YouTuber-AI, open a terminal in the project directory and run main.py with the necessary arguments:
python main.py -id <LIVE_STREAM_ID> -tts <TTS_TYPE> -p <PLATFORM> -d- -id <LIVE_STREAM_ID>: YouTube only. The ID of the live stream.
- -tts <TTS_TYPE>: Text-to-Speech type. Options:
pyttsx3oropenai. - -p : Platform for streaming. Options:
youtubeortwitch. - -d: Enables debug mode for detailed logs.
To start YouTuber-AI, open a terminal in the project directory and run ui_app.py:
python ui_app.py- Enter the YouTube Stream ID (if applicable).
- Select the TTS Type (either
pyttsx3oropenai). - Choose the Platform (
YouTubeorTwitch). - Optionally, check Enable Debug Mode for detailed logs.
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and test them.
- Submit a pull request describing your changes.