Python package for Gemini API: google-cloud-aiplatform or vertexai?

May I ask, when using Python to call the Vertex AI Generative API, should I use the google-cloud-aiplatform package, or should I install the vertexai package? I really confused. These two look similar, and I can’t tell which one I need to install.

Welcome @Will

This should help: Создавайте с помощью Gemini в Google Cloud  |  Gemini API  |  Google for Developers

2 Likes

Thank you.

So both google-cloud-aiplatform and vertexai package contains vertexai module, right? Isn’t it confusing?

Thanks.

Does the vertexai package contains all modules in the google-cloud-aiplatform package have?

You can access Gemini though both packages, but if you’re in a restricted area, like the EU, then you will have to use the Vertex AI package :heart:

1 Like

Where did you get these information? :slight_smile:

1 Like

If you try to access Google AI studio from a restricted region, you’ll be redirected to this information :laughing:

If you can access that page, you can also use the google-cloud-aiplatform package.

Are the node.js and python libraries for calling Gemini via vertex AI compatible with the Google AI Studio version?

Specifically: I have been building an app that interacts with Gemini using vertex AI, but I am not sure if I want to keep the associated Google cloud account active after my trial runs out

So if I decide to switch to AI Studio, is it just a matter of importing different libraries and otherwise my code should run unmodified? Or will I have to rewrite everything?

Welcome to the forum!

So, afaik, you still need a google cloud account in order to generate API keys via Google AI studio, so I would not recommend deactivating the google cloud account.

Welcome to the forum. The API is basically identical, you just change an import here and there. However: Vertex has many convenient features (helpers) that you will not find in the AI Studio endpoint. If you plan your migration, you can easily built the helpers yourself.
If you don’t plan it, when you cut over different things that used to work, won’t.