OpenAI Codex 是基于 GPT 模型的高级代码生成 AI,专门针对编程任务进行了优化。它能够:
通过 i7Relay 中转服务,您可以在国内网络环境下稳定使用 OpenAI 服务。
# Ubuntu / Debian 用户
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo bash -
sudo apt-get install -y nodejs
node --version
# macOS 用户
sudo xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install node
node --version
确保 Node.js 版本 ≥ 18.0
提示:如果你之前安装过其他本地中转/代理工具,占用同一个端口可能导致冲突,建议停用或卸载后再继续。
npm i -g @openai/codex
codex -V
codex -m gpt-5-codex
在 ~/.codex/config.toml
文件中添加以下配置:
model_provider = "i7relay"
model = "gpt-5-codex"
model_reasoning_effort = "high"
disable_response_storage = true
preferred_auth_method = "apikey"
[model_providers.i7relay]
name = "i7relay"
base_url = "https://i7dc.com/api"
wire_api = "responses"
requires_openai_auth = true
# 这个地方指的是环境变量中env key的名字不要替换你个人中心的key,这个只是指定下面使用名字叫I7RELAY_KEY的环境变量
env_key = "I7RELAY_KEY"
在 ~/.codex/auth.json
文件中添加以下配置:
{
"OPENAI_API_KEY": null
}
再配置环境变量
export I7RELAY_KEY="你个人中心的key"
set I7RELAY_KEY=你个人中心的key
$env:I7RELAY_KEY="你个人中心的key"
开始使用 OpenAI Codex,让 AI 成为您的编程助手!🚀