> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zeroruntime.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Cloud STT

> Use the Google Cloud Speech-to-Text plugin in a Zero Runtime pipeline. Setup, options, and usage in Python and JavaScript.

Google Cloud Speech-to-Text is a **speech-to-text** plugin. It transcribes the caller's
audio into text for the LLM using Google Cloud's Speech-to-Text V2 streaming API.

## Setup

Google Cloud STT authenticates with a Google Cloud service account rather than a simple API
key. Point Application Default Credentials at your service-account JSON. Create the service account and key in the [Google Cloud console](https://console.cloud.google.com/apis/credentials):

```bash theme={null}
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json
```

<Note>
  In the Python SDK you can also pass the service-account JSON path (or raw JSON string) as the
  `api_key` argument. The value is used directly as the service-account credentials; it is not
  written to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable.
</Note>

## Usage

Import the plugin and pass it to the pipeline's `stt` slot.

<CodeGroup>
  ```python Python theme={null}
  from zeroruntime.plugins import GoogleSTT

  stt = GoogleSTT(
      languages="en-US",
      model="latest_long",
  )

  # Pipeline(stt=stt, ...)
  ```

  ```typescript Node JS theme={null}
  import { GoogleSTT } from '@zeroruntime/js-sdk/plugins';

  const stt = GoogleSTT({
    languages: 'en-US',
    model: 'latest_long',
  });

  // Pipeline({ stt, ... })
  ```
</CodeGroup>

## Parameters

*Constructor parameters for `GoogleSTT`. The Python and Node JS SDKs share these field names.*

| Parameter                      | Type               | Default         | Description                                                                                                                                                                 |
| ------------------------------ | ------------------ | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `credentials_json`             | `str`              | `None`          | Service-account credentials as a raw JSON string or a path to a JSON key file. Takes highest precedence.                                                                    |
| `service_account_path`         | `str`              | `None`          | Path to a service-account JSON key file. Used when `credentials_json` is not set.                                                                                           |
| `api_key`                      | `str`              | `None`          | Fallback credential source; the value is treated as a JSON file path (or raw JSON) first. Used only when the above are absent. Service-account auth is recommended for STT. |
| `project_id`                   | `str`              | `None`          | Google Cloud project ID. Extracted from the service-account JSON when not set.                                                                                              |
| `languages`                    | `str \| list[str]` | `"en-US"`       | Language code(s) to recognize. The first entry is the primary language.                                                                                                     |
| `model`                        | `str`              | `"latest_long"` | Google Cloud Speech recognition model.                                                                                                                                      |
| `sample_rate`                  | `int`              | `48000`         | Target sample rate (Hz). Matches the native input rate so no resampling occurs; set a lower value (e.g. `16000`) to downsample.                                             |
| `interim_results`              | `bool`             | `True`          | Emit partial transcripts while the caller is still speaking.                                                                                                                |
| `punctuate`                    | `bool`             | `True`          | Add automatic punctuation to transcripts.                                                                                                                                   |
| `min_confidence_threshold`     | `float`            | `0.0`           | Drop results below this confidence. `0.0` disables filtering.                                                                                                               |
| `location`                     | `str`              | `"us"`          | Cloud Speech-to-Text regional endpoint: `"us"` or `"eu"`.                                                                                                                   |
| `profanity_filter`             | `bool`             | `False`         | Mask profane words in transcripts.                                                                                                                                          |
| `enable_voice_activity_events` | `bool`             | `False`         | Emit server-side speech-start/-end events independently of transcripts.                                                                                                     |
| `speech_start_timeout`         | `float`            | `None`          | Seconds to wait for speech to begin before a voice-activity timeout fires. `None` uses the API default.                                                                     |
| `speech_end_timeout`           | `float`            | `None`          | Seconds of silence after speech before an end-of-speech event fires. `None` uses the API default.                                                                           |
| `audio_channel_count`          | `int`              | `1`             | Number of audio channels in the input (mono by default).                                                                                                                    |
| `min_speaker_count`            | `int`              | `None`          | Minimum expected speakers for diarization. `None` disables diarization.                                                                                                     |
| `max_speaker_count`            | `int`              | `None`          | Maximum expected speakers for diarization. `None` disables diarization.                                                                                                     |

## Import paths

| SDK     | Import                                                    | Constructor          |
| ------- | --------------------------------------------------------- | -------------------- |
| Python  | `from zeroruntime.plugins import GoogleSTT`               | `GoogleSTT(...)`     |
| Node JS | `import { GoogleSTT } from '@zeroruntime/js-sdk/plugins'` | `GoogleSTT({ ... })` |

Transcribed text passes to the [LLM](/plugins/llm/google) once
[turn detection](/plugins/turn-detection/namo) decides the caller has finished speaking.
