A minimal command-line app that streams microphone audio to the Gemini Live API and plays back the response in real time.
Note: Use headphones. This script uses the system default audio input and output, which often won't include echo cancellation. To prevent the model from interrupting itself, use headphones.
- Python 3.11+
- uv
- A Gemini API key (get one here)
- PortAudio (
brew install portaudioon macOS)
# Create a virtual environment and activate it
uv venv
source .venv/bin/activate
# Install dependencies
uv pip install google-genai pyaudioexport GEMINI_API_KEY="your-api-key"
python main.pyYou should see "Connected to Gemini. Start speaking!" — talk into your mic and Gemini will respond with audio. Press Ctrl+C to quit.