跪拜 Guibai
← All articles
Backend

Magpie Pools Every Coding Agent's Existing Subscriptions Behind One Local Gateway

By 苏三说技术 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Anyone juggling Claude Code, Codex, and OpenCode with several subscriptions has been paying for the same model capacity twice and editing config files to get at it. Magpie removes both problems: one gateway shares every subscription across every agent, and automatic failover means hitting a quota limit no longer stops the session.

Summary

CC Switch and Magpie both switch AI providers, but they work at different layers. CC Switch rewrites each agent's config file so the agent points at a different provider; each agent still connects directly to its own provider, so a Claude Pro subscription can't be used by Codex and a ChatGPT Plus subscription can't be used by Claude Code. Magpie runs a local gateway (default 127.0.0.1:3425) that all agents connect to. It reads the login states of installed agents, turns each logged-in subscription into a Provider, and atomically rewrites the agent's own config to point at the gateway. The rewrite preserves comments, order, and formatting, so MCP configs, plugins, and hooks stay intact.

On top of that, Magpie translates between OpenAI Chat Completions, OpenAI Responses, Anthropic Messages, and Google Gemini, so agents using different protocols can call the same models. Routing groups let you put several models behind one name (e.g. group/daily-coding) with strategies: smart, order, rotate, usage, and pace. When one subscription's quota is exhausted, Magpie automatically moves to the next account or provider, so the agent never sees a 429. It also masks secrets in requests before they leave the machine by replacing key values with placeholders, and restores them in responses.

Installation is a curl script or a platform package for macOS, Windows, and Linux, with Docker and CLI versions available. Tools outside the support list can connect via environment variables that point at the gateway. Magpie was open sourced in September 2026 and is already at version v0.1.3353; the single-agent, single-provider case doesn't need it, but anyone juggling multiple agents and subscriptions is the target user.

Takeaways
— CC Switch rewrites agent config files; each agent still connects directly to its own provider, so subscriptions are isolated.
— Magpie runs a local gateway at 127.0.0.1:3425 that all agents connect to.
— The gateway translates between OpenAI Chat Completions, OpenAI Responses, Anthropic Messages, and Google Gemini, including streaming, tool calls, and reasoning content.
— Magpie discovers subscriptions by reading agent login files (for example Claude Code config and Codex auth.json) and macOS Keychain, and turns them into Providers.
— When you select a model from Magpie's menu bar, it atomically rewrites the agent's own config file, preserving comments, order, and formatting.
— Routing groups support smart, order, rotate, usage, and pace strategies; when one subscription's quota runs out, Magpie automatically switches to another account or provider before the agent sees an error.
— Secret masking (off by default) replaces API keys, passwords, and emails with placeholders before the request leaves the machine, then restores real values in the response.
— Installation is one curl command or a platform package; macOS, Windows, Linux, Docker, and a CLI-only version are available.
— Tools outside the support list can connect via OPENAI_BASE_URL, ANTHROPIC_BASE_URL, or GOOGLE_GEMINI_BASE_URL pointing at the gateway.
— Magpie was open sourced in September 2026 and is at version v0.1.3353.
Conclusions

CC Switch edits config files, Magpie routes requests; the layer you choose decides whether a subscription can be shared across agents.

Atomic config rewrites matter because Magpie works with the agent's own config, not around it. The agent sees a normal provider, so MCP servers, hooks, and plugins keep functioning.

The secret-masking feature addresses a real leak that most proxies ignore: agents can put API keys from .env files and logs into prompts. It is off by default, so it only protects users who turn it on.

Routing groups convert quota exhaustion from a hard stop into a soft handoff. You chain subscriptions and only care about total spend, not which account is empty.

Concepts & terms
Provider (Magpie)
A model source created from an agent's logged-in subscription, for example claude, codex, or copilot. It exposes that subscription's models to every agent connected to the gateway.
Routing group
A named set of models or providers (for example group/daily-coding) that Magpie treats as one target. When an agent requests the group, Magpie chooses a member using a configured strategy such as smart, order, rotate, usage, or pace.
Atomic config rewrite
Rewriting an agent's configuration file as a single operation so the process cannot leave a partially written file. Magpie uses it to change the model selection while preserving comments, order, and formatting, so MCP, hooks, and plugins remain untouched.
Protocol translation
Converting between OpenAI Chat Completions, OpenAI Responses, Anthropic Messages, and Google Gemini request/response formats so an agent that speaks one protocol can call models that speak another, while preserving streaming, tool calls, and reasoning content.
Secret masking
Replacing sensitive values such as API keys, passwords, and emails with placeholders before a request leaves the local machine, then restoring the real values when the response comes back, so the external provider never sees the actual secrets.
From the discussion

A dispute over the "uninstall cc-switch" headline leaves one side arguing that Magpie's subscription pooling and routing only matter for multi-agent/multi-provider setups, while the other side counters that gateway-level features like vision, image generation, and API sharing are useful even with a single agent. Separately, a reader asks how Magpie differs from litellm, which allegedly already provides the same functions. A spam post adds nothing but an ad link.

— Magpie's gateway architecture is a different class from CC Switch's config rewriting, but the blanket advice to uninstall CC Switch is misleading for users who run one agent and one provider, since they gain no pooling or routing and take on an extra resident gateway.
— The opposing position holds that even single-agent users benefit because the gateway injects capabilities like image recognition, image generation, video synthesis, and web search, plus plugins and proxying of a locally configured API to other computers, regardless of agent support.
— litellm is claimed to already implement every described feature, raising the question of what Magpie adds beyond it.
Featured comments
组合搭配函数

I accept the distinction between "changing a road sign" and "fixing an intersection" — CC Switch rewrites config files, Magpie runs a gateway on 127.0.0.1:3425 to forward requests, these are two different things. But I don't accept the title "uninstall cc-switch" — for someone using only one agent and one provider, Magpie's subscription pooling and routing groups are all useless, and instead you have an extra resident gateway to manage. That clickbait-style advice to uninstall is just creating trouble. You yourself wrote at the end that single-agent benefits are limited, so the title should be "worth switching only with multiple agents", not a blanket statement.

咕嘟

Single agent is enough, and who doesn't have several installed on their computer nowadays. Some features are handled at the gateway level, regardless of which agent you use. You can add image recognition, image generation, video generation, web search, etc. to models that don't have those capabilities — these aren't relying on MCP and skills inside the agent; it's like a real multimodal model. Also, there are tons of plugins. You can proxy the API you have configured on your own machine for other computers to use. I used to always use CC Switch, but now I don't need it at all — why install two?

yioo 1 likes

I don't understand the difference from litellm. litellm can implement all the features described here.

See top comments, translated →
Source: juejin.cn ↗ Google Translate ↗ Backup ↗