Example: Using Vertex AI
For the complete documentation index, see llms.txt.
This example answers an inbound Voximplant call and connects Gemini Live API through Vertex AI. It reads Vertex service account credentials from Voximplant Secrets through a shared credentials scenario.
⬇️ Jump to the Full VoxEngine scenario.
Prerequisites
- Set up an inbound entrypoint for the caller:
- Create a routing rule that points the destination (phone number / WhatsApp / SIP username / app user alias) to this scenario.
- Store your Vertex parameters in Voximplant
ApplicationStorage:GCP_PROJECT_IDGCP_REGION
- Create a
GOOGLE_CREDENTIALSSecret containing the complete service account JSON as a string.
For full Vertex setup details, use the rest of this guide. To create a service account key (JSON), see: https://docs.cloud.google.com/iam/docs/keys-create-delete
Credentials scenario (separate route entry)
Include the credentials scenario before the main scenario in your routing rule. It reads the JSON string from GOOGLE_CREDENTIALS and stops immediately if the Secret is missing.
Routing rule scenario order:
VoxEngine shares global scope across scenarios in the same routing rule, so the credentials scenario sets GEMINI_VERTEX_CREDENTIALS for the main scenario. Keep non-secret project and region values in ApplicationStorage.
Example credentials scenario:
VoxEngine.getSecretValue("GOOGLE_CREDENTIALS") returns the JSON string expected by the connector. Pass it directly as credentials.
Session setup
The Gemini Live API session is configured via connectConfig, passed into Gemini.createLiveAPIClient(...).
In the full scenario, see GEMINI_CONNECT_CONFIG:
responseModalities: ["AUDIO"]asks Gemini to speak back in real time.apiVersion: "v1alpha"matches the Vertex Live API endpoint.speechConfigselects a prebuilt voice.systemInstructiondefines the assistant behavior.toolsandtoolConfigenable function calling.
The Vertex-specific parameters are passed directly to Gemini.createLiveAPIClient(...):
backend: Gemini.Backend.VERTEX_AIproject→GCP_PROJECT_IDlocation→GCP_REGIONcredentials→ the JSON string set by the credentials scenario
Connect call audio
After Gemini.LiveAPIEvents.SetupComplete, bridge audio between the call and Gemini:
The same handler sends a starter message to trigger the greeting:
Events
The scenario logs Gemini events for debugging:
Gemini.LiveAPIEvents:SetupComplete,ServerContent,ToolCall,ToolCallCancellation,ConnectorInformation,UnknownGemini.Events:WebSocketMediaStarted,WebSocketMediaEnded
Notes
- This example uses the Vertex AI backend (
Gemini.Backend.VERTEX_AI). - The credentials scenario only sets
GEMINI_VERTEX_CREDENTIALSin the shared global scope and does not start any calls.
gemini-3.8-live is not available on Vertex AI unless the Google Cloud project has Gemini Enterprise early access. This example keeps the Vertex-supported model gemini-live-2.5-flash-preview-native-audio-09-17. Developer API examples use gemini-3.8-live.
See the VoxEngine API Reference for more details.