cd /news/developer-tools/codex-cli-with-any-model-the-codex-r… · home topics developer-tools article
[ARTICLE · art-109950] src=dev.to ↗ pub= topic=developer-tools verified=true sentiment=↑ positive

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.

read2 min views5 publishedAug 25, 2026

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 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. 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.

── more in #developer-tools 4 stories · sorted by recency
── more on @openai 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/codex-cli-with-any-m…] indexed:0 read:2min 2026-08-25 ·