Skip to content
Skip to article
View as Markdown

Codex CLI

Configure a routing step that speaks the Responses API, such as OpenAI Codex (ChatGPT). Codex can send namespace tools even for a short prompt. A Chat Completions step cannot translate those tools. Provider reference.

From the shell with DODO_ROUTER_URL and DODO_ROUTER_API_KEY set, print the base URL for your configuration. Verify your router URL and key.

printf '%s/v1\n' "$DODO_ROUTER_URL"

In ~/.codex/config.toml, set the two top-level values before any table headers and add a provider table. Replace the example base_url with the literal URL printed above. env_key names the variable holding your router key. You can set model to your routing step's model ID so Codex can use its model metadata.

model_provider = "dodorouter"
model = "default"

[model_providers.dodorouter]
name = "DodoRouter"
base_url = "https://api.dodorouter.com/r/my-agent/v1"
env_key = "DODO_ROUTER_API_KEY"
wire_api = "responses"
supports_websockets = false

From a project directory, send a single prompt.

codex exec "Reply with the word pong."

In Logs, select your router and open the request containing that prompt. Its trace shows the serving model and provider. If Codex reports a disconnected stream, inspect the error on that request before retrying. An unsupported_responses_item error naming a namespace tool means the selected route needs a Responses-format provider. Responses API.

Compare DodoRouter with direct Codex

The repository includes a transport and prompt-cache probe. The direct path uses your Codex ChatGPT login. The routed path uses your router key. Configure both paths to use the same provider account, model and reasoning settings. For a local HTTPS proxy, set SSL_CERT_FILE to its trusted CA certificate. The runner applies this certificate only to the routed path.

Set DODO_COMPARE_MODEL to the model ID on your routing step. From the repository root, preview the test without sending requests.

node scripts/codex_compare.mjs --model "$DODO_COMPARE_MODEL" \
  --base-url "$DODO_ROUTER_URL/v1" --key-env DODO_ROUTER_API_KEY --dry-run

Remove --dry-run to send the comparison requests. Live runs consume provider quota and may incur charges. The default probe runs 16 CLI turns, alternates path order, resumes sessions and checks each answer. A turn times out after two minutes. Codex retries can create additional upstream requests.

The runner prints the directory containing results and raw CLI events. Compare initial turns and follow-ups separately. For per-turn usage, read last_token_usage from each saved Codex session's token_count events. On resumed sessions, turn.completed.usage can contain cumulative totals. Compare correctness, the ratio of cached input tokens to input tokens, and end-to-end elapsed time. Elapsed time includes CLI startup, and the transports can differ. In the router trace, confirm the actual model, fallback attempts and reasoning settings before attributing a difference to routing.