feat(codex): declare gpt-5.6 context window for Claude Code takeover

- Update Codex OAuth presets to the gpt-5.6 family (haiku -> gpt-5.6-luna)
  and bump the custom Codex template default model
- Inject CLAUDE_CODE_MAX_CONTEXT_TOKENS / CLAUDE_CODE_AUTO_COMPACT_WINDOW
  (372000, the ChatGPT Codex catalog window with a ~353K effective budget,
  openai/codex#31860) into effective live settings so Claude Code stops
  assuming a 200K window and compacts before the upstream rejects the prompt
- Gate the injected defaults on every configured model being gpt-5.6*:
  gpt-5.5's upstream catalog oscillates between 272K and 372K and must not
  inherit them; explicit user values always win
- Strip the injected values on switch-away backfill (mirror-inverse of the
  injection conditions) so program defaults never harden into per-provider
  explicit values, and keep both keys out of the shared common-config snippet
This commit is contained in:
Jason
2026-07-12 23:20:55 +08:00
parent f15184edb0
commit 5c39dfbfbe
6 changed files with 458 additions and 6 deletions
+1 -1
View File
@@ -394,7 +394,7 @@ export const claudeDesktopProviderPresets: ClaudeDesktopProviderPreset[] = [
apiFormat: "openai_responses",
providerType: "codex_oauth",
requiresOAuth: true,
modelRoutes: brandedRoutes("gpt-5.5", "gpt-5.5", "gpt-5.4-mini"),
modelRoutes: brandedRoutes("gpt-5.6", "gpt-5.6", "gpt-5.6-luna"),
icon: "openai",
iconColor: "#000000",
},
+26 -4
View File
@@ -1227,10 +1227,32 @@ export const providerPresets: ProviderPreset[] = [
// base_url 由代理后端强制重写为 chatgpt.com/backend-api/codex
// 用户无需配置
ANTHROPIC_BASE_URL: "https://chatgpt.com/backend-api/codex",
ANTHROPIC_MODEL: "gpt-5.5",
ANTHROPIC_DEFAULT_HAIKU_MODEL: "gpt-5.4-mini",
ANTHROPIC_DEFAULT_SONNET_MODEL: "gpt-5.5",
ANTHROPIC_DEFAULT_OPUS_MODEL: "gpt-5.5",
ANTHROPIC_MODEL: "gpt-5.6",
ANTHROPIC_DEFAULT_HAIKU_MODEL: "gpt-5.6-luna",
ANTHROPIC_DEFAULT_SONNET_MODEL: "gpt-5.6",
ANTHROPIC_DEFAULT_OPUS_MODEL: "gpt-5.6",
// Claude Code falls back to a 200K context window for unrecognized
// non-Claude model ids. The ChatGPT Codex backend catalogs gpt-5.6
// at a 372K window with a ~353K effective budget (openai/codex#31860),
// not the 1.05M API window. Declare 372K for both knobs: Claude Code's
// built-in output reserve and compact buffer already keep the compact
// trigger below the effective budget.
CLAUDE_CODE_MAX_CONTEXT_TOKENS: "${CLAUDE_CODE_MAX_CONTEXT_TOKENS}",
CLAUDE_CODE_AUTO_COMPACT_WINDOW: "${CLAUDE_CODE_AUTO_COMPACT_WINDOW}",
},
},
templateValues: {
CLAUDE_CODE_MAX_CONTEXT_TOKENS: {
label: "Max Context Tokens",
placeholder: "372000",
defaultValue: "372000",
editorValue: "372000",
},
CLAUDE_CODE_AUTO_COMPACT_WINDOW: {
label: "Auto Compact Window",
placeholder: "372000",
defaultValue: "372000",
editorValue: "372000",
},
},
category: "third_party",
+1 -1
View File
@@ -14,7 +14,7 @@ export interface CodexTemplate {
*/
export function getCodexCustomTemplate(): CodexTemplate {
const config = `model_provider = "custom"
model = "gpt-5.5"
model = "gpt-5.6"
model_reasoning_effort = "high"
disable_response_storage = true