Registry / llm-agents / google-generativeai

google-generativeai

JSON →
library0.8.6pypypi✓ verified 47d ago

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.

llm-agentsai-mlgcp
pip install google-genai
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
musl
glibc
py 3.10
8/10 runs
8/10 runs
py 3.11
8/10 runs
8/10 runs
py 3.12
8/10 runs
8/10 runs
py 3.13
8/10 runs
8/10 runs
py 3.9
8/10 runs
8/10 runs
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.
fix
pip 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.
fix
Use 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().
fix
Replace 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.
fix
from 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.
fix
Set 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.
fix
Always 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
Audit
Dependencies
google-authoptionalRequired for Vertex AI mode authentication in google-genai.
Agent activity
63 hits · last 30 days
node
4
mj12bot
3
ahrefsbot
3
seranking-bot
2
bytedance
1
yandexbot
1
Resources