外观
Codex CLI
Tokemula 默认模型 gpt-5.6-sol,Base URL https://api.tokemula.com/v1,协议为 Responses API。首次使用只输入 Tokemula API Key。
安装
macOS / Linux
bash
curl -fsSL https://chatgpt.com/codex/install.sh | sh
codex --versionWindows PowerShell
powershell
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
codex --version一键配置
一键配置
Codex CLI 一键配置
set -e
CODEX_DIR="$HOME/.codex"
BACKUP_DIR="$CODEX_DIR/backup-$(date +%Y%m%d-%H%M%S)"
mkdir -p "$CODEX_DIR" "$BACKUP_DIR"
[ ! -f "$CODEX_DIR/config.toml" ] || cp "$CODEX_DIR/config.toml" "$BACKUP_DIR/config.toml"
[ ! -f "$CODEX_DIR/.env" ] || cp "$CODEX_DIR/.env" "$BACKUP_DIR/.env"
read -r -s -p "请输入 Tokemula API Key: " TOKEMULA_KEY; echo
[ -n "$TOKEMULA_KEY" ] || { echo "错误:API Key 不能为空。"; exit 1; }
cat > "$CODEX_DIR/config.toml" <<EOF2
model = "gpt-5.6-sol"
model_provider = "tokemula"
[model_providers.tokemula]
name = "Tokemula"
base_url = "https://api.tokemula.com/v1"
env_key = "TOKEMULA_API_KEY"
wire_api = "responses"
requires_openai_auth = false
EOF2
printf 'TOKEMULA_API_KEY=%s
' "$TOKEMULA_KEY" > "$CODEX_DIR/.env"
chmod 600 "$CODEX_DIR/config.toml" "$CODEX_DIR/.env"
unset TOKEMULA_KEY
echo "配置完成。默认模型:gpt-5.6-sol"
echo "配置文件:$CODEX_DIR/config.toml"
echo "密钥文件:$CODEX_DIR/.env"
echo "备份目录:$BACKUP_DIR"脚本只会询问 Tokemula API Key;模型已自动固定。若已有配置,会先创建时间戳备份。
配置文件
toml
model = "gpt-5.6-sol"
model_provider = "tokemula"
[model_providers.tokemula]
name = "Tokemula"
base_url = "https://api.tokemula.com/v1"
env_key = "TOKEMULA_API_KEY"
wire_api = "responses"
requires_openai_auth = falseenv_key 是环境变量名称,不是实际 Key。
启动
macOS / Linux:
bash
cd ~/Documents/你的项目
codexWindows:
powershell
cd "C:\Users\你的用户名\Documents\你的项目"
codex验证
进入 Codex 后输入 /status,确认 Provider 为 tokemula。