Skip to main content

GeminiRealtime

Google Gemini realtime (speech-to-speech / live) provider.

Constructor

apiKey
string
config
GeminiLiveConfig | null

cleanup

close

getRuntimeConfig

returns
Record<string, any>

GeminiLiveConfig

Configuration for the Google Gemini Live (realtime speech-to-speech) provider. All fields are optional; unset values fall back to the defaults noted on each field. Pass an instance as the config option to GeminiRealtime.

Fields

model
string
default:"gemini-3.1-flash-live-preview"
Gemini Live model id to use.
voice
string
default:"Puck"
Prebuilt Gemini voice name for synthesized audio output (e.g. ‘Puck’, ‘Charon’, ‘Kore’, ‘Fenrir’, ‘Aoede’).
responseModalities
string[]
default:"['AUDIO']"
Output modalities the model should produce. Typically ['AUDIO'] for speech-to-speech or ['TEXT'] for text responses.
topP
number | null
default:"null"
Nucleus sampling probability mass (0..1). Higher values widen token selection. null leaves it unset (model default).
topK
number | null
default:"null"
Top-k sampling: restrict sampling to the k most likely tokens. null leaves it unset (model default).
maxOutputTokens
number | null
default:"null"
Maximum number of tokens to generate per response. null leaves it unset (model default).
presencePenalty
number | null
default:"null"
Presence penalty; positive values discourage reusing tokens already present, encouraging new topics. null leaves it unset (model default).
frequencyPenalty
number | null
default:"null"
Frequency penalty; positive values discourage repeating frequent tokens. null leaves it unset (model default).
candidateCount
number | null
default:"null"
Number of candidate responses to generate. null leaves it unset (model default, typically 1).
languageCode
string | null
default:"null"
BCP-47 language code hint for output (e.g. ‘en-US’). null lets the model auto-detect.
thinkingBudget
number | null
default:"null"
Token budget allotted to the model’s internal “thinking” reasoning. null leaves it unset (model default).
includeThoughts
boolean
default:"false"
Whether to include the model’s thought summaries in the response.
vadStartSensitivity
string | null
default:"null"
Voice-activity-detection start sensitivity for detecting speech onset (e.g. ‘START_SENSITIVITY_LOW’ / ‘START_SENSITIVITY_HIGH’). null uses the model default.
vadEndSensitivity
string | null
default:"null"
Voice-activity-detection end sensitivity for detecting speech end (e.g. ‘END_SENSITIVITY_LOW’ / ‘END_SENSITIVITY_HIGH’). null uses the model default.
vadPrefixPaddingMs
number | null
default:"null"
Milliseconds of audio to retain before detected speech starts. null uses the model default.
vadSilenceDurationMs
number | null
default:"null"
Milliseconds of trailing silence required before speech is considered ended. null uses the model default.
contextCompressionTriggerTokens
number | null
default:"null"
Token count at which context compression is triggered to keep the session within the context window. null disables/uses the model default.
sessionResumptionHandle
string | null
default:"null"
Handle from a previous session used to resume that session’s state. null starts a fresh session.
enableInputTranscription
boolean
default:"true"
Whether to emit transcriptions of the user’s input audio.
enableOutputTranscription
boolean
default:"true"
Whether to emit transcriptions of the model’s output audio.
vertexai
boolean
default:"false"
Use Vertex AI authentication instead of a Gemini API key. When true, vertexProjectId is required.
vertexProjectId
string | null
default:"null"
Google Cloud project id for Vertex AI. Required when vertexai is true.
vertexLocation
string
default:"us-central1"
Google Cloud region for Vertex AI requests.
vertexServiceAccountJson
string | Record<string, any> | null
default:"null"
Vertex AI service-account credentials, as a JSON string or parsed object. If unset, falls back to vertexServiceAccountPath, then the GOOGLE_APPLICATION_CREDENTIALS environment variable.
vertexServiceAccountPath
string | null
default:"null"
Filesystem path to a Vertex AI service-account JSON key file. Used only when vertexServiceAccountJson is not provided.