LiveKit docs › Build Agents › Partner spotlight › OpenAI › OpenAI STT

---

# OpenAI STT

> How to use OpenAI STT with LiveKit Agents.

- **[Use in Agent Builder](https://cloud.livekit.io/projects/p_/agents/builder/new?stt=openai%2Fgpt-live-transcribe)**: Create a new agent in your browser using openai/gpt-live-transcribe

## Overview

OpenAI speech-to-text is available in LiveKit Agents through [LiveKit Inference](https://docs.livekit.io/agents/models/inference.md) and the [OpenAI plugin](#plugin). With LiveKit Inference, your agent runs on LiveKit's infrastructure to minimize latency. No separate provider API key is required, and usage and rate limits are managed through LiveKit Cloud. Use the plugin instead if you want to manage your own billing and rate limits. Pricing for LiveKit Inference is available on the [pricing page](https://livekit.com/pricing/inference#stt).

## LiveKit Inference

Use [LiveKit Inference](https://docs.livekit.io/agents/models/inference.md) to access OpenAI STT without a separate OpenAI API key.

A checkmark in the **EU endpoint** column in the following tables means the model has a dedicated EU endpoint, in addition to the global endpoint. To learn more, see [Data residency](https://docs.livekit.io/agents/models/inference.md#data-residency).

| Model name | Model ID | Languages | EU endpoint |
| -------- | -------- | --------- | ------ |
| GPT-Live Transcribe | `openai/gpt-live-transcribe` | `af`, `ar`, `az`, `be`, `bg`, `bs`, `ca`, `cs`, `cy`, `da`, `de`, `el`, `en`, `es`, `et`, `fa`, `fi`, `fr`, `gl`, `he`, `hi`, `hr`, `hu`, `hy`, `id`, `is`, `it`, `iw`, `ja`, `kk`, `kn`, `ko`, `lt`, `lv`, `mi`, `mk`, `mr`, `ms`, `ne`, `nl`, `no`, `pl`, `pt`, `ro`, `ru`, `sk`, `sl`, `sr`, `sv`, `sw`, `ta`, `th`, `tl`, `tr`, `uk`, `ur`, `vi`, `zh`, `zh-cn`, `zh-tw`, `zh-hk`, `yue`, `cmn`, `fil`, `multi` | ✓ |

### Usage

To use OpenAI, use the `STT` class from the `inference` module:

**Python**:

```python
from livekit.agents import AgentSession, inference

session = AgentSession(
    stt=inference.STT(
        model="openai/gpt-live-transcribe",
        language="en",
        sample_rate=24000
    ),
    # ... llm, tts, vad, turn_handling, etc.
)

```

---

**Node.js**:

```typescript
import { AgentSession, inference } from '@livekit/agents';

const session = new AgentSession({
    stt: new inference.STT({
        model: "openai/gpt-live-transcribe",
        language: "en",
        sampleRate: 24000
    }),
    // ... llm, tts, vad, turnHandling, etc.
});

```

### Audio format and turn detection

The `openai/gpt-live-transcribe` model accepts streaming audio only as 24 kHz PCM or 8 kHz μ-law. The Agents SDK streams PCM, and LiveKit Inference rejects other sample rates instead of resampling them. Set `sample_rate` (`sampleRate` in Node.js) to `24000` explicitly, as shown in the preceding example.

The model has no built-in end-of-turn detection. It emits a final transcript each time your agent finalizes the current audio segment, which the Agents SDK does when it detects the end of speech.

### Parameters

The `STT` class accepts the following parameters:

- **`model`** _(string)_: The model to use for the STT. See [model IDs](#inference) for available models.

- **`language`** _(LanguageCode)_ (optional): [Language code](https://docs.livekit.io/agents/models/stt.md#language-codes) for the transcription. If not set, the model detects the language.

- **`sample_rate`** _(int)_ (optional): Sample rate of the audio sent to the model. Set this to `24000` for PCM audio. In Node.js this parameter is called `sampleRate` and defaults to `16000`, which LiveKit Inference rejects for this model. In Python, it defaults to `24000` for OpenAI models in version 1.8.7 and later. To learn more, see [Audio format and turn detection](#audio-and-turn-detection).

## Plugin

LiveKit's plugin support for [OpenAI](https://developers.openai.com) lets you connect directly to OpenAI's STT API with your own API key.

Available in:
- [x] Node.js
- [x] Python

### Installation

Install the plugin from PyPI:

**Python**:

```shell
uv add "livekit-agents[openai]~=1.8"

```

---

**Node.js**:

```shell
pnpm add @livekit/agents-plugin-openai@1.x

```

### Authentication

The OpenAI plugin requires an [OpenAI API key](https://platform.openai.com/api-keys).

Set `OPENAI_API_KEY` in your `.env` file.

### Usage

Use OpenAI STT in an `AgentSession` or as a standalone transcription service. For example, you can use this STT in the [Voice AI quickstart](https://docs.livekit.io/agents/start/voice-ai.md).

**Python**:

```python
from livekit.plugins import openai

session = AgentSession(
  stt = openai.STT(
    model="gpt-4o-mini-transcribe",
  ),
  # ... llm, tts, etc.
)

```

---

**Node.js**:

```typescript
import { inference, voice } from '@livekit/agents';
import * as openai from '@livekit/agents-plugin-openai';

const vad = new inference.VAD({ model: 'silero' });

const session = new voice.AgentSession({
    stt: new openai.STT({
        model: 'gpt-realtime-whisper',
        vad,
    }),
    // ... llm, tts, etc.
});

```

> 💡 **VAD requirement**
> 
> The `gpt-realtime-whisper` model doesn't support server-side turn detection. You must pass a `vad` instance so the plugin can commit the audio buffer at end-of-speech.

> ℹ️ **Default model change in Node.js**
> 
> In `@livekit/agents-plugin-openai@1.4.1`, the default model for `openai.STT` changed from `whisper-1` to `gpt-realtime-whisper`, which streams transcription over a WebSocket. To restore the previous behavior, set `useRealtime: false`:
> 
> ```typescript
> const stt = new openai.STT({ useRealtime: false });
> 
> ```

### Using an OpenAI-compatible gateway

Available in:
- [x] Node.js
- [ ] Python

Realtime transcription streams over a WebSocket, which you can route through an OpenAI-compatible gateway or proxy, such as [LiteLLM](https://docs.litellm.ai/docs/realtime), Cloudflare AI Gateway, Helicone, or Portkey. Set the `baseURL` to your gateway endpoint and set the `apiKey`:

```typescript
import { voice } from '@livekit/agents';
import * as openai from '@livekit/agents-plugin-openai';
import * as silero from '@livekit/agents-plugin-silero';

const vad = await silero.VAD.load();

const session = new voice.AgentSession({
    stt: new openai.STT({
        model: 'gpt-realtime-whisper',
        // Connects to wss://your-gateway.example.com/v1/realtime?intent=transcription&model=gpt-realtime-whisper
        baseURL: 'https://your-gateway.example.com/v1',
        apiKey: process.env.GATEWAY_API_KEY,
        vad,
    }),
    // ... llm, tts, etc.
});

```

The plugin adds the model as a `?model=` query parameter on the connection URL when the host isn't `api.openai.com`, so the gateway can route each connection to the correct model. An `https://` base URL maps to `wss://`, and `http://` maps to `ws://`.

Connecting directly to OpenAI omits the `?model=` parameter by design. In that case, the plugin sends the model in the session configuration instead.

### Parameters

This section describes some of the available parameters. See the plugin reference links in the [Additional resources](#additional-resources) section for a complete list of all available parameters.

- **`model`** _(WhisperModels | string)_ (optional) - Default: `gpt-4o-mini-transcribe | gpt-realtime-whisper`: Model to use for transcription. See OpenAI's documentation for a list of [supported models](https://developers.openai.com/docs/models#transcription).

Default model varies by SDK:

- Python: `gpt-4o-mini-transcribe`
- Node.js: `gpt-realtime-whisper`

- **`language`** _(LanguageCode)_ (optional) - Default: `en`: [Language code](https://docs.livekit.io/agents/models/stt.md#language-codes) for the input audio. See OpenAI's documentation for a list of [supported languages](https://developers.openai.com/docs/guides/speech-to-text#supported-languages).

- **`use_realtime`** _(bool)_ (optional): Controls whether the plugin streams transcription over a WebSocket connection to the OpenAI Realtime API. When `False`, the plugin sends audio to the REST transcription API instead. In Node.js, use `useRealtime`.

Default varies by SDK:

- Python: `True` for `gpt-realtime-whisper` and `gpt-live-transcribe`, and `False` for other models.
- Node.js: `true`. If you set `useRealtime` to `false` and don't set `model`, the plugin uses `whisper-1`.

- **`vad`** _(VAD)_ (optional): VAD for client-side end-of-speech detection with `gpt-realtime-whisper` and `gpt-live-transcribe`, which don't support server-side turn detection. If you don't set it, the plugin uses the default VAD. Pass `None` in Python or `null` in Node.js to turn this off and commit the audio yourself.

- **`temperature`** _(float)_ (optional): Sampling temperature that controls the randomness of the model's output. Higher values make the output more random, while lower values make it more focused and deterministic. Range of valid values can vary by model.

Valid values are between `0` and `1`. Realtime transcription doesn't support this parameter. If realtime transcription is active, the plugin ignores the value and logs a warning.

Realtime transcription is on by default as follows:

- Python: only for `gpt-realtime-whisper` and `gpt-live-transcribe`.
- Node.js: for all models. Set `useRealtime` to `false` to use this parameter.

## Additional resources

The following resources provide more information about using OpenAI with LiveKit Agents.

- **[OpenAI docs](https://developers.openai.com/docs/guides/speech-to-text)**: OpenAI STT docs.

- **[Voice AI quickstart](https://docs.livekit.io/agents/start/voice-ai.md)**: Get started with LiveKit Agents and OpenAI STT.

- **[OpenAI ecosystem guide](https://docs.livekit.io/agents/integrations/openai.md)**: Overview of the entire OpenAI and LiveKit Agents integration.

---

This document was rendered at 2026-12-06T22:08:43.536Z.
For the latest version of this document, see [https://docs.livekit.io/agents/models/stt/openai.md](https://docs.livekit.io/agents/models/stt/openai.md).

To explore all LiveKit documentation, see [llms.txt](https://docs.livekit.io/llms.txt).