← all repositories
googleapis/python-genai

Google's Python SDK for Gemini that keeps your AI assistant honest

It unifies Google's consumer and enterprise Gemini APIs in one Python client, while shipping 'Agent Skills' to stop your IDE assistant from suggesting outdated libraries.

python-genai
Not currently ranked — collecting fresh signals.
star history

What it does

This is Google’s official Python interface to its generative models, wrapping both the Gemini Developer API and the Gemini Enterprise Agent Platform (formerly Vertex AI) behind a single Client class. It covers text generation, image output, file uploads, and async workflows, letting you point the same code at either Google’s consumer or cloud enterprise stack.

The interesting bit

Most SDKs ship code; this one also ships “Agent Skills”—context files meant to be loaded into AI coding assistants like Cursor or Claude Code so they stop suggesting outdated libraries. It is a rare admission from a vendor that static training data causes library drift, and an attempt to fix it from the inside.

Key highlights

  • One Client handles both developer key auth and enterprise project/location auth
  • All API methods accept either Pydantic models or plain dictionaries
  • Async client offers an optional aiohttp backend for faster performance beyond the default httpx
  • Context managers handle connection cleanup to avoid “client has been closed” runtime errors
  • Supports custom base URLs, proxy configurations (including SOCKS5), and explicit API version selection

Caveats

  • File uploads are restricted to the Gemini Developer API; the enterprise platform does not support them
  • Beta API endpoints are the default, so you must explicitly opt into stable v1 via http_options
  • The README concedes that AI assistants trained on static datasets may still suggest legacy libraries despite the skills

Verdict

Useful if you are building Python applications against Google’s Gemini models and need one codebase that straddles both the developer and enterprise tiers. Not for you if you are outside Google’s ecosystem—this client is tightly coupled to Gemini’s API surface.

Frequently asked

What is googleapis/python-genai?
It unifies Google's consumer and enterprise Gemini APIs in one Python client, while shipping 'Agent Skills' to stop your IDE assistant from suggesting outdated libraries.
Is python-genai open source?
Yes — googleapis/python-genai is open source, released under the Apache-2.0 license.
What language is python-genai written in?
googleapis/python-genai is primarily written in Python.
How popular is python-genai?
googleapis/python-genai has 4k stars on GitHub.
Where can I find python-genai?
googleapis/python-genai is on GitHub at https://github.com/googleapis/python-genai.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.