Install & Compatibility
Where this runs
tested against v0.8.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 2.090s · 196.9MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 9.1s · import 1.994s · 200MB
200MB installed
● package 200MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
genai
✓ import google.genai as genai
✗ from google import genai
types
✓ from google.genai import types
✗ from google.genai import types
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)
Debug
Known issues
breakinggoogle-generativeai is fully end-of-life as of November 30, 2025. No bug fixes, no security patches, no new features. The repo is archived at google-gemini/deprecated-generative-ai-python.fixpip install google-genai and migrate. Full migration guide at ai.google.dev/gemini-api/docs/libraries
affects: all
breakinggoogle-cloud-aiplatform generative AI module deprecated June 24, 2026. SDK releases after that date will not include generative AI modules.fixUse google-genai with vertexai=True for Vertex AI access.
affects: google-cloud-aiplatform all versions
breakingAPI surface completely changed. genai.configure() removed. GenerativeModel class removed. New SDK uses Client() instance with client.models.generate_content().fixReplace genai.configure(api_key=...) with client = genai.Client(api_key=...). Replace model.generate_content() with client.models.generate_content(model=..., contents=...).
affects: google-generativeai all vs google-genai all
breakingGenerationConfig renamed to GenerateContentConfig and moved to google.genai.types.fixfrom google.genai import types; types.GenerateContentConfig(temperature=0.1)
affects: google-generativeai all vs google-genai all
gotchaTwo separate env vars for API key depending on mode. Gemini API mode reads GEMINI_API_KEY. Google AI Studio also accepts GOOGLE_API_KEY. Vertex AI mode uses Application Default Credentials.fixSet GEMINI_API_KEY for AI Studio usage. Use gcloud auth application-default login for Vertex AI mode.
affects: google-genai all
gotchaLLMs trained before 2025 have no knowledge of google-genai SDK. Will generate google-generativeai code (old API) by default. High hallucination risk on import pattern and Client() usage.fixAlways verify generated Gemini code uses 'from google import genai' not 'import google.generativeai as genai'.
affects: google-genai all
Upgrade
Version history
0.8.6latest on PyPI · released Dec 16, 2025
Audit
Dependencies
google-authoptionalRequired for Vertex AI mode authentication in google-genai.