Magpie: A Local Gateway That Lets Claude Code Run Kimi and Codex Run DeepSeek
Magpie Practical Tutorial: A Local Gateway That Lets Claude Code Run Kimi and Codex Run DeepSeek
Start with these commands:
magpie provider add deepseek sk-… # Add a DeepSeek key
magpie claude deepseek/deepseek-v4-pro # Claude Code switches to DeepSeek
magpie codex moonshot/kimi-k2.5 # Codex switches to Kimi
magpie save cheap && magpie use cheap # Save as a profile, switch back next time
Four commands, no manual editing of settings.json, no export ANTHROPIC_BASE_URL. Open a new Claude Code session and it's already running DeepSeek.
That's magpie. It's an open-source project by yetone. The repo was created on September 23, 2026, and by November 4 it had 29,000 GitHub stars, with the latest tag v0.1.2906. It's growing so fast because it solves a problem every multi-agent user has been putting up with:
Every agent writes the model into its own configuration file, in different formats, with each key and base URL managed separately. A subscription you pay for can only be used in one agent.
By the end of this article you will be able to:
- Install magpie and get any vendor's model working with Claude Code / Codex / Gemini CLI within ten minutes;
- Use profiles to switch between a cost-saving configuration and a main configuration with one command;
- Use routing groups to combine multiple accounts or providers into a single model, automatically switching accounts when quotas run out;
- Use intent routing to send simple questions to cheap models and test-writing to stronger models;
- Enable local redaction so that keys in
.envnever leave your computer; - Know where the pitfalls are.
1. What It Actually Is: A Local Gateway + A Configuration Manager
magpie does two things:
First, it runs a gateway on 127.0.0.1:3425. This gateway speaks four APIs simultaneously: OpenAI Chat Completions, OpenAI Responses, Anthropic Messages, and Gemini, and can convert between them, preserving streaming output, tool calls, and reasoning traces. So Claude Code (which only speaks the Anthropic protocol) can use DeepSeek, and Codex (which speaks Responses) can use a Claude subscription.
Second, it edits your agent configuration files for you. When you click a model in the UI, magpie only modifies the few keys that agent configuration needs, preserving comments, ordering, and indentation, and writes atomically. What it changes is documented clearly:
| Agent | Write location | What changes |
|---|---|---|
| Claude Code | ~/.claude/settings.json |
ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, and model variables in env |
| Codex | ~/.codex/config.toml |
A [model_providers.magpie] table + model; model list written to ~/.codex/magpie-models.json |
| Gemini CLI | ~/.gemini/settings.json, ~/.gemini/.env |
GOOGLE_GEMINI_BASE_URL pointed at the gateway, API key auth, model |
| OpenCode / Pi / Crush | Their respective config files | A magpie provider entry, model written as magpie/provider/model |
Two implications:
- No need to export environment variables yourself. For magpie-managed agents, the gateway address and token go straight into the configuration.
- It's reversible at any time.
magpie <agent> defaultdeletes what it wrote and restores the values it replaced, such as your originalANTHROPIC_BASE_URL.
Some terms that will appear repeatedly, let's align them first:
| Term | Meaning |
|---|---|
| Provider | Where a model comes from: API key, logged-in subscription, local model. Each model is written as provider/model |
| Agent | The tool that consumes models: Claude Code, Codex, Gemini CLI, OpenCode…… |
| Profile (方案) | A snapshot of all agents' current settings, switchable with one command |
| Routing Group | Multiple models or accounts combined into one, which an agent treats as a single model: group/<id> |
Is it for you? The README gives its own criteria: if you use more than one agent, more than one provider, or more than one account, it fits. If you use only one agent, only its own subscription, and it's enough, you don't need it.
2. Installation
2.1 Three Ways to Install
Desktop version (recommended): Download from usemagpie.ai. Supports macOS 12+ (Apple Silicon and Intel), Windows 10+, Linux (requires GTK 3 and WebKitGTK 4.1). Mac version is signed and notarized, auto-updates on each release.
One-line script:
curl -fsSL https://usemagpie.ai/install.sh | sh
On Linux, the script checks: if there's a desktop, it installs the desktop version (if WebKitGTK 4.1 is missing, it calls the package manager to install it, requiring sudo password); if no desktop, it installs the terminal version. To choose yourself, add --gui or --tui.
Other ways: go install github.com/yetone/magpie@latest, or use the Docker image ghcr.io/yetone/magpie (covered in section 9).
2.2 Networks in China
The installation script and updates both access GitHub. If you can't connect, add a proxy or mirror:
# Use a local proxy
curl -fsSL https://usemagpie.ai/install.sh | sh -s -- --proxy http://127.0.0.1:7890
# Use a proxy when updating (supports http, https, socks5, socks5h)
magpie update --proxy socks5://127.0.0.1:1080
# Use a GitHub download mirror for every subsequent update
magpie update mirror <prefix>
magpie update mirror off # Cancel
The mirror only downloads files; SHA-256 is always taken from usemagpie.ai, and files modified by the mirror will be refused installation.
2.3 Uninstall
curl -fsSL https://usemagpie.ai/install.sh | sh -s -- --uninstall
Settings in ~/.config/magpie are kept; add --purge to disconnect all agents and delete them as well. Or simply magpie uninstall: it restores each agent first, then deletes magpie's services and files.
After installation, run:
$ magpie --version
magpie 0.1.2906
3. Ten-Minute Quick Start: Switching Models for an Agent
The main flow has three steps: add provider → pick a model for the agent → open a new session.
3.1 Add a Provider
Open magpie, go to Providers → Add provider.
There are four types of providers:
① Vendor presets: just paste the key. magpie presets lists all presets. Here's part of the output for v0.1.2906:
$ magpie presets
vendors
Anthropic anthropic magpie provider add anthropic <key>
OpenAI openai magpie provider add openai <key>
Google Gemini google magpie provider add google <key>
DeepSeek deepseek magpie provider add deepseek <key>
Kimi (China) moonshot-cn magpie provider add moonshot-cn <key>
Zhipu GLM zhipu magpie provider add zhipu <key>
MiniMax (China) minimax-cn magpie provider add minimax-cn <key>
Qwen (China) qwen-cn magpie provider add qwen-cn <key>
Volcengine Ark volcengine magpie provider add volcengine <key>
...
relays
OpenRouter openrouter magpie provider add openrouter <key>
SiliconFlow siliconflow magpie provider add siliconflow <key>
ModelScope modelscope magpie provider add modelscope <key>
...
Note that Kimi, MiniMax, and Qwen all have international and China versions (-cn); for China keys, remember to pick the one with -cn.
The model list is obtained directly from vendors, with names and reasoning tiers filled in from models.dev. If a vendor releases a new model in the morning, it appears in the picker on the next refresh.
② Subscriptions: log in, no key needed. Claude (Pro / Max / Team), ChatGPT (Plus / Pro / Business), GitHub Copilot, Gemini (Code Assist), Antigravity. Click a card, magpie opens the vendor's own login page in a browser; after you log in, the account appears. Agents already logged in on the local machine automatically show as "Logged in …".
Models from subscriptions are written in other agents as claude/…, codex/…, copilot/…. That means your ChatGPT subscription can be used by Claude Code, and a Claude subscription can be used by Codex.
③ Local models: Ollama, LM Studio, no key needed.
④ Custom: any compatible address. Fill in a name, an OpenAI-compatible address (ending in /v1), an Anthropic-compatible address (the root address, i.e. the value of ANTHROPIC_BASE_URL), or both. Proxy endpoints mostly go here.
Already configured elsewhere? The "Import…" at the top of the panel can read providers from CC Switch, Claude Code's settings.json, Codex's config.toml, and Alma. It's read-only, check to import.
Keys are stored in ~/.config/magpie/providers.json, readable only by you. magpie does not read keys from shell environment variables; what you add is what it uses.
Command-line version:
magpie provider add deepseek sk-xxxx # Preset only needs the key
magpie provider add moonshot-cn sk-xxxx
magpie accounts add codex # Log in another ChatGPT subscription
magpie providers # See what you have added
magpie models # All selectable models, in provider/model format
3.2 Pick a Model for Each Agent
Go to the Agents page. Each installed agent gets a row (magpie only shows the ones you have installed).
Clicking a model brings up a searchable list, grouped into three: the agent's own models, your routing groups, and each provider you added. You can also type in a model ID not in the list.
A few hidden switches worth knowing:
- Reasoning effort: when the agent supports it (Codex's reasoning effort, Pi's thinking), a slider appears below the list.
- Fast mode: a lightning button next to supported models. Clicking it makes that agent send requests to this model with
service_tier: "priority"(Claude usesspeed: "fast"). Faster, and more expensive. - Claude Code tiering: when using models via magpie, the three tiers
opus,sonnet, andhaikucan each be assigned a model; by default they follow the main model.
Command line:
magpie ls # List all agents and current settings
magpie claude deepseek/deepseek-v4-pro # Main model
magpie claude haiku deepseek/deepseek-v4-flash # Assign a cheap model specifically to the haiku tier
magpie claude haiku "" # haiku tier returns to following the main model
magpie codex moonshot/kimi-k2.5
magpie codex effort high # Change other fields
magpie gemini zhipu/glm-5.3
Agent names support prefix shorthand, like cc, oc, gem.
3.3 Open a New Session to Verify
A session already running keeps the model it started with. Agents read configuration at startup, so changes take effect from the next session. Codex has an extra note: it generates the model list at startup, so after switching you need to restart the Codex app and any open codex sessions.
3.4 Revert
magpie claude default # Claude Code returns to how it looked before magpie
magpie codex effort default # Revert only one field
Picking the agent's own models (like opus, sonnet) from the picker has the same effect.
3.5 First Pitfall: Claude Code's claude.ai Login
This is in the official reference docs, but easy to miss:
After magpie writes a key to
ANTHROPIC_AUTH_TOKEN, Claude Code will log out of claude.ai while running through magpie: the subscription quota in/usage, connectors, voice, and/teleportare all unavailable.
If you want to keep the claude.ai login, set Claude Code's login method to "claude.ai login". Then magpie writes the token as an empty value, Claude Code sends its claude.ai credentials to magpie, and magpie does not forward them to any other vendor. Remote Control and ultrareview are still unavailable, because Claude Code only exposes those two features on the official Anthropic address.
4. Profiles: Switch the Entire Configuration with One Command
You might have several configurations:
- Cheap: Claude Code uses DeepSeek, Codex uses Kimi;
- Main: Claude Code uses Claude subscription, Codex uses ChatGPT subscription;
- Offline: everything goes to local Ollama.
A profile saves all agents' settings under a name:
magpie save cheap # Save current settings for all agents as cheap
magpie save main
magpie use cheap # Switch back with one command
magpie profiles # List profiles
magpie rename cheap budget
magpie rm budget
In the UI, click "+ Save current" at the bottom of the Agents page. The profile currently in use has a ✓, and the menu bar's "Profile" button shows its name. If you manually change any setting afterward, the ✓ disappears, reminding you that you've drifted from the profile.
5. Routing Groups: Multiple Accounts, Multiple Vendors, No Interruption When Quotas Run Out
Profiles solve "manual switching"; routing groups solve "automatic switching".
5.1 The Routing Group You Don't Need to Create: auto/
If you have two providers that both offer a model with the same name, such as Claude subscription and Copilot both having Claude Opus, or DeepSeek official and OpenRouter both having DeepSeek, magpie automatically groups them into an auto/<model> routing group. Names are matched according to each vendor's convention; deepseek/deepseek-chat and deepseek-chat count as the same.
Select this group for an agent and requests are spread across all providers that offer that model. If you don't want it, use magpie group rm to hide it.
5.2 Create One Manually
magpie group add "Opus anywhere" \
models=claude/claude-opus-5-5,copilot/claude-opus-5.5 \
routing=smart
magpie claude group/opus-anywhere # Claude Code uses this group
When the Claude subscription quota runs out, requests automatically fall to Copilot, and the agent never sees the error.
One prerequisite: if you have only one account and no routing group, there's nothing to switch to, and the error is returned to the agent as-is.
5.3 How to Choose a Routing Mode
All modes listed in magpie help: smart|order|rotate|usage|pace|weight|free|fast|cheap|drain. The common ones:
| Mode | Behavior | Best for |
|---|---|---|
smart (default) |
Among subscriptions with remaining quota, the one that resets soonest ranks first | Multiple subscription accounts, don't want to waste quota |
order |
Use the first one first; if it can't answer, move to the next | Main + backup |
drain |
Use one until quota is exhausted, then switch, and don't switch back | When you want to squeeze an account dry |
rotate |
Switch to the next member each round | Load balancing |
usage |
The one with most remaining quota ranks first | Even consumption |
pace |
Weekly remaining quota ÷ hours until reset, highest first | Weekly quota subscriptions, minimize waste |
weight |
Distribute requests by weight | Max account 5, Pro account 1, that kind of thing |
fast |
The one with best recent time-to-first-token and output speed goes first | Latency-sensitive |
cheap |
The cheapest at the current time slot goes first (only for routing groups) | The same model on multiple providers |
cheap has a detail: it considers time-of-day pricing. The docs' example is that DeepSeek's official API doubles in price during peak hours, so when the same DeepSeek model is on two providers, magpie sends it to the cheaper one for that time slot.
5.4 Session Stickiness: Don't Let the Cache Go to Waste
Switching accounts has a hidden cost: losing the prompt cache. Routing groups default to stays=auto: stay on the same account within a turn, and across turns keep staying while the vendor's cache is still worth keeping.
stays= |
Behavior |
|---|---|
auto (default) |
Stay within one turn; stay across turns when the cache is worth preserving |
session |
Stay for the entire session, as long as it can still answer |
turn |
Stay only within one turn |
off |
Re-route on every request |
strict |
Never switch accounts; hand the error directly to the agent when quota is exhausted |
5.5 Rules: Send Certain Conversations to a Designated Model
Routing groups can have rules attached. Conditions include token count, has images, requires reasoning, from certain agents, intent, compacted context, time slots, and project folders. Each time you send a new message, rules are checked from top to bottom; the first matching rule puts its model first, and the remaining members serve as failover afterward.
Several practical examples, all from the official docs:
# Send long conversations to a large-context model
magpie group rule add opus-anywhere use=openrouter/anthropic/claude-opus-5.5 tokens=150k
# Send /compact summaries to a cheap model, leave the conversation untouched
magpie group rule add opus-anywhere use=deepseek/deepseek-v4-flash compact
# Conversations in these projects go to Kimi first
magpie group rule add opus-anywhere use=kimi/kimi-k2.6 folders=~/oss,"~/My Project"
# Don't use Copilot on weekday afternoons during this window
magpie group rule add opus-anywhere pause=copilot/claude-opus-5.5 time=14:00-18:00 days=mon-fri
# View, reorder, delete
magpie group rule opus-anywhere
magpie group rule mv opus-anywhere 3 1
magpie group rule rm opus-anywhere 2
Two easy-to-miss details:
- Rules are only decided at the start of a turn. Model switching won't happen midway through tool results coming back, to avoid losing cache. The only exception is when the turn grows beyond the current model's context.
- Leave headroom in token thresholds. For a 200k model, set 150k, not 199k.
The compact rule is especially worthwhile: Claude Code's /compact and automatic compaction, as well as Codex and OpenCode's compaction requests, are recognized, so the cheap model writes the summary while the main conversation stays on the original model and cache.
5.6 Routing Groups Can Nest
A routing group's members can be another routing group:
magpie group set coder models+=group/opus-anywhere
Each level uses its own routing mode and rules, up to 8 levels of nesting. Cyclic inclusion won't happen (magpie refuses it).
6. Intent Routing: Simple Questions to Cheap Models, Test-Writing to Strong Models
This is the feature I find most interesting in magpie. Its principle can be explained in one paragraph:
Each turn, when you send a message, magpie sends a numbered list of intents and your latest message to a small model you specify, and asks it to answer with a number. magpie uses that number to match rules from top to bottom. No vector embeddings, no keyword tables, no training.
6.1 Configure a Coder Group
The official docs' example:
# The first rule also specifies the intent classifier model; only needed the first time
magpie group rule add coder use=deepseek/deepseek-v4-flash \
intent="a quick question" classifier=groq/llama-3.1-8b-instant
magpie group rule add coder use=deepseek/deepseek-v4-pro \
intent="writing or fixing tests"
# Same model, use low reasoning effort for simple edits
magpie group rule add coder use=deepseek/deepseek-v4-pro use-effort=low \
intent="a simple edit"
magpie group rule coder # View rules and classifier
magpie group rule classifier coder groq/llama-3.1-8b-instant # Swap the classifier
Intents can be written in Chinese too, like intent="写测试或修测试".
6.2 How a Turn Goes
Assume the Coder group has three rules:
| # | Condition | First sent to |
|---|---|---|
| 1 | ≥ 128000 tokens | kimi/kimi-k2.5 |
| 2 | Intent is "a quick question" | deepseek/deepseek-v4-flash |
| 3 | Intent is "writing or fixing tests" | deepseek/deepseek-v4-pro |
- A 20,000-token turn: rule 1 doesn't match; intents 2 and 3 are candidates; ask the classifier.
- A 150,000-token turn: rule 1 has no intent and matches, so it goes directly to Kimi; the classifier is not asked, no cost incurred.
- The classifier returns 0 (none match): no rule hits; route by the group's normal routing.
An official screenshot from a real request: the classifier deepseek-flash took 964 ms to classify as "writing or fixing tests", the request was routed to the corresponding model, and the answer completed in 5.6 seconds.
6.3 Cost and Risks
- The classifier only sees this one message, not the whole conversation. Answers for the same message + same set of intents are cached for 10 minutes.
- A turn is classified only once; no further classification during tool calls.
- Timeout defaults to 8 seconds, adjustable in "Settings → Model → Replies → Intent classification timeout" (8/15/30/60 seconds). If the classifier errors, times out, or gives a nonsensical answer, no intents match and routing proceeds as if those rules didn't exist; it never blocks.
- The classifier should be small, fast, and non-reasoning. Its calls show up in usage as magpie's own calls.
7. Privacy Redaction: Keys Never Leave Your Computer
Agents stuff what they read into prompts: a .env, a config file, a log with tokens. These all get sent to the vendor.
magpie's approach is to replace sensitive values with placeholders before a request leaves the computer, and swap them back in the response.
7.1 See It in Action
Enable "Redact keys" and "Redact personal info", and add Nightjar to the redaction words. The agent sends:
Deploy Nightjar with OPENAI_API_KEY=sk-proj-8fK2mQx7Lp4Rt9Vw3Yz6Ab1Cd, then mail [email protected] or call 13800138000.
The vendor receives:
Deploy {{TERM_5hmsrhdc}} with OPENAI_API_KEY={{API_KEY_srhjgvja}}, then mail {{EMAIL_eh5um6mb}} or call {{PHONE_uf7iy2qq}}.
When the model replies "I've set OPENAI_API_KEY to {{API_KEY_srhjgvja}} in the .env", the agent sees the real key. Both streaming text and tool call parameters are swapped back, so what the agent writes to files is also the real key.
7.2 Turn It On
Off by default. Go to Settings → Privacy:
- Redact keys: API keys, private keys, tokens, passwords;
- Redact personal info (optional): email, phone numbers, ID card numbers, bank card numbers (only those with valid check digits);
- Redaction words: project codenames, person names, intranet hostnames, one per line;
- Try it: paste some text and see what the vendor actually receives.
When there's no window (magpie serve, Docker), write directly to ~/.config/magpie/settings.json, which is re-read on every request:
{
"redact": true,
"redactPersonal": true,
"redactWords": ["Nightjar", "db.acme-corp.cn"]
}
Or use the command line: magpie settings set redactWords acme,globex.
7.3 Why It Doesn't Break the Conversation
- Placeholders are stable: "type + 8-character keyed hash", so the same value always gets the same placeholder. Conversation context, prompt caches, and thinking signatures are unaffected.
- Original values are never written to disk: they exist in memory only. Records keep only the type, length, and first few characters, stored in
~/.config/magpie/masking, for 30 days. - Fail closed: when redaction is on but can't run, the request returns 503; it never falls back to sending plaintext.
Beyond rules, you can also add a local model to find person names and addresses that rules miss: the default is AstrLink Guard (Chinese/English, 39 MB, runs on the Mac's Neural Engine), or you can switch to OpenAI's Privacy Filter (1.6 GB).
7.4 Cost
- The model sees
{{API_KEY_…}}, so tasks that depend on the value itself can't be done, like "why is this token rejected". Add such values to "Never redact". - Images are sent as-is; text in screenshots isn't masked.
- Only requests that go through magpie are covered. When an agent connects directly to a vendor with its own model, it's out of scope.
- Local providers like ollama can be set to skip redaction:
magpie provider set ollama unmasked=yes.
For each type, after a hit you can choose "Redact", "Alert", or "Block". Blocking returns a 400 and the message contains no original value.
8. Usage and Quotas: Where the Money Goes
magpie usage 7d # Tokens and costs per agent and model
magpie quota # How much remains for each subscription, plan, key
magpie quota wait codex # Block until a Codex account recovers quota
The usage page counts tokens, cache reads/writes, reasoning, and call counts per agent and model, converted to USD or RMB using official prices; any model can have a custom price.
The "Context" tab is worth a separate look: it breaks down what's in each agent's prompt (system prompt, tool definitions, instruction files and skills, read-in files, conversation), how much of the context window each occupies, and gives a 100-point score plus labels like "MCP-heavy". If you suspect an MCP server is eating most of the context, you can see it at a glance.
Note: requests that go directly from an agent to its own vendor don't pass through magpie and aren't counted.
9. Advanced: Using magpie in More Places
9.1 Tools Not on the List Can Also Use the Gateway
Any tool that can set a base URL works:
export OPENAI_BASE_URL=http://127.0.0.1:3425/v1 OPENAI_API_KEY=magpie
export ANTHROPIC_BASE_URL=http://127.0.0.1:3425 ANTHROPIC_API_KEY=magpie
export GOOGLE_GEMINI_BASE_URL=http://127.0.0.1:3425 GEMINI_API_KEY=magpie
Your own scripts or LangChain projects can use all of magpie's models and routing groups just by changing the base URL. The gateway page has ready-made code snippets for shell, curl, Python, and Node.
9.2 Run in the Background
After closing the window, magpie stays in the menu bar. To run at startup without a window:
magpie daemon install # systemd on Linux, launchd on Mac
magpie daemon install --web # Also provide a browser admin page
magpie daemon status
9.3 One Machine Configured, the Whole Family Uses It: Remote magpie
On the machine where you saved providers: Settings → Network & Sharing → LAN Sharing → Enable, then issue a gateway key for each computer:
magpie gateway-key add "Laptop" # Prints sk-magpie-key-…
Each key can have its own daily, weekly, or monthly token and cost limits, as well as allowed models.
On the laptop, add it as a provider:
magpie provider add remote-magpie sk-magpie-key-… url=http://192.168.1.20:3425 id=office
magpie models # office/… are the models on the desktop
Routing groups on the desktop appear as office/group/…. The laptop's magpie still configures its own agents, just with models coming from another machine.
9.4 Docker / NAS
docker run -d --name magpie --restart unless-stopped \
-p 127.0.0.1:3425:3425 -p 127.0.0.1:3430:3430 \
-e MAGPIE_WEB_KEY=$(openssl rand -hex 16) \
-v magpie-config:/config \
ghcr.io/yetone/magpie:latest web --addr 0.0.0.0:3430 --no-open
docker logs magpie # Logs contain the admin page URL with key
3425 is the gateway, 3430 is the Web admin page. Requests from outside the container must carry a gateway key. The official docs specifically warn: anyone with the admin page link can see all keys. Put 3430 only on the loopback address or a VPN; for remote access use an SSH tunnel: ssh -L 3430:127.0.0.1:3430 you@nas.
9.5 Issue Short-Lived Keys for Sandboxes and CI
magpie gateway-key issue --ttl 1h --name sandbox-1 --models office/codex/gpt-5 --tokens 200000
Validity ranges from 1 minute to 30 days, and you can limit models, tokens, and spend. GitHub Actions can also exchange OIDC tokens for short-lived keys, so you don't have to put the gateway key in repo secrets (see the remote magpie docs).
9.6 Gateway Middleware
A small piece of JavaScript can rewrite every request passing through the gateway:
// alias.middleware.js — magpie plugin add ./alias.middleware.js
export function onRequest(body, ctx) {
if (body.model === "fast") return { ...body, model: "deepseek/deepseek-chat" };
}
onRequest rewrites or rejects requests, onEvent sees each streaming event, onResponse sees the full response. If a hook throws or times out, the request goes through unchanged. The community has ready-made model-map, system-prompt, think-tags, etc., mostly corresponding to New API channel features:
magpie plugin add @magpie-community/middleware-model-map
magpie plugin options model-map '{"mapping": {"fast": "deepseek/deepseek-chat"}}'
9.7 Other Handy Features
- Library: instructions, MCP servers, skills, and subagents written once; magpie writes them into each agent's files in that agent's format.
- Web search for any model: for models that can't search, magpie does it on their behalf, supporting Tavily, Brave, Exa, SearXNG, Volcano Engine Doubao Search, etc.
- Direct tool calls:
magpie tool generate_image "a magpie, watercolor" -o hero.png. - Multi-machine sync:
magpie webdav(Nutstore, Nextcloud),magpie s3,magpie github(encrypted repo).
10. Pitfall Checklist
| Symptom | Cause | Treatment |
|---|---|---|
| Switched models, agent still uses the old one | A running session keeps the model it started with | Open a new session; Codex needs a full app restart |
Claude Code's /usage, connectors are gone |
ANTHROPIC_AUTH_TOKEN logged it out of claude.ai |
Set login method to claude.ai login (see 3.5) |
| Closing magpie breaks all agents | The gateway runs with the app | Keep it in the menu bar, or magpie daemon install |
| Quota runs out and it errors directly, no account switch | Only one account and no routing group | Add a second account, or create a routing group |
| Manually changed agent config, worried about conflicts | — | No conflict; magpie re-reads the file each time and only touches the keys it manages |
| Imported provider later changed in the agent, magpie didn't follow | Import is a one-time copy | Change it in magpie, or re-import |
| Don't want magpie to read Claude Code / Codex login info | By default it discovers subscriptions from files and keychain | magpie accounts discovery off, or turn off "Subscription accounts" in Settings → Privacy |
| Don't want usage telemetry | The release reports once a day (random ID, version, OS, which agents/providers/models used; no keys or prompts) | Turn off in Settings → Privacy, or DO_NOT_TRACK=1 |
| Reporting a bug, not sure what to give | — | Attach magpie log -n 200; report on Discord (repo doesn't accept PRs) |
One more word on subscription sharing. Whether using Claude, ChatGPT, Antigravity subscriptions in other agents complies with each vendor's terms of service is something you must judge yourself. The official docs explicitly warn: Google may ban Antigravity accounts used outside of Antigravity, so use an account you don't mind losing. Before putting a main account online, read the vendor terms first.
11. Three Configurations You Can Copy Directly
Configuration A: Just want to save money (one DeepSeek key)
magpie provider add deepseek sk-xxxx
magpie claude deepseek/deepseek-v4-pro
magpie claude haiku deepseek/deepseek-v4-flash
magpie codex deepseek/deepseek-v4-pro
magpie save cheap
Configuration B: Multiple subscriptions, rotating to avoid wasting quota
magpie accounts add claude # Log in the first
magpie accounts add claude # Log in another
magpie group add "Opus pool" models=claude/claude-opus-5-5,copilot/claude-opus-5.5 routing=pace
magpie group rule add opus-pool use=deepseek/deepseek-v4-flash compact
magpie claude group/opus-pool
magpie save main
pace prioritizes the account whose weekly quota is most likely to expire before reset, and the compact rule sends context compaction through the cheap model.
Configuration C: Auto-select model by task
magpie group add coder models=deepseek/deepseek-v4-pro,deepseek/deepseek-v4-flash routing=order
magpie group rule add coder use=deepseek/deepseek-v4-flash intent="a simple question, no code needed" classifier=groq/llama-3.1-8b-instant
magpie group rule add coder use=deepseek/deepseek-v4-pro intent="writing or fixing tests"
magpie claude group/coder
Watch the "Routing" page to see which rule sends each turn where, then adjust the intent descriptions after a day.
The model IDs above are taken from the official docs' examples. Which models are actually available in your account, check
magpie modelsoutput.
Summary
magpie's value isn't "another API relay", but three things:
- Configuration consolidation: the model configs of dozens of agents, collected into one UI and one set of commands, and always revertible with
default; - Quota orchestration: routing groups + rules + intent routing, treating multiple accounts, vendors, and price tiers as one pool;
- Local control: the gateway runs on your own machine, redaction happens before requests leave, and failures don't send.
Suggestion for getting started: first only do section 3, switch one model for one agent, run for a day; only after you have a second account move to routing groups; before working on projects containing keys, turn on redaction.
References
- Official site: https://usemagpie.ai/zh/
- Quick start: https://usemagpie.ai/docs/zh/start
- Intent routing: https://usemagpie.ai/docs/zh/intent
- Local redaction: https://usemagpie.ai/docs/zh/masking
- Remote magpie: https://usemagpie.ai/docs/zh/remote
- Docker: https://usemagpie.ai/docs/zh/docker
- Source code: https://github.com/yetone/magpie (full English reference:
docs/reference.md) - Plugin community: https://github.com/magpie-community/plugins
Top 1 from juejin.cn, machine-translated. The original thread is authoritative.
6