Codex CLI uses OpenAI-style APIs. Configure a custom provider that points to ModRouter.

Endpoint

Codex should use an OpenAI-compatible base URL that includes /v1:
Set MODROUTER_BASE_URL in the shell or config-management system that writes your Codex config.

Setup

Put provider configuration in your user-level Codex config, commonly ~/.codex/config.toml:
If you route Codex to non-OpenAI models, disable WebSocket-only behavior in Codex versions that support that switch:

Models

Use explicit ModRouter model IDs:
Codex relies on tool calling for editing and shell workflows. Pick models that can reliably produce tool calls in OpenAI-compatible format.