Skip to content

GoogleSTTConfig

Configuration for the GoogleSTT provider.

Defined in: src/providers/stt/google/GoogleSTT.ts:94

Configuration for the GoogleSTT provider.

Remarks

Provide either apiKey (for direct API access) or proxyUrl (for server-side proxy). At least one must be set. If both are provided, proxyUrl takes precedence and the API key is not sent to the client.

Direct mode authenticates with a Google Cloud API key via the X-goog-api-key header. Google also supports OAuth2 service-account credentials, but those require token minting/refresh and are out of scope for this SDK — use an API key (restricted to the Speech-to-Text API) or the proxy instead.

Example

// Direct API access
const config: GoogleSTTConfig = {
  apiKey: 'AIza...',
  language: 'en-US',
  encoding: 'WEBM_OPUS',
  sampleRate: 48000,
  model: 'latest_short',
};

// Via proxy server
const proxyConfig: GoogleSTTConfig = {
  proxyUrl: 'http://localhost:3001/api/proxy/google-stt',
  language: 'en-US',
};

See

GoogleSTTEncoding - Available audio encoding options.

Extends

Properties

PropertyTypeDefault valueDescriptionOverridesInherited fromDefined in
alternativeLanguageCodes?string[]undefined (single-language recognition)Up to three additional BCP-47 language codes that the audio might be in. Google picks the language that best matches the audio.--src/providers/stt/google/GoogleSTT.ts:148
apiKey?string | () => Promise<string>undefinedAPI key or authentication token for the provider. Remarks Can be a static string or an async factory function that returns a fresh token on each call. Use a factory for short-lived tokens (e.g. Deepgram JWTs) so each WebSocket connection gets a valid credential. For client-side usage, consider using a proxy server to keep API keys secure. The SDK provides Express, Next.js, and Node adapters for this purpose.-STTProviderConfig.apiKeysrc/core/types/providers.ts:71
authType?"token" | "bearer"Provider-specific (typically 'token' for Deepgram, ignored for REST providers)Authentication type for providers that support multiple auth mechanisms. Remarks Controls how the apiKey is sent to the provider: - 'token' — WebSocket subprotocol ['token', apiKey] or header Authorization: Token <key>. This is the default for Deepgram providers. - 'bearer' — WebSocket subprotocol ['bearer', token] or header Authorization: Bearer <token>. Use this for OAuth tokens or providers that expect Bearer auth. REST/SDK providers (Anthropic, OpenAI) handle auth through their SDK constructors and ignore this field.-STTProviderConfig.authTypesrc/core/types/providers.ts:115
debug?booleanfalseWhether to enable debug logging for this provider. Remarks When true, the provider emits detailed internal logs. This is separate from the SDK-level LoggingConfig.-STTProviderConfig.debugsrc/core/types/providers.ts:126
enableWordTimeOffsets?booleanfalseWhether to include word-level start/end time offsets in the result metadata.--src/providers/stt/google/GoogleSTT.ts:140
encoding?GoogleSTTEncodingundefined (derived from the file header where possible)Encoding of the audio passed to transcribe(). Remarks May be omitted for WAV and FLAC audio — Google reads the encoding and sample rate from the file header. Required for raw or Opus audio. See GoogleSTTEncoding--src/providers/stt/google/GoogleSTT.ts:105
endpoint?stringundefinedCustom endpoint URL to override the provider’s default API endpoint. Remarks Useful for self-hosted instances, proxy servers, or development environments.-STTProviderConfig.endpointsrc/core/types/providers.ts:79
interimResults?booleanundefinedWhether to enable interim (partial) transcription results. Remarks When true, the provider emits results as the user speaks, before the utterance is complete. Only applicable to live/WebSocket providers.-STTProviderConfig.interimResultssrc/core/types/providers.ts:392
keywords?string[]undefinedCustom vocabulary or keyword phrases to boost recognition accuracy. Remarks Useful for domain-specific terminology, product names, or proper nouns that the model might not recognize well by default.-STTProviderConfig.keywordssrc/core/types/providers.ts:406
language?stringundefinedLanguage code for transcription. Remarks Uses BCP 47 language tags (e.g., 'en-US', 'es-ES', 'fr-FR'). The supported languages depend on the provider and model.-STTProviderConfig.languagesrc/core/types/providers.ts:375
maxRetries?number3Maximum number of retries for failed API requests.--src/providers/stt/google/GoogleSTT.ts:162
model?stringundefined (Google selects a default for the language)Recognition model to use. Remarks v1 model identifiers include 'latest_long' (media, conversations), 'latest_short' (short utterances and commands — a good fit for voice-agent turns), 'telephony', 'telephony_short', 'medical_dictation', 'medical_conversation', 'phone_call', 'video', 'command_and_search', and 'default'. Note that Google’s Chirp models are v2-API-only (regional endpoints) and are not valid here.STTProviderConfig.model-src/providers/stt/google/GoogleSTT.ts:132
profanityFilter?booleanfalseWhether to filter profanity from the transcript.--src/providers/stt/google/GoogleSTT.ts:155
proxyUrl?stringundefinedURL of a CompositeVoice proxy server endpoint for this provider. Remarks When set, requests are routed through the proxy which injects the real API key server-side. This keeps API keys out of the browser. For WebSocket providers the HTTP URL is automatically converted to ws(s)://. At least one of apiKey or proxyUrl must be set for providers that require authentication (all except NativeSTT, NativeTTS, and WebLLM). Example proxyUrl: 'http://localhost:3000/api/proxy/deepgram'-STTProviderConfig.proxyUrlsrc/core/types/providers.ts:97
punctuation?booleanundefinedWhether to enable automatic punctuation in transcription results.-STTProviderConfig.punctuationsrc/core/types/providers.ts:397
sampleRate?numberundefined (derived from the file header where possible)Sample rate of the audio in Hz. Remarks Should match the actual sample rate of the recording (e.g. 16000 for raw LINEAR16 capture, 48000 for browser MediaRecorder WEBM_OPUS). May be omitted for WAV and FLAC audio.--src/providers/stt/google/GoogleSTT.ts:117
timeout?numberundefinedRequest timeout in milliseconds. Remarks Applies to HTTP requests (REST providers) and connection establishment (WebSocket providers). Set to 0 for no timeout.-STTProviderConfig.timeoutsrc/core/types/providers.ts:135

© 2026 CompositeVoice. All rights reserved.

Font size
Contrast
Motion
Transparency