magpie

command module
v0.1.1131 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 54 Imported by: 0

README

magpie

magpie

Every agent's model. One place.

Claude Code on Kimi. Codex on DeepSeek. Gemini CLI on GLM. OpenCode on your ChatGPT plan.
Switch any of them from the menu bar. One local gateway serves them all,
and when a quota runs out, it quietly moves on to the next account.

Release Stars Discord License
macOS Windows Linux Docker Termux

Download  ·  Docs  ·  Reference  ·  Plugins  ·  Discord  ·  English · 简体中文



45+

agents, one list

4

wire APIs, one gateway

5

routing modes

0

config files edited by hand

Why magpie

You probably use more than one agent. Each keeps its model in its own file, in its own format, with its own keys and base URLs, and its own opinion about which vendors it supports. The subscription you pay for works in one agent and nowhere else. And when it runs dry at 3 pm, you're back to editing config files.

magpie gathers all of it into one place.

🎛 One screen

Every agent on your machine, in one list. Click a model, pick another. magpie changes exactly one key in the agent's own config. Comments, order and formatting stay untouched.

🔌 One gateway

127.0.0.1:3425 speaks OpenAI Chat, OpenAI Responses, Anthropic Messages and Gemini, and translates between them. Streaming, tool calls and reasoning included.

🔀 Routing that keeps going

Group models from several providers. When one is rate-limited or out of quota, the next one answers. Your agent never sees the error.

🔑 Subscriptions, shared

Your Claude, ChatGPT, Copilot, Gemini or Grok sign-in becomes a provider that every other agent can use. No key to copy.

🧩 Plugins

OpenCode auth plugins and pi packages from npm run inside magpie. A plugin can also be gateway middleware that rewrites every request and reply.

📊 Every token, counted

Tokens, cache hits, cost at list price, balances and quota windows for every provider, account and session, with limits per key.


How it fits together

flowchart LR
  subgraph A["Your agents"]
    direction TB
    a1["Claude Code"]
    a2["Codex"]
    a3["Gemini CLI"]
    a4["OpenCode · Zed · Cursor CLI · 40+ more"]
  end
  subgraph M["magpie · 127.0.0.1:3425"]
    direction TB
    g["Gateway<br/>Chat · Responses · Messages · Gemini"]
    r["Routing groups<br/>fail-over · smart · pace"]
    p["Plugins & middleware"]
    g --> r --> p
  end
  subgraph P["Your providers"]
    direction TB
    p1["API keys<br/>DeepSeek · Kimi · GLM · OpenRouter …"]
    p2["Subscriptions<br/>Claude · ChatGPT · Copilot · Gemini · Grok"]
    p3["Local models<br/>Ollama · LM Studio"]
  end
  A --> M --> P

Any model, any agent

Click a value and a searchable list opens: every model of every provider you added, as provider/model. Pick one and the agent's config is rewritten safely and atomically. Start a new session and the agent is on the new model.

Profiles save the setup of every agent under one name ("Budget", "Focus") and switch them all back in one move. Each agent can also have its own short list of models, so its picker shows only what you want there.

magpie lives where you are: a menu bar panel on macOS, Windows and Linux, a full window, a TUI (magpie tui), a web UI (magpie web, for WSL or a server over SSH) and a plain CLI.

The menu bar panel The model picker

A provider is one field away

Pick a preset, paste a key, done. Model lists come straight from the vendor, with names and reasoning levels filled in from models.dev, so a model released this morning is in your picker on the next refresh. Nothing is compiled in.

Presets include Anthropic · OpenAI · Google Gemini · DeepSeek · Kimi · Zhipu GLM · MiniMax · StepFun · Qwen · Baidu Qianfan · Tencent Cloud · Huawei Cloud MaaS · Volcengine Ark · Mistral · Groq · xAI · OpenRouter · Together · Fireworks · SiliconFlow · NVIDIA NIM · ModelScope · Ollama · LM Studio … and any OpenAI- or Anthropic-compatible URL.

Already set up elsewhere? Import brings in the providers from CC Switch, Claude Code, Codex and Alma. Add to magpie links let a provider's website hand its config to magpie in one click. Each key, like each account, can go through a proxy of its own.

Routing that keeps going

A routing group is several models an agent picks as one, such as group/daily-coding. The gateway spreads requests over every member's keys and accounts:

Mode What it does
smart Of the subscriptions with quota left, use the one that renews soonest, so less is wasted at the reset
order Use the first model until it can't answer, then the next
rotate Move to the next member on each turn
usage Use the least-used member first
pace Use the account with the most of its week left per hour until it resets

Conversations stay with the account that answered them while the vendor's prompt cache is still worth keeping. Intent routing goes further: a small model of your choice reads each new turn, so tests go to the strong model and quick questions to the fast, cheap one. Groups can contain groups, and the Routing view shows every decision live.

An intent-routed turn, explained step by step A routing group inside a routing group

→ Intent routing, in depth

Sign in once, use it everywhere

An agent you're signed in to is a subscription with models behind it, so magpie offers it as a provider. Add several accounts per subscription and magpie fails over between them.

  • Claude: drives the real local claude binary and bridges your agent's tools over MCP
  • Codex / ChatGPT: your ChatGPT plan's models, in every other agent
  • GitHub Copilot, Gemini (Code Assist), Antigravity, Grok (SuperGrok) and more
  • Any OpenCode auth plugin or pi package from npm

Daily warm-up starts each Claude and ChatGPT account's 5-hour window at the times of day you choose, or the moment the last one resets, so your windows line up with your day instead of with your first prompt.

Plugins

magpie plugin add opencode-gemini-auth   # an OpenCode plugin from npm
magpie plugin add pi-antigravity         # a pi package, the same way
magpie plugin login google-plugin        # its own sign-in flow, in magpie

magpie runs plugins on Bun, downloaded the first time a plugin needs it. A plugin signs in, lists its models and makes each request; agents use those models like any other provider's. Browse magpie-community/plugins, or write your own.

A plugin can also be gateway middleware: JavaScript that sees what every agent sends and gets back, whatever the provider. onRequest can rewrite a request or turn it away, onEvent sees each streamed event, onResponse sees the whole reply. It runs in-process, about a microsecond per event, and a hook that throws or runs too long leaves the request as it was.

// alias.middleware.js — magpie plugin add ./alias.middleware.js
export function onRequest(body, ctx) {
  if (body.model === "fast") return { ...body, model: "deepseek/deepseek-chat" };
}
Ready-made middleware, most of it what New API does for its channels, with the same JSON
Package What it does
param-override New API's param_override: set, delete, move or rewrite request fields, under conditions, or turn a request away
model-map New API's model_mapping: send a model under another name; replies keep the name asked for
system-prompt Your system prompt on every request, or some agents' or models'
word-guard New API's sensitive-word filter: turn away or mask words in what users send, and in replies
think-tags Take <think>…</think> out of replies, or put reasoning_content into them
magpie plugin add @magpie-community/middleware-model-map
magpie plugin options model-map '{"mapping": {"fast": "deepseek/deepseek-chat"}}'

Find them under Plugins › Discover › Gateway middleware. See Gateway middleware.

Every token, counted

  • Tokens, cache reads and writes, reasoning and calls, with cost at list price, in dollars or yuan. Set your own price for any model.
  • Balances and quota windows for every key, plan and subscription account (magpie quota). A reset reminder warns you before a window renews with much of it unused.
  • Sessions: every agent conversation with its cost and title, reopened in your terminal with one click.
  • Context: how full each request's context window is, how much came from the cache, and what fills it, part by part.
  • By account and by upstream key, so you can check a vendor's bill line by line, and OTLP export to your own observability stack.

Share one magpie

  • On your network. Turn on Share on local network and give each client a named gateway key, each with its own daily, weekly or monthly token and cost limit.
  • Remote magpie. A laptop can use the providers, accounts and routing groups of the magpie on your desktop, while still wiring its own agents.
  • Docker. Run ghcr.io/yetone/magpie on a server or a NAS and manage it from the web UI.
  • Sync. Back up to a file, or keep machines in sync over WebDAV (Nutstore, Nextcloud…) or S3.

The little things

📚 Library. Write instructions, MCP servers and skills once; magpie writes them into each agent's files in that agent's format, and removes only what it wrote.

🖼 Images and video. Give any agent an image tool through MCP, made with the model you choose, and videos with a Grok subscription.

☕ Keep awake. Your computer doesn't go to sleep in the middle of an agent's task.

⬆️ Install and update agents. The Agents page shows each CLI's version, updates it the way it was installed, and gives the commands to install the ones you don't have yet.

🐧 WSL. On Windows, agents inside WSL distros are wired too, and their sessions counted.

🎨 At home on your desktop. Light and dark, and on Omarchy magpie takes your theme's look.

Supported agents

Claude Code · Claude Desktop · Codex · Gemini CLI · Antigravity CLI · OpenCode · OpenChamber · MiMo Code · Pi · oh-my-pi · Aside · OmO · Goose · Cursor CLI · Cursor Private Inference · Zed · VS Code Chat · VS Code Insiders · VSCodium Chat · JetBrains Air · Copilot (JetBrains) · Copilot CLI · Crush · DeepSeek Harness · Reasonix Studio · Command Code · fx · Devin · Hermes Agent · Mister Morph · Kimi Code · Qwen Code · Muse Code · Empryo · MiniMax Code · Droid · Cline · Qoder · Qoder CN · Grok Build · ZCode · WorkBuddy · CodeBuddy Code · Pencil · T3 Code · OpenHanako · AtomCode · Alma · Cindy

magpie shows only the agents installed on your machine; setup notes for some of them are in the reference. Anything else that takes a base URL can use the gateway too:

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

Quick start

1 · Install. Download the app from usemagpie.ai, or run:

curl -fsSL https://usemagpie.ai/install.sh | sh

Mac builds are signed and notarised, and every build updates itself. Behind a firewall, use --proxy or --mirror. Or go install github.com/yetone/magpie@latest, or the Docker image.

2 · Add a provider. Open magpie and go to Providers → Add provider. Pick a preset, or sign in with a subscription.

3 · Pick a model for each agent on the Agents page. Start a new session and it's on the new model.

Or do it all from the terminal:

magpie provider add deepseek sk-…              # a preset needs only the key
magpie claude deepseek/deepseek-v4-pro          # Claude Code on DeepSeek
magpie codex moonshot/kimi-k2.5                 # Codex on Kimi
magpie group add "Opus anywhere" models=claude/claude-opus-5-5,copilot/claude-opus-5.5 routing=smart
magpie claude group/opus-anywhere               # fails over between subscriptions
magpie save work && magpie use work             # profiles
magpie quota                                    # what's left on every plan
magpie tui                                      # the whole thing, in a terminal

Documentation

Get started The guided tour
Reference Every agent, provider option, gateway endpoint, CLI command and file
Plugins Use plugins and write your own
Intent routing Route each turn by what it asks for
Import links "Add to magpie" buttons for provider websites

Privacy

Your prompts, replies, keys and accounts go only to the providers you use. Once a day a released magpie tells us it is in use: a random id, its version and system, and which agents, providers and models it is used with, by magpie's own ids (a provider you added yourself is only custom), and for each partner listed first in the add sheet, how many times a day it was shown, opened and added (counts only). No names, URLs, accounts, keys, prompts or usage. Turn part or all of it off in Settings → Privacy, or with DO_NOT_TRACK=1. What is sent, exactly.

Community

Questions, ideas, or a model that won't show up? Tell us on Discord. That is where feedback goes.

This repository doesn't take pull requests. Only maintainers can open them. If you'd like a fix or a feature, describe it on Discord and we'll build it.

If magpie saved you from editing one more config file, a ⭐ helps others find it.

Star history

License

MIT

Documentation

Overview

magpie — one place to pick every agent's model.

Directories

Path Synopsis
internal
access
Package access keeps the named API keys issued by the gateway.
Package access keeps the named API keys issued by the gateway.
agent
Package agent describes every coding agent magpie can drive: where its config lives, which fields matter (model, effort, …) and which values to offer.
Package agent describes every coding agent magpie can drive: where its config lives, which fields matter (model, effort, …) and which values to offer.
agentenv
Package agentenv names the environment variables through which an agent really installed on this machine reaches magpie: the one list a test sandbox clears, so that a test meets only the agents it put there itself.
Package agentenv names the environment variables through which an agent really installed on this machine reaches magpie: the one list a test sandbox clears, so that a test meets only the agents it put there itself.
appdir
Package appdir decides where magpie keeps its own files: the one place every other package asks (#508).
Package appdir decides where magpie keeps its own files: the one place every other package asks (#508).
autostart
Package autostart opens magpie when the user logs in, in the tray with no window, so the gateway every agent is pointed at is there from the start.
Package autostart opens magpie when the user logs in, in the tray with no window, so the gateway every agent is pointed at is there from the start.
awake
Package awake keeps the computer from going to sleep by itself while agents work through magpie's gateway (xiao_wang24004 on X: the computer went to sleep in the middle of an agent's task).
Package awake keeps the computer from going to sleep by itself while agents work through magpie's gateway (xiao_wang24004 on X: the computer went to sleep in the middle of an agent's task).
backup
Package backup packs what the user set up in magpie into one file, sealed with a passphrase, to carry to another machine: the providers (their keys too, unless left out), the pictures picked for them, the settings, the profiles, every agent's model and the library (the instructions, MCP servers and skills magpie gives the agents).
Package backup packs what the user set up in magpie into one file, sealed with a passphrase, to carry to another machine: the providers (their keys too, unless left out), the pictures picked for them, the settings, the profiles, every agent's model and the library (the instructions, MCP servers and skills magpie gives the agents).
budget
Package budget holds each gateway key to its own limit (#585): what a key has used in its window is summed from usage.jsonl, the records the Usage page shows, so it survives a restart; a request is let in only while the key has something left after what its requests in flight are expected to use, and those are settled with what the call recorded.
Package budget holds each gateway key to its own limit (#585): what a key has used in its window is summed from usage.jsonl, the records the Usage page shows, so it survives a restart; a request is let in only while the key has something left after what its requests in flight are expected to use, and those are settled with what the call recorded.
catalog
Package catalog knows which models exist.
Package catalog knows which models exist.
claudebridge
Package claudebridge contains the small stdio MCP helper used by magpie's Claude Subscription bridge.
Package claudebridge contains the small stdio MCP helper used by magpie's Claude Subscription bridge.
codexcat
Package codexcat renders models the way Codex describes them: the entries of its models.json, for `model_catalog_json` and for the model list magpie hands Codex in place of the ChatGPT backend's.
Package codexcat renders models the way Codex describes them: the entries of its models.json, for `model_catalog_json` and for the model list magpie hands Codex in place of the ChatGPT backend's.
davsync
Package davsync keeps magpie's setup the same on every computer through a WebDAV folder or an S3-compatible bucket.
Package davsync keeps magpie's setup the same on every computer through a WebDAV folder or an S3-compatible bucket.
desktopdir
Package desktopdir finds Claude Desktop's folders: the one place the agent, the library and the session readers ask.
Package desktopdir finds Claude Desktop's folders: the one place the agent, the library and the session readers ask.
edit
Package edit provides format-preserving editors for the config files that coding agents keep: JSON/JSONC, TOML and YAML.
Package edit provides format-preserving editors for the config files that coding agents keep: JSON/JSONC, TOML and YAML.
filememo
Package filememo keeps what was parsed from a file until the file changes, so a page that asks many times over reads it once.
Package filememo keeps what was parsed from a file until the file changes, so a page that asks many times over reads it once.
fonts
Package fonts describes the installed faces a desktop page can choose.
Package fonts describes the installed faces a desktop page can choose.
fx
Package fx keeps the dollar-to-yuan rate the CNY currency preference (see internal/settings) converts list-price costs with.
Package fx keeps the dollar-to-yuan rate the CNY currency preference (see internal/settings) converts list-price costs with.
gateway
Package gateway is the local LLM endpoint agents talk to.
Package gateway is the local LLM endpoint agents talk to.
gui
Package gui hosts the desktop app: a tray panel and a regular window that share one small web UI.
Package gui hosts the desktop app: a tray panel and a regular window that share one small web UI.
gui/genpurposes command
genpurposes generates the browser's request-kind catalog from usage's catalog.
genpurposes generates the browser's request-kind catalog from usage's catalog.
imagemcp
Package imagemcp is `magpie mcp image`: a stdio MCP server an agent is given, when it is picked for it in the Library, to make images with the model the Settings' Image generation names, and videos with a Grok subscription.
Package imagemcp is `magpie mcp image`: a stdio MCP server an agent is given, when it is picked for it in the Library, to make images with the model the Settings' Image generation names, and videos with a Grok subscription.
library
Package library keeps what every agent should know, once: the instructions each reads before a conversation, the MCP servers it can call and the skills it can load.
Package library keeps what every agent should know, once: the instructions each reads before a conversation, the MCP servers it can call and the skills it can load.
mcpauth
Package mcpauth signs magpie in to a remote MCP server that asks for an OAuth sign-in (Neon, Notion, Supabase…), once for every agent (#615).
Package mcpauth signs magpie in to a remote MCP server that asks for an OAuth sign-in (Neon, Notion, Supabase…), once for every agent (#615).
mcpauth/mcpauthtest
Package mcpauthtest is a remote MCP server behind an OAuth sign-in, as Neon's or Notion's is, for the tests of magpie signing in to one (#615).
Package mcpauthtest is a remote MCP server behind an OAuth sign-in, as Neon's or Notion's is, for the tests of magpie signing in to one (#615).
middleware
Package middleware runs the gateway middleware plugins declare: a module with onRequest, onEvent and onResponse hooks that the gateway calls on every request an agent sends it, every event of the reply's stream and every whole reply.
Package middleware runs the gateway middleware plugins declare: a module with onRequest, onEvent and onResponse hooks that the gateway calls on every request an agent sends it, every event of the reply's stream and every whole reply.
netproxy
Package netproxy decides which proxy magpie's own requests to vendors go through.
Package netproxy decides which proxy magpie's own requests to vendors go through.
omarchy
Package omarchy is what magpie knows of Omarchy (omarchy.org), the Hyprland desktop: whether it runs on one, and the look its current theme gives every surface, so magpie's windows can take that look there and nowhere else.
Package omarchy is what magpie knows of Omarchy (omarchy.org), the Hyprland desktop: whether it runs on one, and the look its current theme gives every surface, so magpie's windows can take that look there and nowhere else.
plugin
Package plugin runs OpenCode's provider plugins for magpie.
Package plugin runs OpenCode's provider plugins for magpie.
proc
Package proc makes the commands magpie runs: agents' CLIs, the probes that ask them what they have, the system's own tools.
Package proc makes the commands magpie runs: agents' CLIs, the probes that ask them what they have, the system's own tools.
profile
Package profile stores named snapshots of every agent's settings, and of who gets what from the library, so a whole setup can be switched in one move.
Package profile stores named snapshots of every agent's settings, and of who gets what from the library, so a whole setup can be switched in one move.
provider
Package provider holds the model vendors magpie can reach: where each one lives, which protocols it speaks, the API key the user typed in, and which of its models should show up in the agents' pickers.
Package provider holds the model vendors magpie can reach: where each one lives, which protocols it speaks, the API key the user typed in, and which of its models should show up in the agents' pickers.
qoder
Package qoder speaks Qoder's inference API (api3.qoder.sh agent_chat_generation SSE) the way the Qoder desktop client does, so a Qoder subscription can serve every agent through magpie's gateway.
Package qoder speaks Qoder's inference API (api3.qoder.sh agent_chat_generation SSE) the way the Qoder desktop client does, so a Qoder subscription can serve every agent through magpie's gateway.
redact
Package redact keeps secrets on the machine.
Package redact keeps secrets on the machine.
sessions
Package sessions lists the agents' recent sessions from their own session files — Claude Code's projects/*/<id>.jsonl (and Qoder's, the same kind), Codex's rollout files, OpenCode's database (or its older JSON files) and ZCode's, Pi's session files and omp's, DeepSeek Harness's, Cline's, Grok Build's, WorkBuddy's, Droid's, Cursor CLI's and Alma's chat stores — with the tokens each spent, what that cost at the effective price, and the command that resumes it.
Package sessions lists the agents' recent sessions from their own session files — Claude Code's projects/*/<id>.jsonl (and Qoder's, the same kind), Codex's rollout files, OpenCode's database (or its older JSON files) and ZCode's, Pi's session files and omp's, DeepSeek Harness's, Cline's, Grok Build's, WorkBuddy's, Droid's, Cursor CLI's and Alma's chat stores — with the tokens each spent, what that cost at the effective price, and the command that resumes it.
settings
Package settings keeps the few preferences the desktop app has: which palette to paint with, which language to speak, how the agents are arranged.
Package settings keeps the few preferences the desktop app has: which palette to paint with, which language to speak, how the agents are arranged.
shortcut
Package shortcut puts magpie in the Start menu on Windows.
Package shortcut puts magpie in the Start menu on Windows.
source
Package source chooses where magpie reads from, with a mirror as a fallback when the official address can't be reached.
Package source chooses where magpie reads from, with a mirror as a fallback when the official address can't be reached.
stats
Package stats counts magpie's users: once a day a running magpie tells PostHog it is in use, under an id made up on this computer, with its version and system, and, unless the user turned that part off, which agents, providers and models it is used with, by their built-in ids (Usage): a provider of the user's own is only "custom".
Package stats counts magpie's users: once a day a running magpie tells PostHog it is in use, under an id made up on this computer, with its version and system, and, unless the user turned that part off, which agents, providers and models it is used with, by their built-in ids (Usage): a provider of the user's own is only "custom".
steady
Package steady reads and replaces files that another process may be replacing at that moment.
Package steady reads and replaces files that another process may be replacing at that moment.
testenv
Package testenv gives a package's tests a home of their own, on every OS: HOME, USERPROFILE (Windows' home), the XDG folders and Windows' APPDATA and LOCALAPPDATA all point into one new temporary folder, the agents' own variables (agentenv.Vars) are cleared, and the keychain tools and agent CLIs on PATH are failing stand-ins, so that no test reads or writes the files of the user running it.
Package testenv gives a package's tests a home of their own, on every OS: HOME, USERPROFILE (Windows' home), the XDG folders and Windows' APPDATA and LOCALAPPDATA all point into one new temporary folder, the agents' own variables (agentenv.Vars) are cleared, and the keychain tools and agent CLIs on PATH are failing stand-ins, so that no test reads or writes the files of the user running it.
tui
Package tui is magpie in the terminal: one row per agent, arrow keys to pick a field, enter to change it; and pages for providers and usage beside it (pages.go), routing groups (routing.go), sessions (sessions.go) and the library (library.go), 1–6 to go between them.
Package tui is magpie in the terminal: one row per agent, arrow keys to pick a field, enter to change it; and pages for providers and usage beside it (pages.go), routing groups (routing.go), sessions (sessions.go) and the library (library.go), 1–6 to go between them.
update
Package update keeps magpie current.
Package update keeps magpie current.
upstream
Package upstream reads the vendors' own status pages (#971, emo172): a request that fails while Anthropic's or OpenAI's API is down looks, in magpie, like a sign-in or quota problem, and the user signs in again and again for nothing.
Package upstream reads the vendors' own status pages (#971, emo172): a request that fails while Anthropic's or OpenAI's API is down looks, in magpie, like a sign-in or quota problem, and the user signs in again and again for nothing.
usage
Package usage keeps the token count of every call the gateway serves, so magpie can show what each agent and model consumed and roughly what it cost.
Package usage keeps the token count of every call the gateway serves, so magpie can show what each agent and model consumed and roughly what it cost.
wslrun
Package wslrun runs, from magpie on Windows, a command that is installed only in a WSL distro: Claude Code signed in to inside Ubuntu, say.
Package wslrun runs, from magpie on Windows, a command that is installed only in a WSL distro: Claude Code signed in to inside Ubuntu, say.
zed
Package zed speaks to Zed's hosted models, the way the Zed editor does for a Zed Pro (or trial, student, business) account.
Package zed speaks to Zed's hosted models, the way the Zed editor does for a Zed Pro (or trial, student, business) account.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL