Pour utiliser Gemini sur Vertex AI, vous devez vous authentifier à l'aide d'une clé APIGoogle Cloud ou des identifiants par défaut de l'application. Nous vous recommandons d'utiliser une clé API pour les tests et les identifiants par défaut de l'application pour la production. Cette page vous explique comment configurer les identifiants par défaut de l'application.
Avant de commencer
Sélectionnez un projet, activez la facturation, activez l'API Vertex AI et installez 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
Créer des identifiants d'authentification locaux
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.
Envoyer votre première requête API
Après avoir configuré les identifiants par défaut de l'application, découvrez comment effectuer votre première requête dans le guide de démarrage rapide de l'API.