Realtime: migrate to OpenAI GA shape (beta API was retired)

Upstream returned 'beta_api_shape_disabled' on every wake. Changes:
- Drop OpenAI-Beta: realtime=v1 header from the upgrade.
- session.update payload nests audio under session.audio.{input,output}
  and adds session.type='realtime'; audio.{input,output}.format is now
  an object {type:audio/pcm, rate:24000} instead of 'pcm16' string.
- Default model bumped to gpt-realtime (the GA name); the relay also
  promotes any stored 'gpt-4o-realtime-preview*' to gpt-realtime so
  pre-Plan-3 DeviceConfig rows keep working without a manual DB edit.
This commit is contained in:
2026-06-12 06:42:21 +00:00
parent d01b78b225
commit 7294a81a9a
4 changed files with 44 additions and 13 deletions
+7 -1
View File
@@ -130,8 +130,14 @@ public static class DeviceHubEndpoint
{
var enabledTools = JsonSerializer.Deserialize<string[]>(device.Config?.EnabledToolsJson ?? "[]")
?? Array.Empty<string>();
// Promote any deprecated Beta-era model name to the GA name. Plan 4's
// admin UI will let users set a specific value; until then, anything
// that mentions the old preview slug routes to gpt-realtime.
var model = device.Config?.Model ?? "gpt-realtime";
if (model.StartsWith("gpt-4o-realtime-preview", StringComparison.Ordinal))
model = "gpt-realtime";
var cfg = new RealtimeSettings(
Model: device.Config?.Model ?? "gpt-4o-realtime-preview",
Model: model,
Voice: device.Config?.Voice ?? "alloy",
SystemPrompt: device.Config?.SystemPrompt ?? "",
IdleTimeoutSeconds: device.Config?.IdleTimeoutSeconds ?? 30,