Loading layout…
Codex 使用指南 | Let AI RunCodex 使用指南
本文介绍如何在 macOS 和 Windows 上安装 OpenAI Codex,并通过 Let AI Run 进行模型调用。
1. 准备 API Key
你需要先准备一个可用的 Let AI Run Key(示例以 sk- 开头),后续会写入 auth.json。
2. macOS 安装
brew install codex
如果本机已有 Node.js,也可以使用 npm 全局安装:
npm install -g @openai/codex
3. macOS 配置
先创建隐藏目录(注意目录名包含前缀 .):
mkdir -p ~/.codex
在 ~/.codex/config.toml 写入:
model_provider = "letairun"
model = "gpt-5.4"
model_reasoning_effort = "xhigh"
disable_response_storage = true
network_access = "enabled"
model_verbosity = "high"
[model_providers.letairun]
name = "letairun"
base_url = "https://api.letai.run/v1"
wire_api = "responses"
requires_openai_auth = true
[features]
fast_mode = false
prevent_idle_sleep = true
streamable_shell = false
{
"OPENAI_API_KEY": "your-api-key-here"
}
将 your-api-key-here 替换为你的真实 API Key。
4. Windows 安装
- 安装 Node.js:
https://nodejs.org/zh-cn/download/current
- 安装 Codex:
npm install -g @openai/codex
5. Windows 配置
在 %USERPROFILE%\\.codex\\config.toml 写入:
model_provider = "letairun"
model = "gpt-5.4"
model_reasoning_effort = "xhigh"
disable_response_storage = true
network_access = "enabled"
windows_wsl_setup_acknowledged = true
model_verbosity = "high"
[model_providers.letairun]
name = "letairun"
base_url = "https://api.letai.run/v1"
wire_api = "responses"
requires_openai_auth = true
[features]
fast_mode = false
prevent_idle_sleep = true
streamable_shell = false
同时创建 %USERPROFILE%\\.codex\\auth.json:
{
"OPENAI_API_KEY": "your-api-key-here"
}
6. 启动方式
- 终端:运行
codex
- VSCode / Cursor:安装 OpenAI 官方
Codex 扩展后即可使用
7. 常见排查
- 输入
codex 提示命令不存在:
- 检查是否安装成功。
- 使用
npm 安装时,确认全局安装目录已加入 PATH。
- 提示认证失败:
- 检查
auth.json 文件名和路径是否正确。
- 确认
OPENAI_API_KEY 的值不是示例占位符。
- 请求未走 Let AI Run:
- 检查
config.toml 中 base_url 是否为 https://api.letai.run/v1。