Skip to content

GoogleTTSConfig

Configuration for the GoogleTTS provider.

Defined in: src/providers/tts/google/GoogleTTS.ts:80

Configuration for the GoogleTTS 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 Text-to-Speech API) or the proxy instead.

Example

// Direct API access
const config: GoogleTTSConfig = {
  apiKey: 'AIza...',
  languageCode: 'en-US',
  voiceName: 'en-US-Chirp3-HD-Kore',
  audioEncoding: 'MP3',
};

// Via proxy server
const proxyConfig: GoogleTTSConfig = {
  proxyUrl: 'http://localhost:3001/api/proxy/google-tts',
  voiceName: 'en-US-Neural2-F',
};

See

GoogleTTSAudioEncoding - Available audio encoding options.

Extends

Properties

PropertyTypeDefault valueDescriptionInherited fromDefined in
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.TTSProviderConfig.apiKeysrc/core/types/providers.ts:71
audioEncoding?GoogleTTSAudioEncoding'MP3'The audio encoding of the synthesized output. See GoogleTTSAudioEncoding-src/providers/tts/google/GoogleTTS.ts:123
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.TTSProviderConfig.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.TTSProviderConfig.debugsrc/core/types/providers.ts:126
effectsProfileId?string[]undefined (no effects profile)Audio effects profiles to post-process the audio for a playback device, e.g. ['headphone-class-device'] or ['telephony-class-application'].-src/providers/tts/google/GoogleTTS.ts:156
endpoint?stringundefinedCustom endpoint URL to override the provider’s default API endpoint. Remarks Useful for self-hosted instances, proxy servers, or development environments.TTSProviderConfig.endpointsrc/core/types/providers.ts:79
languageCode?string'en-US'BCP-47 language (and optionally region) code for the voice. Remarks For example 'en-US', 'en-GB', 'de-DE'. When voiceName is set, the language code should match the voice’s language prefix.-src/providers/tts/google/GoogleTTS.ts:90
maxRetries?number3Maximum number of retries for failed API requests.-src/providers/tts/google/GoogleTTS.ts:163
model?stringundefinedModel to use for text-to-speech synthesis. Remarks Provider-specific model identifier (e.g., 'aura-2' for Deepgram).TTSProviderConfig.modelsrc/core/types/providers.ts:1165
outputFormat?stringundefinedOutput audio format identifier. Remarks Provider-specific format string (e.g., 'linear16', 'mp3', 'opus').TTSProviderConfig.outputFormatsrc/core/types/providers.ts:1190
pitch?numberundefinedPitch adjustment in semitones. Remarks Values from -20 to +20 semitones. Not all providers support pitch adjustment.TTSProviderConfig.pitchsrc/core/types/providers.ts:1182
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'TTSProviderConfig.proxyUrlsrc/core/types/providers.ts:97
rate?numberundefinedSpeech rate multiplier. Remarks Values from 0.25 (quarter speed) to 4.0 (quadruple speed), where 1.0 is normal speed. Not all providers support rate adjustment.TTSProviderConfig.ratesrc/core/types/providers.ts:1174
sampleRate?numberundefinedSample rate for the output audio in Hz. Remarks Common values are 16000, 24000, and 48000. Must match the format capabilities of the chosen voice and model.TTSProviderConfig.sampleRatesrc/core/types/providers.ts:1199
sampleRateHertz?numberundefined (voice’s native sample rate)Sample rate of the returned audio in Hz. Remarks When omitted, the voice’s native sample rate is used (typically 24000 Hz).-src/providers/tts/google/GoogleTTS.ts:148
speakingRate?numberundefined (API default, 1.0)Speaking rate multiplier, from 0.25 to 2.0 (v1 range is 0.25—4.0, but values above 2.0 are increasingly unnatural). 1.0 is normal speed.-src/providers/tts/google/GoogleTTS.ts:131
ssmlGender?GoogleTTSSsmlGenderundefined (no preference)Preferred voice gender when no specific voice name is configured. See GoogleTTSSsmlGender-src/providers/tts/google/GoogleTTS.ts:115
timeout?numberundefinedRequest timeout in milliseconds. Remarks Applies to HTTP requests (REST providers) and connection establishment (WebSocket providers). Set to 0 for no timeout.TTSProviderConfig.timeoutsrc/core/types/providers.ts:135
voice?stringundefinedVoice ID or name to use for synthesis. Remarks Provider-specific voice identifier. For example, Deepgram uses identifiers like 'aura-asteria-en', while ElevenLabs uses voice IDs.TTSProviderConfig.voicesrc/core/types/providers.ts:1157
voiceName?stringundefined (Google’s default voice for the language)The specific Google Cloud voice to use. Remarks Voice names encode the language, voice family, and variant, e.g. 'en-US-Chirp3-HD-Kore' (Chirp 3: HD), 'en-US-Neural2-F' (Neural2), 'en-US-Studio-O' (Studio), or 'en-US-Wavenet-D' (WaveNet). List available voices via Google’s GET /v1/voices endpoint. When omitted, Google selects a default voice for the languageCode (optionally biased by ssmlGender).-src/providers/tts/google/GoogleTTS.ts:107
volumeGainDb?numberundefined (API default, 0.0)Volume gain in dB, from -96.0 to 16.0. 0.0 is normal volume.-src/providers/tts/google/GoogleTTS.ts:138

© 2026 CompositeVoice. All rights reserved.

Font size
Contrast
Motion
Transparency