Google Vertex AI hosts the Gemini family of models on Google Cloud infrastructure with IAM-based auth and project-level billing. Arize AX captures every Vertex call — chat completions, tool calls, and token usage — via theDocumentation Index
Fetch the complete documentation index at: https://arize-ax.mintlify.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
openinference-instrumentation-google-genai package. The same instrumentor that covers the Gemini API also covers Vertex — only the credential setup differs.
The legacy vertexai Python SDK (in google-cloud-aiplatform) is deprecated as of June 24, 2025 with removal scheduled for June 24, 2026. This guide uses the canonical replacement: the Google Gen AI Python SDK (google-genai) configured against Vertex.
Prerequisites
- Python 3.10+
- An Arize AX account (sign up)
- A Google Cloud project with the Vertex AI API enabled
- A service account or user with the
roles/aiplatform.userIAM role - Authenticated Application Default Credentials (
gcloud auth application-default login) or a service account JSON file referenced byGOOGLE_APPLICATION_CREDENTIALS
Launch Arize AX
- Sign in to your Arize AX account.
- From Space Settings, copy your Space ID and API Key. You will set them as
ARIZE_SPACE_IDandARIZE_API_KEYbelow.
Install
google-genai includes google-auth as a transitive dependency, so Application Default Credentials work out of the box — no extra install required.
Configure credentials
Vertex AI uses Google Cloud auth (IAM), not an API key. Authenticate locally and tell the SDK which project / region to target:GOOGLE_CLOUD_PROJECT is mandatory. GOOGLE_CLOUD_LOCATION is optional and defaults to us-central1; set it explicitly when you need a different region (e.g. europe-west1 for EU residency, or to match where the target model is enabled).
Setup tracing
Run Vertex AI
Expected output
Verify in Arize AX
- Open your Arize AX space and select project
vertexai-tracing-example. - You should see a new trace within ~30 seconds containing a
GenerateContentLLM span with the prompt, response, and token usage attached. - If no traces appear, see Troubleshooting.
Troubleshooting
- No traces in Arize AX. Confirm
ARIZE_SPACE_IDandARIZE_API_KEYare set in the same shell that runsexample.py. Enable OpenTelemetry debug logs withexport OTEL_LOG_LEVEL=debugand re-run. - Vertex spans missing but other spans present.
GoogleGenAIInstrumentor().instrument(...)must run before anyfrom google import genaiimport. Make sureinstrumentation.pyis the first import in your entry point. 401 UNAUTHENTICATED. API keys are not supported by this API.ADC isn’t set up. Rungcloud auth application-default login(interactive) or setGOOGLE_APPLICATION_CREDENTIALSto a service account JSON. Vertex AI accepts only IAM-based auth, not API keys.403 PERMISSION_DENIED. Permission denied on resource project ...The principal in your ADC doesn’t haveroles/aiplatform.user(or finer-grained Vertex permissions) on the project, or you authenticated with end-user credentials that have no quota project. Grant the role in the IAM console, then rungcloud auth application-default set-quota-project <PROJECT_ID>.Your application has authenticated using end user credentials from Google Cloud SDK without a quota project. This warning meansgcloud auth application-default loginsucceeded but you haven’t set a quota project. Calls work but may hit403later. Fix withgcloud auth application-default set-quota-project <PROJECT_ID>.404 NOT_FOUNDfor the model. The model isn’t available in the region you set forGOOGLE_CLOUD_LOCATION. Check the Vertex AI generative model availability matrix and swap regions accordingly.- Using the Gemini API instead of Vertex. Drop
vertexai=Trueand setGEMINI_API_KEY— see the Google GenAI tracing doc for the API-key path. The same instrumentor captures both. - Using the legacy
vertexaiSDK (vertexai.GenerativeModel). That SDK is deprecated as of June 24, 2025 and will be removed June 24, 2026. Migrate togoogle-genaiwithgenai.Client(vertexai=True, ...)as shown above. The OpenInference instrumentor for the legacy SDK (openinference-instrumentation-vertexai) still works against gapic but is no longer the recommended path.