feat(provider): 支持 ChatGPT 订阅认证与 OpenAI Codex - #1752
Draft
Ayuilos wants to merge 6 commits into
Draft
Conversation
Collaborator
|
不要提交功能性PR和大型PR,有需求可以提issue |
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.
概述
为 OpenAI Provider 增加 ChatGPT 订阅认证,使已有 ChatGPT 订阅的用户可以在 RikkaHub 中登录并使用 OpenAI Codex 模型。
背景与根因
原有 OpenAI Provider 仅支持 API Key,无法使用 ChatGPT 订阅访问 Codex 后端。Codex 后端还要求 Responses 请求启用流式传输,并且实际 SSE 响应可能不携带 Content-Type;OkHttp 默认 EventSource 会在解析事件前拒绝这类响应。
本 PR 增加独立的订阅认证状态和请求认证器,并只对官方 Codex 订阅请求启用缺失 Content-Type 的 SSE 兼容逻辑。
用户影响
用户可以在 OpenAI Provider 中选择“ChatGPT 订阅”,通过浏览器完成设备授权登录,加载可用 Codex 模型,并使用普通回复、流式回复和工具调用。第三方 OpenAI-compatible Provider 继续使用 API Key,不显示 ChatGPT 订阅选项。
验证
assembleDebug构建通过