Static ReadonlySupportsGemini Live sessions accept dynamically-defined tools at connect/mint time.
ProtectedapiOnly sub-classes can access the API key
ProtectedEndpointThe Gemini endpoint this driver talks to. The Developer API here; the Gemini Enterprise driver (Vertex AI) overrides it. Every profile lookup passes it, because what a model renders depends on the endpoint (live avatars are Enterprise only).
The voices Gemini Live can speak with — used to populate the voice picker. Includes all 30 built-in Gemini voices supported in prebuiltVoiceConfig.
Gemini Live supports the client-direct topology: the server mints a short-lived ephemeral
auth token (v1alpha auth_tokens API) that the browser uses to open its OWN Live
websocket, while the server keeps prompt/tool authority by LOCKING the connect config into
the token via liveConnectConstraints.
Whether this driver's sessions carry a video track in addition to audio.
false in every MJ driver.
Nothing reads it, and no driver overrides it: it is false for Gemini Live, which takes camera video
and renders avatars. What a session does with video is declared on its IRealtimeSession.Capabilities:
RealtimeSessionCapabilities.SupportedInboundTracks for video in and
RealtimeSessionCapabilities.SupportedOutboundTracks for video out, each track with its encoding. Whether a
model renders a live avatar is SupportsAvatarOutput. A driver declares video there, not here.
ProtectedAvatarThe minted session config's avatar block: present only when this session renders an avatar, so the browser driver knows to expect video parts, their encoding, and whether they carry the voice.
The connect config the session was built with.
The model's profile on this driver's endpoint.
ProtectedAvatarWhat the mint tells the call about the avatar the session asked for: granted, or audio only and why. undefined when
it asked for none. Read from the connect config BuildConnectConfig built, so it says what the session does:
an avatarConfig there is the grant. Every Gemini driver returns it on its minted config.
The session parameters (the avatar request).
The connect config the session was built with.
ProtectedBuildBuilds the LiveConnectConfig from the Core session params: audio response modality,
input/output transcription, system instruction, sliding-window context compression
(GeminiRealtime.DefaultContextWindowCompression), session resumption (unless the
session is zero-data-retention), mapped tools, the neutral voice key mapped via
GeminiRealtime.buildSpeechConfig, plus any provider-specific overrides from the open
config bag.
ProtectedconnectCreation seam for the underlying Gemini Live session.
Production code routes through ai.live.connect; unit tests override this method to inject a
fake GeminiLiveSession. Kept as a thin, single-responsibility method so the network
boundary is the only thing tests need to replace.
Resolved model, connect config, and the server-message callback.
A promise resolving to the live session handle; it rejects if the socket errors or closes before Gemini acknowledges the setup.
ProtectedconnectOpens a Live connection with connect, which passes the given callbacks to live.connect, and rejects if the
socket errors or closes before Gemini acknowledges the setup. live.connect (@google/genai 2.11+) resolves only on
the server's setupComplete frame and never rejects when the socket errors or closes first (a rejected key, model or
setup field), so without this the connect waits forever. A promise settles once, so callbacks after a successful
connect only reach the handlers. Every connectLiveSession override should open through this.
Mints an ephemeral, server-scoped Live credential for a client-direct session.
The connect config is built EXACTLY as StartSession builds it (same
BuildConnectConfig: audio modality, input+output transcription, system instruction,
mapped tools) and is locked into the token via liveConnectConstraints +
lockAdditionalFields: [] — so the API ignores any attempt by the browser to change the
locked fields. The same config is ALSO carried in SessionConfig (as { model, config })
because the SDK still expects the client to pass a model/config at live.connect time; the
token-side lock is what makes the server's prompt and tool set authoritative.
Expiry: the browser must open its session within GEMINI_CLIENT_TOKEN_NEW_SESSION_WINDOW_MS; the token (and thus the session's ability to send messages) dies at GEMINI_CLIENT_TOKEN_EXPIRY_MS.
Session configuration (model, system prompt, tools, config bag).
The minted ClientRealtimeSessionConfig the browser authenticates + applies.
OptionalExchangeOptional WebRTC SDP exchange seam for drivers that support server-brokered WebRTC topologies.
The local SDP offer generated by the browser.
Optional_sessionConfig: Record<string, unknown>The session configuration to initialize the session with.
The answer SDP, provider session ID, and any prebill accounting.
ProtectedmintMint seam for the ephemeral auth token. Production routes through the SDK's
authTokens.create on a v1alpha client (ephemeral tokens are v1alpha-only); unit tests
override this to return a fake token with no network.
The auth-token create parameters (expiry, uses, live-connect constraints).
The created AuthToken (its name is the credential the browser presents).
ProtectedSessionThe minted session config, the private pact with the browser driver: a plain-JSON copy of the model and the config
the browser passes to live.connect, plus the model's facts on this driver's endpoint (idle signal, tooling, inbound
video limits, and the avatar block when the session renders one).
The model id.
The session's connect config, as BuildConnectConfig built it. It decides the avatar block.
The config the browser passes to live.connect: the full config here; a driver whose sessions
go through MJAPI's relay, which writes the setup, passes a smaller one.
Opens a Gemini Live session and returns the Core session handle that translates between the provider's frames and the MemberJunction realtime contract.
Whether the model renders a live avatar on this driver's endpoint, from its Live profile: never on the Developer API; on Gemini Enterprise for the models whose profile says so.
The model's API name.
StaticBuildProjects the full connect config down to the fields Gemini's ephemeral-token API accepts
as liveConnectConstraints.config. The token mint converts the provided keys into a
field mask over BidiGenerateContentSetup, and only generation-level fields are valid
there — systemInstruction, tools, and the transcription configs are NOT, and their
presence 400s the entire mint. Only defined fields are copied (an absent key must stay
absent so it doesn't enter the mask).
contextWindowCompression is left out on purpose. No test or doc shows the mask accepts
it, and a rejected mask would fail every client-direct session. The browser applies it from
SessionConfig, like the other server-built keys the token cannot lock.
sessionResumption: {} is locked as in Google's ephemeral-token example. The browser adds
the handle when it resumes, and Google accepts the same token for that until expireTime.
StaticDefaultThe context-window compression every Gemini Live session gets unless the config bag sets its own: a server-side sliding window with Google's default trigger and target sizes.
Without compression, Google ends a session when its context fills: about 15 minutes for audio only and about 2 minutes for audio plus video (Google's Live API session-management docs). With compression the server drops the oldest turns and the session continues. Session resumption handles a different limit (a single connection lasts about 10 minutes) and does not lift this one.
Returns a new object on each call so no session shares mutable config with another.
StaticExtractExtracts scheduling hints (__mj_scheduling or legacy scheduling) from the tool output,
strips both keys so they do not leak into the model's response payload, resolves the scheduling
directive accepting both 'INTERRUPT' and 'INTERRUPTED', and warns on unrecognized values or
unsupported models (delegates normalization to Core ExtractToolSchedulingHint).
StaticMapMaps MJ's lowercase thinking level onto the SDK's uppercase ThinkingLevel enum.
StaticMapMaps Core RealtimeToolDefinitions up to Gemini FunctionDeclarations.
The Core ParametersSchema is a JSON-schema object, so it rides in parametersJsonSchema
(the SDK's JSON-schema slot) rather than the OpenAPI-style parameters slot.
In Gemini Live, function calling defaults to asynchronous execution (Behavior.NON_BLOCKING).
On models that forbid synchronous blocking execution (e.g. gemini-3.8-live-extended-thinking),
Behavior.BLOCKING is refused locally and forced to Behavior.NON_BLOCKING with a warning,
preventing a hard error from the Live API server.
Optionalmodel: stringOptionalrequestedBehavior: string
Real-time, full-duplex driver for Google's Gemini Live API, implementing the Core BaseRealtimeModel primitive.
The driver opens a bidirectional Gemini Live session, streams client audio in, and translates the provider's LiveServerMessage frames into the modality-agnostic Core events (RealtimeTranscript, RealtimeToolCall, RealtimeUsage, output media, and interruption). It registers via the MemberJunction class factory as
GeminiRealtimeand is resolved forMJ: AI ModelstypedRealtime.Testability: the live-session creation is isolated behind the overridable connectLiveSession seam, so unit tests inject a fake GeminiLiveSession and exercise the full message→event translation with no network.