# Google (/en/ai/platform/models/tts/google)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

> Documentation: Conversational AI.
> Documentation version: Preview.
> This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt).


Google provides fast, reliable text-to-speech (TTS) with customizable voices.

## Sample configuration

The following example shows how to configure Google TTS as the agent's TTS when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent).

Google TTS supports BYOK only. It isn't available in managed mode. Store your Google Cloud service account credentials JSON string in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys).

**Python SDK**

```python
from agora_agent import Agent, GoogleTTS, secret_ref

# client is your configured Agora client
agent = (
    Agent(client=client)
    .with_stt(...)  # configure your ASR vendor
    .with_llm(...)  # configure your LLM vendor
    .with_tts(
        GoogleTTS(
            key=secret_ref("support_prod", "google"),
            voice_name="en-US-Chirp3-HD-Charon",
            sample_rate_hertz=24000,
        )
    )
)
```

**TypeScript SDK**

```ts
import { Agent, GoogleTTS, secretRef } from 'agora-agents';

// client is your configured Agora client
const agent = new Agent({ client })
  .withStt(/* configure your ASR vendor */)
  .withLlm(/* configure your LLM vendor */)
  .withTts(
    new GoogleTTS({
      key: secretRef('support_prod', 'google'),
      voiceName: 'en-US-Chirp3-HD-Charon',
      sampleRate: 24000,
    }),
  );
```

**Go SDK**

```go
// client is your configured Agora client
sampleRate := vendors.SampleRate24kHz
agent := agentkit.NewAgent(client).
	WithStt( /* configure your ASR vendor */ ).
	WithLlm( /* configure your LLM vendor */ ).
	WithTts(vendors.NewGoogleTTS(vendors.GoogleTTSOptions{
		Key:        agentkit.SecretRef("support_prod", "google"),
		VoiceName:  "en-US-Chirp3-HD-Charon",
		SampleRate: &sampleRate,
	}))
```

**REST API**

Set `credential.mode` to `byok` and `credential.fields.credentials` to a reference to your Google Cloud service account credentials JSON string. In the following example, the key is stored as `google` in the `support_prod` set:

```json
"tts": {
  "credential": {
    "mode": "byok",
    "fields": {
      "credentials": "$secrets.support_prod.google"
    }
  },
  "vendor": "google",
  "params": {
    "VoiceSelectionParams": {
      "name": "en-US-Chirp3-HD-Charon"
    },
    "AudioConfig": {
      "speaking_rate": 1.0,
      "sample_rate_hertz": 24000
    }
  }
}
```

## Key parameters

The `tts` block takes the following fields. In the SDKs, `GoogleTTS` sets them from its options.

**tts**

**`vendor` (string) required**

Set to `google`.

**`credential` (object) required**

Set `mode` to `byok` and `fields.credentials` to a `$secrets.<set>.<key>` reference to your Google Cloud service account credentials JSON string. Get your credentials from the [Google Cloud Console](https://console.cloud.google.com/).

**`params` (object) required**

**`VoiceSelectionParams` (object) required**

**`name` (string) required**

The name of the voice to use, for example, `en-US-Chirp3-HD-Charon` or `en-US-Neural2-A`. See [supported voices](https://cloud.google.com/text-to-speech/docs/voices) for available voice names.

**`AudioConfig` (object) optional**

**`speaking_rate` (number) optional**

The speed of speech. Valid range is `0.25` to `2.0`, where `1.0` is the normal speed. Values less than `1.0` slow down the speech, while values greater than `1.0` speed it up.

**`sample_rate_hertz` (integer) optional**

The sample rate in Hertz for the audio output, for example, `24000` or `16000`. The default value depends on the selected voice.

> **Caution**
>
> The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Google without validation. For a full list of supported options, refer to the [Google documentation](https://cloud.google.com/text-to-speech/docs/create-audio-text-streaming).

This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads.
