# Google (/en/ai/platform/models/asr/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 advanced automatic speech recognition with high accuracy and support for multiple languages, designed for real-time conversational AI applications.

## Sample configuration

The following example shows how to configure Google as the agent's ASR 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 supports BYOK only. It isn't available in managed mode. Store your Google Cloud service account credentials in a secret set, and refer to them 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, GoogleSTT, secret_ref

# client is your configured Agora client
agent = (
    Agent(client=client)
    .with_stt(
        GoogleSTT(
            adc_credentials_string=secret_ref("support_prod", "google"),
            project_id="<GOOGLE_ASR_PROJECT_ID>",
            location="global",
            language="en-US",
            model="long",
        )
    )
    .with_llm(...)  # configure your LLM vendor
    .with_tts(...)  # configure your TTS vendor
)
```

**TypeScript SDK**

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

// client is your configured Agora client
const agent = new Agent({ client })
  .withStt(
    new GoogleSTT({
      adcCredentialsString: secretRef('support_prod', 'google'),
      projectId: '<GOOGLE_ASR_PROJECT_ID>',
      location: 'global',
      language: 'en-US',
      model: 'long',
    }),
  )
  .withLlm(/* configure your LLM vendor */)
  .withTts(/* configure your TTS vendor */);
```

**Go SDK**

```go
// client is your configured Agora client
agent := agentkit.NewAgent(client).
	WithStt(vendors.NewGoogleSTT(vendors.GoogleSTTOptions{
		ADCCredentialsString: agentkit.SecretRef("support_prod", "google"),
		ProjectID:            "<GOOGLE_ASR_PROJECT_ID>",
		Location:             "global",
		Language:             "en-US",
		Model:                "long",
	})).
	WithLlm( /* configure your LLM vendor */ ).
	WithTts( /* configure your TTS vendor */ )
```

**REST API**

Set `credential.mode` to `byok` and `credential.fields.adc_credentials_string` to a reference to your service account credentials in a secret set. In the following example, the credentials are stored as `google` in the `support_prod` set:

```json
"asr": {
  "credential": {
    "mode": "byok",
    "fields": {
      "adc_credentials_string": "$secrets.support_prod.google"
    }
  },
  "vendor": "google",
  "model": "long",
  "language": "en-US",
  "params": {
    "language": "en-US",
    "project_id": "<GOOGLE_ASR_PROJECT_ID>",
    "location": "global"
  }
}
```

## Key parameters

The `asr` block takes the following fields. In the SDKs, `GoogleSTT` sets them from its options, and passes any other Google parameters from its additional parameters option to `params`.

**asr required**

**`vendor` (string) required**

Set to `google`.

**`credential` (object) required**

How the agent authenticates with Google. Set `mode` to `byok` and `fields.adc_credentials_string` 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/).

**`model` (string) optional**

The recognition model to use.

**`language` (string) required**

The language code for speech recognition, for example, `en-US`, `es-ES`, or `fr-FR`. See [supported languages](https://cloud.google.com/speech-to-text/docs/speech-to-text-supported-languages) for available language codes.

**`params` (object) required**

**`project_id` (string) required**

The Google Cloud project ID where the Speech-to-Text API is enabled. Get your project ID from the [Google Cloud Console](https://console.cloud.google.com/).

**`location` (string) required**

The Google Cloud region where the speech service is hosted, for example, `global`, `us-central1`, or `europe-west1`.

> **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 official documentation](https://docs.cloud.google.com/speech-to-text/v2/docs).

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.
