Configure Codex CLI to use RedRouter's stateless Responses endpoint. This recipe has not been live-tested; the security-agent guide preserves separate, dated checks of specific client versions.
Install and add a profile
npm install -g @openai/codex
export REDROUTER_API_KEY="your-redrouter-api-key"
Add these tables to ~/.codex/config.toml, or to config.toml under your chosen CODEX_HOME. Merge with existing tables instead of creating duplicates:
[profiles.redrouter]
model = "red-cyber-1"
model_provider = "redrouter"
model_reasoning_summary = "none"
web_search = "disabled"
[model_providers.redrouter]
name = "RedRouter"
base_url = "https://redrouter.org/v1"
env_key = "REDROUTER_API_KEY"
wire_api = "responses"
requires_openai_auth = false
supports_websockets = false
request_max_retries = 0
stream_max_retries = 0
Use the profile for one invocation:
codex --profile redrouter \
-c features.shell_snapshot=false -c features.view_image=false \
exec --sandbox read-only \
"Read the README in this directory and summarize it. Do not run commands or edit files."
Expected result: Codex sends HTTP Responses requests to RedRouter and produces a source-based summary. It uses your RedRouter API credits. Your local Codex installation owns sandboxing and tool execution. The command disables shell-environment snapshots and image viewing for this text-only setup.
Keep the Responses boundary explicit
wire_api = "responses" is required for this client; a Chat Completions base alone cannot translate its requests. WebSockets are unavailable, so the recipe selects HTTP/SSE.
RedRouter translates ordinary functions, namespaced functions, and freeform tools to the selected model's tool-calling interface. Freeform grammar hints are not enforced. Hosted tools, uploaded files, stored response retrieval, previous_response_id, and server conversations are unavailable. The client must send the complete history, including tool calls and their matching results. Read the full Responses contract before building wrappers around Codex.
The selected red-cyber-1 model supports tools and structured output and is text-only. Disable or avoid image workflows. Reasoning effort and summary options are compatibility fields, not guaranteed model controls; see reasoning.
Diagnose failures
A missing REDROUTER_API_KEY fails authentication. A 400 can indicate an unsupported client feature; record the client version and consult compatibility. A 404 often indicates a base URL missing /v1, or a client trying a stored-resource route.
A response.incomplete event or max_output_tokens truncation is an incomplete agent turn. Shorten the task, reduce tool output, or choose appropriate catalog limits. Do not assume the client can recover automatically. The example disables provider retries so an interrupted generation cannot silently create repeated attempts; review production guidance before changing that choice.
References: official Codex CLI documentation and configuration reference.