ChatGPT/Codex 桌面端 GPT-5.6 模型菜单修复说明

适用场景:后端或中转站已经支持 OpenAI 新模型 gpt-5.6-*~/.codex/config.tomlcodex debug models 也能看到 5.6,但 ChatGPT/Codex 桌面端模型菜单仍只显示:

  • GPT-5.5
  • GPT-5.4
  • GPT-5.4 Mini
  • GPT-5.2

根因

桌面端前端还有一层模型白名单过滤。即使 app-server 的 model/list 已经返回:

  • gpt-5.6-sol
  • gpt-5.6-terra
  • gpt-5.6-luna

前端仍可能根据远程动态配置里的旧 available_models 白名单过滤菜单,导致 5.6 不显示。

关键逻辑在 app.asar 里的前端 bundle 中,类似:

l=o&&e!==`amazonBedrock`

use_hidden_models/白名单门控开启时,它会只显示旧白名单里的模型。把这里改成恒为 false 后,模型菜单会直接展示 app-server 返回的非隐藏模型,5.6 就会出现。

一键修复脚本

在任意工作目录创建文件 patch-chatgpt-model-picker-gpt56.js

#!/usr/bin/env node

const fs = require("node:fs");

const asarPath =
  process.argv[2] || "/Applications/ChatGPT.app/Contents/Resources/app.asar";

const oldText = "l=o&&e!==`amazonBedrock`,u=a.some";
const newText = "l=false                 ,u=a.some";

if (Buffer.byteLength(oldText) !== Buffer.byteLength(newText)) {
  throw new Error("Internal patch error: replacement must be byte-for-byte equal length.");
}

const oldBytes = Buffer.from(oldText);
const newBytes = Buffer.from(newText);
const buffer = fs.readFileSync(asarPath);

const matches = [];
let offset = 0;
while ((offset = buffer.indexOf(oldBytes, offset)) !== -1) {
  matches.push(offset);
  offset += oldBytes.length;
}

if (matches.length === 0) {
  if (buffer.indexOf(newBytes) !== -1) {
    console.log("Patch already applied:", asarPath);
    process.exit(0);
  }
  throw new Error("Patch target was not found. The app bundle may have changed.");
}

if (matches.length !== 1) {
  throw new Error(`Expected exactly one patch target, found ${matches.length}.`);
}

const backupPath = `${asarPath}.bak-gpt56-${new Date()
  .toISOString()
  .replace(/[-:T.Z]/g, "")
  .slice(0, 14)}`;

fs.copyFileSync(asarPath, backupPath, fs.constants.COPYFILE_EXCL);
newBytes.copy(buffer, matches[0]);
fs.writeFileSync(asarPath, buffer);

console.log("Patched:", asarPath);
console.log("Backup:", backupPath);
console.log("Restart ChatGPT completely, then reopen the model menu.");

然后运行:

osascript -e 'quit app "ChatGPT"'
node ./patch-chatgpt-model-picker-gpt56.js
open -a ChatGPT

如果提示没有权限,使用:

osascript -e 'quit app "ChatGPT"'
sudo node ./patch-chatgpt-model-picker-gpt56.js
open -a ChatGPT

验证

打开模型菜单后应能看到:

  • GPT-5.6-Sol
  • GPT-5.6-Terra
  • GPT-5.6-Luna

也可以用命令确认后端模型目录本身是正常的:

/Applications/ChatGPT.app/Contents/Resources/codex debug models | grep 'gpt-5.6'

回滚

脚本会自动生成备份,例如:

/Applications/ChatGPT.app/Contents/Resources/app.asar.bak-gpt56-YYYYMMDDHHMMSS

需要回滚时:

osascript -e 'quit app "ChatGPT"'
sudo cp "/Applications/ChatGPT.app/Contents/Resources/app.asar.bak-gpt56-YYYYMMDDHHMMSS" "/Applications/ChatGPT.app/Contents/Resources/app.asar"
open -a ChatGPT

YYYYMMDDHHMMSS 换成实际备份文件名。

注意事项

  • ChatGPT/Codex 桌面端更新后,app.asar 可能会被覆盖,需要重新运行补丁。
  • 如果脚本报 Patch target was not found,说明新版前端 bundle 代码变了,需要重新搜索模型过滤逻辑。
  • 这个补丁只影响模型菜单显示过滤,不会修改 ~/.codex/config.toml、API key、中转站地址或模型缓存。
  • 官方 5.6 菜单项不是单独的 GPT-5.6,而是 GPT-5.6-SolGPT-5.6-TerraGPT-5.6-Luna
posted @ 2026-08-05 22:50  梧桐鹿  阅读(16)  评论(0)    收藏  举报