What you need
Getting a service-account JSON
- In the Google Cloud Console, select or create a project.
- Enable the Vertex AI API (
aiplatform.googleapis.com) on that project. - Go to IAM & Admin → Service Accounts and create one.
- Grant it the Vertex AI User role (
roles/aiplatform.user). This is the role that permits calling Gemini. - Open its Keys tab, choose Add Key → Create new key, and select JSON.
- The file downloads once. Store it securely and treat it as a secret.
private_key and client_email. The project ID is read out of the JSON, so you do not type it — supplying a different one is the kind of mismatch that only shows up as a failure mid-call.
Adding the connection
- Go to Connections and choose Vertex AI Gemini.
- Use Upload JSON to attach the service-account file.
- Save.
What you can select afterwards
Choose your models on Model Configurations. Language model — start on a Flash tier and move up only if the agent’s reasoning falls short. Latency is heard as hesitation before the agent speaks. See Google’s Gemini model list.Completing the pipeline
This connection covers the language model only. A call also needs a voice and a transcriber, each from its own connection:
For a single connection that handles the whole conversation instead, see Vertex AI Gemini Live.
Vertex AI or AI Studio
Both run Gemini. They differ in how you are billed and how access is controlled.
Choose Vertex when Gemini spend belongs on an existing Google Cloud bill, when access has to be revocable through IAM, or when requests need to stay in a particular region. Choose the AI Studio key when none of that applies and you want the shorter setup.
Troubleshooting
I have an API key, not a service account
I have an API key, not a service account
An AI Studio API key belongs on the Gemini connection. Vertex and the Gemini Developer API are separate backends: Vertex authenticates through Google Cloud credentials against your project, and does not take an API key.
Calls fail after adding the JSON
Calls fail after adding the JSON
Confirm the Vertex AI API is enabled on the project the service account belongs to. A valid service account on a project without that API enabled fails at call time, not when you save the connection.
A 403 during a call
A 403 during a call
Permission denied — the service account is reaching Vertex but is not allowed to call the model. Check that it still holds the Vertex AI User role on that project. IAM changes and role removals surface here rather than at save time.
The service-account key will not upload
The service-account key will not upload
Make sure it is the JSON file, not P12, and that you pasted the whole file contents rather than a single field from it.