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

# Azure

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

## AzureSTT

Azure (Cognitive Services) speech-to-text provider.

Creates a configured Azure Speech STT provider for use in a voice agent.

### Constructor

```typescript theme={null}
new AzureSTT(opts: AzureSTTOptions)
```

<ParamField path="speechKey" type="string">
  Azure Speech key. Falls back to the `AZURE_SPEECH_KEY` env var.
</ParamField>

<ParamField path="speechRegion" type="string">
  Azure Speech region. Falls back to the `AZURE_REGION` env var, then `'eastus'`.
</ParamField>

<ParamField path="language" type="string">
  Recognition language code. Default: `'en-US'`.
</ParamField>

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

<ParamField path="enablePhraseList" type="boolean">
  Enable a phrase list to bias recognition.
</ParamField>

<ParamField path="phraseList" type="string[]">
  Phrases to bias recognition toward.
</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>" />

***

## AzureOpenAISTT

Azure OpenAI speech-to-text provider.

Creates a configured Azure OpenAI transcription provider for use in a voice agent.

### Constructor

```typescript theme={null}
new AzureOpenAISTT(opts: AzureOpenAISTTOptions)
```

<ParamField path="apiKey" type="string | null">
  Azure OpenAI API key. Falls back to the `AZURE_API_KEY` then `AZURE_OPENAI_API_KEY` env vars, then `null`.
</ParamField>

<ParamField path="azureEndpoint" type="string | null">
  Azure OpenAI resource endpoint. Falls back to the `AZURE_OPENAI_ENDPOINT` env var, then `null`.
</ParamField>

<ParamField path="deployment" type="string | null">
  Azure deployment name. Falls back to the `AZURE_OPENAI_STT_DEPLOYMENT` env var, then `null`.
</ParamField>

<ParamField path="apiVersion" type="string">
  Azure OpenAI REST API version. Default: `'2025-03-01-preview'`.
</ParamField>

<ParamField path="model" type="AzureOpenAISTTModel | string">
  Transcription model name. Default: `''`.
</ParamField>

<ParamField path="language" type="string">
  Transcription language code. Default: `'en'`.
</ParamField>

<ParamField path="stream" type="boolean">
  Whether to use streaming transcription. Default: `false`.
</ParamField>

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

<ParamField path="outputSampleRate" type="number">
  Output audio sample rate in Hz. Default: `24000`.
</ParamField>

<ParamField path="prompt" type="string | null">
  Optional prompt to bias transcription. Default: `null`.
</ParamField>

<ParamField path="temperature" type="number | null">
  Sampling temperature. Default: `null`.
</ParamField>

<ParamField path="responseFormat" type="string">
  Response format, e.g. `'json'`, `'text'`. Default: `'json'`.
</ParamField>

<ParamField path="turnDetection" type="string">
  Turn-detection mode, e.g. `'server_vad'`. Default: `'server_vad'`.
</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>" />

***

## AzureOpenAISTTModel

Supported Azure OpenAI STT transcription model names.

```typescript theme={null}
type AzureOpenAISTTModel = 'gpt-4o-transcribe' | 'gpt-4o-mini-transcribe' | 'gpt-4o-transcribe-diarize' | 'whisper'
```
