Magpie: Share AI Subscriptions Across Coding Agents via Local Gateway
Magpie is a local gateway and menu-bar app that discovers your existing AI coding agent subscriptions (Claude Code, Codex, Copilot) and exposes them as a unified pool, letting any agent use any model via protocol translation, routing groups with fallback strategies, and atomic config rewrites — no API keys copied, quotas auto-rotate, secrets masked before leaving your machine.
Reading font
Introduction: The Problem
A developer asked: "I want to use Kimi's model in Claude Code and my ChatGPT subscription in Codex without constantly editing config files." Someone replied: "Install Magpie." The follow-up: "How is that different from CC Switch, which also switches providers?"
Both tools "switch", but they switch different things. CC Switch rewrites each agent's configuration files — it changes the signposts. Magpie runs a local gateway that all agents connect to; it changes the intersection itself.
What CC Switch Does — and Its Ceiling
CC Switch is a desktop configuration manager for AI coding tools (Claude Code, Codex, etc.). It writes provider keys and endpoints into each client's own config file; one click rewrites the file. Convenient for single-agent, single-provider workflows.
Its ceiling: it manages config files, not model requests. Each agent still connects directly to its provider, using its own key and quota. Claude Code cannot use Codex's subscription, and vice versa. Resources remain isolated islands. CC Switch later added local routing and aggregation modes, but its core remains "help the client find the right upstream", not "pool upstreams".
What Magpie Is
Magpie is not just another API proxy like LiteLLM. LiteLLM forwards requests to different providers; you still manage keys and decide which agent uses which model. Magpie steps earlier: it reads the subscriptions you've already logged into across agents (Claude Code, Codex, GitHub Copilot, etc.), exposes them as a single local gateway, then atomically rewrites each agent's config file to point at that gateway.
From the menu bar you can assign Claude Code to use Kimi, or Codex to use your ChatGPT Plus GPT model. In one sentence: Magpie is a local gateway + menu-bar app that centralizes model management for all coding agents, letting your subscriptions be reused across every agent.
Architecture Overview
Magpie's core design has three pillars:
Protocol translation : The gateway speaks four protocols — OpenAI Chat Completions, OpenAI Responses, Anthropic Messages, Google Gemini — and translates between them, including streaming, tool calls, and reasoning content.
Subscription discovery : Magpie reads each agent's login files (e.g., Claude Code config, Codex auth.json) and macOS Keychain to learn which subscriptions you have. It turns each subscription into a "Provider" available to all agents.
Atomic config rewrite : When you pick a model for an agent in Magpie's menu, it atomically rewrites that agent's own config file, preserving comments, order, and formatting. The agent truly believes it's talking to a normal model.
Structural Difference: CC Switch vs Magpie
Each agent connects to its own provider; CC Switch edits config files. Agents are islands.
All agents connect to the same Magpie gateway; Magpie unifies outbound connections. Agents share a single resource pool.
Under the Hood
5.1 Subscriptions Become Providers: One Subscription, All Agents
This is Magpie's core capability. You log into Claude Pro in Claude Code, ChatGPT Plus in Codex, Copilot in GitHub Copilot. Magpie reads those login states and creates three providers: claude, codex, copilot. Every agent's model selector then shows all three providers' models.
In OpenCode you choose claude/claude-opus — OpenCode talks to Magpie, Magpie uses your Claude Code login to call Claude. In Claude Code you choose codex/gpt-5.5 — Claude Code talks to Magpie, Magpie uses your Codex login to call GPT. No key is ever copied or pasted. Magpie directly reuses each agent's own login flow; token refresh happens exactly as the agent originally does it.
5.2 Routing Groups: Quota Exhaustion Doesn't Break the Agent
You can group several models into a "routing group", e.g., group/daily-coding with members DeepSeek, GLM, Kimi. When an agent requests the group, the gateway picks a member per strategy.
Supported strategies:
smart : Among subscriptions with remaining quota, use the one that resets soonest (reduces waste).
order : Try members sequentially; if one fails, move to the next.
rotate : Round-robin across members.
usage : Use the member with the least usage so far.
pace : Use the member with the most remaining weekly quota.
Crucially : when a subscription's quota is exhausted, Magpie automatically fails over to your next account or provider . The agent sees no 429 error, no interruption. Multiple accounts for the same provider are also supported — add several Claude accounts, and Magpie rotates when one hits its limit.
5.3 Secret Masking: Keys Never Leave Your Machine
A clever security feature (disabled by default). Agents may embed API keys, passwords, or emails from .env, config files, or logs into prompts. Before a request leaves your computer, Magpie replaces those values with placeholders like {{API_KEY_k3v9x2mq}}, sends the request, then restores the real values in the response. The provider never sees your actual secrets. Your agent and tools still receive the real values. This is not automatic with self-hosting; it's an extra gateway-layer protection Magpie adds.
Hands-On: Install to Production
6.1 Install
curl -fsSL https://usemagpie.ai/install.sh | shOr download platform-specific packages from usemagpie.ai. Supports macOS, Windows, Linux, Docker, and a pure CLI version.
6.2 Launch
After install, Magpie runs in the menu bar (or system tray). Default gateway address: 127.0.0.1:3425. The UI auto-discovers installed agents and logged-in subscriptions.
6.3 Assign Models to Agents
In the menu-bar panel, each agent shows its current model. Click to open a searchable list of all providers' models. Example: assign codex/gpt-5.5 to Claude Code; Magpie rewrites Claude Code's config so its opus, sonnet, haiku entries point to different models.
6.4 Environment Variable Integration for Unsupported Tools
If a tool isn't in Magpie's supported list but allows custom base URLs, set:
export OPENAI_BASE_URL=http://127.0.0.1:3425/v1
export OPENAI_API_KEY=magpie
export ANTHROPIC_BASE_URL=http://127.0.0.1:3425
export ANTHROPIC_API_KEY=magpie
export GOOGLE_GEMINI_BASE_URL=http://127.0.0.1:3425
export GEMINI_API_KEY=magpie6.5 Profiles: One-Click Full Configuration Switch
Save snapshots of all agents' model assignments as Profiles (e.g., "Focus Mode" = strong models, "Budget Mode" = cheap models) and switch instantly.
AI-Assisted Routing Log Analysis
Magpie's routing decisions are visible in a Routing view showing which provider each request went to and which strategy was used. This means you can feed routing logs to an AI and ask it to analyze "why is my quota draining so fast?"
Scenario : You configured a routing group with DeepSeek, GLM, Kimi, but Kimi's quota is barely used.
Step 1: Ask AI to read the routing logs. Paste Magpie's exported routing log and ask: "Why is Kimi almost never called in group/daily-coding?"
The AI scans the log and finds that under the smart strategy, DeepSeek's reset time is soonest, so it's always preferred. Kimi's reset is later, so smart never picks it.
Step 2: Ask AI for adjustment suggestions. Ask: "If I want Kimi used evenly, what strategy should I use?"
The AI suggests switching to rotate or pace (most remaining weekly quota). It also notes: smart aims to "reduce waste", not "balance usage" — your expectation and the strategy were mismatched.
What AI cannot do : Decide "should Kimi's quota be saved?" — maybe you prefer DeepSeek's response quality, so smart is correct. AI helps you understand strategy behavior; you make the trade-off.
Pros and Cons
Pros
Subscription pooling maximizes resource utilization : One Claude Pro subscription serves all agents; one ChatGPT Plus serves Codex and others. No need to buy duplicate APIs.
Config files untouched except the necessary line : Atomic rewrites preserve comments, order, formatting. Your MCP, plugins, hooks stay intact.
Routing groups prevent interruption on quota exhaustion : Multi-account, multi-provider auto-failover; agent-side is unaware.
Protocol translation enables cross-protocol sharing : OpenAI, Anthropic, Gemini protocols interoperate; agents using different protocols can share models.
On-device secret masking : Keys are masked before requests leave your machine; providers never see real values.
Cons
Requires a local gateway process : Magpie runs as a resident menu-bar app. Lightweight, but one more component to manage.
Subscription discovery reads login files : By default Magpie reads agent login states (config files, Keychain). Privacy-sensitive users must disable this manually.
Ecosystem still growing : Open-sourced September 2026 (version v0.1.3353), iterating fast, but docs and community are still accumulating.
Not zero-config : First-time users must grasp Providers, routing groups, Profiles. Higher learning curve than CC Switch's "click a button".
When to Use Magpie
Multiple agents, want shared subscriptions → ✅✅✅ Strongly recommended. Subscription pooling: one subscription, all agents.
Quota-sensitive, want per-task model allocation → ✅✅✅ Strongly recommended. Routing groups allocate by strategy.
Don't want config files repeatedly rewritten → ✅✅✅ Strongly recommended. Atomic rewrite preserves format.
Need multi-account auto-rotation → ✅✅✅ Strongly recommended. Quota exhaustion triggers auto-switch.
Single agent, single provider → ⚠️ Evaluate. Magpie's value shines in "multi" scenarios; single-agent benefit limited.
Extremely privacy-sensitive → ⚠️ Evaluate. Must disable subscription discovery or use pure API key mode.
Conclusion
Back to the original question: Why are more people using Magpie?
Because "multiple agents, multiple subscriptions" is shifting from "a few tinkerers" to "many developers' daily reality".
When you only had Claude Code, you didn't need Magpie. When you simultaneously use Claude Code, Codex, OpenCode, and hold three or four subscriptions, "each agent using its own" is itself the biggest waste .
Magpie uses a "local gateway" abstraction to decouple agents from providers. Agents no longer care who's behind the curtain; Magpie handles unified scheduling, routing, and rotation.
This is the leap from "configuration tool" to "infrastructure".
References:
GitHub: https://github.com/yetone/magpie
Official download: https://usemagpie.ai
For questions about attribution, corrections or content rights, please contactand we will review it promptly.