magpie: A Local Gateway That Lets Claude Code, Codex, Gemini CLI and Other Coding Agents Share Any Model, and Switches Accounts When a Quota Runs Out
yetone/magpie is an open-source project in Go under MIT, created on September 23, 2026, with about 11,500 stars as of this writing. It runs a local gateway at 127.0.0.1:3425 that speaks four protocols, OpenAI Chat, OpenAI Responses, Anthropic Messages and Gemini, and translates between them, so "Claude Code on Kimi, Codex on DeepSeek" becomes one command. It can also read the subscriptions your agents are signed in to and fail over when a quota ends, which calls for care on privacy and terms of service.
yetone/magpie is an open-source project written in Go under the MIT license. It was created on September 23, 2026, last pushed on October 14, and has about 11,517 stars and 773 forks at the time of writing. Its slogan is "Every agent's model. One place." From the menu bar you can switch Claude Code to Kimi, Codex to DeepSeek, Gemini CLI to GLM, and even let OpenCode use your ChatGPT plan. The reason is practical. There are many coding agents now, each keeps its model in its own config file with its own format, keys and base URL, and a subscription you pay for in one agent usually works only there. magpie wants to put all of that behind one app and one local gateway.
The core is the local gateway at 127.0.0.1:3425. It speaks four protocols, OpenAI Chat, OpenAI Responses, Anthropic Messages and Gemini, and translates between them, with streaming, tool calls and reasoning included. So any agent that lets you set a base URL can use it, and the README shows three sets of environment variables. The list of supported agents is long and includes Claude Code, Codex, Gemini CLI, OpenCode, Cursor CLI, Copilot CLI, Goose, Cline and Qwen Code, among dozens more, and magpie shows only those installed on your machine. To pick a model, click a value and a searchable list opens with every model of every provider you added. magpie rewrites the one key setting in the agent's own config atomically, and its comments, order and formatting stay as they were. Profiles save every agent's setup under one name, such as "Budget" or "Focus", and switch them all in one move.
The provider side is broad. Presets include Anthropic, OpenAI, Google Gemini, DeepSeek, Kimi, Zhipu GLM, MiniMax, Qwen, Mistral, Groq, xAI, OpenRouter, Ollama and LM Studio, plus any OpenAI- or Anthropic-compatible URL. Model lists come from the vendor, with names and reasoning levels filled in from models.dev. More unusual are "subscriptions". An agent you are signed in to counts as a subscription with models behind it, and magpie offers it as a provider to every other agent. You can add several accounts per subscription and magpie fails over between them. The README lists Claude (it drives the real local claude binary and bridges your agent's tools over MCP), Codex and ChatGPT, GitHub Copilot, Gemini Code Assist, Antigravity and Grok, and it also supports OpenCode auth plugins and pi packages from npm.
Routing groups are the other main feature. A group treats several models as one, and the gateway spreads requests over every member's keys and accounts. There are five modes: smart picks the subscription with quota left that renews soonest, so less is wasted at the reset; order uses the first model until it cannot answer, then the next; rotate moves to the next member on each turn; usage picks the least-used member first; and pace picks the account with the most of its week left per hour. A conversation stays with the account that answered it, so the vendor's prompt cache is kept, and groups can contain groups. Intent routing has a small model of your choice read each new turn, so tests go to the strong model and quick questions to the cheap one. A daily warm-up can start each Claude and ChatGPT account's 5-hour window at set times. On the command line, magpie provider add adds a provider, magpie claude deepseek/deepseek-v4-pro puts Claude Code on DeepSeek, and magpie quota shows what is left on each plan.
A few real cautions before you use it. The first is credentials. magpie finds subscriptions by reading the sign-ins your agents already hold, including Claude Code's and Codex's files and the system keychain. To stop that, turn off Settings, Privacy, Subscription accounts, run magpie accounts discovery off, or use MAGPIE_NO_ACCOUNTS=1 for one run; providers that use API keys work either way. The second is terms. Whether passing one subscription to other tools fits that subscription's terms of service is for you to check. We did not verify it, and we would not use an important account while unsure. The third is installation. The official one-liner is curl piped to sh, and there are also app downloads, go install and a Docker image, so read the script first. The README says plainly that if you use one agent on its vendor's own plan and that is enough, you do not need magpie. It suits people who use more than one agent, provider or account.
Sources
FAQ
What problem does magpie solve?
Each coding agent keeps its model in its own file, with its own format, keys and base URL, and a subscription you pay for works in one agent only. magpie runs a gateway on your machine that speaks OpenAI Chat, OpenAI Responses, Anthropic Messages and Gemini and translates between them, including streaming, tool calls and reasoning. In the app or the CLI you pick any provider's model for any agent, and magpie rewrites the one key setting in that agent's config atomically, keeping its comments, order and formatting.
What does it do when a quota runs out?
It uses routing groups. A group is several models that an agent treats as one, such as group/daily-coding, and the gateway spreads requests over each member's keys and accounts. There are five modes: smart uses the subscription with quota left that renews soonest; order uses the first model until it cannot answer, then the next; rotate moves to the next member each turn; usage uses the least-used member first; pace uses the account with the most of its week left per hour. A conversation stays with the account that answered it so the vendor's prompt cache is kept. magpie quota shows what is left on every plan.
What risks should I weigh before using it?
First, magpie finds subscription accounts by reading the sign-ins your agents already have, such as Claude Code's and Codex's files and the system keychain. You can turn this off in Settings, Privacy, run magpie accounts discovery off, or set MAGPIE_NO_ACCOUNTS=1 for one run. Second, whether lending one subscription to other tools fits that subscription's terms of service is for you to check, and we did not verify it. Third, the README offers a curl-to-sh install as well as go install and a Docker image. Read the script before you run it.