콘텐츠로 이동
ABTO 가이드
앱토(ABTO) 홈
무료로 시작

연동 가이드

Vertex AI

Google Cloud Vertex AI로 Gemini를 호출하도록 설정하는 방법과 Google AI Studio 경로와 다른 점을 설명합니다.

ABTO는 Gemini 모델을 두 경로로 부릅니다. Google AI Studio는 제공사 gemini, Google Cloud Vertex AI는 제공사 vertex입니다. 같은 모델이라도 경로마다 다른 모델로 다루므로 모델 목록과 옵션 편집기에 vertex:gemini-3.6-flash처럼 따로 나타납니다. 요청 본문과 받는 파라미터는 Chat Completions와 Responses의 Gemini와 같습니다.

  1. Google Cloud 프로젝트에서 Vertex AI API를 켜고, 호출에 쓸 서비스 계정에 Vertex AI User 역할을 줍니다.
  2. 대시보드 설정의 기능과 데이터에 있는 제공사 카드에 Google Cloud 프로젝트 ID와 location을 저장합니다. 두 값이 요청 주소가 됩니다.
  3. 저장한 뒤부터 라우팅 옵션에서 vertex 모델을 고를 수 있습니다.

location은 global, us, eu 중 하나입니다. Vertex AI는 Gemini 호출에 이 세 값만 받고 us-central1 같은 단일 리전은 받지 않습니다. 설정을 비우려면 먼저 그 설정을 쓰는 옵션을 모두 보관해야 합니다.

ABTO는 Google 자격 증명을 저장하지 않습니다. 서버가 Google 애플리케이션 기본 자격 증명(ADC)으로 발급한 access token을 요청마다 x-abto-key-vertex 헤더로 보내고, Gateway는 그 값을 Authorization: Bearer로 Vertex AI에 전달합니다.

access token은 1시간 뒤 만료됩니다. 환경변수에 고정하지 말고 서버 SDK의 provider key에 토큰을 돌려주는 함수를 넣으세요. SDK는 요청마다 함수를 불러 그때의 토큰을 싣습니다. 다른 제공사와 달리 환경변수 VERTEX_API_KEY는 읽지 않습니다.

Python은 google-auth, JavaScript는 google-auth-library, JVM은 google-auth-library-oauth2-http가 토큰을 발급하고 갱신합니다.

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 모델은 Gemini 3 세대만 있습니다. Vertex AI가 Gemini 2.5 세대의 이 호출 방식을 받지 않기 때문입니다.
  • 파라미터와 값 범위는 AI Studio의 같은 모델과 같습니다. 모델 목록에서 owned_by가 vertex인 항목으로 확인합니다.
  • 비용은 Vertex AI 요금으로 기록합니다. global은 AI Studio와 같은 단가이고, us와 eu는 Google 요금표대로 10% 높은 단가입니다. 대시보드에 보이는 단가는 global 기준입니다.

AI Studio와 Vertex AI가 만드는 추론 항목은 서로 호환되지 않습니다. Responses 응답의 추론 항목은 format이 google-vertex-v1입니다. 도구 호출이 이어지는 대화 중에 배정이 gemini와 vertex 사이에서 바뀌면 이전 응답의 추론 항목을 제공사가 400으로 거절합니다. 한 기능에서 두 경로를 함께 라우팅하면 이 점을 고려하세요.

  • Vertex AI의 Gemini 외 모델은 지원하지 않습니다.
  • Vertex AI express mode의 API 키는 받지 않습니다.