№ 0869GitHub
codex-model-router
A ~90-line zero-dependency Node forwarder that lets OpenAI Codex switch between GPT and third-party models such as Meta Muse Spark just by model name.
codex-model-router
Use models from different providers in the same OpenAI Codex setup — switch between GPT and third-party models (e.g. Meta Muse Spark) just by picking a model name, with no config.toml edits and no app patching.
A ~90-line, zero-dependency Node.js forwarder on 127.0.0.1. Codex talks to it as its normal OpenAI endpoint; the router reads the "model" field of each request and forwards it, unchanged, to the matching provider with that provider's API key. Responses stream straight through.
Codex ──► http://127.0.0.1:4141/v1 (router) ──┬─ "muse-*" ─► api.meta.ai/v1 (META_API_KEY)
└─ anything ─► api.openai.com/v1 (your Codex OpenAI key, passed through)
Context: openai/codex#46484 (native multi-provider model switching). Today model_provider is global, so a custom provider and GPT models can't coexist in one model picker. This router is a no-patch workaround.
One-click install (Windows)
Prerequisites: Node.js in PATH, and your provider keys as user environment variables, e.g.:
[Environment]::SetEnvironmentVariable('META_API_KEY', '<your-meta-key>', 'User')
Then double-click install.cmd (or run powershell -ExecutionPolicy Bypass -File install.ps1). It:
- copies the router to
%LOCALAPPDATA%\codex-model-router - adds a hidden launcher
codex-model-router.vbsto your Startup folder (runs at login) - backs up
~/.codex/config.toml, then sets at the top:model_provider = "openai" openai_base_url = "http://127.0.0.1:4141/v1" # codex-model-router - starts the router and checks
http://127.0.0.1:4141/health
Restart the Codex app afterwards. Undo everything with uninstall.ps1.
Options: -Port 4141 -CodexHome <dir> -InstallDir <dir> -StartupDir <dir> -NoStart.
macOS/Linux: no installer yet — run node codex-router.js (e.g. via launchd/systemd) and add the two config lines above.
Adding a provider or model
1. Route — edit routes.json (in the install dir). First matching match prefix wins; "" is the catch-all.
[
{ "match": "muse-", "host": "api.meta.ai", "base": "/v1", "keyEnv": "META_API_KEY" },
{ "match": "", "host": "api.openai.com", "base": "/v1", "keyEnv": "OPENAI_API_KEY", "passthroughAuth": true





