> ## 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

> JavaScript API reference for the google speech-to-text plugin.

## GoogleSTT

Google Cloud speech-to-text (STT) provider.

### Constructor

```typescript theme={null}
new GoogleSTT(opts: GoogleSTTOptions)
```

<ParamField path="apiKey" type="string | null">
  Google API key. Falls back to the `GOOGLE_API_KEY` environment variable, then `null`.
</ParamField>

<ParamField path="languages" type="string | string[]">
  Recognition language(s) as BCP-47 tags (e.g. `'en-US'`), a single string or an array (joined with commas). Default `'en-US'`.
</ParamField>

<ParamField path="model" type="GoogleSTTModel | string">
  Recognition model. Default `'latest_long'`.
</ParamField>

<ParamField path="sampleRate" type="number">
  Input audio sample rate in Hz. Default `48000`.
</ParamField>

<ParamField path="credentialsJson" type="string | Record<string, any> | null">
  Service-account credentials, as a raw JSON string or parsed object. Default `null`.
</ParamField>

<ParamField path="serviceAccountPath" type="string | null">
  Path to a service-account JSON key file. Read when `credentialsJson` is not provided.
</ParamField>

<ParamField path="projectId" type="string | null">
  Google Cloud project id. Default `null` (derived from the service-account JSON when omitted).
</ParamField>

<ParamField path="location" type="string">
  Recognizer location/region. Default `'us'`.
</ParamField>

<ParamField path="stream" type="boolean">
  Use streaming recognition. Default `true`.
</ParamField>

<ParamField path="audioChannelCount" type="number">
  Number of audio channels in the input. Default `1`.
</ParamField>

<ParamField path="interimResults" type="boolean">
  Emit interim (non-final) transcription results. Default `true`.
</ParamField>

<ParamField path="punctuate" type="boolean">
  Add automatic punctuation to transcripts. Default `true`.
</ParamField>

<ParamField path="profanityFilter" type="boolean">
  Filter profanity from transcripts. Default `false`.
</ParamField>

<ParamField path="enableSpokenPunctuation" type="boolean">
  Recognize spoken punctuation (e.g. "comma" -> ","). Default `false`.
</ParamField>

<ParamField path="enableSpokenEmojis" type="boolean">
  Recognize spoken emojis. Default `false`.
</ParamField>

<ParamField path="enableWordTimeOffsets" type="boolean">
  Include per-word start/end time offsets. Default `false`.
</ParamField>

<ParamField path="enableWordConfidence" type="boolean">
  Include per-word confidence scores. Default `false`.
</ParamField>

<ParamField path="maxAlternatives" type="number">
  Maximum number of recognition alternatives to return. Default `1`.
</ParamField>

<ParamField path="enableVoiceActivityEvents" type="boolean">
  Emit voice-activity (speech begin/end) events. Default `false`.
</ParamField>

<ParamField path="speechStartTimeout" type="number | null">
  Timeout in seconds to wait for speech to start. Default `null` (no timeout).
</ParamField>

<ParamField path="speechEndTimeout" type="number | null">
  Timeout in seconds of silence marking speech end. Default `null` (no timeout).
</ParamField>

<ParamField path="minSpeakerCount" type="number | null">
  Minimum number of speakers for diarization. Default `null`.
</ParamField>

<ParamField path="maxSpeakerCount" type="number | null">
  Maximum number of speakers for diarization. Default `null`.
</ParamField>

<ParamField path="minConfidenceThreshold" type="number">
  Minimum confidence threshold for accepting results, `0.0`-`1.0`. Default `0.0`.
</ParamField>

### close

```typescript theme={null}
close(): Promise<void>
```

Release any resources held by the provider.

### closeEmitter

```typescript theme={null}
closeEmitter(): Promise<void>
```

Close the emitter: drop all handlers and stop emitting. Waits up to 2 seconds
for in-flight async handlers to settle before returning.

### emit

```typescript theme={null}
emit(event: string, ...args: any[]): void
```

<ParamField path="event" type="string" required />

### getRuntimeConfig

```typescript theme={null}
getRuntimeConfig(): Record<string, any>
```

<ResponseField name="returns" type="Record<string, any>" />

### listenerCount

```typescript theme={null}
listenerCount(event: string): number
```

<ParamField path="event" type="string" required />

<ResponseField name="returns" type="number" />

### off

```typescript theme={null}
off(event: string, handler: EventHandler): void
```

<ParamField path="event" type="string" required />

<ParamField path="handler" type="EventHandler" required />

### on

```typescript theme={null}
on(event: string, handler: EventHandler): EventHandler
```

<ParamField path="event" type="string" required />

<ParamField path="handler" type="EventHandler" required />

<ResponseField name="returns" type="EventHandler" />

### once

```typescript theme={null}
once(event: string, handler: EventHandler): EventHandler
```

<ParamField path="event" type="string" required />

<ParamField path="handler" type="EventHandler" required />

<ResponseField name="returns" type="EventHandler" />

### onSttTranscript

```typescript theme={null}
onSttTranscript(callback: SttTranscriptCallback): void
```

Register a callback to receive transcripts as they are produced.

<ParamField path="callback" type="SttTranscriptCallback" required />

### processAudio

```typescript theme={null}
processAudio(_audioFrames: Uint8Array, _language?: string | null, ..._extra: any[]): Promise<void>
```

Process a buffer of audio frames. Override in a custom provider.

### removeAllListeners

```typescript theme={null}
removeAllListeners(event?: string): void
```

<ParamField path="event" type="string" />

### streamTranscribe

```typescript theme={null}
streamTranscribe(_audioStream: AsyncIterable<Uint8Array>, ..._extra: any[]): AsyncIterator<STTResponse>
```

Transcribe a streaming audio source, yielding STTResponses. Override in a custom provider.

<ResponseField name="returns" type="AsyncIterator<STTResponse>" />

***

## GoogleSTTModel

Supported Google Cloud STT recognition model ids.

```typescript theme={null}
type GoogleSTTModel = | 'chirp_3' | 'chirp_2' | 'latest_long' | 'latest_short' | 'telephony' | 'telephony_short'
```
