Skip to content

Codex 手動設定

透過編輯 config.tomlauth.json 把 Codex 接到天樞。

前置:已完成 環境檢查與安裝,codex 能正常執行。

開啟設定目錄

text
按 Win + R,輸入路徑後回車:
%userprofile%\.codex
text
在訪達按 Command + Shift + G,輸入路徑後回車:
~/.codex

我們只需要兩個檔案:config.toml(核心設定)和 auth.json(金鑰)。首次安裝可能沒有這兩個檔案,需要手動建立。

設定 config.toml

把以下內容寫入 config.toml(model 請填 模型廣場 中你的 Codex 分組下的模型名):

toml
model_provider = "tianshu"
model = "gpt-5.2"
model_reasoning_effort = "high"
model_verbosity = "high"
network_access = "enabled"
disable_response_storage = true
windows_wsl_setup_acknowledged = true

[features]
web_search_request = true

[model_providers.tianshu]
name = "tianshu"
base_url = "https://tian-shu.org/v1"
wire_api = "responses"
requires_openai_auth = true

設定 auth.json

把以下內容寫入 auth.json,將 xxx 替換成你的天樞 Codex 分組權杖:

json
{
  "OPENAI_API_KEY": "xxx"
}

測試

在終端機執行:

bash
codex

出現對話介面並能正常回覆,即設定成功。

小貼士

  • 全域提示詞:在設定目錄建立 AGENTS.md,寫入你的全域工作規則(如「回答使用中文」),重啟 Codex 生效。
  • 常用命令、Windows 亂碼、VSCode 外掛等更多技巧見 常見問題 · Codex