Para usar Gemini en Vertex AI, debes autenticarte con una clave de API deGoogle Cloud o con las credenciales predeterminadas de la aplicación. Te recomendamos que uses una clave de API para las pruebas y las credenciales predeterminadas de la aplicación para la producción. En esta página, se muestra cómo configurar las credenciales predeterminadas de la aplicación.
Antes de comenzar
Selecciona un proyecto, habilita la facturación, habilita la API de Vertex AI y, luego, instala gcloud CLI.
-
Sign in to your Google Account.
If you don't already have one, sign up for a new account.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Vertex AI API.
-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Vertex AI API.
-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init
Crea credenciales de autenticación locales
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
Realiza tu primera solicitud a la API
Después de configurar las credenciales predeterminadas de la aplicación, aprende a realizar tu primera solicitud en la guía de inicio rápido de la API.