Google Generative AI SDK (Gemini)

0.8.6 · deprecated · verified Tue Mar 24

DEPRECATED. The original Python SDK for Gemini API (AI Studio). Replaced by google-genai (the unified Google Gen AI SDK). End-of-life: November 30, 2025. All support permanently ended. New features like Live API, Veo, Imagen 3 are only available in google-genai. Last version: 0.8.6. Do not use for new projects.

Warnings

Install

Imports

Quickstart

Minimal Gemini call using the new google-genai SDK 1.x.

# pip install google-genai
from google import genai
from google.genai import types
import os

client = genai.Client(api_key=os.environ['GEMINI_API_KEY'])

response = client.models.generate_content(
    model='gemini-2.5-flash',
    contents='What is the capital of France?',
    config=types.GenerateContentConfig(
        temperature=0.1,
        max_output_tokens=256
    )
)
print(response.text)

view raw JSON →