Skip to content
ABTO Guide
abto.app
Start free

Integration guide

Vertex AI

How to call Gemini through Google Cloud Vertex AI, and how it differs from the Google AI Studio route.

ABTO calls Gemini models through two routes. Google AI Studio is the provider gemini, and Google Cloud Vertex AI is the provider vertex. The same model is treated as a different model on each route, so it appears separately in the model list and the variant editor, for example as vertex:gemini-3.6-flash. The request body and accepted parameters are the same as Gemini in Chat Completions and Responses.

  1. Enable the Vertex AI API in your Google Cloud project and grant the Vertex AI User role to the service account that will make the calls.
  2. In the dashboard, open Features and data in Settings and save your Google Cloud project ID and location on the provider card. These two values form the request address.
  3. Once saved, vertex models can be chosen for routing variants.

The location is one of global, us, or eu. Vertex AI accepts only these three values for Gemini calls; single regions such as us-central1 are not accepted. To clear the settings, archive every variant that uses them first.

ABTO stores no Google credentials. Your server sends an access token issued through Google Application Default Credentials (ADC) with each request in the x-abto-key-vertex header, and the Gateway forwards it to Vertex AI as Authorization: Bearer.

An access token expires after one hour. Do not pin it in an environment variable; give the server SDK’s provider key a function that returns the token. The SDK calls the function on every request and sends the current token. Unlike the other providers, the environment variable VERTEX_API_KEY is not read.

google-auth in Python, google-auth-library in JavaScript, and google-auth-library-oauth2-http on the JVM issue and refresh the token.

import os
from typing import Optional
import google.auth
from google.auth.transport.requests import Request
from abto import init_abto
credentials, _ = google.auth.default(scopes=["https://www.googleapis.com/auth/cloud-platform"])
def vertex_token() -> Optional[str]:
if not credentials.valid:
credentials.refresh(Request())
return credentials.token
abto = init_abto(
api_key=os.environ["ABTO_CALLING_KEY"],
gateway_base_url="https://gateway.abto.app/v1",
provider_keys={
"vertex": vertex_token,
},
)
import { GoogleAuth } from 'google-auth-library';
import { initAbto } from '@abto-app/calling';
const auth = new GoogleAuth({ scopes: 'https://www.googleapis.com/auth/cloud-platform' });
const abto = initAbto({
abtoApiKey: process.env.ABTO_CALLING_KEY,
gatewayBaseURL: 'https://gateway.abto.app/v1',
providerKeys: {
vertex: async () => (await auth.getAccessToken()) ?? undefined,
},
});
import app.abto.calling.AbtoConfig;
import com.google.auth.oauth2.GoogleCredentials;
var credentials = GoogleCredentials.getApplicationDefault()
.createScoped("https://www.googleapis.com/auth/cloud-platform");
var config = AbtoConfig.builder()
.apiKey(() -> System.getenv("ABTO_CALLING_KEY"))
.gatewayBaseUrl("https://gateway.abto.app/v1")
.providerKey("vertex", () -> {
try {
credentials.refreshIfExpired();
return credentials.getAccessToken().getTokenValue();
} catch (java.io.IOException e) {
throw new java.io.UncheckedIOException(e);
}
})
.build();
  • vertex models are the Gemini 3 generation only, because Vertex AI does not accept this call style for the Gemini 2.5 generation.
  • Parameters and value ranges match the same model on AI Studio. Check the model list for entries whose owned_by is vertex.
  • Cost is recorded at Vertex AI prices. global costs the same as AI Studio, while us and eu are 10% higher, as in Google’s price list. The prices shown in the dashboard are the global prices.

Reasoning items produced by AI Studio and by Vertex AI are not interchangeable. In Responses output, reasoning items from Vertex AI carry format: google-vertex-v1. If the assignment switches between gemini and vertex in the middle of a conversation with ongoing tool calls, the provider rejects the previous response’s reasoning items with 400. Keep this in mind when one feature routes to both routes.

  • Models other than Gemini on Vertex AI are not supported.
  • Vertex AI express mode API keys are not accepted.