Interface OpenAIRealtimeTranscriptionSTTConfig

Configuration for the OpenAIRealtimeTranscriptionSTT provider.

Per-session overrides go in StreamingSTTConfig.providerOptions: safetyIdentifier (string) and prompt (string).

interface OpenAIRealtimeTranscriptionSTTConfig {
    apiKey: string;
    baseUrl?: string;
    model?: string;
    turnDetection?: null | OpenAIRealtimeTurnDetection;
    prompt?: string;
    safetyIdentifier?: string;
    connectTimeoutMs?: number;
    maxRetries?: number;
    retryIntervalMs?: number;
    maxBufferedMs?: number;
    finalTimeoutMs?: number;
    usageIntervalMs?: number;
    rollover?: false | OpenAIRealtimeTranscriptionRollover;
    priority?: number;
    capabilities?: Partial<ProviderCapabilities>;
    healthProbe?: ((apiKey) => Promise<{
        ok: boolean;
        status: number;
        latencyMs: number;
    }>);
}

Properties

apiKey: string

OpenAI API key, or comma-separated keys rotated per session. Sent as a Bearer token on the upgrade.

baseUrl?: string

Realtime API WebSocket URL, without query parameters. A host other than api.openai.com (an OpenAI-compatible gateway) also gets the model as a model query parameter. The default health probe reads the models endpoint beside it: the same URL over HTTP(S), with a trailing /realtime replaced by /models.

Default Value

'wss://api.openai.com/v1/realtime'
model?: string

Transcription model.

Default Value

'gpt-4o-mini-transcribe'
turnDetection?: null | OpenAIRealtimeTurnDetection

Server turn detection, or null for none: the caller then ends each turn with flush(), which commits the buffer. Defaults to server turn detection with 600 ms of padding and 350 ms of silence (the LiveKit plugin's values; OpenAI's own defaults are 300 ms and 500 ms), and to null for gpt-live-transcribe and gpt-realtime-whisper, which accept no server turn detection.

prompt?: string

Context for the transcription model, such as vocabulary or the setting.

safetyIdentifier?: string

Stable, privacy-preserving identifier of the end user (for example a hash of an account id), sent as the OpenAI-Safety-Identifier header.

connectTimeoutMs?: number

Time a connection has to open and confirm its session update.

Default Value

10_000
maxRetries?: number

Reconnects allowed after consecutive failures before the session ends with an 'error'. The count resets after every final transcript and when a dropped connection had stayed open longer than connectTimeoutMs.

Default Value

3
retryIntervalMs?: number

Wait before each reconnect after the first, which waits 100 ms.

Default Value

2_000
maxBufferedMs?: number

Audio held while no connection can take it (a reconnect), in milliseconds; older audio is dropped first.

Default Value

10_000
finalTimeoutMs?: number

Longest wait for the finals of committed items in flush() and when a connection closes.

Default Value

5_000
usageIntervalMs?: number

Interval of 'usage' reports for open connections; 0 reports each connection once, when it closes.

Default Value

0

Rollover settings, or false to keep a single connection.

priority?: number

Chain priority. Lower values are tried first.

Default

15
capabilities?: Partial<ProviderCapabilities>

Optional capability overrides. Merged into defaultCapabilities().

healthProbe?: ((apiKey) => Promise<{
    ok: boolean;
    status: number;
    latencyMs: number;
}>)

Health probe, injectable for tests. Defaults to a GET of the models endpoint on the host baseUrl names (https://api.openai.com/v1/models when it is unset), with the key as a Bearer token.

Type declaration

    • (apiKey): Promise<{
          ok: boolean;
          status: number;
          latencyMs: number;
      }>
    • Parameters

      • apiKey: string

      Returns Promise<{
          ok: boolean;
          status: number;
          latencyMs: number;
      }>