Versions
@livekit/agents-plugin-openai 1.4.4 (code unchanged on current main: plugins/openai/src/stt.ts)
Behavior
With useRealtime: true (the default for realtime-capable models), the OpenAI realtime transcription session dies immediately after session.update with:
{"type":"error","error":{"type":"invalid_request_error","code":"invalid_model",
"message":"Model \"gpt-4o-mini-transcribe\" is not supported in transcription mode."}}
followed by ws close 4000 reason=invalid_request_error.invalid_model. Every transcription model fails the same way (gpt-4o-transcribe, gpt-4o-mini-transcribe, whisper-1), so realtime STT via this plugin currently produces zero transcripts.
Root cause
buildRealtimeSttUrl appends the model to the websocket URL:
url.searchParams.set('intent', 'transcription');
url.searchParams.set('model', model);
As of 2026-06, OpenAI's realtime endpoint treats a ?model= query param as selecting a conversation session; the subsequent transcription-mode session.update is then rejected for any transcription model. Verified directly against wss://api.openai.com/v1/realtime?intent=transcription:
- Without
&model=...: identical session.update → session.updated, and audio streams transcribe correctly (deltas + completed events)
- With
&model=...: the invalid_model error above, for every model tried
The model is already conveyed in the documented place for transcription sessions — session.update → audio.input.transcription.model — so the URL param is redundant.
Repro (raw ws, isolates the param)
const ws = new WebSocket('wss://api.openai.com/v1/realtime?intent=transcription&model=gpt-4o-mini-transcribe',
{ headers: { Authorization: `Bearer ${process.env.OPENAI_API_KEY}` } });
ws.on('open', () => ws.send(JSON.stringify({ type: 'session.update', session: { type: 'transcription', audio: { input: {
format: { type: 'audio/pcm', rate: 24000 },
transcription: { model: 'gpt-4o-mini-transcribe', language: 'en' },
turn_detection: { type: 'server_vad', threshold: 0.5, prefix_padding_ms: 600, silence_duration_ms: 350 },
} } } })));
ws.on('message', (d) => console.log(String(d)));
// → error invalid_model + close 4000. Remove `&model=...` from the URL → session.updated + working transcription.
Suggested fix
Drop url.searchParams.set('model', model) from buildRealtimeSttUrl (keep intent=transcription). We've been running this as a one-line dist patch in production and realtime transcription works correctly.
Aggravating factor
The failure is completely silent at default log levels: the plugin throws a plain Error (not APIError, so the base class doesn't retry/log it), the base stt class emits error on the STT instance — and an application without an error listener gets an ERR_UNHANDLED_ERROR inside a floating promise, which the job child process logs at DEBUG. The stream then drains cleanly, so the app just sees zero transcription events. A logger.warn on the realtime ws error path (like the Deepgram plugin's retry logging) would make this class of failure visible.
Versions
@livekit/agents-plugin-openai1.4.4 (code unchanged on currentmain:plugins/openai/src/stt.ts)Behavior
With
useRealtime: true(the default for realtime-capable models), the OpenAI realtime transcription session dies immediately aftersession.updatewith:{"type":"error","error":{"type":"invalid_request_error","code":"invalid_model", "message":"Model \"gpt-4o-mini-transcribe\" is not supported in transcription mode."}}followed by ws close
4000 reason=invalid_request_error.invalid_model. Every transcription model fails the same way (gpt-4o-transcribe,gpt-4o-mini-transcribe,whisper-1), so realtime STT via this plugin currently produces zero transcripts.Root cause
buildRealtimeSttUrlappends the model to the websocket URL:As of 2026-06, OpenAI's realtime endpoint treats a
?model=query param as selecting a conversation session; the subsequent transcription-modesession.updateis then rejected for any transcription model. Verified directly againstwss://api.openai.com/v1/realtime?intent=transcription:&model=...: identicalsession.update→session.updated, and audio streams transcribe correctly (deltas + completed events)&model=...: theinvalid_modelerror above, for every model triedThe model is already conveyed in the documented place for transcription sessions —
session.update → audio.input.transcription.model— so the URL param is redundant.Repro (raw ws, isolates the param)
Suggested fix
Drop
url.searchParams.set('model', model)frombuildRealtimeSttUrl(keepintent=transcription). We've been running this as a one-line dist patch in production and realtime transcription works correctly.Aggravating factor
The failure is completely silent at default log levels: the plugin throws a plain
Error(notAPIError, so the base class doesn't retry/log it), the basesttclass emitserroron the STT instance — and an application without anerrorlistener gets anERR_UNHANDLED_ERRORinside a floating promise, which the job child process logs at DEBUG. The stream then drains cleanly, so the app just sees zero transcription events. Alogger.warnon the realtime ws error path (like the Deepgram plugin's retry logging) would make this class of failure visible.