Skip to content

Codex 使用指南

这页先把账号和令牌准备好,再配置 Codex。

先准备什么

  • 一个可用的 Filifili API Key
  • 控制台给出的 Base URL
  • Node.js 18 或更高版本

Windows

  1. 安装 Codex:
bash
npm i -g @openai/codex --registry=https://registry.npmmirror.com
  1. 创建 C:\Users\你的用户名\.codex\config.toml
toml
model_provider = "custom"
model = "gpt-5.4"
model_reasoning_effort = "xhigh"
disable_response_storage = true

[model_providers.custom]
name = "filifili"
wire_api = "responses"
requires_openai_auth = true
base_url = "你的 Filifili Base URL/v1"
  1. 再创建 auth.json
json
{
  "OPENAI_API_KEY": "你的 Filifili API Key"
}
  1. 启动:
bash
codex

macOS

  1. 安装:
bash
npm install -g @openai/codex
  1. 写入环境变量:
bash
echo 'export OPENAI_BASE_URL="你的 Filifili Base URL/v1"' >> ~/.zshrc
echo 'export OPENAI_API_KEY="你的 Filifili API Key"' >> ~/.zshrc
source ~/.zshrc
  1. 启动:
bash
codex

Linux

  1. 安装:
bash
npm install -g @openai/codex
  1. 写入环境变量:
bash
echo 'export OPENAI_BASE_URL="你的 Filifili Base URL/v1"' >> ~/.bashrc
echo 'export OPENAI_API_KEY="你的 Filifili API Key"' >> ~/.bashrc
source ~/.bashrc
  1. 启动:
bash
codex

VS Code

如果你只打算在 VS Code 里使用 Codex,仍然遵循同样的思路:

  1. 先确认命令行可用。
  2. 再安装扩展。
  3. 最后把同一份 Base URL 和 API Key 填进去。

常见检查点

  • 模型名要和控制台里的别名一致。
  • 如果提示网络或鉴权失败,优先检查 base_urlOPENAI_API_KEY
  • 如果你改过 Base URL,先确认当前客户端读到的是哪一份配置。

如果你要配桌面工具

桌面端配置和 CLI 不是一套界面,但底层仍然是同一份网关信息。要么继续看 CC-Switch 快速配置,要么直接看对应客户端的配置页。

Filifili.com