Published on

在 Claude Code 中使用 Codex Plan

Authors

前段时间由于 Claude 极高的费用和 Anthropic 公司非常不友好的价值观,我从 CC 切换到了 Codex,但是最近发现写代码还是 Claude Code 更胜一筹,并且听说 Chat-GPT 5.6 sol 接入Claude Code 效果不错,所以我尝试将我的 Chat GPT Plus Plan 接入 Claude Code 试一下。

目前使用结果:如果不是幻觉的话,我觉得 Cluade Code 接入 GPT 5.6 写代码确实好一点。


核心:CLI Proxy API

不管在什么平台上,都是安装命令即可,比如 MacOS:

brew install cliproxyapi
brew services start cliproxyapi

其他平台的可以查看文档:Quick Start | CLIProxyAPI

如果你现在有 Codex 可以运行,那么一切就太简单了,告诉他:

我现在在本地安装了 cliproxyapi,请你帮我做下 Api-key 配置,需要开启管理页面,告诉我登陆密码,并做下测试。

当 Codex 执行完成之后,登陆:http://localhost:8317/management.html?#/login

输入 Codex 输出的登陆密码,登陆。

进入页面之后,点击 Oauth 登陆,点击 Codex 认证,打开页面进行认证。

然后再进入 Codex,输入:

我现在已经验证了 Codex,帮我修改 Claude Code 配置,接入 cliproxyapi,模型使用 gpt-5.6 sol,思考模式使用 中档。

等待执行结束就可以在 Claude Code 中使用 Chat GPT 了。


如果需要手动修改,请参照官方文档,主要核心依旧是

  1. 找到 配置文件,Mac 上在 /opt/homebrew/etc/cliproxyapi.conf
  2. 修改 api-keys:
# API keys for authentication
api-keys:
  - "your-api-key-1"
  - "your-api-key-2"
  - "your-api-key-3"
  1. 填写 secret-key:
# Management API settings
remote-management:
  # Whether to allow remote (non-localhost) management access.
  # When false, only localhost can access management endpoints (a key is still required).
  allow-remote: false

  # Management key. If a plaintext value is provided here, it will be hashed on startup.
  # All management requests (even from localhost) require this key.
  # Leave empty to disable the Management API entirely (404 for all /v0/management routes).
  secret-key: ""
  1. 重启 cliproxyapi
  2. 使用 cc-switch 或者手动改 Claude Code 的配置,配置信息;重启 Claude 即可。
export ANTHROPIC_BASE_URL=http://127.0.0.1:8317
export ANTHROPIC_AUTH_TOKEN=<你设置的那个 API-Key>
# version 2.x.x
"ANTHROPIC_DEFAULT_OPUS_MODEL": "gpt-5.6-sol",
"ANTHROPIC_DEFAULT_OPUS_MODEL_NAME": "Codex GPT-5.6 Sol",

"ANTHROPIC_DEFAULT_SONNET_MODEL": "gpt-5.6-sol",
"ANTHROPIC_DEFAULT_SONNET_MODEL_NAME": "Codex GPT-5.6 Sol",

"ANTHROPIC_DEFAULT_HAIKU_MODEL": "gpt-5.4-mini",
"ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME": "Codex GPT-5.4 Mini",

"ANTHROPIC_CUSTOM_MODEL_OPTION": "gpt-5.6-sol",
"ANTHROPIC_CUSTOM_MODEL_OPTION_NAME": "Codex GPT-5.6 Sol",