The new Google Gen AI SDK provides a unified interface to Gemini 2.0 through both the Gemini Developer API and the Gemini Enterprise API ( Vertex AI). With a few exceptions, code that runs on one platform will run on both. The Gen AI SDK also supports the Gemini 1.5 models.
Python
The Google Gen AI SDK for Python is available on PyPI and GitHub:
Or try out the Getting Started notebook.
To learn more, see the Python SDK reference.
Quickstart
1. Import libraries
from google import genai
from google.genai import types
2. Create a client
client = genai.Client(api_key='YOUR_API_KEY')
3. Generate content
response = client.models.generate_content(
model='gemini-1.5-pro-002', contents='What is your name?'
)
print(response.text)
Go
The Google Gen AI SDK for Go is available on GitHub.
To learn more, see the Go SDK reference.