Skip to content

Step 1: 安装 Codex

使用 npm 进行安装

bash
npm install -g @openai/codex

Step 2: 配置文件

配置 config.toml

编辑文件 ~/.codex/config.toml

toml
model_provider = "bsf-ai"
# 可配置gpt-5或gpt-5-codex
model = "gpt-5.4"
# 可配置high medium low minimal
model_reasoning_effort = "high"
disable_response_storage = true

# bsf.ai 配置
[model_providers.bsf-ai]
name = "bsf.ai"
base_url = "https://api.bsf.ai/v1"
wire_api = "responses"
requires_openai_auth = true

[projects."/Users/chrischen/Library/Application Support/Orchids"]
trust_level = "trusted"

[projects."/Users/chrischen/code/docs-bsf-ai"]
trust_level = "trusted"

[notice.model_migrations]
gpt-5-codex = "gpt-5.4"

配置 auth.json

编辑文件 ~/.codex/auth.json

json
{
  "OPENAI_API_KEY": "替换为您的API Key"
}

Step 3: 使用最新 Codex 模型(可选)

方法一:通过命令切换

bash
codex -m gpt-5-codex

方法二:通过配置文件指定

~/.codex/config.toml 中设置:

toml
model = "gpt-5-codex"

Step 4: 开始使用

基本用法

  • 配置完成后,在终端中运行 codex 命令即可开始使用
  • 使用 codex --help 查看更多命令选项