~/.codex/config.toml. Requests appear in Traces automatically.
Prerequisites
- Codex CLI installed
- Active Orq.ai account with AI Gateway access
- Orq.ai API key
- Model enabled in AI Gateway → Supported Models
Setup
1
Export the API key
<your-orq-api-key> with an API key. This sets the variable for the current shell session. To persist it across sessions, add the line to ~/.zshrc or ~/.bashrc.2
Create or edit ~/.codex/config.toml
Create Replace
~/.codex/config.toml if it does not exist. Add or merge the following keys. The top-level model and model_provider lines set the default; the [model_providers.orq] block registers the custom provider:openai/gpt-5.4 with the provider-prefixed model to use by default (e.g. anthropic/claude-sonnet-4-6). If a model key already exists in the file, replace it.3
Run Codex
codex without flags routes all calls through the AI Gateway using the model configured in ~/.codex/config.toml.Pass --model to override the model for a single invocation:Configuration Reference
Troubleshooting
Authentication error
Authentication error
Confirm
ORQ_API_KEY is exported in the shell running Codex. Run echo $ORQ_API_KEY to verify the value is set.Model not found
Model not found
The model must be enabled in AI Gateway → Supported Models before Codex can route to it. Check that the model ID in
config.toml uses the provider-prefixed format (e.g. openai/gpt-5.4, not gpt-4o).No Traces appearing in Orq.ai
No Traces appearing in Orq.ai
Confirm
base_url is https://api.orq.ai/v3/router and model_provider is set to the custom provider name (e.g. orq), not openai.Auto-review requests fail
Auto-review requests fail
With
approvals_reviewer = "auto_review" in ~/.codex/config.toml, Codex sends its internal model name codex-auto-review for automatic approval reviews. The AI Gateway resolves this name to openai/gpt-5.3-codex, so that model must be enabled in AI Gateway → Supported Models. To keep approval prompts interactive instead, set approvals_reviewer = "user" (the default).Verification
Send a prompt in Codex. The response appears in the terminal and the trace appears in Orq.ai Traces with the model identifier (e.g.openai/gpt-5.4).