The Vertex AI Generative Models SDK is Being Deprecated

Ben Makansi
April 8, 2026

Just a head's up - the vertexai.generative_models SDK Is deprecated.

I've seen a lot of people get confused about this because a lot of the LLMs are still recommending this library and there are a lot of code examples out there using it still.

If you've built anything on Vertex AI using the Python SDK, you've probably written code that starts like this:

import vertexai
from vertexai.generative_models import GenerativeModel, Part, Content

vertexai.init(project="my-project", location="us-central1")
model = GenerativeModel(model_name="gemini-2.5-flash")
response = model.generate_content("Hello")

But Google deprecated vertexai.generative_models on June 24, 2025, and it will be removed on June 24, 2026. So people will have had a year to migrate.

What replaces it

The replacement is the google-genai package, which uses a client-based pattern instead of the old module-level init approach. The equivalent code looks like this:

from google import genai
from google.genai import types

client = genai.Client(vertexai=True, project="my-project", location="us-central1")
response = client.models.generate_content(
   model="gemini-2.5-flash",
   contents="Hello",
)

You can install it with pip install google-genai.

What's different

A few things stand out when you start migrating.

First, there's no more global vertexai.init(). The old SDK used module-level state where you called vertexai.init() once and every subsequent call inherited the project and location. The new SDK puts that configuration on the client object. If you need multiple projects or regions, you create multiple clients instead of re-initializing a global.

Second, model configuration moved from constructor arguments to per-request config. In the old SDK, you'd pass tools= and generation_config= when constructing the GenerativeModel. In the new SDK, you pass a types.GenerateContentConfig object with each generate_content call. That makes it easier to vary parameters across requests without creating new model instances.

Third, the response structure is slightly different. You'll need to update any code that parses tool calls, safety ratings, or multi-part responses. The fields are similar but not identical.

What's NOT deprecated

This only affects vertexai.generative_models. If you're using the Agent Development Kit (ADK) or vertexai.agent_engines, those are not part of this deprecation. The ADK has its own abstractions over the model layer, so your ADK-based agents should continue working without changes.

Don't wait too long

If you have production code on the old SDK, don't wait too long to figure this out! The migration is pretty straightforward, but if you have function calling, multi-turn conversations, or custom tool handling, the config and response parsing differences add up. Better to migrate now while you have time to test properly than to rush it when the removal date gets close.

You honestly can probably put your code into Claude Code or Gemini and get back the converted code.

arrow