Codex is an AI-powered coding agent from OpenAI that can run directly in your terminal and help automate software development tasks.
1.1 Usage
Codex CLI and the Codex IDE extension share the same config.toml system. For OpenAI-compatible endpoints, the safest approach is to define a custom provider and load the API key from an environment variable.
Method 1: User Config File (Recommended)
Edit ~/.codex/config.toml:
model = "your-model-name"
model_provider = "rygen"
[model_providers.rygen]
name = "Rygen API"
base_url = "https://api.rygen.io/v1"
env_key = "INFERENCE_API_KEY"
env_key_instructions = "Export INFERENCE_API_KEY before starting Codex"
wire_api = "responses"
request_max_retries = 4
stream_max_retries = 5
stream_idle_timeout_ms = 300000
# supports_websockets = falseStart Codex:
export INFERENCE_API_KEY="your-rygen-api-key"
codexMethod 2: Project Config
For project-specific configuration:
- Create:
<project>/.codex/config.toml - Add the same configuration as above
Note: Codex only loads project config for trusted projects
Method 3: Named Profile
Add a reusable profile in ~/.codex/config.toml:
[profiles.rygen]
model = "your-model-name"
model_provider = "rygen"Run with:
export INFERENCE_API_KEY="your-rygen-api-key"
codex --profile rygen1.2 Troubleshooting
| Issue | Fix |
|---|---|
| WebSocket errors | Add supports_websockets = false if endpoint doesn’t support it |
| Project config ignored | Trust the project or move config to ~/.codex/config.toml |

