fix(realtime): correct Azure transcription WS URL (intent=transcription, no deployment)#87
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #86. The admin「測試模型」按鈕真打暴露 Azure realtime URL 形態不對(HTTP 400)。用真憑證在 cluster 內探測(非 CI、非猜)定位並修正:
真實 Azure 回應(eastus2)
deployment=gpt-realtime-whisper存在,但 URL 帶deployment=→ HTTP 400OperationNotSupported「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-version2025-04-01-preview(可用 envAZURE_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