Codex CLI setup guide (pending verification)
Configure a custom model provider and Responses endpoint in Codex CLI, then verify a request.
Prerequisites
Pending verification. The configuration has been checked against client documentation and repository examples. End-to-end acceptance on the production line is pending. Update this status after acceptance.
Prepare the Codex CLI and an iRouter key. Ask your administrator to confirm Responses support for the chosen model and line. Record the client version with codex --version.
Configuration
Use the client’s official installation and update instructions. Complete environment setup, set the iRouter key, and preserve existing client configuration.
Merge this configuration into the user-level ~/.codex/config.toml, replacing <model-id> with an available model ID. On Windows, the directory is %USERPROFILE%\.codex. Save your existing configuration before editing.
model_provider = "irouter"
model = "<model-id>"
[model_providers.irouter]
name = "iRouter"
base_url = "https://gateway.irouter.io/v1"
env_key = "IROUTER_API_KEY"
wire_api = "responses"
requires_openai_auth = falseSet the key in the terminal that starts Codex.
export IROUTER_API_KEY='<your-irouter-api-key>'
codexUse the following in PowerShell.
$env:IROUTER_API_KEY = '<your-irouter-api-key>'
codexVerify
Start the CLI in a separate test directory and send a short message. Confirm a reply, then check the model and request in iRouter Usage details. Line acceptance should also cover streaming, tool calls, and multi-turn conversations. Record the client version and model ID.
Troubleshooting
For missing credentials, check that the current terminal sets the variable named by env_key. For endpoint or model errors, check /v1, the model ID, and Responses support. Use the user-level configuration file, as the client restricts provider settings in project-level files. Keep the default approval and sandbox settings and approve specific operations when prompted.
References
The official documentation describes provider fields, user-level configuration, and the protocol. Codex configuration reference · Advanced configuration