Integrations
Codex Integration
This guide explains how to use Codex CLI with the ReachAPI gateway.
Example gateway URL used in this guide: https://direct.reachapi.ai/v1
Note: The instructions below were compiled from the official OpenAI Codex documentation reviewed on 2026-04-17.
1. Prerequisites
Before you begin, make sure that:
- You already have a valid ReachAPI key, for example
sk-xxxxxx - The gateway supports the Responses API
- Node.js is installed on your machine, preferably an LTS release
2. Windows (PowerShell recommended)
2.1 Install Codex CLI
npm install -g @openai/codex
codex --version2.2 Write the configuration in one step
# Create directory
New-Item -ItemType Directory -Force "$HOME\.codex" | Out-Null
# Create config.toml
@'
model_provider = "reachapi"
model = "gpt-5.4"
model_reasoning_effort = "high"
disable_response_storage = true
preferred_auth_method = "apikey"
[model_providers.reachapi]
name = "reachapi"
base_url = "https://direct.reachapi.ai/v1"
wire_api = "responses"
requires_openai_auth = true
'@ | Set-Content -Path "$HOME\.codex\config.toml" -Encoding utf8
# Create auth.json
@'
{
"OPENAI_API_KEY": "YOUR_REACH_API_KEY"
}
'@ | Set-Content -Path "$HOME\.codex\auth.json" -Encoding utf82.3 Verify the setup
codexEnter this test prompt:
Reply with: Codex gateway connection successful3. macOS / Linux / WSL
3.1 Install Codex CLI
npm install -g @openai/codex
codex --versionHomebrew is also available on macOS:
brew install codex3.2 Write the configuration in one step
mkdir -p ~/.codex
# Create config.toml
cat > ~/.codex/config.toml << 'EOF'
model_provider = "reachapi"
model = "gpt-5.4"
model_reasoning_effort = "high"
disable_response_storage = true
preferred_auth_method = "apikey"
[model_providers.reachapi]
name = "reachapi"
base_url = "https://direct.reachapi.ai/v1"
wire_api = "responses"
requires_openai_auth = true
EOF
# Create auth.json
cat > ~/.codex/auth.json << 'EOF'
{
"OPENAI_API_KEY": "YOUR_REACH_API_KEY"
}
EOFReplace
YOUR_REACH_API_KEYwith your actual key.
3.3 Verify the setup
codexEnter this test prompt:
Reply with: Codex gateway connection successful4. Troubleshooting
401 / 403 Authentication Failed
- Check whether the key in
auth.jsonis correct - Check whether the key has expired and whether it has access to the target model
404 / Not Found
- Check whether
base_urlishttps://direct.reachapi.ai/v1 - Check whether
wire_api = "responses"is set correctly
model not found
- Change
model = "gpt-5.4"to a model ID that is actually enabled on your gateway
Windows Command Issues
- PowerShell is recommended
- If you see permission or execution-policy errors, try running PowerShell as Administrator
5. Official References
- Codex Quickstart: https://developers.openai.com/codex/quickstart
- Codex Authentication: https://developers.openai.com/codex/auth
- Codex Config Basics: https://developers.openai.com/codex/config-basic
- Codex Configuration Reference: https://developers.openai.com/codex/config-reference
- OpenAI Codex GitHub README: https://github.com/openai/codex