LiveAPI Streaming In Colab
Copyright 2025 Google LLC.
Gemini Live - Multimodal live API: Streaming in Colab
This notebook uses the Multimodel Live API to stream bidirectional audio in Colab. This notebook is much more a demo than a tutorial. This code demonstrates that it is possible to stream audio with interruptions in Colab. It takes a few hacks to make it work.
- For an overview of the Live API, see the Live API docs.
- If you want a good live API experience, try the Live API in Google AI Studio.
- If you want to learn how the Live API works, please refer to the Live API starter tutorial.
Set up
To run the following cell, your API key must be stored in a Colab Secret named GOOGLE_API_KEY. If you don't already have an API key, or you're not sure how to create a Colab Secret, see Authentication for an example.
Now to run it just run all the cells.
Important: On first try it will typically throw an error and ask for permission to record audio, if that happens allow audio, and run it again.
Run the client
<connected>
unhandled message: {'setupComplete': {}}
<end of turn>
Important: On first try it will typically throw an error and ask for permission to record audio, if that happens allow audio, and run it again.