Google GenAI Python SDK

1.69.0 · active · verified Sat Mar 28

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

Install

Imports

Quickstart

This script demonstrates how to configure the Google GenAI SDK with your API key and generate text using the 'gemini-1.5-flash' model.

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)

view raw JSON →