Wenn Sie Gemini in Vertex AI verwenden möchten, müssen Sie sich mit einem Google Cloud API-Schlüssel oder mit Standardanmeldedaten für Anwendungen authentifizieren. Wir empfehlen, für Tests einen API-Schlüssel und für die Produktion die standardmäßigen Anmeldedaten der Anwendung zu verwenden. Auf dieser Seite erfahren Sie, wie Sie Standardanmeldedaten für Anwendungen konfigurieren.
Hinweise
Projekt auswählen, Abrechnung aktivieren, Vertex AI API aktivieren, gcloud CLI installieren
-
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
Lokale Anmeldedaten zur Authentifizierung erstellen
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.
Erste API-Anfrage stellen
Nachdem Sie die Standardanmeldedaten für Anwendungen konfiguriert haben, erfahren Sie in der API-Kurzanleitung, wie Sie Ihre erste Anfrage stellen.