1. 引入
根据参考1,将"阿里云百炼Coding Plan"接入codex,配置完成后,启动codex时,报错如下:
(base) C:\Users\xxx>codex
Error loading config.toml: `wire_api = "chat"` is no longer supported.
How to fix: set `wire_api = "responses"` in your provider config.
More info: https://github.com/openai/codex/discussions/7782
in `model_providers.Model_Studio_Coding_Plan.wire_api`
该报错的原因,是因为较新版本codex,比如 0.123.0 ,已经不支持"阿里云百炼Coding Plan"的API的这种用法了。如果强行将 C:\Users\xxx\.codex\config.toml 中的配置修改,wire_api = "responses",则也会报错:
unexpected status 404 Not Found: Unknown error, url: https://coding.dashscope.aliyuncs.com/v1/responses
2. 解决方法
这个问题,本质上,是"阿里云百炼Coding Plan"的API不支持codex新版本的用法。所以将codex降级后就能使用,具体方法:
npm install -g @openai/codex@0.80.0
降级到 0.80.0,将C:\Users\xxx\.codex\config.toml 中的配置,设置:wire_api = "chat"。
codex启动后,也会报警如下,但不影响实际使用:
⚠ Support for the "chat" wire API is deprecated and will soon be removed. Update your model provider definition in
config.toml to use wire_api = "responses".
