For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Platform docsVideosCommunitySign up
CapabilitiesGetting startedVoice AI OrchestrationVoxEngine PlatformAPI ReferenceFAQ
CapabilitiesGetting startedVoice AI OrchestrationVoxEngine PlatformAPI ReferenceFAQ
      • Overview
        • Cartesia
        • Deepgram
        • ElevenLabs
        • Gemini
        • Grok
        • Inworld
        • OpenAI
        • Pipecat
        • Ultravox
        • Yandex
  • Management API
    • Reference
    • Authorization
    • Errors
  • Web SDK
    • Overview
  • Android SDK
    • Overview
  • Android SDK v3
    • Overview
  • iOS SDK
    • Overview
  • React Native SDK
    • Overview
  • Flutter SDK
    • Overview
LogoLogo
Platform docsVideosCommunitySign up
On this page
  • Related guides
  • Contents
  • Usage
  • Factory functions
  • createLiveAPIClient
  • LiveAPIClient
  • Methods
  • addEventListener
  • clearMediaBuffer
  • close
  • id
  • removeEventListener
  • sendClientContent
  • sendMediaTo
  • sendRealtimeInput
  • sendToolResponse
  • stopMediaTo
  • webSocketId
  • Events
  • WebSocketMediaStarted
  • WebSocketMediaEnded
  • LiveAPIEvents
VoxEngineVoice AI

Gemini

Voice agent client for Google Gemini Live API real-time voice scenarios.

||View as Markdown|
Was this page helpful?
Edit this page
Previous

ElevenLabs

Next

Google

Built with

Gemini provides a VoxEngine client for connecting a call or media unit to the Google Gemini Live API over WebSocket.

Use Gemini.createLiveAPIClient(...) to create a LiveAPIClient for the current scenario.

Related guides

Gemini connector overview

Learn how Gemini Live fits into a VoxEngine call flow.

Contents

  • Usage: required module import and basic flow.
  • Factory functions: create the Gemini Live client.
  • Methods: media, response, and connection control methods.
  • Events: WebSocket media bridge events.
  • LiveAPIEvents: Gemini Live API event names and payload fields.

Usage

Add the module before using the namespace:

1require(Modules.Gemini);

Create the client, bridge media, and listen for Live API events.

Factory functions

createLiveAPIClient

Creates a Gemini.LiveAPIClient instance.

1createLiveAPIClient(parameters: LiveAPIClientParameters): Promise<LiveAPIClient>

Parameters

ParameterTypeReq.Description
parametersLiveAPIClientParameters✓

Returns

TypeDescription
Promise<LiveAPIClient>Resolves to the Gemini.LiveAPIClient instance.

LiveAPIClient

Methods

addEventListener

Adds a handler for the specified Gemini.LiveAPIEvents or Gemini.Events event. Use only functions as handlers; anything except a function leads to the error and scenario termination when a handler is called.

1addEventListener(event: Events | LiveAPIEvents | string, callback: (event: object) => any): void

Parameters

ParameterTypeReq.Description
eventEvents | LiveAPIEvents | string✓Event constant or event name to subscribe to.
callback(event: object) => any✓Function called when the event is emitted.

Returns

TypeDescription
voidDoes not return a value.

clearMediaBuffer

Clears the LiveAPI WebSocket media buffer.

1clearMediaBuffer(parameters?: ClearMediaBufferParameters): void

Parameters

ParameterTypeReq.Description
parametersClearMediaBufferParameters✗

Returns

TypeDescription
voidDoes not return a value.

close

Closes the LiveAPI connection (over WebSocket) or connection attempt.

1close(): void

Parameters

This method does not accept parameters.

Returns

TypeDescription
voidDoes not return a value.

id

Returns the LiveAPIClient id.

1id(): string

Parameters

This method does not accept parameters.

Returns

TypeDescription
stringThe requested string value.

removeEventListener

Removes a handler for the specified Gemini.LiveAPIEvents or Gemini.Events event.

1removeEventListener(event: Events | LiveAPIEvents | string, callback?: (event: object) => any): void

Parameters

ParameterTypeReq.Description
eventEvents | LiveAPIEvents | string✓Event constant or event name to subscribe to.
callback(event: object) => any✗Function called when the event is emitted.

Returns

TypeDescription
voidDoes not return a value.

sendClientContent

Transmits a LiveClientContent over the established connection. https://pkg.go.dev/google.golang.org/genai@v1.57.0#Session.SendClientContent

1sendClientContent(input: Object): void

Parameters

ParameterTypeReq.Description
inputObject✓

Returns

TypeDescription
voidDoes not return a value.

sendMediaTo

Starts sending media from the LiveAPI (via WebSocket) to the media unit. LiveAPI works in real time.

1sendMediaTo(mediaUnit: VoxMediaUnit, parameters?: SendMediaParameters): void

Parameters

ParameterTypeReq.Description
mediaUnitVoxMediaUnit✓
parametersSendMediaParameters✗

Returns

TypeDescription
voidDoes not return a value.

sendRealtimeInput

Transmits a LiveClientRealtimeInput over the established connection. https://pkg.go.dev/google.golang.org/genai@v1.57.0#Session.SendRealtimeInput

1sendRealtimeInput(input: Object): void

Parameters

ParameterTypeReq.Description
inputObject✓

Returns

TypeDescription
voidDoes not return a value.

sendToolResponse

Transmits a LiveClientToolResponse over the established connection. https://pkg.go.dev/google.golang.org/genai@v1.57.0#Session.SendToolResponse

1sendToolResponse(input: Object): void

Parameters

ParameterTypeReq.Description
inputObject✓

Returns

TypeDescription
voidDoes not return a value.

stopMediaTo

Stops sending media from the LiveAPI (via WebSocket) to the media unit.

1stopMediaTo(mediaUnit: VoxMediaUnit): void

Parameters

ParameterTypeReq.Description
mediaUnitVoxMediaUnit✓

Returns

TypeDescription
voidDoes not return a value.

webSocketId

Returns the LiveAPI WebSocket id.

1webSocketId(): string

Parameters

This method does not accept parameters.

Returns

TypeDescription
stringThe requested string value.

Events

These events describe audio received through the Gemini WebSocket media bridge.

WebSocketMediaStarted

Triggered when the audio stream sent by a third party through a Gemini WebSocket is started playing.

Event constant: Events.WebSocketMediaStarted

Payload

FieldTypeReq.Description
clientLiveAPIClient✓The Gemini.LiveAPIClient instance.
tagstring✗Special tag to name audio streams sent over one WebSocket connection. With it, one can send 2 audios to 2 different media units at the same time.
encodingstring✗Audio encoding formats.
customParameters{ [key: string]: string }✗Custom parameters.

WebSocketMediaEnded

Triggers after the end of the audio stream sent by a third party through a Gemini WebSocket (1 second of silence).

Event constant: Events.WebSocketMediaEnded

Payload

FieldTypeReq.Description
clientLiveAPIClient✓The Gemini.LiveAPIClient instance.
tagstring✗Special tag to name audio streams sent over one WebSocket connection. With it, one can send 2 audios to 2 different media units at the same time.
mediaInfoWebSocketMediaInfo✗Information about the audio stream that can be obtained after the stream stops or pauses (1 second of silence).

LiveAPIEvents

These events mirror server messages from the Gemini Live API. The data field contains the provider event payload.

Unknown

The unknown event.

Event constant: LiveAPIEvents.Unknown

Payload

FieldTypeReq.Description
clientLiveAPIClient✓The Gemini.LiveAPIClient instance.
dataObject✗The event’s data.
ServerContent

Content generated by the model in response to client messages. https://pkg.go.dev/google.golang.org/genai@v1.57.0#LiveServerContent

Event constant: LiveAPIEvents.ServerContent

Payload

FieldTypeReq.Description
clientLiveAPIClient✓The Gemini.LiveAPIClient instance.
dataObject✗The event’s data.
ToolCall

Request for the client to execute the function_calls and return the responses with the matching ids. https://pkg.go.dev/google.golang.org/genai@v1.57.0#LiveServerToolCall

Event constant: LiveAPIEvents.ToolCall

Payload

FieldTypeReq.Description
clientLiveAPIClient✓The Gemini.LiveAPIClient instance.
dataObject✗The event’s data.
ToolCallCancellation

Notification for the client that a previously issued ToolCallMessage with the specified ids should have been not executed and should be cancelled. https://pkg.go.dev/google.golang.org/genai@v1.57.0#LiveServerToolCallCancellation

Event constant: LiveAPIEvents.ToolCallCancellation

Payload

FieldTypeReq.Description
clientLiveAPIClient✓The Gemini.LiveAPIClient instance.
dataObject✗The event’s data.
ConnectorInformation

Contains information about connector.

Event constant: LiveAPIEvents.ConnectorInformation

Payload

FieldTypeReq.Description
clientLiveAPIClient✓The Gemini.LiveAPIClient instance.
dataObject✗The event’s data.