JoeyWu-tech 32ea16c5a4 gateway, provider: a model AgentRouter turns away on chat in Chinese is asked, and tested, on the next API (#3766)
char1eslu (#3766): AgentRouter answers gpt-5.6-sol, gpt-6-astra and
gpt-6.1-sol on chat completions with a 400, "模型 gpt-5.6-sol 不支持
/v1/chat/completions 接口,请改用 /v1/responses(OpenAI Responses API)。",
and serves them on Responses (gpt-5.6-sol on Messages too: the report's
provider test has ✓ anthropic). wrongEndpoint, the gateway's word that a
model is served on another API, which has the request asked there when
the provider has a URL for it (and remembers it in unfit), read English
alone. So while the provider had a Chat URL, a Chat client's request for
these models got that 400 back, whatever other URLs it had. The report's
200 ("/v1/chat/completions → /v1/responses") is a request translated
past chat, which d03779cc does for this host only while chat isn't
usable for the model, as after the report's url=. A Messages client's
request goes to the reporter's Anthropic URL and is answered there.

wrongEndpoint now also reads the message's two clauses, "不支持
/v1/chat/completions 接口" and "改用 /v1/responses", and asksResponses
the second, so a provider with its Chat URL alone gets the note that the
model is served on /v1/responses, which it has no URL for. Both read the
body's JSON strings decoded too (wordsOf), as the gateway's other words
are (#1669): the report quotes the message, not the body, and a relay
whose JSON escapes it (模型 ...) says the same. Neither clause
names a model, so the other two models' refusals match if their
messages differ only in the name (the report shows their 400 rows, not
their words). The routing page says so.

The same words now reach the group's checks, as retryable and
shapeRefused read wrongEndpoint. In a routing group (chat, drawing,
video, System One), a member answering this 400 ended the request there
on d03779cc: it was neither retryable nor shapeRefused, as
unservedWords' 模型.{0,12}不支持 misses these model ids by one
character. Now the next member is asked and this one isn't rested, as
for the English words. The image-tool and cache-key retries, which ask
again on a 400, don't on this one.

Not changed: a model's test, which still asks one API (the next
commit). Other relays' wordings: only the report's two clauses are
added, nor AgentRouter's other way round (a chat-only model asked on
/v1/responses), which the report has no words for.

What was run (tree 4e5bb297, on origin/main d03779cc, go1.26.8,
linux/amd64):
- TestChineseRefusalFallsBackToResponses, new: a provider with a Chat
  and a Responses URL whose chat completions answers the report's 400
  (its message verbatim; the JSON around it is a guess), as it is and
  escaped as Python's json.dumps escapes it. A request on
  /v1/chat/completions and one on /v1/messages each get the reply from
  Responses, chat asked once and Responses once.
- TestWrongEndpoint: the report's 400, escaped too, and each of its
  clauses alone are the wrong endpoint; "当前分组 default 下对于模型 gone
  无可用渠道" (new-api's wording for a model no channel serves, written
  from memory, not from the report) is not.
- TestWrongAPINote: AgentRouter with its Chat URL alone and the report's
  400, as it is and escaped, gets " (asked at
  https://agentrouter.org/v1/chat/completions; gpt-5.6-sol is served on
  /v1/responses, which AgentRouter has no URL for)".
- The three, -count=50 -v: 150 PASS. -race -count=20 -cpu 1,2 over them
  and the fallback tests beside them (WrongEndpoint, WrongAPINote,
  FallsBack, OpenCodeGo, OtherRelayKeepsItsOneAPI): ok, no race.
- Broken by hand, each red:
  - wrongEndpoint without the two clauses: every case of
    TestChineseRefusalFallsBackToResponses, and TestWrongEndpoint's
    rows of the whole message.
  - wrongEndpoint with one clause of the two: TestWrongEndpoint's row of
    the other clause alone (each).
  - wrongEndpoint reading the body as it came: the escaped cases of
    TestChineseRefusalFallsBackToResponses and TestWrongEndpoint's
    escaped row.
  - asksResponses without its clause: TestWrongAPINote, both bodies;
    reading the body as it came: its escaped one.
- A real run: magpie built at d03779cc and at this tree (go build -tags
  nogui -buildvcs=false), in a sandbox HOME, a local server standing in
  for AgentRouter (its /v1/models lists gpt-5.6-sol, chat completions
  answers the report's 400, /v1/responses and /v1/messages answer), set
  up as the report has it: magpie provider add agentrouter url=...
  key=... models=gpt-5.6-sol and anthropic=..., then responses=..., then
  url= (the chat URL cleared). At each step magpie serve, and curl on
  /v1/chat/completions (whole and streamed) and /v1/messages:
  - Chat and Anthropic URLs: d03779cc answers both chat requests with
    the 400; this tree 200, chat asked once and /v1/messages after it.
  - Chat, Responses and Anthropic URLs: d03779cc answers both chat
    requests with the 400; this tree 200, chat asked once and Responses
    after it (the streamed one went to Responses at once: unfit).
  - The chat URL cleared: both builds 200, the chat requests answered
    on Responses.
  - /v1/messages: 200 at every step on both, from /v1/messages.
- gofmt -l; go vet -tags nogui and go build -tags nogui for linux,
  windows and darwin, and go vet and go build for windows without the
  tag: exit 0 each. go vet and go build without the tag on linux: exit
  1 (this box has no GTK or WebKitGTK dev packages).
- go test -tags nogui -count=1 -timeout 45m ./..., Bun 1.4.2 on PATH:
  67 ok, and 7 red, none in what this changes: agent
  TestInstalledVersion, TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
  TestQoderSettingsFromAnIDEPluginIsNotTheCLI, TestOmpDetectedWithPiDir
  and TestZedAppPath (#3141);
  TestReasonixCLIRequiresSupportedNativeVersion and
  TestReasonixCLIRecoversAfterProbeTimeout (#3641); davsync TestSync
  (#3420); edit TestWriteAtomicReadOnlyHardLink and testenv TestProgram
  (#3640); gateway TestPluginToldWhereTheAgentWorks (#3675); gui
  TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie
  (#3649); provider's "close of synctest channel from outside bubble"
  from TestUnreadLoginsWriteErrorsKeepCredentials (#3632), so the
  package's tests after it didn't run: go test ./internal/provider
  -skip '^TestUnreadLoginsWriteErrorsKeepCredentials$', Bun 1.4.2 on
  PATH: ok.

Not tried: the real AgentRouter (no account here), macOS, an agent's
own requests (curl's stood in).

---- provider (second commit of the branch) ----

provider: a model turned away on one API is tested on the next (#3766)

char1eslu (#3766): after Test models, the three models AgentRouter
turns away on chat completions were red in the provider's Models list,
and Working only hid them, while the gateway answered them on
Responses. Their usage rows (kind provider_test, source probe: the
editor's test) were each a 400 on /v1/chat/completions, "模型
gpt-5.6-sol 不支持 /v1/chat/completions 接口,请改用 /v1/responses(OpenAI
Responses API)。". They stayed red after the reporter cleared the chat
URL (magpie provider set agentrouter url=), with their provider test
printing only ✓ responses and ✓ anthropic.

A model's test (testOne) asked one API, the first the provider speaks
unless the vendor's list, the user's pick or the client names another,
and took its answer as the model's. The editor's Test models sends the
editor's form, whose fields that aren't empty win over the saved
provider (typed), so a form that still names a chat URL the saved
provider no longer has asks chat: in the real run below that is red at
d03779cc, as the report's rows are.

Now, when the vendor says the model isn't served there
(catalog.WrongEndpoint: the gateway's wrongEndpoint, moved with its
words so both read the same), the test asks the next API the provider
has a URL for that may serve the model, by the gateway's rule (usable:
the model's listed or picked APIs, else each API the provider isn't
named-only on), with a key that sees the model on that API (keySeeing,
testOne's pick taken out as it was). That API's answer is the model's.
One that says the same has the next asked; when none is left the first
answer stays, so a provider with its Chat URL alone still shows the
vendor's message. Test models, a model's own test and Test as in the
editor, and magpie provider test <id> <model> (--as too), go through
it. As Codex the next API is asked with Codex's headers, as the gateway
sends them on Responses and Chat; as Claude Code the test isn't moved,
since the gateway sends Claude Code's headers on Messages alone.
docs/subsystems/providers-accounts.md says so, and the routing page
points there.

Not changed: which API is asked first, so a model that moved is asked
on chat again at each test before the API that serves it (the
gateway's unfit is its own). magpie provider test <id> with no model,
which tests each endpoint with a model of its own pick (testModel), is
as it was: its chat row can be red for a model the vendor serves
elsewhere, #3844.

What was run (tree 519dee3b, on origin/main d03779cc, go1.26.8,
linux/amd64):
- TestTestModelsMovesToTheAPIServingIt, new: AgentRouter with a Chat
  and a Responses URL and a key for each (sk-chat made for Chat,
  sk-responses for Responses), its chat completions answering the
  report's 400 (its message verbatim; the JSON around it is a guess), as
  it is and escaped. gpt-5.6-sol is OK on Responses, asked on chat with
  sk-chat and then on responses with sk-responses, and nothing else. A
  model chat turns away with new-api's "无可用渠道" (written from memory,
  not from the report) is red after one ask. With the Chat URL alone,
  gpt-5.6-sol is red after one ask, its error the vendor's message. When
  both APIs say it, both are asked and chat's answer stays.
- TestTestModelsKeepsAModelOnItsAPI, new: a model the user picked chat
  for, and one the vendor's list names on chat alone, is red on chat
  after one ask, as the gateway keeps its request there.
- TestTestModelsAsAClientMovesAsTheGatewayDoes, new: turned away on
  Responses with the word, a test as Codex is green on chat, asked with
  Codex's User-Agent; a test as Claude Code is red on Messages after one
  ask.
- The three, -count=50: 150 PASS; the gateway's
  TestChineseRefusalFallsBackToResponses, TestWrongEndpoint and
  TestWrongAPINote at this tree, -count=50: 150 PASS.
- -race -count=20 -cpu 1,2, internal/provider's TestTest and TestDetect
  tests and internal/gateway's WrongEndpoint, WrongAPINote, FallsBack,
  OpenCodeGo and OtherRelayKeepsItsOneAPI ones: ok, no race.
- Broken by hand, each red:
  - the test never hearing the vendor's word, as at the previous
    commit: TestTestModelsMovesToTheAPIServingIt, and
    TestTestModelsAsAClientMovesAsTheGatewayDoes as Codex;
  - the next API asked with the first one's key:
    TestTestModelsMovesToTheAPIServingIt, red on responses;
  - the next API asked whatever API the model is picked or listed on:
    TestTestModelsKeepsAModelOnItsAPI, both models green on responses
    after two asks;
  - a test as Claude Code moved too:
    TestTestModelsAsAClientMovesAsTheGatewayDoes, green on chat;
  - the words in English alone, as at d03779cc:
    TestTestModelsMovesToTheAPIServingIt, the report's message as it is
    and escaped;
  - the words matched in the body as it came:
    TestTestModelsMovesToTheAPIServingIt, escaped.
  The previous commit's own breaks of the words are red at this tree
  too, in the gateway's tests.
- A real run: magpie built at d03779cc, at the previous commit and at
  this tree (go build -tags nogui -buildvcs=false), in a sandbox HOME,
  the previous commit's stand-in and steps. magpie provider test
  agentrouter gpt-5.6-sol:
  - Chat and Anthropic URLs: "✗ chat gpt-5.6-sol · 400 · 模型
    gpt-5.6-sol 不支持 ..." at d03779cc and the previous commit, chat
    asked alone; "✓ anthropic" at this tree, chat asked and then
    /v1/messages.
  - Chat, Responses and Anthropic URLs: the same ✗ chat, then; "✓
    responses" at this tree, chat asked and then /v1/responses.
  - The chat URL cleared: "✓ responses" at all three, responses asked
    alone.
  Then, the chat URL cleared, magpie web's /api/provider/test (the
  editor's Test models) for gpt-5.6-sol: with the form naming the old
  chat URL, red on chat with the vendor's message at d03779cc and the
  previous commit, green on responses at this tree (chat asked, then
  responses); with the form's chat empty, green on responses at all
  three. The gateway answered as at the previous commit.
- gofmt -l; go vet -tags nogui and go build -tags nogui for linux,
  windows and darwin, and go vet and go build for windows without the
  tag: exit 0 each. go vet and go build without the tag on linux: exit
  1 (this box has no GTK or WebKitGTK dev packages).
- go test -tags nogui -count=1 -timeout 45m ./..., Bun 1.4.2 on PATH:
  67 ok, and 7 red, none in what this changes: agent
  TestCodexDriftReached and TestCodexBehindReverseProxy (#3398);
  TestInstalledVersion, TestHowInstalled,
  TestQoderSettingsFromAnIDEPluginIsNotTheCLI, TestOmpDetectedWithPiDir
  and TestZedAppPath (#3141);
  TestReasonixCLIRequiresSupportedNativeVersion and
  TestReasonixCLIRecoversAfterProbeTimeout (#3641); davsync
  TestSyncTeraCloudStillSeesOtherWrites (#3420); edit
  TestWriteAtomicReadOnlyHardLink and testenv TestProgram (#3640);
  gateway TestPluginToldWhereTheAgentWorks (#3675); gui
  TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie
  (#3649); provider's "close of synctest channel from outside bubble"
  from TestUnreadLoginsWriteErrorsKeepCredentials (#3632), so the
  package's tests after it didn't run: go test ./internal/provider
  -skip '^TestUnreadLoginsWriteErrorsKeepCredentials$', Bun 1.4.2 on
  PATH: ok.

Not tried: the editor itself (magpie web's route, which its Test models
posts to, stood in), macOS, the real AgentRouter (no account here).

Review (yetone/magpie maintainer agent): the two commits of
JoeyWu-tech's branch (387191d5a, f8fcf936e, patch sha256 15d451ff…,
as the issue says) squashed into one, one commit per issue. Read every
line. The only other place reading these words, asksResponses (the
note that a provider lacks a Responses URL), reads the Chinese and the
escaped body too; no other matcher of a wrong-API refusal is left
(grep for the English phrases outside catalog.go).

Run at this tree on 6cb1cfb79, macOS, go1.27:
- red by hand: the two Chinese phrases taken out of WrongEndpoint:
  TestChineseRefusalFallsBackToResponses (all four subtests) and
  TestTestModelsMovesToTheAPIServingIt red. The next-API loop in
  testOne off: TestTestModelsMovesToTheAPIServingIt and
  TestTestModelsAsAClientMovesAsTheGatewayDoes red. Green restored.
- real run, macOS: base and patched builds in a sandbox HOME, a fake
  AgentRouter (chat answers the report's literal 400, Responses
  answers), magpie provider add agentrouter url=… responses=…, then
  magpie provider test agentrouter gpt-5.6-sol and magpie serve with a
  /v1/chat/completions request. Base: "✗ chat … 400 · 模型 gpt-5.6-sol
  不支持 …" and the client gets the 400. Patched: "✓ responses", and
  the client gets the answer from /v1/responses (vendor log: chat,
  responses, chat, responses).
- at the pushed head (rebased on 5f3146be0; the docs conflict with
  #3696's sentences merged, both kept): go build ./..., go test
  ./internal/catalog ok; gateway -run
  'WrongEndpoint|WrongAPI|Fallback|FallsBack|Chinese|OtherAPI|Endpoint|OpenCode'
  ok (50s); provider -run 'TestTestModels|TestTest|TestOne|Probe' ok;
  vet linux and windows of the three packages ok; gofmt -l clean.
  The whole gateway and provider packages were not run at this head:
  another session's go test ./... held the machine (one suite at a
  time).

Not tried: the real AgentRouter, the GUI editor itself.
2026-10-27 16:23:20 +08:00

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 your next account.

Release Stars Discord License
macOS Windows Linux Docker Termux

Sponsors

APINEBULA  零词元  Kimi  APIKEY.FAN  WandAPI

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


magpie's Agents page: Claude Code on Kimi K3, Codex on DeepSeek V4 Pro, Gemini CLI on GLM-5.3, each picked from one list

Is magpie for you?

Each agent keeps its model in its own file, in its own format, with its own keys and base URLs. A subscription you pay for works in one agent and nowhere else. magpie puts all of that behind one app and one local gateway:

  • Pick any model for any agent from one list. magpie edits the one key that matters in the agent's own config.
  • Use one provider everywhere: an API key, a local model, or the Claude, ChatGPT, Copilot, Gemini or Grok plan you're signed in to.
  • Keep going when a quota runs out: a provider's next account takes over, and a routing group moves on to another model or provider, so the agent never sees the error. With one account and no group there is nothing to move to, and the error reaches the agent.
  • Keep your secrets off the vendor's servers: once you turn masking on in Settings → Privacy (it's off by default), keys, passwords and emails in a prompt are masked on your computer before the request leaves it, and put back in the reply.

It's for you if you use more than one agent, more than one provider, or more than one account. If you use one agent on its vendor's own plan and that's enough, you don't need it.

Runs on macOS, Windows and Linux (menu bar app, window, TUI, web UI and CLI), in Docker, and on Termux.

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 and paste a key, 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 tool generate_image "a magpie, watercolour" -o hero.png   # magpie's image, vision and search tools, called directly
magpie tui                                      # the whole thing, in a terminal

magpie finds the subscriptions your agents are signed in to by reading their sign-ins (Claude Code's and Codex's files, the Keychain). To keep it from reading them, turn off Settings → Privacy → Subscription accounts, or run magpie accounts discovery off (on turns it back on). MAGPIE_NO_ACCOUNTS=1 turns it off for one run without changing the saved setting. API-key providers work either way.

Supported agents

Claude Code · Claude Desktop · Claude Science · Codex · Gemini CLI · Antigravity CLI · OpenCode · OpenChamber · MiMo Code · DevEco Code · Pi · oh-my-pi · StepCode · MothX · PenguinHarness · Aside · OmO · Prime Agent · Goose · Cursor CLI · Cursor Private Inference · Zed · VS Code Chat · VS Code Insiders · VSCodium Chat · Zoo Code · JetBrains Air · Copilot (JetBrains) · Copilot CLI · Crush · DeepSeek Harness · Reasonix Studio · Command Code · fx · Devin · Hermes Agent · Mister Morph · Kimi Code · jcode · Qwen Code · Muse Code · Empryo · MiniMax Code · Droid · Cline · Qoder · Qoder CN · Grok Build · Grok App · ZCode · WorkBuddy · WorkBuddy AI · CodeBuddy Code · Pencil · OpenPencil · NewMax · Raycast · Kiro Crew · T3 Code · OpenHanako · AtomCode · Snow CLI · Alma · Cindy · Lody · AionUi · Ante · AstrBot

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

How it fits together

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

How magpie fits together: your agents send requests to the magpie gateway at 127.0.0.1:3425, which routes them through routing groups and plugins to your API keys, subscriptions and local models.

What it does

Any model, any agent

Click a value and a searchable list opens: every model of every provider you added, as provider/model. The agent's config is rewritten atomically, and its comments, order and formatting stay as they were. Profiles save every agent's setup under one name ("Budget", "Focus") and switch them all back in one move. Each agent can also have its own short list of models; a profile keeps that list too.

The menu bar panel The model picker

Privacy masking

Agents put what they read into the prompt: an .env, a config file, a log with a token in it. With masking on, magpie swaps those values for placeholders on your computer before a request leaves it, and swaps them back in the reply. Your agent and your files keep the real values; the vendor never sees them.

Insights › Masking: 5,812 values kept from vendors in 7 days, flowing from Claude Code and Codex through magpie to OpenAI, Kimi and DeepSeek, and each request's masked values
Found two ways Rules for what is certain (API keys, private keys, tokens, emails, and card and ID numbers whose checksum adds up), and, if you want it, a model that runs on this computer for the names, addresses and passwords no rule can find (a 1.6 GB download, on the CPU)
Put back everywhere A value becomes a placeholder such as {{API_KEY_k3v9x2mq}}, and every placeholder in the reply turns back into its value: streamed text and tool-call arguments too, so a command the agent runs has the real key
Nothing breaks A value gets the same placeholder every time, so the conversation, the prompt cache and thinking signatures stay valid. A value masked once is masked wherever it shows up later
Never on disk Values are held in memory only. The record keeps each value's kind, length and first characters. If masking is on and can't run, the request is held back (503), never sent as written
You can check it Insights › Masking lists every request it changed, with what the vendor got instead, side by side, and Try it in Settings shows what a text would become
Your rules Secrets and personal data each on or off, finer kinds (passport, IBAN, MAC, public IP…), your own words and patterns, and whether a value found is masked, only warned about, or held back (Mask, Warn, Block)

The cost: the model sees {{API_KEY_…}}, not the key, so a task about the value itself (why is this token refused?) can't be done on it. Put such values under Never mask. Rules can be wrong now and then; the Masking page is where you'd see it. It's off until you turn it on in Settings → Privacy. Emails at names kept for examples (example.com, .test, .invalid) are left as written.

Providers

Pick a preset, paste a key. Model lists come 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.

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

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 and each account can go through a proxy of its own.

Add provider: subscriptions to sign in to, vendors, relays and local servers

Subscriptions

An agent you're signed in to is a subscription with models behind it, so magpie offers it as a provider to every other agent. 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 you choose, or the moment the last one resets.

Routing groups

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

A conversation stays with the account that answered it while the vendor's prompt cache is worth keeping. Groups can contain groups. Intent routing has a small model of your choice read each new turn, so tests go to the strong model and quick questions to the cheap one. The Routing view shows every decision live.

The Routing view: four agents through magpie to seven providers, live
An intent-routed turn, explained step by step A routing group inside a routing group

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

Plugins run on Bun, downloaded the first time one 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. onRequest can rewrite a request or turn it away, onEvent sees each streamed event, onResponse the whole reply. 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.

Usage and cost

The Usage page: balances, tokens, cache hit rate and cost
Tokens and cost Tokens, cache reads and writes, reasoning and calls, with cost at list price in dollars or yuan; set your own price for any model
Quota Balances and quota windows for every key, plan and account (magpie quota), and a reminder 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
Bills By account and by upstream key, and OTLP export to your own observability stack

Sharing

Local network Turn on Share on local network and give each client a named gateway key with its own daily, weekly or monthly token and cost limit
Remote magpie A laptop uses the providers, accounts and groups of the magpie on your desktop, and still wires 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 sync machines over WebDAV (Nutstore, Nextcloud…), S3, or an encrypted GitHub repository backup

Also

  • Library: write instructions, MCP servers, skills and subagents once; magpie writes them into each agent's files in its format, and removes only what it wrote.
  • Web search for any model: a model that can't search gets magpie's search: a provider that can, or search APIs (Tavily, Brave, Exa, Firecrawl, You.com, DeepSeek, SearXNG), asked in the order you drag them into, each one able to be switched off without losing its key. An API can hold several keys: searches take turns over them (or use them in order with pick=order), a key refused lately is asked last, and Tavily keys show what each has used of its limit, in Settings and in magpie search. Any agent can mount the same search as an MCP server, with a web_search tool and a web_fetch tool that reads a page by its URL.
  • Images and video: an image tool for any agent over MCP, with the model you choose, and videos with a Grok subscription.
  • Agents kept current: the Agents page shows each CLI's version, updates it the way it was installed, and gives the commands for the ones you don't have.
  • WSL: on Windows, agents inside WSL distros are wired too, and their sessions counted.
  • Keep awake, light and dark, and your theme's look on Omarchy.

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
Remote magpie Use one magpie's providers and groups from your other computers
Docker Run magpie on a server or a NAS

Privacy

Your prompts, replies, keys and accounts go only to the providers you use, and with privacy masking on, the secrets in them don't go even there. 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. A partner's website and key links go through usemagpie.ai/go/…, which counts the click, and usemagpie.ai counts fetches of the partner list; the server sees these whatever the settings, and keeps no id or address. Icons named by a plugin, an import link or the library are fetched through usemagpie.ai/api/icon, so their hosts see Cloudflare's address, not yours; the server only passes the picture on, and counts and keeps nothing. The Privacy page lists everything magpie sends by itself, with an example and every switch; the reference has the rules.

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

S
Description
Magpie with per-account plugin concurrency
Readme MIT
312 MiB
Languages
Go 60%
JavaScript 28.1%
HTML 10.8%
CSS 1%