Skip to content

fix: 中转 gpt-realtime 系列 GA 模型时不再发送 realtime beta 标识 - #6032

Merged
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
feitianbubu:pr/b4cb4a6b6
Jul 20, 2026
Merged

fix: 中转 gpt-realtime 系列 GA 模型时不再发送 realtime beta 标识#6032
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
feitianbubu:pr/b4cb4a6b6

Conversation

@feitianbubu

@feitianbubu feitianbubu commented Jul 9, 2026

Copy link
Copy Markdown
Member

📝 变更描述 / Description

OpenAI 已经下线 Realtime Beta API。现在网关中转 /v1/realtime 时无条件给上游带 OpenAI-Beta: realtime=v1会导致最新的正式模型报错

改法:只有模型名含 -realtime-preview 的遗留 beta 模型才携带该标识,GA 模型走正常请求

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix)
  • ✨ 新功能 (New feature)
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 Issues 与 PRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 `Bug fix`,我已提交或关联对应 Issue。
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

修复前,OpenAI SDK 直连网关 /v1/realtime?model=gpt-realtime-2.1-mini,上游立刻断连:
image

修复后: 实时语音识别正常:
image

Summary by CodeRabbit

  • New Features
    • Added support for additional realtime model variants.
  • Bug Fixes
    • Improved WebSocket connection handling so beta negotiation details are only sent when needed for legacy realtime models.
    • Reduced the chance of connection issues with newer realtime models by avoiding unnecessary beta headers.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The realtime WebSocket header setup now conditionally applies OpenAI beta protocol markers only for legacy -realtime-preview models, rather than unconditionally. Additionally, three new realtime model identifiers (gpt-realtime-2, gpt-realtime-2.1, gpt-realtime-2.1-mini) were added to the exported ModelList.

Changes

Realtime model support update

Layer / File(s) Summary
Legacy beta header gating and new model entries
relay/channel/openai/adaptor.go, relay/channel/openai/constant.go
SetupRequestHeader now checks for -realtime-preview in the model name to decide whether to include openai-beta.realtime-v1 / openai-beta: realtime=v1 headers, and ModelList gains three new realtime model entries.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • QuantumNous/new-api#3221: Both PRs modify OpenAI's exported ModelList in relay/channel/openai/constant.go by adding/reworking realtime model identifiers.

Suggested reviewers: seefs001

Poem

A hop, a header, a model or three,
Beta whispers now gated with glee,
Legacy previews get their old due,
While new realtime friends join the queue,
This rabbit thumps twice for the code review! 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了本次对 gpt-realtime GA 模型握手中不再发送 beta 标识的主要改动。
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Calcium-Ion
Calcium-Ion merged commit 16bfae1 into QuantumNous:main Jul 20, 2026
2 checks passed
JacksonsY added a commit to JacksonsY/new-api that referenced this pull request Jul 22, 2026
同步上游 10 个提交(至 1721144),重点整合:

- QuantumNous#6329 鉴权重构:dashboard 会话全面改为无状态 token(access/refresh
  + 版本栅栏 + 会话管理),gin session 全部移除。fork 侧适配:
  - turnstile 一次性消费改为按 token 键控内存缓存(兼容发码+注册两步流)
  - TRUSTED_PROXY_CIDRS 作为 TRUSTED_PROXIES 的兼容别名保留
  - UserBase/ToBaseUser 保留 ParentId(子号计费),补 AuthVersion/CacheSchema
  - OAuth 绑定改 flow_token 流,保留 GitHub 账号年龄门禁(消费 flow 后校验)
  - RecordUserIP 反欺诈埋点移入 setupLoginAtAuthVersion
  - 子号/代理鉴权门(SubPermission/RejectSubAccount/AgentAuth)原样保留
  - profile 嫁接上游 LoginSessionsCard(会话管理 UI),绑定卡接入
    popup+postMessage 新绑定机制
  - 2FA/OAuth/微信登录后 redirect 目标经 handleLoginSuccess 传递恢复
- web/default → web/ 扁平化 + 删除 classic 主题:fork 全部前端定制
  (agent/supplier/detector/sub-account 等 180+ 文件)迁移至新路径,
  保留 fork 的 i18n 按需加载、每表分页记忆、主题调校与设计系统
- QuantumNous#6157 渠道代理客户端重构(别名缓存+失效清理),保留 fork 全局代理
  与 RELAY_DISABLE_HTTP2;QuantumNous#6074 suno CAS 防重复退款;QuantumNous#6163 playground
  自动分组;QuantumNous#6224 无限额度密钥显示已用量;QuantumNous#6032 realtime GA 去 beta 头
- 语言文件三方合并:fork ~6280 键 + 上游新增 55 键鉴权文案
- fork 刻意删除的组件与 workflows 维持删除(上次合并曾误恢复)

验证:go build/test 全绿,前端 tsgo 类型检查与 rsbuild 构建通过。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
zhaodechao2008 pushed a commit to zhaodechao2008/new-api that referenced this pull request Jul 27, 2026
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