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.1 Install Codex CLI

npm install -g @openai/codex
codex --version

2.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 utf8

2.3 Verify the setup

codex

Enter this test prompt:

Reply with: Codex gateway connection successful

3. macOS / Linux / WSL

3.1 Install Codex CLI

npm install -g @openai/codex
codex --version

Homebrew is also available on macOS:

brew install codex

3.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"
}
EOF

Replace YOUR_REACH_API_KEY with your actual key.

3.3 Verify the setup

codex

Enter this test prompt:

Reply with: Codex gateway connection successful

4. Troubleshooting

401 / 403 Authentication Failed

  • Check whether the key in auth.json is correct
  • Check whether the key has expired and whether it has access to the target model

404 / Not Found

  • Check whether base_url is https://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

On this page