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

# Gladia

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

## GladiaSTT

Gladia speech-to-text (STT) provider.

### Constructor

```typescript theme={null}
new GladiaSTT(opts: GladiaSTTOptions)
```

<ParamField path="apiKey" type="string | null">
  Gladia API key used to authenticate requests.
  Defaults to the `GLADIA_API_KEY` environment variable, or `null` if unset.
</ParamField>

<ParamField path="model" type="string" default="'solaria-1'">
  Gladia transcription model to use.
</ParamField>

<ParamField path="languages" type="string[] | null">
  Preferred transcription language(s) as language codes/names. Only the
  first entry is used to select the active language. When empty or omitted,
  the language defaults to `'english'`.
</ParamField>

<ParamField path="codeSwitching" type="boolean">
  Enable automatic detection and switching between languages within a single
  stream (multilingual audio).
</ParamField>

<ParamField path="inputSampleRate" type="number">
  Sample rate, in Hz, of the audio fed into the provider.
</ParamField>

<ParamField path="outputSampleRate" type="number" default="16000">
  Sample rate, in Hz, used for the transcription stream. This value is also
  used as the effective sample rate.
</ParamField>

<ParamField path="encoding" type="string">
  Audio encoding format of the input stream (e.g. PCM encodings).
</ParamField>

<ParamField path="bitDepth" type="number">
  Bit depth of the input audio samples (e.g. `16`).
</ParamField>

<ParamField path="channels" type="number">
  Number of audio channels in the input stream (e.g. `1` for mono).
</ParamField>

<ParamField path="receivePartialTranscripts" type="boolean">
  Whether to emit interim/partial transcripts as audio is still being
  processed, in addition to final transcripts.
</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>" />
