Google GenAI Python SDK
The Google GenAI Python SDK provides an interface for developers to integrate Google's generative models into their Python applications. Current version: 1.69.0, released on March 27, 2026. The SDK is actively maintained with regular updates, typically on a monthly basis.
Warnings
- breaking Breaking change in Interactions API: Refactored TextContent annotations to use specific citation types in version 1.68.0.
- breaking Breaking change in Interactions API: Renamed ContentDelta unions in version 1.68.0.
Install
-
pip install google-genai
Imports
- genai
import google.generativeai as genai
Quickstart
import google.generativeai as genai
# Configure the API key
api_key = os.environ.get('GENAI_API_KEY')
genai.configure(api_key=api_key)
# Generate content using a model
model = genai.GenerativeModel(model='gemini-1.5-flash')
response = model.generate_text(prompt='Once upon a time')
print(response.text)