记录一次配置

首先安装node.js

1
2
3
apt update 
apt install -y curl curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
apt-get install -y nodejs

验证是否安装成功

1
2
node -v 
npm -v

安装codex

1
2
npm i -g @openai/codex --registry=https://registry.npmmirror.com
codex --version

创建配置

1
2
3
mkdir -p ~/.codex
apt update && apt install -y nano
nano ~/.codex/config.toml

写以下的配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
model_provider = "OpenAI" 
model = "gpt-5.4"
model_reasoning_effort = "xhigh"
disable_response_storage = true
approval_policy = "never"
sandbox_mode = "workspace-write"
personality = "pragmatic"
web_search = "live"
suppress_unstable_features_warning = true
[
features
]
plan_tool = true
apply_patch_freeform = true
view_image_tool = true
unified_exec = false
streamable_shell = false
rmcp_client = true
[
model_providers.OpenAI
]
name = "OpenAI"
base_url = "https://api.hanbbq.top/v1"
wire_api = "responses"
requires_openai_auth = true
[
sandbox_workspace_write
]
network_access = true

创建api的key文件
nano ~/.codex/auth.json

1
2
3
{ 
"OPENAI_API_KEY": "your-api-key-here"
}

codex chat验证是否成功