Codex CLI with any model: the "codex router" setup in one config block OpenAI's Codex CLI can be configured to route requests to any model provider that implements the Responses API, using a single config block. An engineer at Opper demonstrates how to set up custom providers and profiles in ~/.codex/config.toml, enabling models like Claude Opus, Kimi K3, and Gemini to run inside Codex. The setup also supports EU-hosted models for compliance-sensitive clients. OpenAI's Codex CLI is a genuinely good coding agent, but out of the box it runs OpenAI models on OpenAI billing. Sometimes you want Claude Opus for a gnarly refactor, Kimi K2.7 Code for cheap long sessions, or a model served from EU infrastructure because your client asks where tokens go. What most people miss: Codex has custom providers built in. It speaks the Responses API to whatever base url you give it, so any gateway that implements the Responses API can act as the router behind Codex. No forks, no proxies, one config block. Codex reads ~/.codex/config.toml . Add a provider and a profile: model providers.opper name = "Opper" base url = "https://api.opper.ai/v3/compat" env key = "OPPER API KEY" wire api = "responses" profiles.opus model = "anthropic/claude-opus-4-7" model provider = "opper" profiles.kimi model = "moonshot/kimi-k3" model provider = "opper" I'm using Opper https://opper.ai here disclosure: I work there , an EU-hosted gateway with 700+ models behind one API key that implements the Responses API. Export the key and launch with a profile: export OPPER API KEY="your-key" codex --profile opus That's the whole router. Yes, that means Claude running inside OpenAI's own CLI, which never stops being funny. If you don't want to touch config files, the Opper CLI writes exactly that block for you with sentinel markers, so it never clobbers your existing config and can cleanly remove itself : npm install -g @opperai/cli opper launch codex It detects Codex installs it with --install if missing , configures the provider, and starts it with preset profiles. opper launch codex --model moonshot/kimi-k3 picks a model at launch. openai/gpt-5.3-codex anthropic/claude-opus-4-7 / claude-sonnet-4-6 moonshot/kimi-k3 alibaba:global/kimi-k2.7-code vertexai/gemini-3.7-flash-eu or Claude on European Vertex regions, if tokens staying in Europe is a requirement and not a preference.The full catalogue with per-model pricing, context windows and hosting regions is at opper.ai/models https://opper.ai/models . Every route is labeled with where it runs and what the retention posture is, which is the part my compliance-minded clients actually care about. wire api = "responses" . Chat-completions-only gateways need wire api = "chat" , which Codex also supports, but Responses is the native path and what I tested here.If you hit something weird with a specific model, tell me in the comments, I run this setup daily.