Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 963 Bytes

File metadata and controls

32 lines (22 loc) · 963 Bytes

Gemini Live API – Command Line (Python)

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.

Prerequisites

  • Python 3.11+
  • uv
  • A Gemini API key (get one here)
  • PortAudio (brew install portaudio on macOS)

Setup

# Create a virtual environment and activate it
uv venv
source .venv/bin/activate

# Install dependencies
  uv pip install google-genai pyaudio

Run

export GEMINI_API_KEY="your-api-key"
python main.py

You should see "Connected to Gemini. Start speaking!" — talk into your mic and Gemini will respond with audio. Press Ctrl+C to quit.