Docs · Guide
Use DeepSeek, Kimi, GLM, Claude or any model in Codex
Codex speaks one API, OpenAI Responses. magpie puts a gateway on your computer that speaks it for every provider you add, and writes Codex’s config.toml for you. The models then show in Codex’s /model, with their reasoning efforts.
The gateway runs at 127.0.0.1:3425. When a provider serves the Responses API itself, as DeepSeek and the Zhipu GLM Coding Plan do, Codex’s request is passed on as it is. When it serves only Chat Completions or Anthropic Messages, as Kimi, MiniMax and Qwen do, or a Claude subscription, magpie translates the request and the reply, streaming and tool calls included.
Chinese models
DeepSeek, Kimi and Kimi Code, Zhipu GLM (pay as you go or Coding Plan), Z.ai, MiniMax and Qwen, each with its China endpoint where it has one.
Claude
Your Claude subscription’s models, or an Anthropic key’s.
Anything else
Any OpenAI- or Anthropic-compatible URL and key, Copilot and Antigravity accounts, Ollama and LM Studio.
Set it up
- Add the providerIn magpie’s Providers tab, press + Add provider, pick DeepSeek, Kimi, Zhipu GLM, MiniMax or Qwen, paste your API key and save. magpie asks the vendor which models it serves.
- Pick the model for CodexIn the Agents tab, click the model on the Codex row and choose one, such as
deepseek/deepseek-v4-pro. The effort slider under the list sets its reasoning effort. magpie writes both into~/.codex/config.toml. - Restart CodexCodex builds its model list when it starts. Restart the Codex app, and open new
codexsessions, after a switch.
The same from a terminal:
magpie provider add deepseek sk-… magpie models # every model, as provider/model magpie codex deepseek/deepseek-v4-pro magpie codex effort high
The models in Codex’s /model
magpie’s models are listed in Codex’s /model beside its own, so you can switch there too. Each one carries what Codex needs to run it: its reasoning efforts and default effort, its context window and the base instructions Codex sends with it.
How they get there depends on how Codex is signed in:
- Signed in to ChatGPT. Codex keeps its own OpenAI provider and your sign-in. magpie points it at the gateway with
openai_base_url; Codex’s own models still go to OpenAI on your account, and magpie’s models join them in/model. - Not signed in, or signed in with an API key. magpie becomes Codex’s provider, and the list comes from a catalog file magpie writes,
magpie-models.jsonbesideconfig.toml.
What changes in config.toml
magpie changes only the keys it needs in ~/.codex/config.toml. Comments, ordering and your other settings stay.
| Key | Set to |
|---|---|
model | The model you picked |
model_reasoning_effort | The effort, when you set one |
openai_base_url | The gateway’s address. A base URL of your own stays |
model_provider | "magpie", when magpie is the provider |
model_catalog_json | The path of the catalog file, magpie-models.json, when magpie is the provider |
[model_providers.magpie] | name, base_url (the gateway’s /v1), wire_api = "responses", and the gateway’s key. Your vendor keys stay in magpie |
model = "deepseek/deepseek-v4-pro" model_provider = "magpie" model_catalog_json = "/Users/you/.codex/magpie-models.json" [model_providers.magpie] name = "magpie" base_url = "http://127.0.0.1:3425/v1" wire_api = "responses"
That is the shape when magpie is the provider; the table also carries the gateway’s key and a header. Signed in to ChatGPT, only openai_base_url and model are set at the top. The [model_providers.magpie] table stays once written. A Codex thread keeps the provider it was started on, and a thread started on magpie can’t be opened again without it.
Going back to OpenAI’s models
Pick one of Codex’s own models on its row, or run magpie codex default. magpie takes model_provider, model_catalog_json and the base URL back out and puts back the provider and model you had. A provider of your own at the top stays. Threads started on magpie are moved back to the provider Codex is on, so Codex lists them, and a copy is kept in magpie’s trash.
Claude in Codex
Sign in to your Claude subscription in magpie: + Add provider, then the Claude tile. Its models are claude/… in Codex’s picker. magpie translates Codex’s Responses requests into Anthropic Messages and the replies back.
magpie accounts add claude # sign in to a Claude account magpie models | grep '^claude/' magpie codex claude/…
Requests on a Claude subscription run through the Claude Code installed on your computer, so keep it installed. An Anthropic API key works too: add Anthropic as a vendor and pick an anthropic/… model.
Routing over several keys
- Several keys for one vendor. Add them all to the provider and tick each one. Routing on the provider says how requests spread, and Fallback lists models to use when it is out of quota or down.
- One model from several providers. When two of your providers serve the same model, magpie makes the group
auto/<model>by itself. Pick it for Codex. - Your own group. New group in the Routing tab puts any models behind one name,
group/<id>.
The routing modes are in Get started.
By provider: DeepSeek · Kimi and Kimi Code · GLM Coding Plan · Qwen · MiniMax
FAQ
Do I write [model_providers] myself?
No. magpie writes Codex’s config.toml when you pick a model. You don’t export OPENAI_BASE_URL either.
Does my ChatGPT sign-in still work?
Yes. Signed in to ChatGPT, Codex keeps its own provider and sign-in. Its own models go to OpenAI on your account, and magpie’s are added beside them.
I picked a model, but Codex’s /model doesn’t show it.
Codex reads its model list when it starts. Restart the Codex app and open a new codex session.
Can I set the reasoning effort?
Yes, on the Codex row’s effort slider, with magpie codex effort high, or in Codex’s /model, which lists each model’s efforts.
Which Chinese models can Codex use?
Any that a provider you add serves. magpie has presets for DeepSeek, Kimi, Kimi Code, Zhipu GLM, Z.ai, MiniMax and Qwen. Others can be added as a custom URL.
Does magpie have to be running?
Yes, while Codex is on a model through magpie: the gateway runs with the app. magpie daemon install keeps it running as a service with no window.
How do I undo it?
Pick one of Codex’s own models in magpie, or run magpie codex default. magpie’s keys come out, and your provider and model come back.
Using Claude Code too? See Use any model in Claude Code. Stuck? Ask on Discord.