Skip to content

fix(realtime): correct Azure transcription WS URL (intent=transcription, no deployment)#87

Merged
timcsy merged 1 commit into
mainfrom
044-realtime-azure-url-fix
Jun 12, 2026
Merged

fix(realtime): correct Azure transcription WS URL (intent=transcription, no deployment)#87
timcsy merged 1 commit into
mainfrom
044-realtime-azure-url-fix

Conversation

@timcsy

@timcsy timcsy commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Follow-up to #86. The admin「測試模型」按鈕真打暴露 Azure realtime URL 形態不對(HTTP 400)。用真憑證在 cluster 內探測(非 CI、非猜)定位並修正:

真實 Azure 回應(eastus2)

  • deployment=gpt-realtime-whisper 存在,但 URL 帶 deployment=HTTP 400 OperationNotSupported「realtime operation does not work with the specified model」(deployment= 路由到對話型 realtime session,轉錄模型不支援)。
  • 可用形態:/openai/realtime?api-version=2025-04-01-preview&intent=transcription(無 deployment=) → 連上即收 transcription_session.created。模型由 client 的 session.update(input_audio_transcription.model)指定。
  • 2024-10-01-preview 在此資源不行;2025-04-01-preview 可。

改動

  • _build_realtime_url:去掉 deployment=、保留 intent=transcription、預設 api-version 2025-04-01-preview(可用 env AZURE_REALTIME_API_VERSION 覆寫)。
  • open_realtime_ws:握手被拒時把 Azure 的 status + body 帶出來(壞 api-version/deployment 會顯實際訊息,不再是裸 400)——這個診斷正是定位本 bug 的關鍵。
  • realtime_smoke:改成純連線 + 等第一個 server 事件(session 連上即自動建立,不必送 session.update)。這讓測試按鈕通過。
  • _model_from_session_update:容忍轉錄形態(model 在 session.input_audio_transcription.model)。

驗證

全套件 744 passed;ruff+mypy 乾淨。新 URL+連線路徑已用真憑證對真 Azure 端點確認回 transcription_session.created

🤖 Generated with Claude Code

…ion, no deployment=, 2025-04-01-preview

Validated against the live Azure resource (eastus2) via in-cluster probe with the
real credential:
- The deployment `gpt-realtime-whisper` exists, but connecting with `deployment=` in
  the URL → HTTP 400 "OperationNotSupported: realtime operation does not work with the
  specified model" (deployment= routes to a *conversation* realtime session, which a
  transcription model can't do).
- The working form is `/openai/realtime?api-version=2025-04-01-preview&intent=transcription`
  (NO deployment=); Azure emits `transcription_session.created` immediately on connect.
  The model is selected by the client's session.update (input_audio_transcription.model).
- api-version 2024-10-01-preview does NOT work here; 2025-04-01-preview does.

Changes:
- _build_realtime_url: drop deployment=, keep intent=transcription, default api-version
  2025-04-01-preview (env-overridable AZURE_REALTIME_API_VERSION). OpenAI form unchanged.
- open_realtime_ws: surface the upstream handshake-rejection status+body (so a bad
  api-version / deployment shows Azure's actual message, not a bare HTTP 400).
- realtime_smoke: just connect + await the first server event (no session.update/append
  needed — the session is auto-created on connect). This is what made the test button work.
- _model_from_session_update: tolerant of the transcription shape (model in
  session.input_audio_transcription.model) + transcription_session.update type.

Full suite 744 passed; ruff+mypy clean. The exact URL+connect path was confirmed
returning transcription_session.created against the real Azure endpoint.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 12, 2026 15:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@timcsy timcsy merged commit e0e34d6 into main Jun 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants