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

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

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

<CalloutContainer type="info">
  <CalloutTitle>
    Info
  </CalloutTitle>

  <CalloutDescription>
    This integration is fully supported for use with Conversational AI Engine. 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.
  </CalloutDescription>
</CalloutContainer>

### Sample configuration [#sample-configuration]

The following examples show how to configure Google TTS when starting a conversational AI agent.

<Tabs defaultValue="python" groupId="ai-sdk-language">
  <TabsList>
    <TabsTrigger value="python">
      Python SDK
    </TabsTrigger>

    <TabsTrigger value="typescript">
      TypeScript SDK
    </TabsTrigger>

    <TabsTrigger value="go">
      Go SDK
    </TabsTrigger>

    <TabsTrigger value="rest-api">
      REST API
    </TabsTrigger>
  </TabsList>

  <TabsContent value="python">
    ```python
    from agora_agent import Agent
    from agora_agent.agentkit.vendors import GoogleTTS

    # client is your configured Agora client
    agent = (
        Agent(client)
        .with_stt(...)  # configure your STT vendor
        .with_llm(...)  # configure your LLM vendor
        .with_tts(GoogleTTS(
            key='<google_application_credentials_string>',
            voice_name='en-US-Chirp3-HD-Charon',
        ))
    )
    ```
  </TabsContent>

  <TabsContent value="typescript">
    ```typescript
    import { Agent, GoogleTTS } from 'agora-agents';

    // client is your configured Agora client
    const agent = new Agent({ client })
      .withStt(/* configure your STT vendor */)
      .withLlm(/* configure your LLM vendor */)
      .withTts(new GoogleTTS({
        key: '<google_application_credentials_string>',
        voiceName: 'en-US-Chirp3-HD-Charon',
      }));
    ```
  </TabsContent>

  <TabsContent value="go">
    ```go
    import "github.com/AgoraIO/agora-agents-go/v2/agentkit/vendors"

    // client is your configured Agora client
    agent := agentkit.NewAgent(client).WithStt(/* configure your STT vendor */).
      WithLlm(/* configure your LLM vendor */).
      WithTts(
        vendors.NewGoogleTTS(vendors.GoogleTTSOptions{
            Key:       "<google_application_credentials_string>",
            VoiceName: "en-US-Chirp3-HD-Charon",
        }),
    )
    ```
  </TabsContent>

  <TabsContent value="rest-api">
    Use the following `tts` configuration in your request:

    ```json
    "tts": {
        "vendor": "google",
        "params": {
            "credentials": "<GOOGLE_APPLICATION_CREDENTIALS_STRING>",
            "VoiceSelectionParams": {
                "name": "en-US-Chirp3-HD-Charon"
            },
            "AudioConfig": {
                "speaking_rate": 1.0,
                "sample_rate_hertz": 24000
            }
        }
    }
    ```
  </TabsContent>
</Tabs>

<CalloutContainer type="warning">
  <CalloutTitle>
    Caution
  </CalloutTitle>

  <CalloutDescription>
    The parameters listed on this page are validated for use with Conversational AI Engine. Required parameters must be provided as documented. Any additional parameters are passed through directly to the underlying vendor 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).
  </CalloutDescription>
</CalloutContainer>

### Key parameters [#key-parameters]

<ParameterList title="params" required="true">
  <Parameter name="credentials" type="string" required="true">
    The Google Cloud service account credentials JSON string used for authentication. Get your credentials from the [Google Cloud Console](https://console.cloud.google.com/).
  </Parameter>

  <Parameter name="VoiceSelectionParams" type="object" required="true">
    <Parameter name="name" type="string" required="true">
      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.
    </Parameter>
  </Parameter>

  <Parameter name="AudioConfig" type="object" required="false">
    <Parameter name="speaking_rate" type="number" required="false">
      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.
    </Parameter>

    <Parameter name="sample_rate_hertz" type="integer" required="false">
      The sample rate in Hertz for the audio output, for example, `24000` or `16000`. The default value depends on the selected voice.
    </Parameter>
  </Parameter>
</ParameterList>
