Configuring Codex CLI
Codex CLI is OpenAI’s coding agent that you can run locally from your terminal. It can read, change, and run code on your machine in the selected directory. It’s open source and built in Rust for speed and efficiency.
Use Codex through OriginRouter CLI
OriginRouter CLI provides a unified local entry point for Codex, connecting Cloud routes, model providers, session control, approvals, and cross-device collaboration. This path does not require manually installing Codex CLI or maintaining account credentials and configuration files.
For OriginRouter CLI installation and initialization, see CLI overview and install. If you prefer a graphical interface to start, view, and control Codex sessions, see Agent Control.
originrouter codex
Use OriginRouter Coding Plan through OriginRouter CLI for a 50% Credits deduction, easier model switching, and more advanced AI assistance. See quickstart for account sign-in and Cloud route initialization.
Manually install Codex CLI
Prerequisites
- You need to install Node.js 18 or higher
- macOS users are recommended to install Node.js via nvm or Homebrew
- On Windows, run Codex natively in PowerShell with Windows sandboxing, or use WSL2 when you need a native Linux environment. For setup details, see the Windows setup guide
Choose either method to install Codex CLI:
Choose an installation method
npm i -g @openai/codex
codex --version
Configure Codex CLI
Open the ~/.codex/auth.json configuration file and enter the API Key you obtained from the Developer Console using the following template:
{
"OPENAI_API_KEY": "$YOUR_API_KEY"
}
Open the ~/.codex/config.toml configuration file and, depending on your subscription plan, copy the matching template below verbatim:
config.toml
For users on the pay-as-you-go API plan. Requests are served via the /beta/v1 endpoint and billed per request.
model_provider = "originrouter"
model = "gpt-5.5-2026-04-23"
# 您可以替换为标准模型列表中的其他模型,也可以使用携带路由的模型 ID,例如:
# model = "gpt-5.5-2026-04-23:codex"
# 更多模型请参考 https://originrouter.com/console/#models
model_reasoning_effort = "high"
disable_response_storage = true
preferred_auth_method = "apikey"
[model_providers.originrouter]
name = "originrouter"
base_url = "https://api.easytransnote.com/beta/v1"
wire_api = "responses"
requires_openai_auth = true
With an OriginRouter One subscription, choose the corresponding Coding API endpoint and make sure the model ID comes from the Supported Models list; with the pay-as-you-go API plan, choose the corresponding Beta API endpoint and make sure the model ID comes from the Model List; a plan and endpoint mismatch may make models unavailable or result in unexpected billing.
Start Codex CLI
codex