Point Codex at any model with magpie
Models usually live in separate places: API keys, ChatGPT / Claude / Copilot logins, and each coding agent's own picker. magpie's job, per its website and Get started, is to keep providers in one local app and rewrite each agent's own config.
How this page was checked (2026-10-06): we re-read the official magpie docs and kept the 2026-09-24 screenshots. We did not run a comparative benchmark or an end-to-end gateway session.
Catalog entry: magpie. Related setup: Codex CLI, Claude Code.
What magpie is for
From the README and Get started:
- A local gateway on
127.0.0.1:3425that speaks OpenAI Chat, OpenAI Responses, Anthropic Messages, and Gemini, including streaming and tool calls. - One Agents list for installed tools. Clicking a model rewrites only the keys magpie needs in that agent's config (atomic write; comments and ordering kept).
- Subscriptions you sign in to inside magpie (Claude, ChatGPT, Cursor, Grok, Copilot, Devin, and others listed in current docs) become providers other agents can use. magpie says it does not copy a key for that path.
- Ollama and LM Studio: no API key.
- Keys you paste live in
~/.config/magpie/providers.json. magpie says it does not read keys from shell environment variables.
For Codex, the start guide says magpie writes ~/.codex/config.toml ([model_providers.magpie]) and ~/.codex/magpie-models.json, and leaves the ChatGPT sign-in alone.
Install and confirm the setup
Install only when you intend to use magpie on this machine:
curl -fsSL https://usemagpie.ai/install.sh | sh
Then, from a new terminal:
magpie help
magpie ls
magpie presets
Expected result: magpie ls lists agents magpie found. magpie presets lists vendor presets. Neither command needs a paid API key.
If you already run Ollama or LM Studio, the start guide says you can add them with no key. README example:
magpie provider add ollama
Troubleshooting:
- Command not found: reopen the terminal, or check the installer's printed PATH note. A missing CLI on PATH does not prove the desktop app is absent.
- Empty agent list: install Codex (or the agent you want) first, then run
magpie lsagain. - Do not paste production API keys into a tutorial. Do not treat an old screenshot of someone else's OpenRouter list as your live model count.
Point Codex at a model
After magpie is installed and at least one provider exists:
- Open Providers and add a preset, a subscription tile, or Ollama / LM Studio.
- Open Agents, select the Codex row, pick
provider/model. - Fully quit Codex, or start a new
codexsession. magpie's docs state a running session keeps the model it started with.
CLI equivalent from the README (sk-… needs a real vendor key; skip it unless you intend to pay that vendor):
magpie codex moonshot/kimi-k2.5
Screenshot from 2026-09-24 (not recaptured): Codex listing third-party models in its own picker.

Providers panel (2026-09-24 screenshot)
The panel below is the 2026-09-24 capture. Current docs still describe vendors and subscription tiles in one Providers list. Do not read the old "24 OpenRouter models" figure as a live inventory.

How the gateway fits
Codex speaks the OpenAI Responses API. Claude Code speaks Anthropic Messages. Gemini CLI uses Google's format. magpie's documented gateway accepts those shapes and forwards to the provider that serves the chosen model.
Compared with Codex Router: Router is a Codex-oriented path when quota is tight. magpie is a local gateway for many agents. If you already run Codex Router, magpie is not an automatic replacement. Pick one wiring and keep the other as fallback until you have tested a real session.
For why Codex's model list matters at all, see importing models into Codex.
Limits and recovery
- magpie must be running for gateway models (
magpie trayormagpie servein the start guide). An agent on its own vendor login does not have to go through magpie. - Switching models does not change an already-open session.
- Subscription reuse touches local credential files. Read magpie's README scope and the vendor terms before routing a paid plan into a different agent.
- The gateway listens on loopback. Other processes on the same machine can still reach that port.
- Restore an agent with
magpie default, or by picking a native model.
In one line: magpie is a local model switcher and protocol gateway. Confirm the install with magpie ls, then treat subscription routing and third-party keys as a separate, terms-sensitive step.
Sources (2026-10-06): usemagpie.ai, Get started, GitHub README.
Comments
No comments yet. Be the first to comment!
Related Tools
Related Articles
What Locks Codex Is the Picker, Not the Models
You already pay for OpenCode Go, Grok, and Z.ai, but the Codex picker still shows mostly GPT. The community project codex-router does not teach another install ritual. It puts subscriptions you already bought back into the selector, keeps keys on the machine, and leaves native GPT alone.
Running low on ChatGPT Codex quota? Switch to DeepSeek or Grok inside Codex
Codex Router lets you keep your Codex workspace while using DeepSeek, Grok, and other external models. A plain-English guide to routing, quotas, and network access.
OpenCode Go in Codex on Windows: Setup, Troubleshooting, and Rollback
Connect OpenCode Go to Codex through the community codex-router project. Check prerequisites, authentication, real tool calls, and rollback.