Google Vertex AI
SideSeat instruments the native Vertex AI SDK (vertexai / google-cloud-aiplatform) to capture model information, token usage, messages, and costs from Gemini models on Google Cloud.
Prerequisites
Section titled “Prerequisites”- SideSeat running locally (
sideseat) - Python SDK installed with the Vertex AI extra (
pip install "sideseat[vertex-ai]" vertexai) - Google Cloud project with Vertex AI API enabled
- Google Cloud credentials configured
Quick Start
Section titled “Quick Start”import vertexaifrom vertexai.generative_models import GenerativeModelfrom sideseat import SideSeat, Frameworks
SideSeat(framework=Frameworks.VertexAI)
vertexai.init(project="your-project", location="us-central1")model = GenerativeModel("gemini-2.5-flash")response = model.generate_content("What is the speed of light?")print(response.text)Streaming
Section titled “Streaming”Streaming responses are fully captured, including token counts aggregated from stream chunks:
import vertexaifrom vertexai.generative_models import GenerativeModelfrom sideseat import SideSeat, Frameworks
SideSeat(framework=Frameworks.VertexAI)
vertexai.init(project="your-project", location="us-central1")model = GenerativeModel("gemini-2.5-flash")
for chunk in model.generate_content("Explain quantum computing.", stream=True): print(chunk.text, end="", flush=True)Tool Use
Section titled “Tool Use”Tool definitions and function call results are captured:
import vertexaifrom vertexai.generative_models import FunctionDeclaration, GenerativeModel, Toolfrom sideseat import SideSeat, Frameworks
SideSeat(framework=Frameworks.VertexAI)
vertexai.init(project="your-project", location="us-central1")
get_weather = FunctionDeclaration( name="get_weather", description="Get the current weather for a location.", parameters={ "type": "object", "properties": { "location": {"type": "string", "description": "City name"} }, "required": ["location"], },)
tool = Tool(function_declarations=[get_weather])model = GenerativeModel("gemini-2.5-flash", tools=[tool])response = model.generate_content("What's the weather in London?")Authentication
Section titled “Authentication”# Application Default Credentials (recommended for local dev)gcloud auth application-default login
# Service account keyexport GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.jsonThe Vertex AI SDK uses Application Default Credentials (ADC) automatically. Run gcloud auth application-default login for local development, or configure a service account key for CI/production.
Next Steps
Section titled “Next Steps”- Google Gemini — use the unified Google Gen AI SDK with Vertex AI or Developer API
- Python SDK — SDK configuration and API reference