Skip to content

Google Vertex AI

SideSeat automatically extracts model information, token usage, and costs from Google Vertex AI API calls.

  • SideSeat running locally (sideseat)
  • SDK installed (pip install sideseat / uv add sideseat or npm install @sideseat/sdk)
  • Google Cloud credentials configured
from sideseat import SideSeat
SideSeat()
import vertexai
from vertexai.generative_models import GenerativeModel
vertexai.init(project="your-project", location="us-central1")
model = GenerativeModel("gemini-2.5-flash")
response = model.generate_content("Hello!")
print(response.text)
from sideseat import SideSeat
SideSeat()
import google.generativeai as genai
genai.configure(api_key="your-api-key")
model = genai.GenerativeModel("gemini-2.5-flash")
response = model.generate_content("Hello!")
print(response.text)
AttributeSource
gen_ai.systemvertex_ai or google_ai
gen_ai.request.modelModel name
gen_ai.response.modelResponse model field
gen_ai.usage.input_tokensUsage metadata
gen_ai.usage.output_tokensUsage metadata
cloud.providergcp
cloud.regionVertex AI location

Streaming responses are captured:

model = GenerativeModel("gemini-2.5-flash")
for chunk in model.generate_content("Tell me a story", stream=True):
print(chunk.text, end="")

Multi-turn conversations are traced:

model = GenerativeModel("gemini-2.5-flash")
chat = model.start_chat()
response1 = chat.send_message("Hello!")
response2 = chat.send_message("Tell me more")

Tool use is captured:

from vertexai.generative_models import FunctionDeclaration, Tool
get_weather = FunctionDeclaration(
name="get_weather",
description="Get weather for a location",
parameters={
"type": "object",
"properties": {
"location": {"type": "string"}
}
}
)
tool = Tool(function_declarations=[get_weather])
model = GenerativeModel("gemini-2.5-flash", tools=[tool])
response = model.generate_content("What's the weather in Paris?")

Vertex AI uses Google Cloud credentials:

Terminal window
# Application Default Credentials
gcloud auth application-default login
# Or service account
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json