feat(speech): make OpenAI realtime transcription URL configurable (#570)

Allow `OPENAI_REALTIME_URL` env var to override the hardcoded
`wss://api.openai.com/v1/realtime?intent=transcription` endpoint, with
the current value as default. Pairs with the OpenAI SDK's existing
`OPENAI_BASE_URL` support that already makes HTTP audio endpoints
reroutable. Unblocks pointing the realtime session at any OpenAI
Realtime API protocol-compatible backend (Azure OpenAI, Alibaba
Bailian / DashScope, self-hosted compat layers) without further
changes.

Closes #569

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yurui Zhou
2026-04-27 13:26:21 +08:00
committed by GitHub
parent 15df680a64
commit df49fbe0ac

View File

@@ -102,7 +102,8 @@ export class OpenAIRealtimeTranscriptionSession
this.closing = false;
this.ready = new Promise<void>((resolve, reject) => {
const url = "wss://api.openai.com/v1/realtime?intent=transcription";
const url =
process.env.OPENAI_REALTIME_URL ?? "wss://api.openai.com/v1/realtime?intent=transcription";
const ws = new WebSocket(url, {
headers: {
Authorization: `Bearer ${this.apiKey}`,