Google Vertex AI
SideSeat automatically extracts model information, token usage, and costs from Google Vertex AI API calls.
Prerequisites
Section titled “Prerequisites”- SideSeat running locally (
sideseat) - SDK installed (
pip install sideseat/uv add sideseatornpm install @sideseat/sdk) - Google Cloud credentials configured
Usage with Vertex AI SDK
Section titled “Usage with Vertex AI SDK”from sideseat import SideSeatSideSeat()
import vertexaifrom 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)Usage with Google GenAI SDK
Section titled “Usage with Google GenAI SDK”from sideseat import SideSeatSideSeat()
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)Extracted Attributes
Section titled “Extracted Attributes”| Attribute | Source |
|---|---|
gen_ai.system | vertex_ai or google_ai |
gen_ai.request.model | Model name |
gen_ai.response.model | Response model field |
gen_ai.usage.input_tokens | Usage metadata |
gen_ai.usage.output_tokens | Usage metadata |
cloud.provider | gcp |
cloud.region | Vertex AI location |
Streaming
Section titled “Streaming”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="")Chat Sessions
Section titled “Chat Sessions”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")Function Calling
Section titled “Function Calling”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?")Authentication
Section titled “Authentication”Vertex AI uses Google Cloud credentials:
# Application Default Credentialsgcloud auth application-default login
# Or service accountexport GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.jsonNext Steps
Section titled “Next Steps”- First Run — get started with SideSeat
- Python SDK — SDK reference