fix(ai-openai): migrate WebRTC realtime adapter to OpenAI GA API#699
fix(ai-openai): migrate WebRTC realtime adapter to OpenAI GA API#699amitsaroj wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe adapter updates address OpenAI's deprecated Beta realtime API and session event initialization. The SDP exchange endpoint migrates from the Beta shape using a model query parameter to the GA ChangesOpenAI Realtime Adapter Fixes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🎯 Changes
Fixes #586
Migrates the
@tanstack/ai-openaiWebRTC realtime adapter from the deprecated OpenAI Beta realtime API to the GA (generally available) API. OpenAI deprecated the Beta realtime endpoint on 2026-05-12, causing allopenaiRealtime()connections to fail withbeta_api_shape_disabled.Root Cause
Two GA-shape mismatches in
packages/ai-openai/src/realtime/adapter.ts:1. Wrong SDP-exchange endpoint (connection fails immediately)
The Beta API used
/v1/realtime?model=<model>for WebRTC SDP negotiation. OpenAI's GA API uses/v1/realtime/calls.2. Missing
session.typeinupdateSession(session config silently rejected)The GA API requires
session.typeon everysession.updateevent. Without it, the server rejects the update withmissing_required_parameter: session.type, which means instructions, tools, and voice settings are never applied.Fix
Minimal two-line change, consistent with the issue reporter's verified local fix.
✅ Checklist
pnpm run test:pr.🚀 Release Impact
🧪 Test Plan
new RealtimeClient({ adapter: openaiRealtime(), ... }).connect()against OpenAI's live API.beta_api_shape_disabled400 error.session.updateis accepted (instructions, tools, and voice apply correctly).packages/ai-openai/tests/openai-adapter.test.tscover the session update shape.Summary by CodeRabbit