Codex
Connect the Codex CLI to EasyRouteAPI with your own model and API key.
Choose a compatible model
Select an exact model ID from Models & pricing and check its Responses, streaming and tool-calling support. A Chat Completions endpoint alone is not enough for current Codex clients.
Create a dedicated API key with a spending limit and access to that model. A model route can be used after every candidate has been checked for the required capabilities.
Edit the user configuration
Back up and merge this configuration into ~/.codex/config.toml, or %USERPROFILE%\.codex\config.toml on Windows. Replace YOUR_MODEL_ID with the exact available model ID. Provider settings belong in the user configuration, not a repository’s .codex/config.toml.
model = "YOUR_MODEL_ID"
model_provider = "easyrouteapi"
[model_providers.easyrouteapi]
name = "EasyRouteAPI"
base_url = "https://easyrouteapi.com/v1"
env_key = "EASYROUTE_API_KEY"
wire_api = "responses"
requires_openai_auth = false
supports_websockets = falseSet the key on macOS or Linux
Run this example in Bash and paste your key at the hidden prompt. The key is not part of the saved command. It is passed to Codex through the current process environment and cleared when Codex exits.
read -rs -p 'EasyRouteAPI key: ' EASYROUTE_API_KEY
printf '\n'
export EASYROUTE_API_KEY
codex
unset EASYROUTE_API_KEYSet the key in Windows PowerShell
Works with Windows PowerShell 5.1 and PowerShell 7. Paste the key at the masked prompt. The finally block removes the temporary key after Codex exits. Environment variables remain readable to the process and its children; do not print or share them.
$secureKey = Read-Host "EasyRouteAPI key" -AsSecureString
try {
$env:EASYROUTE_API_KEY = [System.Net.NetworkCredential]::new("", $secureKey).Password
codex
} finally {
$secureKey.Dispose()
Remove-Variable secureKey
Remove-Item Env:EASYROUTE_API_KEY -ErrorAction SilentlyContinue
}Verify before coding
Start a new Codex session and run /status to inspect the model and provider. Send a small request, then check EasyRouteAPI Usage Logs. Test a harmless tool call before working on a real repository; a text response does not verify coding-tool compatibility.