Magpie Takes Over Model Selection, Quota Balancing, and Failover for AI Agents
I declare! Magpie is the definitive answer!
Recently I started using a new tool called Magpie.
I've recommended CC Switch a lot before; with several model channels in hand, switching between them was indeed convenient.
But as accounts and models multiplied, I began to wonder: can we also hand the selection over to software?
For example, two accounts both have quota—which one to use first? Who should handle writing articles vs. checking code? If a common channel suddenly fails, can a backup pick up on its own?
These were the main reasons I switched to Magpie.
It can manage account quotas, model assignments, and backup order together. The MCP tools and Skills I've accumulated can also be uniformly assigned to different software. Rules and Hooks can be collected into a resource library for unified management.
When I work with Codex, Claude Code and other software, Magpie works behind the scenes to connect models and dispatch requests.
It can even help you auto-check-in (get daily sign-in bonuses).
Usage Instructions
First search for Magpie on GitHub, go to the Releases download area, and choose the version matching your computer.
The official website offers Windows, macOS, and Linux builds. On Windows, pay attention to the difference between x64 and ARM.
When you open Magpie, you'll see names like Agent, Provider, Routing, and Resources on the left. For first-time use, get to know two: Agent and Provider.
Agent is the software you open to give tasks.
For example, Codex, Claude Code, OpenCode. You still go to those software to edit articles or write code.
Provider is the source of models and quota.
For example, DeepSeek's API channel, ChatGPT subscription, or other channels you've configured.
In a concrete setup, the flow is like this: you ask in Codex, Magpie hands the question to the DeepSeek you selected, and the answer comes back to Codex.
So the operation order is: first connect a provider, then select a model for the agent.
The integration switch on the right side of each row on the Agent page decides whether that software goes through Magpie.
At the bottom of the Agent page there's an entry to install other agents. Expand it, choose the software you want, follow its installation instructions, launch it once, then come back to configure.
Step 1: Bring in the models you have
There are two paths here:
If you already configured API channels with CC Switch, go with A.
If you're adding a channel for the first time or planning to log in to a subscription account, go with B.
Connect the one you use most often first; add more later.
A: CC Switch users, import existing channels
At the bottom-right of the Provider page, click "Import local config", check the CC Switch channels you want to migrate, and confirm the import.
But the imported ones aren't all guaranteed to work. This time I found two bad channels out of a dozen or so.
After importing, it's best to test each one: if you get 401 or a login failure, the key has expired; go to the channel's backend and replace it. If "Unknown Model" appears, the model code is wrong; switch to a model that actually exists in the channel list and test again.
B: First time, add a model source
At the bottom-left of the Provider page, click "+ Add Provider".
Subscription account: select the corresponding subscription entry and finish logging in on the official page.
API channel: select the corresponding provider, paste the key, save, and the model list will load accordingly.
For example, for DeepSeek, go to its open platform to create a key and paste it in.
If it's not in the list, choose Custom and fill in three items: name, API endpoint (if the channel docs say OpenAI-compatible, fill that field; if Anthropic-compatible, fill that field), and API key.
After saving, expand the provider, confirm the model appears, test it; once it works, go connect your agent.
Step 2: Let the Agent use the model you just added
Back in Magpie, click Agent on the left and find the row for the software you use.
Turn on the integration switch on the far right, then click the model selection box next to it and choose the model under the provider you just added.
It's best to restart that software after changing it, otherwise it may still use the old config. Then go back to the input box and send this message:
Please only reply: received
After you see the reply, switch back to Magpie, open the Routing page on the left, find this request, and confirm which provider and model it actually went to.
If there are many requests, click "By session" at the top to group them by conversation.
Step 3: When the primary fails, let the backup take over
First, let's say why this step is valuable: routing groups are where Magpie pulls ahead of CC Switch. Give several models a common name, normally use the primary automatically; when the primary's quota runs out or the channel dies, it switches to the next one by itself. You don't have to watch quotas or manually switch channels in the middle of the night.
Open Routing on the left and click "+ New Group" in the top-right.
Fill it in in this order:
Give it a name, such as "daily backup".
Click "Add model" and add the two models you plan to use. Put the primary first, the backup second.
Scroll down to the routing field, choose "In order", then save.
One more step: go back to the Agent page, and replace the single model you originally selected with the "daily backup" group you just created, similar to my coding assignment in the picture below.
Models can now automatically back each other up. The same applies to two subscription accounts from the same provider, like two ChatGPT accounts: use the multi-account settings in the provider first.
Go to Provider → Add Provider, select the same subscription again, and log in to the second account.
When you return to the list and expand this provider, you'll see the accounts under it.
Check the accounts you want to participate, and in the provider's routing settings, choose "Smart".
When assigning new sessions, Smart first ranks accounts with nearly exhausted quota lower, then gives priority to accounts whose quota resets sooner.
In this way, account quota and reset time also participate in the selection, saving you one round of manual judgment.
To check quotas, open the Usage page and look at subscription usage and reset times. Which information is shown depends on what the corresponding source actually returns.
Step 4: Let it assign writing articles and checking code by itself
The previous steps handled who uses first and who is backup. Now let's add task type into the equation.
Intent routing hands task type to the system: article-revision work goes to a writing model, code-checking work goes to a coding model.
You just state what you need; it reads the sentence and decides who to send it to, without you specifying.
It also needs an intent-judgment model, which reads your current request and determines who should handle it. Just pick a small and fast model; you can use one that's already connected.
Continuing with the group you just made, go to Routing → find this group → Edit. First confirm the group already has a model for writing and one for code-checking; if either is missing, click "Add model" to put it in.
Click "Add rule", and after "intent is" fill in your requirement:
MCP and Skills: move them over after they're connected
Once the models are connected, let's organize the tools.
Entering the Resources page, you'll see configurations for MCP, Skills, and Rules.
The resource library is a distribution layer: import existing ones, check which clients to assign them to, and then it manages them uniformly.
MCP can be understood as a way for AI to connect to external tools, such as web search or browser control. Skills are a set of written working methods, like your WeChat official account editing process.
Suppose Claude Code already has a search tool configured, and you want Codex to use it too.
Open Resources → MCP Servers, scroll down to "Already in Agents", find that tool, and click "Import" on its right.
After the import is complete, check the corresponding Agent under this resource.
Importing only into the resource library just collects the config. Checking the client that should use it sends the config to that software.
Skills follow the same order: Resources → Skills → Already in Agents → find the skill → Import → check the client → reload.
Requirements that several software all need to follow can go into the Rules page in the resource library, then be distributed to the corresponding clients. Requirements that only relate to one project should stay in that project.
Want AI to configure it for you? There's also a command-line interface
Magpie also supports CLI, meaning an AI that can execute local commands can operate it.
For example, if you're already using Claude Code and want it to change Codex's model, you can send the following prompt to Claude Code. First change the first three items to your actual selections.
Please modify the model access for the following client through local Magpie.
Client: Codex
Provider: fill in the provider name that exists in Magpie
Model or routing group: fill in the actual ID shown in Magpie
First find Magpie, read `magpie --help` and related subcommand help, and verify the above three items exist.
Only modify this client's model access. Before modifying, back up the involved config; keep other clients, project rules, MCP and Skills intact; do not output any API keys or login credentials.
If you need me to log in, install dependencies, or find a conflict with CC Switch takeover, tell me the specific entry point and what needs handling first.
After finishing, tell me how to reload the client. Send one minimal test request and verify the actual provider, model, and request result in Magpie. If you need me to send a test message, give me a sentence I can send directly.
The model ID can be copied from the model list on the Gateway page. If the command isn't yet added to the system, go to Settings → Command Line to see how to add it.
A few other useful things to turn on
Privacy masking (I think this one is excellent)
Before a request leaves your computer, Magpie automatically replaces sensitive values like API keys and emails with placeholders, and restores them when the answer comes back. If you have many channels, I recommend turning this on. It's in Settings → Privacy.
Status bar. Click the status bar block in the Claude Code row on the Agent page, and a bar appears at the bottom: the current session's model and each subscription's quota window.
Web search fallback. In Settings, find the Search option and add a key like DeepSeek. Then all software can use a unified web search tool; fees are based on that search provider's pricing.
Configuration profiles. Save a version of your whole setup with magpie save daily. If you mess things up, use magpie use daily to restore it with one click.
It also comes with image generation, video generation, and image viewing tools that use the already-connected providers. Whichever software they're assigned to, that software can use them. These are in the Plugins page.
Final words
The reason I want to switch to Magpie is simple: it's all about automation.
Whatever can be automated should go to AI; humans should only make judgments.
Otherwise, you've hired a bunch of AI assistants and end up being the assistant yourself.
That's all!
Thanks for reading my article.
If you think it's good, press like, watch, and share—three in a row 🙂.
If you want to receive updates first, you can also give me a star ⭐. Thanks for reading.
Open-source knowledge base (real-time updates, discussion group):
https://my.feishu.cn/wiki/OhQ8wqntFihcI1kWVDlcNdpznFf