首先关闭 Codex 客户端,结束所有相关进程,并且删除缓存目录 %USERPROFILE%\.codex\cache

操作步骤

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
"user": {
"id": "",
"email": ""
},
"expires": "",
"account": {
"id": "",
"planType": "plus",
"structure": "personal",
},
"accessToken": "",
"authProvider": "openai",
"sessionToken": ""
}
  • 使用附录脚本转换为 Codex 能够识别的格式,形如
1
2
3
4
5
6
7
8
9
10
11
{
"auth_mode": "chatgpt",
"OPENAI_API_KEY": null,
"tokens": {
"id_token": "",
"access_token": "",
"refresh_token": "",
"account_id": ""
},
"last_refresh": ""
}
  • 将转换结果另存为 %USERPROFILE%\.codex\auth.json

  • 启动 Codex 客户端

附录

auth.json 格式转换脚本

1
python .\codex-auth.py .\input.json -o auth.json
1
node .\codex-auth.js .\input.json -o auth.json