Docs · Guide

Get started

magpie is one place to choose the model each of your coding agents uses. Add the providers you have, then pick a model per agent; magpie writes it into that agent’s own config.

Behind it is a small gateway on your machine, at 127.0.0.1:3425. It speaks the OpenAI, Anthropic and Gemini APIs and translates between them, streaming and tool calls included, so any agent can use any provider’s models: Claude Code on a GPT model from your ChatGPT plan, Codex on DeepSeek, OpenCode on your Claude plan.

Providers

Where models come from: subscriptions you sign in to, vendors you have an API key for, and your own endpoints. Each model is named provider/model.

Agents

The tools that use them: Claude Code, Codex, Gemini CLI, OpenCode and the rest. One row each, with the model it is set to.

Gateway

The local endpoint every agent is pointed at when you pick a model through magpie. It sends each request to whoever serves that model.

Routing groups

Optional. Several models or accounts an agent picks as one, group/<id>, for when one runs out of quota.

  1. Add providersSign in to your subscriptions, paste API keys. Once is enough.
  2. Pick a model for each agentClick the agent’s model, choose one. magpie rewrites that agent’s config.
  3. Start a new sessionAgents read their config when they start; the next session uses the new model.

1 · Add your providers

Open the Providers tab and press + Add provider. Pick a tile, or type a vendor’s name to find it.

The Add provider sheet: subscriptions, vendors, relays, what’s on this machine, and custom URLs The Add provider sheet: subscriptions, vendors, relays, what’s on this machine, and custom URLs
Add provider: sign in to a subscription, pick a vendor, or point at any compatible URL.

Subscriptions · sign in, no key

Claude (Pro, Max, Team), ChatGPT (Plus, Pro, Business), Cursor, Grok (SuperGrok), Copilot and Devin. Click the tile and magpie opens the vendor’s own sign-in page in your browser; the account shows up as soon as you finish (Copilot gives you a code to enter on GitHub’s page). Subscriptions are added here, in magpie, not by logging in inside another agent.

Vendors

Anthropic, OpenAI, Google Gemini, DeepSeek, Kimi, Zhipu GLM, MiniMax, Qwen, Mistral, Groq, xAI and more. Pick one, paste the key (Get a key ↗ links to the vendor’s key page), save. magpie asks the vendor which models it serves and offers those; open the provider’s row to choose which ones agents see, or Test it.

On this machine

Ollama and LM Studio. No key.

Custom · any compatible URL

For anything else: a Name, an OpenAI compatible base URL (ending in /v1), an Anthropic compatible one (the root, what ANTHROPIC_BASE_URL would take), or both, and the key. Give every API the endpoint speaks; each agent uses the one it speaks natively and magpie translates for the rest.

Already set up providers in Claude Code or Codex? Import… at the top of the sheet reads Claude Code’s settings.json and Codex’s config.toml, changes nothing in them, and brings over the providers you tick.

Keys live in ~/.config/magpie/providers.json, readable by you alone. magpie never reads keys from your shell environment: what you add is what it uses.

2 · Pick a model for each agent

The Agents tab has a row for each agent installed or configured on this machine. magpie knows Claude Code, Codex, Gemini CLI, OpenCode, Pi, Goose, Cursor, Copilot CLI, Crush, DeepSeek Harness, Command Code, omp, Devin, Hermes Agent and Grok Build.

The Agents tab: one row per agent with the model it uses, and saved profiles at the bottom The Agents tab: one row per agent with the model it uses, and saved profiles at the bottom
One row per agent. Pick a model from any provider; profiles switch everything at once.

Picking a model writes it into the agent’s own config file. Only the keys magpie needs change; comments, ordering and indentation survive, and writes are atomic.

AgentWhat a model through magpie writes
Claude Code~/.claude/settings.json: ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN and the model variables in its env block
Codex~/.codex/config.toml: a [model_providers.magpie] table and the model, with the list in magpie-models.json. Your ChatGPT sign-in is left alone
OpenCode, Pi, CrushA magpie provider entry, and magpie/provider/model
Gemini CLIGOOGLE_GEMINI_BASE_URL pointed at the gateway, API-key auth, and the model

A running session keeps the model it started with. Agents read their config when they start, so the change applies to the next session. Codex builds its model list at start-up too: restart the Codex app and open codex sessions after a switch.

Paseo, editor extensions and other front-ends that run Claude Code or Codex for you start the same CLI, which reads the same ~/.claude or ~/.codex config. Set the model once in magpie and they get it too, from their next session.

3 · Optional: routing groups

With one account per provider you can skip this. It matters once you have several: two ChatGPT accounts, or the same model from a subscription and from a key.

The Routing tab: four agents sending at once through three routing groups, with a rate-limited provider sitting out The Routing tab: four agents sending at once through three routing groups, with a rate-limited provider sitting out
Routing groups: several models or accounts behind one name, with smart or ordered fallback.

Several accounts or keys in one provider

Open the provider’s row and tick every account or key to use. Routing says how requests spread over them: Smart (the default), In order, In turn or Least used first. Fallback lists models to use instead when the provider is out of quota, rate limited or down.

One model over several providers

A group is several models, from one provider or many, that an agent picks as one: group/<id>, under Routing groups in the picker. A model two of your providers serve under the same name becomes a group on its own; New group in the Routing tab makes one of any models you like. The first model answers for what the group can do.

Groups you get without doing anything. Add a second provider that serves a model you already have — Claude Opus from your Claude subscription and from Copilot, DeepSeek from its own API and from OpenRouter — and magpie makes it a group by itself, group/auto-<model>, over every provider that serves it. The name is matched however each vendor spells it (deepseek/deepseek-chat, deepseek-chat). Pick it for an agent to spread its requests over all of them; magpie group rm hides one you don’t want.
RoutingWhat goes first
Smart smartThe default. Over every member’s accounts and keys together: of the subscriptions with quota to spare, the one whose allowance renews soonest; one resting after a failure goes last.
In order orderThe first model until it can’t answer, then the next.
In turn rotateEach conversation’s next turn goes to the next member’s account or key, spreading the load.
Least used usageThe account or key with the most of its allowance left.
StaysHow long a conversation stays with the account or key that answered it
Auto autoThe default. Within a turn always, across turns while what the vendor cached of it is worth keeping.
Session sessionThe whole session, while it can answer.
Within a turn turnWhile the agent sends tool results back; when you speak again, routing decides afresh.
Off offEvery request is routed afresh.

The Routing tab shows the gateway’s decisions live: who answered each request, and why. The same groups from a terminal:

Terminal
magpie groups                        # yours, then those magpie found
magpie group add "Opus anywhere" models=claude/claude-opus-5-5,copilot/claude-opus-5.5 routing=order stays=session
magpie group set opus-anywhere models+=openrouter/anthropic/claude-opus-5.5
magpie group rm opus-anywhere        # one magpie found is hidden; magpie group restore <id>
magpie claude group/opus-anywhere    # use it

Usage and profiles

Usage. The Usage tab counts tokens, cache hits and cost for each agent and model, from every call through the gateway, for Today, 7 days, 30 days or All; your subscriptions’ allowance used, and when it resets, sits on top. Calls an agent makes to its own vendor directly don’t pass through magpie and aren’t counted.

The Usage tab: remaining balances, token and cost totals, and a 30-day chart The Usage tab: remaining balances, token and cost totals, and a 30-day chart
Balances, tokens, cache hits and cost for every call through the gateway.

Profiles. At the bottom of the Agents tab, + Save current snapshots every agent’s settings under a name; click the chip to switch everything back in one move.

From the terminal

magpie tui is the whole app in a terminal, and every step above has a command. magpie help lists them all.

CommandDoes
magpie lsEvery agent found and its settings
magpie presetsThe vendors magpie knows
magpie provider add deepseek sk-…Add a preset with its key
magpie accounts add codexSign in to one more Claude or ChatGPT subscription
magpie providersYour providers: host, key, models, who uses them
magpie modelsEvery model agents can pick, as provider/model
magpie claude codex/gpt-5.5Set an agent’s model
magpie codex effort highSet another field
magpie codex defaultBack to the agent’s own default, magpie’s wiring removed
magpie save work · use workSave and apply a profile
magpie usage 7dTokens and cost per agent and model
magpie trayStart with the menu bar icon only

FAQ

Do I need to export OPENAI_BASE_URL or ANTHROPIC_BASE_URL?

No. For the agents magpie lists, it writes the gateway’s address and token into the agent’s own config file. Those variables are only for other tools with a base-URL setting: the Gateway tab’s Connect section has them as copy buttons and snippets.

Does magpie have to be running?

For a model through magpie, yes: the gateway runs with the app. Closing the window leaves it running in the menu bar or tray; magpie tray starts the icon alone (put it in your login items), and magpie serve runs just the gateway. An agent on its own model and its own sign-in doesn’t go through magpie.

How do I put an agent back the way it was?

Pick one of the agent’s own models in the picker, or run magpie <agent> default. magpie removes what it wrote and restores the values it replaced, such as an ANTHROPIC_BASE_URL you had before.

I switched models, but my agent still uses the old one.

A running session keeps what it started with. Start a new one; for Codex, restart the Codex app too.

Does editing the agent’s config by hand break anything?

No. magpie reads the files each time and touches only the keys it sets, so your other settings and comments stay. Providers brought over with Import… are copies: later changes in the agent’s settings aren’t copied again.

Stuck, or have a setup worth sharing? Ask on Discord. Vendors who want to hand their users a ready-made provider: see Add to magpie.