Installation
Install the Gemini Live plugin withTutorials
The Voice AI quickstart and Video AI quickstart pages have examples to get you up and running.Example
Check out our Gemini Live example to see a practical implementation of the plugin and get inspiration for your own projects, or read on for some key details.Initialization
The Gemini plugin for Stream exists in the form of theRealtime
class:
Parameters
These are the parameters available in thegemini.Realtime
plugin:
Name | Type | Default | Description |
---|---|---|---|
model | str | "gemini-2.5-flash-native-audio-preview-09-2025" | The Gemini model to use. Supports Live-enabled models only. |
config | LiveConnectConfigDict or None | None | Configuration for the Gemini Live connection. If None , uses sensible defaults. |
api_key | str or None | None | Your Gemini API key. If not provided, the SDK will look for it in env vars. |
fps | int | 1 | Number of video frames per second to send to Gemini. |
client | genai.Client or None | None | Optional pre-configured Gemini client. If provided, uses this instead of creating one. |
http_options | HttpOptions or None | None | HTTP options for the Gemini client connection. |
Functionality
Connect
Theconnect()
method establishes a websocket connection to Gemini Live:
Send Text Message
Thesimple_response()
method allows you to send a text instruction to Gemini:
Send Audio
Thesimple_audio_response()
method allows you to send audio data to Gemini:
Advanced: Send Realtime Input
For more control, you can use the nativesend_realtime_input()
method which wraps Gemini’s API:
Function Calling and MCP
Gemini Live supports function calling and MCP (Model Context Protocol) tools. When using the Realtime plugin via the main Agent class, you can register tools that Gemini can call. Follow the instructions in the MCP tool calling guide, using the Gemini Realtime class as your LLM. The plugin automatically handles:- Converting your tool definitions to Gemini’s format
- Executing function calls when Gemini requests them
- Sending function results back to Gemini
Configuration
The Gemini Live API usesLiveConnectConfigDict
for configuration. You can customize various aspects of the connection:
Events
The Gemini plugin emits standard Vision Agents events that you can listen to:RealtimeConnectedEvent
: Fired when connection is establishedRealtimeDisconnectedEvent
: Fired when connection is closedRealtimeAudioOutputEvent
: Fired when Gemini generates audioLLMResponseChunkEvent
: Fired when Gemini generates textRealtimeTranscriptEvent
: Fired for transcriptions