Magpie: Open-source model gateway for coding agents (Claude Code, Codex)
Open-source developer yetone released Magpie, a local model gateway on port 3425 that routes Claude Code and Codex agents across multiple provider quotas.
By Dillip Chowdary • Nov 10, 2026 • Source: github.com
In this post
Open-source developer yetone released Magpie, an open-source model gateway for coding agents, as detailed in github.com's report. Supported by Moonshot AI's Kimi, the tool centralizes model routing for assistants like Claude Code, Codex, and Gemini CLI behind a local proxy at 127.0.0.1:3425. Developers can redirect any coding agent to commercial subscriptions, remote APIs, or local engines through a menu bar app or terminal interface.
This report covers Magpie's proxy architecture, translation layer, quota failover, privacy masking, and setup steps. It is written for engineers running multiple command-line agents or managing accounts across DeepSeek, Anthropic, OpenAI, and Google. Developers using one assistant on its vendor plan without quota limits do not need this gateway.
01Universal Local Gateway For Coding Agents
Magpie provides a unified local control plane that discovers installed coding assistants and updates their configuration files on disk. Instead of manually editing keys and URLs across disparate files, developers select models from a single menu. The gateway rewrites settings atomically, preserving existing comments, parameter ordering, and whitespace across tools like Claude Code, Codex, and OpenCode.
The local daemon runs at 127.0.0.1:3425, exposing endpoints compatible with OpenAI, Anthropic, and Gemini wire protocols. Subscription accounts in agent files or system keychains are detected automatically, letting active plans from Claude, Copilot, ChatGPT, or Grok share models across tools. Developers can disable account discovery using privacy settings, terminal flags, or the MAGPIE_NO_ACCOUNTS environment variable.
02Multi Protocol Translation And Failover Routing
Coding agents operate in isolated environments, causing workflows to halt whenever an API key hits rate limits or exhausts usage allowances. Magpie replaces manual credential swapping with routing groups that monitor responses and execute automatic failovers. When an account exhausts its quota, the gateway redirects pending requests to a backup account or secondary provider before the agent errors.

The gateway engine performs real-time translation across OpenAI Chat, OpenAI Responses, Anthropic Messages, and Google Gemini protocols. This allows assistants like Claude Code to query Moonshot Kimi or Codex to run on DeepSeek while preserving streaming, tool calls, and reasoning traces. Model catalogs and reasoning levels synchronize with models.dev, adding newly released models to local pickers immediately upon refresh.
| Metric | Standalone Setup | Magpie Gateway |
|---|---|---|
| Listening Port | None (direct connection) | 127.0.0.1:3425 |
| Wire Protocols | 1 native protocol | 4 translated formats |
| Quota Depletion | Immediate agent error | Automated account failover |
| Privacy Model Size | 0 GB (no local scanning) | 1.6 GB CPU neural model |
| Masking Failure | Plaintext sent to vendor | HTTP 503 held back |
Advertisement
Tech Pulse Daily
Get tomorrow's pulse first
Join engineers who read Tech Pulse before stand-up. Free, weekday mornings.
03Client Side Privacy Masking And Token Protection
Coding assistants frequently ingest project files, environment variables, authentication tokens, and server logs into prompt payloads. Magpie addresses credential exposure through a client-side privacy masking engine that intercepts outgoing requests, replacing sensitive strings with deterministic placeholders before payloads leave the host computer. When the remote model responds, the gateway reverses placeholders, restoring original values in streamed text and tool arguments.
Detection combines pattern matching with optional local neural inference to balance speed and accuracy. Built-in regex filters identify private keys, API tokens, email addresses, and checksummed cards, while an optional 1.6 gigabyte CPU model detects names, addresses, and passwords. Extracted values reside strictly in volatile memory rather than disk, with failed masking operations triggering an HTTP 503 status code.
04Cross Platform Installation And Terminal Configuration
Magpie runs on macOS, Windows, Linux, Termux, and Docker containers, distributing prebuilt binaries through usemagpie.ai and package scripts. On Linux systems, the installer configures desktop dependencies like WebKitGTK 4.1 or sets up an interactive terminal interface on headless systems. Developers install or update the software via the official shell script or compile directly using Go.
curl -fsSL https://usemagpie.ai/install.sh | sh
magpie provider add deepseek sk-your-key-here
magpie claude deepseek/deepseek-v4-pro
magpie codex moonshot/kimi-k2.5
magpie group add "Opus anywhere" models=claude/claude-opus-5-5,copilot/claude-opus-5.5 routing=smart
magpie claude group/opus-anywhere
magpie save work && magpie use workStandard environment variables route third-party tools through the local gateway port without modifying binary files. Supplying custom base URLs and placeholder API keys directs any OpenAI, Anthropic, or Gemini client through Magpie routing. The uninstaller restores original agent configuration files before removing software binaries, preserving user profiles unless purged.
05Privacy Model Overhead And Upstream Constraints
While client-side privacy masking shields credentials, substituting real values with placeholders creates constraints during prompt debugging. Because upstream models receive placeholder tokens rather than raw text, agents cannot diagnose authentication failures or malformed cryptographic signatures. Engineers debugging token syntax must register those values in the Never mask exemption list so raw text reaches the model.
Running the optional neural masking model introduces host resource overhead, requiring a 1.6 gigabyte disk download and dedicated CPU execution during request preparation. Furthermore, single-account setups without configured routing groups cannot execute automated failovers when token quotas expire. In those configurations, upstream HTTP rate limit errors pass directly to the agent, mirroring standard unproxied operational behavior.
Source model gateway for coding agents FAQ
What network port does the Magpie gateway use?
Magpie runs as a local proxy service on port 127.0.0.1:3425, translating across OpenAI, Anthropic, and Gemini wire protocols.
How does Magpie handle quota exhaustion during agent runs?
When an account runs out of tokens, Magpie transfers the request to the next configured account or routing group to prevent agent errors.
Can Magpie mask sensitive credentials before requests leave the computer?
Yes, client-side privacy masking replaces API keys, passwords, and emails with deterministic placeholders, restoring original text in the reply.
Sources
Author
Dillip Chowdary
Writes Tech Bytes coverage of AI, engineering, and the tools that actually ship. Editor of Tech Pulse Daily.
Related on Tech Bytes
Advertisement