diff --git a/src-tauri/src/proxy/providers/auth.rs b/src-tauri/src/proxy/providers/auth.rs index 6bd9a02a5..04242eb25 100644 --- a/src-tauri/src/proxy/providers/auth.rs +++ b/src-tauri/src/proxy/providers/auth.rs @@ -124,7 +124,7 @@ pub enum AuthStrategy { /// /// - Header: `Authorization: Bearer ` /// - Header: `ChatGPT-Account-Id: ` (来自 forwarder 注入) - /// - Header: `originator: cc-switch` + /// - Header: `originator: codex_cli_rs` + `version: `(成对,后端按此做模型 cohort 路由) /// /// 使用动态获取的 OpenAI access_token(通过 Device Code 流程获取) CodexOAuth, diff --git a/src-tauri/src/proxy/providers/claude.rs b/src-tauri/src/proxy/providers/claude.rs index dbaffbb2e..bfde18b6f 100644 --- a/src-tauri/src/proxy/providers/claude.rs +++ b/src-tauri/src/proxy/providers/claude.rs @@ -24,6 +24,13 @@ const ANTHROPIC_REDACTED_THINKING_PLACEHOLDER: &str = "[redacted thinking]"; // Keep hints lowercase; matching lowercases only the input value. const REASONING_VENDOR_HINTS: &[&str] = &["moonshot", "kimi", "deepseek", "mimo", "xiaomimimo"]; +// ChatGPT Codex 后端按 originator+version 组合做模型 cohort 路由:非官方身份会把 +// gpt-5.6-luna 解析到未部署的内部引擎(HTTP 404 Model not found,openai/codex#31967, +// 本机 A/B 实测确认)。两个头必须成对发送,缺一即 404;version 需 ≥ 目标模型 +// catalog 的 minimal_client_version(luna=0.144.0),新模型抬门槛时同步 bump。 +const CODEX_OAUTH_ORIGINATOR: &str = "codex_cli_rs"; +const CODEX_OAUTH_CLIENT_VERSION: &str = "0.144.1"; + /// 获取 Claude 供应商的 API 格式 /// /// 供 handler/forwarder 外部使用的公开函数。 @@ -843,7 +850,11 @@ impl ProviderAdapter for ClaudeAdapter { (HeaderName::from_static("authorization"), hv(&bearer)?), ( HeaderName::from_static("originator"), - HeaderValue::from_static("cc-switch"), + HeaderValue::from_static(CODEX_OAUTH_ORIGINATOR), + ), + ( + HeaderName::from_static("version"), + HeaderValue::from_static(CODEX_OAUTH_CLIENT_VERSION), ), ] }