# magpie

> magpie is a free, open-source (MIT) desktop app for macOS, Windows and Linux that lets every AI coding agent use every model. Add a provider once (DeepSeek, Kimi, GLM, Qwen, MiniMax, OpenRouter, Ollama, or the Claude and ChatGPT subscriptions you already pay for), then pick it in Codex, Claude Code, Gemini CLI or any other agent. It runs a local gateway that speaks the OpenAI, Anthropic and Gemini APIs and translates between them, with streaming, tool calls and reasoning intact.

magpie lives in the menu bar (tray on Windows and Linux), with a full window, a TUI and a CLI. The Mac download is about 15 MB, built on the system WebView (no Electron). It is signed and notarised on macOS and updates itself.

Key facts:

- Website: https://usemagpie.ai/ (English), https://usemagpie.ai/zh/ (中文), https://usemagpie.ai/ja/ (日本語), https://usemagpie.ai/de/ (Deutsch)
- Source code: https://github.com/yetone/magpie
- Downloads: https://github.com/yetone/magpie-releases/releases/latest
- Install from a terminal (macOS, Linux): `curl -fsSL https://usemagpie.ai/install.sh | sh`
- Community: Discord, linked from the website
- Price: free
- Full text of every docs page in one file: https://usemagpie.ai/llms-full.txt

This file holds the full text of every English docs page. The index is https://usemagpie.ai/llms.txt.

---

Source: https://usemagpie.ai/docs/start

# Get started

magpie is one place to choose the model each of your 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 providers.** Sign in to your subscriptions, paste API keys. Once is enough.
2. **Pick a model for each agent.** Click the agent’s model, choose one. magpie rewrites that agent’s config.
3. **Start a new session.** Agents 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.

### Subscriptions · sign in, no key

Claude (Pro, Max, Team), ChatGPT (Plus, Pro, Business), Copilot, Gemini (Code Assist) and Antigravity; Cursor, Grok (SuperGrok), Devin and others are added from the Plugins page. 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.

- **More than one account..** Click the Claude or ChatGPT tile again to add another; each is listed under the provider, one click from being the one in use.
- **Already signed in?.** An agent you are signed in to on this machine shows up as a provider too, *signed in as …*.
- **Every agent can use it..** A subscription’s models are `claude/…`, `codex/…`, `copilot/…`, `antigravity/…` in every other agent’s picker: to run Antigravity’s Claude or Gemini models in Codex or Claude Code, sign in to Antigravity here and pick an `antigravity/…` model on the agent’s row. Nothing else to set up. Google may suspend an Antigravity account it sees used outside Antigravity, so use one you can afford to lose. Claude subscription requests run through the Claude Code installed on this machine, so keep it installed.

### 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, MiMo Code, DevEco Code, Pi, Goose, Cursor CLI, Copilot CLI, Crush, DeepSeek Harness, Command Code, omp, OmO, Devin, Hermes Agent, MiniMax Code, Grok Build, ZCode, OpenHanako and Alma.

- **Click the model.** to open the picker. Models are grouped: the agent’s own, your routing groups, then each provider you added. Type to filter, or type any model id that is not listed.
- **Reasoning effort.** , where the agent has it (Codex’s *effort*, Pi’s *thinking*), is a slider under the list.
- **Fast mode..** A model with a fast mode has a bolt on its row, beside its star; it shows on the picked row and under the pointer. That is a GPT model of a ChatGPT (Codex) account, a GPT or o-series model on an OpenAI key, Cursor’s models with a fast variant, Claude Opus on an Anthropic key, and a plugin’s or another magpie’s model that says it is served at priority. Click it, and every request this agent sends that model goes in its vendor’s fast mode, quicker at a higher price: `service_tier: "priority"`, as Codex’s own `/fast` sends it, or Claude’s `speed: "fast"`, whatever API the agent speaks. Click again for Ultrafast, where a ChatGPT account offers it on the model, and again for the usual speed. Each agent is switched apart, and the model’s fallbacks go as they are. In a routing group, each member has the same switch in its row.
- **Claude Code through magpie.** can also give its opus, sonnet and haiku tiers models of their own; by default they follow the main model.

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.

| Agent | What 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, MiMo Code, DevEco Code, Pi, Crush | A `magpie` provider entry, and `magpie/provider/model` |
| Open Code Review | `~/.opencodereview/config.json`: a `magpie` custom provider, made the one `ocr` uses |
| AtomCode | `~/.atomcode/config.toml`: a `magpie` provider account and one model entry per catalog model |
| Snow CLI | `~/.snow/profiles/magpie.json`: a `magpie` profile, made the active one (Snow App takes it in with "Sync Snow CLI API config") |
| QwenPaw | A `magpie` provider in `~/.qwenpaw.secret/providers/custom/magpie.json`, and each agent's `active_model` in its `agent.json`. Restart QwenPaw after the first connect |
| Gemini CLI | `GOOGLE_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.

> **`claude-magpie`: Claude Code through magpie, `claude` left as it is.** To keep a plain `claude` on your own Claude account and start magpie's Claude Code only when you ask for it, leave Claude Code unconnected and run `claude-magpie` instead. It starts the same `claude` with magpie's settings over yours for that session (the gateway, the model and its tiers), so `~/.claude/settings.json` is never rewritten. Every argument goes to Claude Code: `claude-magpie --resume`, `claude-magpie -p "…"`. magpie puts it beside the `magpie` command when you add that in Settings › Command line; with the command there already, run `magpie claude launcher add` once. `magpie claude run` does the same. A model you pick with `/model` in it is kept for the next `claude-magpie`, and your own `claude` keeps its model. magpie has to be running.

## 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.

### 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, Until used up, staying on the next once one is used up even after the first renews, In turn, Least used first, Use before expiry, By weight, each account or key taking its share by the weight set beside it (a Max account 5, a Pro one 1), or Speed first, the key that answered fastest lately 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, `auto/<model>` (the model's own id, as in `auto/claude-opus-4.6`; the older `group/auto-…` id still works), 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.

> **One model under the provider's odd id.** Some providers serve a model under an id of their own, `deepseek-v4.1-flash-1017` or `grok-4.6@500k`. Give it the id you want in the provider's editor, under Names, prices & levels, in Listed as beside Same as, then Save; or run `magpie model id relay/grok-4.6@500k grok-4.6`. magpie then lists it, routes it, joins it to the `auto/grok-4.6` group with your other providers' `grok-4.6`, holds gateway keys to it and counts its usage as `grok-4.6`, and still asks the provider for `grok-4.6@500k`. One id is one model of a provider: the last one you give it to has it, and the provider's own model of that id is left out of the list while it does. `magpie model id relay/grok-4.6 --reset` takes it back, and `magpie model ids` lists them. It works for a subscription you signed in to and a plugin's provider too (`magpie model id cursor/deepseek-v41-flash-1017 deepseek-v4.1-flash`): the account or the plugin is still asked for its own id.

| Routing | What goes first |
| --- | --- |
| Smart `smart` | The default. Over the members’ accounts and keys together (a group in the group as one, see below): of the subscriptions with quota to spare, the one whose allowance renews soonest. The week decides; an account with five hours and no week (Claude Enterprise) goes by its five hours, so ahead of every week renewing later. Credits with no reset (WorkBuddy’s packages, each ending on its own day) count as renewing when the soonest of those left run out, so the WorkBuddy account whose credits end first goes first; accounts renewing together (free ones at the month’s end) go by whose credits left end first after that. One resting after a failure goes last. |
| In order `order` | The first model until it can’t answer, then the next. |
| Until used up `drain` | One account or key until it is used up, then the next, which keeps the requests: one before it that renews meanwhile doesn’t take them back. One rate limited or failing is passed over only while it rests. |
| In turn `rotate` | Each message you send goes to the next member’s account or key; the agent’s tool calls for it stay on the same one. With Stays on Session, a whole conversation stays on one instead. |
| Least used `usage` | The account or key with the most of its allowance left. |
| Use before expiry `pace` | The account with the most of its week left per hour until it renews — the one with the most to lose at its reset — so less of each member’s week is lost at its reset; an account with five hours and no week (Claude Enterprise) by what its five hours have left per hour until they renew, so almost always first. Credits in an account that expire before it resets count too: those that expire first, per hour until they do, when that is the more (WorkBuddy’s check-in credits). One at 90% or more waits until the others can’t answer. A key by the tokens sent it lately. |
| By weight `weight` | Each model takes its share of the requests by the weight set beside it in the group editor (1 to 1000, 1 if unset): one weighing 3 takes three for every one a model weighing 1 takes, spread out rather than in bursts. Each model is tried whole over its own accounts or keys, as its provider routes them, and a group in the group counts as one. One resting after a failure leaves the round; the next model is the fallback when one fails. |
| Speed first `fast` | The member, account or key that answered this model fastest lately: the time to its first token and how fast it writes, newer answers counting more. Those within a tenth of each other keep their order. One not measured in the last hour gets one request in five, so a channel that was slow once is tried again; one resting after a failure goes last. Only streamed replies are measured, and a restart measures again from scratch. |
| Cheapest first `cheap` | Groups only. The member whose model costs least now, by its price a million tokens in and out at this hour as Usage counts it: your own price for it, else its list price, at the provider’s price rate and rate windows. DeepSeek’s own API, Command Code’s and OpenCode Go’s DeepSeek models cost double in their peak hours (weekdays 01:00–04:00 and 06:00–10:00 UTC), and Ollama Cloud’s DeepSeek V4.1 Flash and V4 Pro in its own (weekdays 12:00–18:00 UTC, half price the rest of the time), so a DeepSeek model listed on two providers goes to the one cheaper at that hour. Members that cost the same keep their order; one with no known price goes last. |
| Small context first `fit` | Groups only. Each request goes to the member with the smallest context window that holds it, so the big ones are kept for long requests. A member whose window the request is longer than is left out, as under every routing. Members of one size go as Smart orders them, and one whose window isn’t known goes last. |

| Stays | How long a conversation stays with the account or key that answered it |
| --- | --- |
| Auto `auto` | The default. Within a turn always, across turns while what the vendor cached of it is worth keeping. |
| Session `session` | The whole session, while it can answer. With Smart, Least used first or Use before expiry, a new session goes to the account or key the fewest other sessions are on, so sessions side by side each keep one of their own. |
| Within a turn `turn` | While the agent sends tool results back; when you speak again, routing decides afresh. |
| Off `off` | Every request is routed afresh. |
| Strict `strict` | Never moves to another account or key, even past its usage cap: when that one is rate limited or out of quota, the error goes to the agent. New conversations are spread as with Session. |

### Rules · a turn to a chosen model

A group’s Rules send a turn to one of its models when the turn is of a kind you name: long (`tokens ≥ N`), carrying an image, asking for reasoning (on, or at least a level), from certain agents, asking for something you describe (an *intent*), the agent compacting its context, or working in one of some folders (a project). A rule’s conditions all have to hold, so one can say “in ~/work/acme, and long”. They are looked at top first when you send a message; the first that matches puts its model first, with the group’s others behind it if it fails. A turn no rule matches is routed as the group always routes, and keeps to where it was.

- A rule decides as a turn begins, and the turn stays on that model while the agent sends tool results back, so what the vendor cached isn’t lost halfway. The one exception: a turn that grows past its model’s context moves to a member that takes it.
- Tokens are estimated from the request’s size, or what the vendor counted for the conversation’s last request, whichever is more. Leave some margin: a rule at 150k for a 200k model, not 199k.
- A subagent is a conversation of its own, so a rule can send it elsewhere while its agent keeps where it is.
- An intent is a few words for what the user asks for — “writing or fixing tests”, “a quick question”. As a turn begins, the group’s classifier — any model magpie has; a small, fast one without reasoning is best — is asked once which of the intents that could match the user’s message is. Only the message is sent, not the conversation. If it fails, exceeds the configured timeout (15 s by default; set in Settings → Models → Replies → Intent classifier timeout) or can’t say, no intent matches and the turn goes by the other rules. It isn’t asked when a rule without an intent would decide anyway, and the same message isn’t asked about twice. Its calls show in Usage as magpie’s own. Exactly what it is asked, how its answer is used and what happens when it fails: [Intent routing](https://usemagpie.ai/docs/intent).
- compacting matches an agent compacting its conversation — Claude Code’s `/compact` and auto-compact, Codex, OpenCode, Pi, Gemini CLI, Qwen Code, Kimi Code — so a cheaper, faster model writes the summary while the conversation stays on its own. A compaction is decided on its own: the turn it happens in, and its cache, stay where they were. When the conversation is longer than the rule’s model takes, the next rule that matches, or the group’s order, decides instead.
- **Hours and days..** A rule can hold only at some hours, on some days, by this computer’s clock — a vendor’s peak hours, say. A rule that sends those turns elsewhere still leaves the vendor’s model behind it for failover. To keep a model out entirely, choose Pause the model instead from the rule’s ⋯ menu: while it holds (its hours and days, its agents), that model is left out of the group — never first, never a fallback, not kept for the conversation it was in — and it is back once they end. A pause holds by hours, days and agents only; if every model of the group is paused, the agent is told so.
- **Folders..** in folder matches a turn from an agent working in one of the folders you list, or a folder inside one: `~/work/acme` takes `~/work/acme/web`, not `~/work/acme-old`. The folder is the one the agent tells its model in the request — Claude Code, Codex, OpenCode and Pi say it — so an agent that doesn’t say its folder matches no folder rule. `~` is your home folder, `C:\work` is also WSL’s `/mnt/c/work`, and on macOS and Windows case doesn’t count.
- **Reasoning..** A rule can also set the reasoning its model is asked for, so an intent picks the model and the effort as a pair: Set its reasoning in the rule’s ⋯ menu, or `use-effort=low` from a terminal. The model is asked for it whatever the agent asked, at the model’s nearest level; a model whose levels magpie doesn’t know, and the models behind it for failover, are asked as the agent asked. See [Intent routing](https://usemagpie.ai/docs/intent#effort).
- The Routing tab says which rule sent each turn where, what the classifier said, and the folder the agent said it was in.

### Groups in groups

A group’s models can include another group: pick it under *Routing groups* in Add a model, or `models+=group/<id>` from a terminal. The group in it takes its place in the order and routes among its own models by its own routing and rules. So Coder can be `deepseek-v4-pro` then *Fast*, and Fast its own order of cheap models. A Coder rule can send a turn to `group/fast`, and Fast’s own rules then pick which of its models goes first.

- **No loops..** A group can’t be in itself, directly or through the groups in it. Saving Fast with Coder in it, while Coder has Fast, is refused, and the picker doesn’t offer such a group. Groups go at most 8 deep. A group can’t be removed while another has it: take it out there first.
- **Each group routes by its own routing..** Whatever the outer group’s routing, it never reaches inside a group in it: Smart, In turn, Least used or Use before expiry weighs the inner group as one member, by the account or key the inner group would try first, and where it lands the inner group is tried whole, in its own order. Coder on Smart with Claude (In order) and GPT (In order) in it compares Claude’s first with GPT’s first, not all of their accounts together.
- **So does a provider routed its own way..** A model whose provider routes its accounts or keys In order, In turn, by Least used, Use before expiry or Weight keeps that inside any group, weighed as one by the account or key it would try first and tried whole in its own order. One left on Smart, the default, has its accounts weighed with the group’s others as one pool, so the one whose allowance renews soonest goes first whichever provider it is of.
- **Failover goes through..** If every model in the inner group fails, the outer group’s next member answers, as with any member.
- A model that appears twice (on its own and in a group in it) is asked once, at its first place.

The Routing tab shows the gateway’s decisions live: who answered each request, and why. The same groups from a 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 set opus-anywhere routing=weight weight=claude/claude-opus-5-5=3  # three of every four requests to it
magpie group rule add opus-anywhere use=openrouter/anthropic/claude-opus-5.5 tokens=150k  # long turns to it first
magpie group rule add opus-anywhere use=copilot/claude-opus-5.5 intent="a quick question" classifier=groq/llama-3.1-8b-instant
magpie group rule add opus-anywhere use=deepseek/deepseek-v4-flash compact  # /compact summaries to a cheap model
magpie group rule add opus-anywhere use=kimi/kimi-k2.6 folders=~/oss,"~/My Project"  # turns in those projects to it first
magpie group rule add opus-anywhere pause=copilot/claude-opus-5.5 time=14:00-18:00 days=mon-fri  # left out in those hours
magpie group rule add opus-anywhere pause=claude/claude-opus-5-5 except-folders=~/big-task  # the model kept for the task in ~/big-task: left out of every other folder
magpie group rule add opus-anywhere use=deepseek/deepseek-v4-flash when="effort is off" when="not subagent"  # reasoning off, not a subagent
magpie group rule add opus-anywhere use=deepseek/deepseek-v4-flash when="system matches ^你是对话标题命名"  # a harness's title call, told by its system prompt
magpie group set coder models+=group/opus-anywhere  # a group in a group
magpie group rule opus-anywhere      # its rules; rule rm|mv <n>, rule classifier <group> <model>
magpie group copy opus-anywhere "Opus test"  # the same models, routing and rules, to change on its own
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.

**Context.** Usage’s Context tab shows what each agent’s prompts hold, read as they pass through the gateway: its system prompt, tool definitions (an MCP server’s as one), instruction files and skills, the files its tools read, their other output and the conversation, as parts of the model’s context window. Each agent gets a score out of 100 — how much of its prompt the cache reads, how lean it starts, how fast it fills and how often it fails — and tags such as *Lean start* or *MCP-heavy* that say what the score was told by. Open a session to see its latest request’s window, cell by cell; the Routing page shows the same for any request you pick. Click a part, a cell or an item to read its text as magpie sent it, masked where masking is on. That text is kept for the last 10 requests only, in memory while magpie runs; what is saved keeps names only, never your prompt’s text, and nothing of it is sent anywhere.

**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. The profile in use is ticked, and the tray panel’s Profiles button shows its name; a setting changed by hand since clears the tick.

## From the terminal

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

| Command | Does |
| --- | --- |
| `magpie ls` | Every agent found and its settings |
| `magpie presets` | The vendors magpie knows |
| `magpie provider add deepseek sk-…` | Add a preset with its key |
| `magpie accounts add codex` | Sign in to one more Claude or ChatGPT subscription |
| `magpie accounts switch claude next` | Sign Claude Code (or `codex`) in to the next of your accounts that has room, or the one with the most left when none has |
| `magpie accounts discovery off` | Never read your agents’ sign-ins (Claude Code’s and Codex’s files, the Keychain); `on` reads them again |
| `magpie providers` | Your providers: host, key, models, who uses them |
| `magpie models` | Every model agents can pick, as `provider/model` |
| `magpie claude codex/gpt-5.5` | Set an agent’s model |
| `claude-magpie` | Claude Code through magpie for one session, a plain `claude` left on your account (`magpie claude run`; `magpie claude launcher add` puts it on PATH) |
| `magpie codex effort high` | Set another field |
| `magpie codex default` | Back to the agent’s own default, magpie’s wiring removed |
| `magpie save work` · `use work` | Save and apply a profile |
| `magpie usage 7d` | Tokens and cost per agent and model |
| `magpie tools` · `magpie tool generate_image "…" -o hero.png` | The tools magpie gives agents over MCP (image generation, image recognition, web search, plugins’), listed and called directly; an image it makes is saved |
| `magpie tray` | Start with the menu bar icon only |
| `magpie log` · `magpie log -f` | Where magpie’s logs are, to send with a report; `-n 200` prints the app log’s last lines, `-f` follows it |

[Keep magpie in sync across computers: WebDAV, S3 and GitHub](https://usemagpie.ai/docs/sync)

## 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, and `magpie daemon install` keeps it running as a service (systemd on Linux, launchd on the Mac), from login or boot, with no window; `magpie daemon install --web` has it serve the browser page too, and `magpie daemon status` prints the page’s link. 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.

### Installing or updating behind a firewall, or without access to GitHub?

Give the installer and `magpie update` a proxy: `curl -fsSL https://usemagpie.ai/install.sh | sh -s -- --proxy http://127.0.0.1:7890`, or `magpie update --proxy socks5://127.0.0.1:1080` (http, https, socks5 and socks5h; `HTTPS_PROXY` and `ALL_PROXY` are honoured too). Release files come from usemagpie.ai (Cloudflare R2), and from github.com when that fails. `--mirror <prefix>` fetches the release file from a GitHub download mirror you choose, as `<prefix>https://github.com/…`, when the site’s copy fails; `magpie update mirror <prefix>` keeps it for every update, the app’s too, and `magpie update mirror off` removes it. No mirror is used unless you give one, and the file’s SHA-256 still comes from usemagpie.ai, never from the mirror: a file the mirror changed is refused. The app’s own updates go through Settings → Proxy.

### How do I check that a download was built by GitHub Actions?

Every file on [yetone/magpie-releases](https://github.com/yetone/magpie-releases/releases) carries a SLSA build provenance attestation, signed through Sigstore with the GitHub Actions run’s own identity and no key of ours. With the [GitHub CLI](https://cli.github.com): `gh attestation verify magpie-darwin-arm64.dmg -R yetone/magpie-releases`. It shows the workflow and run that built the file, and fails for a file that run didn’t produce. The same command works on the copy in yetone/magpie’s Releases. From v0.1.3891 on. The attestation names the magpie-releases repo and its commit, not the source commit in yetone/magpie. The app’s own updates check both: the release’s SHA-256 list carries an ed25519 signature, checked against a key built into magpie (offline, and also for a file from usemagpie.ai’s mirror), and from v0.1.3891 on the app also checks the file’s attestation and refuses a file that has none or whose attestation is not from this repo’s release workflow. A file downloaded from usemagpie.ai has its attestation taken from usemagpie.ai too (the `attestations.jsonl` below), and from GitHub when the mirror doesn’t have it; wherever it comes from, it is checked the same way, against Sigstore’s root built into magpie, so the mirror only carries it. When it can’t be had, the update goes on on the signature alone and the log says so. The same attestations are kept on usemagpie.ai, beside the mirrored files, so they are there when GitHub is not: `https://usemagpie.ai/files/v<version>/attestations.jsonl` holds one bundle per line for every file of the release. Download it with the file and check offline of the attestation API: `gh attestation verify magpie-darwin-arm64.dmg -R yetone/magpie-releases --bundle attestations.jsonl` (the bundles are Sigstore bundles; a release that is not among the newest on the mirror falls back to the command above).

### Which build does the installer put on Linux?

The desktop app (window, tray icon and a menu entry) when GTK 3 and WebKitGTK 4.1 are installed. On a computer with a desktop but without them, the installer installs WebKitGTK 4.1 with your package manager (apt, dnf, pacman or zypper), through `sudo`, which asks for your password, and then the app; it says what it installs before it asks. Run without a terminal (CI, a Dockerfile), without `sudo`, on another distribution or when that install fails, it installs the terminal build (`magpie tui`, `magpie web` and the CLI) and ends with the command that installs them, such as `sudo apt install libwebkit2gtk-4.1-0` on Debian and Ubuntu or `sudo dnf install webkit2gtk4.1` on Fedora; run the installer again afterwards for the app. A desktop counts whether you run it there or over ssh: a graphical session, your graphical login, or a desktop installed to log in to. A server without one gets the terminal build. To choose yourself, add `--gui` (the app even when its libraries can't be installed now) or `--tui` (the terminal build, and no package installed): `curl -fsSL https://usemagpie.ai/install.sh | sh -s -- --tui`.

### How do I uninstall magpie?

Installed with the script: `curl -fsSL https://usemagpie.ai/install.sh | sh -s -- --uninstall` has magpie disconnect every agent and put back what each had first, then takes off what the script put there: the `magpie` command, and the app on macOS or its menu entry, icon and `magpie://` handler on Linux, with magpie’s service and opening at login there, which would start a magpie that is gone. Your settings, providers and usage in `~/.config/magpie` stay, for when you install again. Add `--purge` to delete them too (`magpie uninstall --yes`). Installed another way, `magpie uninstall` or Settings → Uninstall magpie does what `--purge` does and leaves the program itself for you to delete.

Deleted magpie already (the app in the Trash, the folder removed) and an agent still says it can’t connect? On macOS and Linux run the same `--uninstall` line: with no magpie left it downloads the newest to a temporary folder, checked like an install, and that one puts your agents back while magpie’s record of what each had is still in `~/.config/magpie`. On Windows, download magpie again and use Settings → Uninstall magpie. To put Codex back by hand, quit it, then in `~/.codex/config.toml` delete each line under a `# magpie:` comment (`openai_base_url`, `model_provider = "magpie"`, `model_catalog_json`) and set `model` to one of Codex’s own; the `[model_providers.magpie]` table can go too once no thread you keep was started on magpie. Delete `~/.codex/magpie-models.json`, and open Codex again.

### Can magpie keep its files on another disk, so reinstalling the system doesn’t lose them?

Installed, magpie keeps its settings, providers, usage and library in `~/.config/magpie` (`C:\Users\<you>\.config\magpie` on Windows). It backs them up by itself once a day, into `auto-backups` in that same folder, so a reinstalled system loses the backups too; Settings → Sync and backup says so under Backup folder. Click Change… there and pick a folder on another disk (`D:\magpie-backups`) or one a cloud drive syncs. After a reinstall, install magpie, pick the same folder there and Restore… the newest version. Backups hold no API keys; Sign-ins in backups adds subscription accounts and plugin sign-ins, sealed with a passphrase. To carry the keys too, sync to a WebDAV folder, an S3 bucket or a GitHub repository, sealed with a passphrase, in the same place.

To keep magpie’s own files on that disk (an external SSD, say), click Move… beside Data folder in the same place and pick a folder there. magpie restarts, moves its files and cache into a folder named `magpie` inside it, and leaves a link where they were, so nothing else changes. Keep the disk connected: without it magpie won’t open until it is back. Move back brings them home. `magpie data move <folder>` does the same from a terminal.

To keep everything on that disk, run magpie portable: put `magpie.exe` in a folder there with an empty folder named `data` beside it (`D:\magpie\magpie.exe` and `D:\magpie\data`). magpie then keeps everything in `data`, its caches and log too, and writes nothing of its own to your user folder; Settings → About → Config folder says Portable. Open it, and restore a backup into it as above. After a reinstall, open `D:\magpie\magpie.exe` again. The agents’ own configs (`~/.claude`, `~/.codex`…) stay where each agent reads them.

### Where is magpie’s log?

The app (its window, the menu bar or tray icon and the panel, however it was opened) writes `app.log`: `~/Library/Logs/magpie/app.log` on macOS, `%LOCALAPPDATA%\magpie\logs\app.log` on Windows, `~/.local/state/magpie/app.log` on Linux (`$XDG_STATE_HOME/magpie` when that is set), and `logs` in a portable magpie’s data folder. Settings → About → Log has its path and an Open that shows its folder; `magpie log` prints it, and `magpie log -f` follows it. At 5 MiB it becomes `app.old.log` beside it, so two files at most are kept. It holds what magpie did and the errors it met (a provider refusing a request, a retry, a plugin that failed to start), not your keys, prompts or replies; what looks like a key or token is masked anyway. `magpie serve` run as a service logs elsewhere: `~/Library/Logs/magpie/serve.log` on macOS, `journalctl --user -u magpie` on Linux; `magpie log` names it too.

### What does magpie send about me?

Your prompts, replies, keys and accounts go only to the providers you use; magpie has no server of its own in the path. Once a day a released magpie tells us it is in use, so we know how many people use it and what to look after first: a random id made up on your computer, magpie’s version and your system, and which agents, providers and models it is used with, by magpie’s own ids (`claude`, `deepseek`, `deepseek/deepseek-v4`) with how many of each. A provider you added yourself, and a model on it, is only `custom`. For each partner listed first in the add sheet, how many times a day it was shown, opened and added from goes with them, as counts only. No names, base URLs, accounts, keys, prompts or usage are sent. Settings → Privacy → Share the agents, providers, models and plugins I use leaves out the agents, providers and models, the partner counts and which of Discover’s plugins are installed and which of the Library market’s MCP servers are used (for their counts of who uses and likes each); Count me as a user, `DO_NOT_TRACK=1` or `MAGPIE_NO_STATS=1` turns it all off. Builds from source never send it. A partner's website and key-page links go through `usemagpie.ai/go/…`, which counts the click (the partner, which link, and a country) before sending you on, and usemagpie.ai counts how many times the partner list is fetched. The server sees these whatever the settings say, as any website sees its visits; no id, address or account is kept with them. 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](https://usemagpie.ai/docs/privacy) lists everything magpie sends by itself, with an example of the daily count, the files it keeps and every switch.

### The agent gets 502 or can’t connect, and nothing shows in magpie’s Routing tab?

A proxy app (Surge, Clash, mihomo and the like, with system proxy, TUN or enhanced mode on) has taken the agent’s request to `http://127.0.0.1:3425` and sent it somewhere else, so it never reaches magpie. The bypass list (`skip-proxy`, “bypass”) isn’t always enough: some agents, Codex among them, send it through the proxy anyway. Add rules that send the local addresses direct, ahead of your other rules:

```
IP-CIDR,127.0.0.0/8,DIRECT,no-resolve
IP-CIDR6,::1/128,DIRECT,no-resolve
```

In a Clash or mihomo config the same lines go under `rules:`, each starting with `- `. Then send the agent a new request.

### Can DeepSeek Harness keep its own DeepSeek row and go through magpie?

Yes, by hand. Connecting dsh adds magpie’s routes and leaves dsh’s DeepSeek row (`llm-deepseek`) to dsh. That row keeps DeepSeek’s cache when dsh’s prompt or tools change mid-session. To send it through magpie, add this to `~/.dsh/profiles/<profile>/cordis.patch.yml`:

```
- id: llm-deepseek
  config:
    baseURL: http://127.0.0.1:3425
    apiKeyEnv: MAGPIE_DS_KEY
    maxInlineRequestImageBytes: 67108864
    models:
      - id: deepseek/deepseek-flash
        name: DeepSeek V4.1 Flash (magpie)
        contextWindow: 1000000
        inputModalities: [text, image]
        systemPromptUpdate: in-history
        toolUpdate: addition-only
      - id: deepseek/deepseek-v4-pro
        name: DeepSeek V4 Pro (magpie)
        contextWindow: 1000000
```

`baseURL` has no `/anthropic`. The model ids are magpie’s (`magpie models`), and a `models` list replaces dsh’s defaults, so keep the two update lines. `MAGPIE_DS_KEY` holds the gateway key (`magpie` on this computer), not your DeepSeek key: export it, put it in `~/.dsh/.env`, or enter it on the DeepSeek row in dsh’s Models page. Pick the model in dsh; Disconnect leaves the entry alone. magpie has no Files API, so dsh sends images inline as base64 each turn, up to `maxInlineRequestImageBytes` (20 MiB by default, 64 MiB above). Keep the row on DeepSeek’s own models. [More in the reference](https://github.com/yetone/magpie/blob/main/docs/reference.md#deepseek-harness-the-deepseek-row-by-hand).

### Can Trae or Trae CN use magpie’s models?

Users report that this works. Trae keeps custom models in your Trae account, on its servers, so magpie can’t set it up for you, and Trae may not reach `127.0.0.1`. So:

1. In magpie, turn on Settings → Network and sharing → Share on local network, and note the Address it shows.
2. Take a gateway key (Gateway → Gateway keys, or `magpie gateway-key add "Trae"`).
3. In Trae’s custom model settings, enter that address as the address and the gateway key as the API key.

The model id is magpie’s (`magpie models`). Sharing lets other computers on your network in with a gateway key; see [Remote magpie](https://usemagpie.ai/docs/remote#share).

An error from the gateway? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting). Stuck, or have a setup worth sharing? Ask on [Discord](https://discord.gg/vGSnD3ZKQF). Chatting in Cherry Studio? See [Every model in Cherry Studio](https://usemagpie.ai/docs/cherry-studio). Vendors who want to hand their users a ready-made provider: see [Add to magpie](https://usemagpie.ai/docs/import).

---

Source: https://usemagpie.ai/docs/claude-code-models

# Use DeepSeek, Kimi, GLM, Qwen or any model in Claude Code

Claude Code speaks one API, Anthropic Messages. magpie puts a gateway on your computer that speaks it for every provider you add, and points Claude Code at it. You pick the model in magpie or in Claude Code’s `/model`.

The gateway runs at `127.0.0.1:3425`. It speaks the Anthropic, OpenAI and Gemini APIs. When a provider speaks Anthropic Messages itself, as DeepSeek, Kimi, Zhipu GLM, MiniMax and Qwen do, Claude Code’s request is passed on as it is. When it doesn’t, as with a GPT model from your ChatGPT plan, magpie translates the request and the reply, streaming and tool calls included.

### Chinese models

DeepSeek, Kimi and Kimi Code, Zhipu GLM (pay as you go or Coding Plan), Z.ai, MiniMax and Qwen, each with its China endpoint where it has one.

### Subscriptions

The models of a ChatGPT, Copilot or Antigravity account you sign in to in magpie.

### Anything else

Any OpenAI- or Anthropic-compatible URL and key, Ollama and LM Studio.

## Set it up

1. **Add the provider.** In magpie’s Providers tab, press ＋ Add provider, pick DeepSeek, Kimi, Zhipu GLM, MiniMax or Qwen, paste your API key and save. magpie asks the vendor which models it serves.
2. **Pick the model for Claude Code.** In the Agents tab, click the model on the Claude Code row and choose one, such as `deepseek/deepseek-v4-pro`. magpie writes it into `~/.claude/settings.json`.
3. **Start a new session.** Claude Code reads its settings when it starts. A session already open keeps the model it started with.

The same from a terminal:

```
magpie provider add deepseek sk-…
magpie models                       # every model, as provider/model
magpie claude deepseek/deepseek-v4-pro
```

Model ids are magpie’s, `provider/model`. Inside Claude Code, `/model` lists magpie’s models too, marked “via magpie”, so you can switch there.

> **Zhipu GLM Coding Plan.** When you add Zhipu GLM or Z.ai, pick the plan your key is for. A Coding Plan key has its own endpoints, and sent to the pay-as-you-go one it is told it has no balance.

> **Keep `claude` on your own account.** Leave Claude Code unconnected in magpie and run `claude-magpie` when you want it on another model. It starts the same `claude` with magpie’s settings for that session only, and `settings.json` is not rewritten. See [Get started](https://usemagpie.ai/docs/start#agents).

## How Opus, Sonnet and Haiku map

Claude Code asks for models by tier: `opus`, `sonnet`, `haiku` and `fable`. Its own small jobs, such as a session’s title and Explore subagents, go to the haiku tier. magpie writes a model into each tier’s variable:

| Tier | Variable in `env` | By default |
| --- | --- | --- |
| opus | `ANTHROPIC_DEFAULT_OPUS_MODEL` | The main model |
| sonnet | `ANTHROPIC_DEFAULT_SONNET_MODEL` | The main model |
| haiku | `ANTHROPIC_DEFAULT_HAIKU_MODEL`, `ANTHROPIC_SMALL_FAST_MODEL` | The main model; on a Claude model, the Haiku its provider serves |
| fable | `ANTHROPIC_DEFAULT_FABLE_MODEL` | Left unset unless the main model is a Fable model |

So with DeepSeek as the main model, every tier runs on DeepSeek. To give a tier a model of its own, say a cheaper one for haiku, set it on the Claude Code row in magpie, or from a terminal:

```
magpie claude haiku deepseek/deepseek-v4-flash   # one tier on its own model
magpie claude haiku ""                           # back to the main model
```

A tier takes a model through magpie, and only once the main model is one.

## What changes in settings.json

Claude Code reads its endpoint from the `env` block of `~/.claude/settings.json`. magpie changes only the keys it needs there. Comments and your other settings stay.

| Key | Set to |
| --- | --- |
| `env.ANTHROPIC_BASE_URL` | The gateway’s address |
| `env.ANTHROPIC_AUTH_TOKEN` | The gateway’s key (not your vendor key; that stays in magpie) |
| `model` | The main model |
| `env.ANTHROPIC_DEFAULT_*_MODEL`, `env.ANTHROPIC_SMALL_FAST_MODEL` | The tiers, as above |
| `env.CLAUDE_CODE_MAX_OUTPUT_TOKENS` | The longest reply the model can write. Claude Code asks a model it doesn’t know for 32000 at most |
| `env.CLAUDE_CODE_MAX_CONTEXT_TOKENS`, `env.CLAUDE_CODE_AUTO_COMPACT_WINDOW` | Where needed, the model’s window and where to compact. Claude Code takes a model it doesn’t know for 200K. A 1M model is marked `[1m]` |
| `modelPicker` | magpie’s models, for `/model`. A picker you wrote yourself is left alone |

A value you set yourself, such as your own output limit, stays yours. `ANTHROPIC_MODEL` is taken out, because it would outrank a pick in `/model`. A cloud switch in that file, such as `CLAUDE_CODE_USE_BEDROCK`, is set aside while Claude Code runs through magpie and put back afterwards.

### Going back to Claude’s own models

Pick one of Claude Code’s own models on its row, or run `magpie claude default`. magpie takes out what it wrote and puts back what it replaced the first time: your own base URL, token and tier models. You don’t edit the file by hand.

## GPT models from a ChatGPT or Copilot subscription

Sign in to the subscription in magpie: ＋ Add provider, then the ChatGPT or Copilot tile. magpie opens the vendor’s own sign-in page. The account’s models then show in Claude Code’s picker as `codex/…` or `copilot/…`.

```
magpie accounts add codex      # sign in to a ChatGPT account
magpie claude codex/gpt-5.5
```

Claude Code still speaks Anthropic Messages. magpie translates each request for the GPT model and the reply back, tool calls included. Antigravity accounts work the same way, as `antigravity/…`. For a ChatGPT plan in full, tiers, effort and limits included, see [ChatGPT in Claude Code](https://usemagpie.ai/docs/claude-code-chatgpt).

## Routing over several keys

With several keys or accounts, magpie can spread Claude Code’s requests over them and move on when one runs out.

- **Several keys for one vendor..** Add them all to the provider and tick each one. Routing on the provider says how requests spread, and Fallback lists models to use when it is out of quota or down.
- **One model from several providers..** When two of your providers serve the same model, such as DeepSeek from its own API and from a relay, magpie makes the group `auto/<model>` by itself. Pick it for Claude Code.
- **Your own group..** New group in the Routing tab puts any models behind one name, `group/<id>`.

The routing modes are in [Get started](https://usemagpie.ai/docs/start#routing).

**By provider:** [DeepSeek](https://usemagpie.ai/docs/deepseek) · [Kimi and Kimi Code](https://usemagpie.ai/docs/kimi) · [GLM Coding Plan](https://usemagpie.ai/docs/glm) · [Volcengine Ark](https://usemagpie.ai/docs/volcengine) · [Tencent Cloud](https://usemagpie.ai/docs/tencent-cloud) · [Baidu Qianfan](https://usemagpie.ai/docs/baidu-qianfan) · [SiliconFlow](https://usemagpie.ai/docs/siliconflow) · [ModelScope](https://usemagpie.ai/docs/modelscope) · [Huawei Cloud MaaS](https://usemagpie.ai/docs/huaweicloud) · [Xiaomi MiMo](https://usemagpie.ai/docs/xiaomi-mimo) · [StepFun](https://usemagpie.ai/docs/stepfun) · [LongCat](https://usemagpie.ai/docs/longcat) · [Qwen](https://usemagpie.ai/docs/qwen) · [MiniMax](https://usemagpie.ai/docs/minimax) · [Anthropic](https://usemagpie.ai/docs/anthropic) · [OpenAI](https://usemagpie.ai/docs/openai) · [Gemini](https://usemagpie.ai/docs/gemini) · [Grok](https://usemagpie.ai/docs/grok) · [Mistral](https://usemagpie.ai/docs/mistral) · [OpenRouter](https://usemagpie.ai/docs/openrouter) · [GitHub Copilot](https://usemagpie.ai/docs/copilot) · [Ollama](https://usemagpie.ai/docs/ollama)

## FAQ

### Do I set `ANTHROPIC_BASE_URL` myself?

No. magpie writes it into Claude Code’s `settings.json`. If `CLAUDE_CODE_USE_BEDROCK`, `CLAUDE_CODE_USE_VERTEX` or another cloud switch is set in your shell’s environment, Claude Code sends its requests to that cloud and not to magpie; magpie tells you so, and you take it out of your shell profile.

### Can I switch models inside Claude Code?

Yes. While Claude Code runs through magpie, `/model` lists magpie’s models and routing groups, and a pick there persists.

### Which Chinese models can Claude Code use?

Any that a provider you add serves. magpie has presets for DeepSeek, Kimi, Kimi Code, Zhipu GLM, Z.ai, MiniMax and Qwen, with China endpoints for Kimi, Kimi Code, MiniMax and Qwen. Others can be added as a custom URL.

### Does magpie have to be running?

Yes, while Claude Code is on a model through magpie: the gateway runs with the app. `magpie daemon install` keeps it running as a service with no window.

### Can I keep my claude.ai sign-in?

The Claude Code row has a sign-in setting. With magpie’s key, the default, Claude Code is signed out of claude.ai while it runs through magpie, so the plan limits in `/usage`, connectors, voice and `/teleport` are off. With claude.ai it keeps its sign-in, which magpie never passes on. Remote Control and ultrareview stay off either way.

### Does Claude Code’s Code Mode work through magpie?

No. Claude Code turns Code Mode on only when it talks to Anthropic’s API directly: with `ANTHROPIC_BASE_URL` pointing anywhere but `api.anthropic.com`, or with `ANTHROPIC_AUTH_TOKEN` set, it starts with the ordinary tools and says “it only works directly with the Anthropic API”. That is a check in Claude Code, and it holds for every model magpie serves, a Claude subscription’s or an Anthropic API key’s included. To use Code Mode, pick one of Claude Code’s own models in magpie so it goes straight to Anthropic, then start `claude` with `CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1`. Code Mode also needs the feature flags Claude Code downloads, so leave Claude Code’s telemetry on in magpie’s Agents page.

### Can I use my Claude subscription and DeepSeek side by side?

Yes. Sign in to Claude in magpie and its models are `claude/…` in the same picker. Requests on a Claude subscription run through the Claude Code installed on your computer.

### How do I undo it?

Pick one of Claude Code’s own models in magpie, or run `magpie claude default`. What magpie wrote comes out, and what it replaced comes back.

Using Codex too? See [Use any model in Codex](https://usemagpie.ai/docs/codex-models). On Claude Desktop? See [Claude Desktop on any model](https://usemagpie.ai/docs/claude-desktop). Stuck? Ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/codex-models

# Use DeepSeek, Kimi, GLM, Claude or any model in Codex

Codex speaks one API, OpenAI Responses. magpie puts a gateway on your computer that speaks it for every provider you add, and writes Codex’s `config.toml` for you. The models then show in Codex’s `/model`, with their reasoning efforts.

The gateway runs at `127.0.0.1:3425`. When a provider serves the Responses API itself, as DeepSeek and the Zhipu GLM Coding Plan do, Codex’s request is passed on as it is. When it serves only Chat Completions or Anthropic Messages, as Kimi, MiniMax and Qwen do, or a Claude subscription, magpie translates the request and the reply, streaming and tool calls included.

### Chinese models

DeepSeek, Kimi and Kimi Code, Zhipu GLM (pay as you go or Coding Plan), Z.ai, MiniMax and Qwen, each with its China endpoint where it has one.

### Claude

Your Claude subscription’s models, or an Anthropic key’s.

### Anything else

Any OpenAI- or Anthropic-compatible URL and key, Copilot and Antigravity accounts, Ollama and LM Studio.

## Set it up

1. **Add the provider.** In magpie’s Providers tab, press ＋ Add provider, pick DeepSeek, Kimi, Zhipu GLM, MiniMax or Qwen, paste your API key and save. magpie asks the vendor which models it serves.
2. **Pick the model for Codex.** In the Agents tab, click the model on the Codex row and choose one, such as `deepseek/deepseek-v4-pro`. The effort slider under the list sets its reasoning effort. magpie writes both into `~/.codex/config.toml`.
3. **Restart Codex.** Codex builds its model list when it starts. Restart the Codex app, and open new `codex` sessions, after a switch.

The same from a terminal:

```
magpie provider add deepseek sk-…
magpie models                        # every model, as provider/model
magpie codex deepseek/deepseek-v4-pro
magpie codex effort high
```

> **Zhipu GLM Coding Plan.** When you add Zhipu GLM or Z.ai, pick the plan your key is for. A Coding Plan key has its own endpoints, and sent to the pay-as-you-go one it is told it has no balance.

## The models in Codex’s /model

magpie’s models are listed in Codex’s `/model` beside its own, so you can switch there too. Each one carries what Codex needs to run it: its reasoning efforts and default effort, its context window and the base instructions Codex sends with it.

How they get there depends on how Codex is signed in:

- **Signed in to ChatGPT..** Codex keeps its own OpenAI provider and your sign-in. magpie points it at the gateway with `openai_base_url`; Codex’s own models still go to OpenAI on your account, and magpie’s models join them in `/model`.
- **Not signed in, or signed in with an API key..** magpie becomes Codex’s provider, and the list comes from a catalog file magpie writes, `magpie-models.json` beside `config.toml`.

## What changes in config.toml

magpie changes only the keys it needs in `~/.codex/config.toml`. Comments, ordering and your other settings stay.

| Key | Set to |
| --- | --- |
| `model` | The model you picked |
| `model_reasoning_effort` | The effort, when you set one |
| `openai_base_url` | The gateway’s address. A base URL of your own stays |
| `model_provider` | `"magpie"`, when magpie is the provider |
| `model_catalog_json` | The path of the catalog file, `magpie-models.json`, when magpie is the provider |
| `[model_providers.magpie]` | `name`, `base_url` (the gateway’s `/v1`), `wire_api = "responses"`, and the gateway’s key. Your vendor keys stay in magpie |

```
model = "deepseek/deepseek-v4-pro"
model_provider = "magpie"
model_catalog_json = "/Users/you/.codex/magpie-models.json"

[model_providers.magpie]
name = "magpie"
base_url = "http://127.0.0.1:3425/v1"
wire_api = "responses"
```

That is the shape when magpie is the provider; the table also carries the gateway’s key and a header. Signed in to ChatGPT, only `openai_base_url` and `model` are set at the top. The `[model_providers.magpie]` table stays once written. A Codex thread keeps the provider it was started on, and a thread started on magpie can’t be opened again without it.

### Going back to OpenAI’s models

Pick one of Codex’s own models on its row, or run `magpie codex default`. magpie takes `model_provider`, `model_catalog_json` and the base URL back out and puts back the provider and model you had. A provider of your own at the top stays. Threads started on magpie are moved back to the provider Codex is on, so Codex lists them, and a copy is kept in magpie’s trash.

## Claude in Codex

Sign in to your Claude subscription in magpie: ＋ Add provider, then the Claude tile. Its models are `claude/…` in Codex’s picker. magpie translates Codex’s Responses requests into Anthropic Messages and the replies back.

```
magpie accounts add claude     # sign in to a Claude account
magpie models | grep '^claude/'
magpie codex claude/…
```

Requests on a Claude subscription run through the Claude Code installed on your computer, so keep it installed. An Anthropic API key works too: add Anthropic as a vendor and pick an `anthropic/…` model.

## Routing over several keys

- **Several keys for one vendor..** Add them all to the provider and tick each one. Routing on the provider says how requests spread, and Fallback lists models to use when it is out of quota or down.
- **One model from several providers..** When two of your providers serve the same model, magpie makes the group `auto/<model>` by itself. Pick it for Codex.
- **Your own group..** New group in the Routing tab puts any models behind one name, `group/<id>`.

The routing modes are in [Get started](https://usemagpie.ai/docs/start#routing).

**By provider:** [DeepSeek](https://usemagpie.ai/docs/deepseek) · [Kimi and Kimi Code](https://usemagpie.ai/docs/kimi) · [GLM Coding Plan](https://usemagpie.ai/docs/glm) · [Volcengine Ark](https://usemagpie.ai/docs/volcengine) · [Tencent Cloud](https://usemagpie.ai/docs/tencent-cloud) · [Baidu Qianfan](https://usemagpie.ai/docs/baidu-qianfan) · [SiliconFlow](https://usemagpie.ai/docs/siliconflow) · [ModelScope](https://usemagpie.ai/docs/modelscope) · [Huawei Cloud MaaS](https://usemagpie.ai/docs/huaweicloud) · [Xiaomi MiMo](https://usemagpie.ai/docs/xiaomi-mimo) · [StepFun](https://usemagpie.ai/docs/stepfun) · [LongCat](https://usemagpie.ai/docs/longcat) · [Qwen](https://usemagpie.ai/docs/qwen) · [MiniMax](https://usemagpie.ai/docs/minimax) · [Anthropic](https://usemagpie.ai/docs/anthropic) · [OpenAI](https://usemagpie.ai/docs/openai) · [Gemini](https://usemagpie.ai/docs/gemini) · [Grok](https://usemagpie.ai/docs/grok) · [Mistral](https://usemagpie.ai/docs/mistral) · [OpenRouter](https://usemagpie.ai/docs/openrouter) · [GitHub Copilot](https://usemagpie.ai/docs/copilot) · [Ollama](https://usemagpie.ai/docs/ollama)

## FAQ

### Do I write `[model_providers]` myself?

No. magpie writes Codex’s `config.toml` when you pick a model. You don’t export `OPENAI_BASE_URL` either.

### Does my ChatGPT sign-in still work?

Yes. Signed in to ChatGPT, Codex keeps its own provider and sign-in. Its own models go to OpenAI on your account, and magpie’s are added beside them.

### I picked a model, but Codex’s /model doesn’t show it.

Codex reads its model list when it starts. Restart the Codex app and open a new `codex` session.

### Can I set the reasoning effort?

Yes, on the Codex row’s effort slider, with `magpie codex effort high`, or in Codex’s `/model`, which lists each model’s efforts.

### Which Chinese models can Codex use?

Any that a provider you add serves. magpie has presets for DeepSeek, Kimi, Kimi Code, Zhipu GLM, Z.ai, MiniMax and Qwen. Others can be added as a custom URL.

### Does magpie have to be running?

Yes, while Codex is on a model through magpie: the gateway runs with the app. `magpie daemon install` keeps it running as a service with no window.

### How do I undo it?

Pick one of Codex’s own models in magpie, or run `magpie codex default`. magpie’s keys come out, and your provider and model come back.

Using Claude Code too? See [Use any model in Claude Code](https://usemagpie.ai/docs/claude-code-models). Stuck? Ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/gemini-cli-models

# Use DeepSeek, Kimi, GLM, Claude or GPT in Gemini CLI

Gemini CLI speaks only Google’s Gemini API. magpie puts a gateway on your computer that serves the Gemini API for every provider you add, and points Gemini CLI at it. You pick the model on Gemini CLI’s row in magpie.

The gateway runs at `127.0.0.1:3425`. It serves the Gemini API’s `generateContent`, `streamGenerateContent` and `countTokens` calls and its model list, beside the OpenAI and Anthropic APIs. A request goes straight through when the provider speaks the Gemini API, and is translated when it doesn’t, as with DeepSeek, Kimi, Zhipu GLM or a Claude or ChatGPT subscription: the request and the reply, streaming, tool calls, images and reasoning included.

### Chinese models

DeepSeek, Kimi and Kimi Code, Zhipu GLM (pay as you go or Coding Plan), Z.ai, MiniMax and Qwen.

### Subscriptions

The models of a Claude, ChatGPT, Copilot or Antigravity account you sign in to in magpie.

### Anything else

Any OpenAI- or Anthropic-compatible URL and key, Ollama and LM Studio.

## Set it up

1. **Add the provider.** In magpie’s Providers tab, press ＋ Add provider, pick DeepSeek, Kimi, Zhipu GLM, MiniMax or Qwen, paste your API key and save. magpie asks the vendor which models it serves.
2. **Pick the model for Gemini CLI.** In the Agents tab, click the model on the Gemini CLI row and choose one, such as `deepseek/deepseek-v4-pro`. magpie writes it into `~/.gemini/settings.json` and the gateway’s address into `~/.gemini/.env`.
3. **Restart gemini.** Gemini CLI reads its settings when it starts. A session already open keeps what it started with.

The same from a terminal:

```
magpie provider add deepseek sk-…
magpie models                              # every model, as provider/model
magpie gemini model deepseek/deepseek-v4-pro
```

Model ids are magpie’s, `provider/model`. The Gemini CLI row shows once the `gemini` command is on your `PATH`.

> **Zhipu GLM Coding Plan.** When you add Zhipu GLM or Z.ai, pick the plan your key is for. A Coding Plan key has its own endpoints, and sent to the pay-as-you-go one it is told it has no balance.

## What changes in ~/.gemini

Gemini CLI loads `~/.gemini/.env` and reads `~/.gemini/settings.json`. magpie changes four keys across the two:

| File | Key | Set to |
| --- | --- | --- |
| `.env` | `GOOGLE_GEMINI_BASE_URL` | The gateway’s address |
| `.env` | `GEMINI_API_KEY` | The gateway’s key (not your vendor key; that stays in magpie) |
| `settings.json` | `security.auth.selectedType` | `gemini-api-key`, so Gemini CLI sends that key and not a Google sign-in |
| `settings.json` | `model.name` | The model, as `provider/model` |

The first time, magpie keeps what those keys held before: your own base URL, API key, sign-in choice and model. If the sign-in choice is changed to anything but the API key while the model is one of magpie’s, Gemini CLI asks Google directly, and magpie’s Gemini CLI row says so.

### Going back to Google

Pick one of Gemini CLI’s own Gemini models on its row, or run `magpie gemini default`. magpie takes `GOOGLE_GEMINI_BASE_URL` and `GEMINI_API_KEY` out of `.env` and puts back the base URL, key, sign-in choice and model you had. You don’t edit either file by hand.

The row’s auth setting chooses how Gemini CLI signs in on its own: Google (your Google account), API key or Vertex AI. With Google Gemini added as a provider in magpie, API key writes that key into `.env` for Gemini CLI.

```
magpie gemini default   # magpie’s wiring out, what you had back
magpie gemini google    # sign in with your Google account
```

## Claude and GPT models from a subscription

Sign in to the subscription in magpie: ＋ Add provider, then the Claude, ChatGPT or Copilot tile. magpie opens the vendor’s own sign-in page. The account’s models are then `claude/…`, `codex/…` or `copilot/…` on Gemini CLI’s row.

```
magpie accounts add codex           # sign in to a ChatGPT account
magpie gemini model codex/gpt-5.5
```

Gemini CLI still speaks the Gemini API; magpie translates each request for the model and the reply back. Requests on a Claude subscription run through the Claude Code installed on your computer, so keep it installed. More in [Use your subscription in any agent](https://usemagpie.ai/docs/subscriptions).

## Routing over several keys

- **Several keys for one vendor..** Add them all to the provider and tick each one. Routing on the provider says how requests spread, and Fallback lists models to use when it is out of quota or down.
- **One model from several providers..** When two of your providers serve the same model, magpie makes the group `auto/<model>` by itself. Pick it for Gemini CLI.
- **A cheaper model for compaction..** A routing group’s compacting rule matches Gemini CLI compacting its conversation, so a cheaper, faster model can write the summary.

The routing modes and rules are in [Get started](https://usemagpie.ai/docs/start#routing).

**By provider:** [DeepSeek](https://usemagpie.ai/docs/deepseek) · [Kimi and Kimi Code](https://usemagpie.ai/docs/kimi) · [GLM Coding Plan](https://usemagpie.ai/docs/glm) · [Volcengine Ark](https://usemagpie.ai/docs/volcengine) · [Tencent Cloud](https://usemagpie.ai/docs/tencent-cloud) · [Baidu Qianfan](https://usemagpie.ai/docs/baidu-qianfan) · [SiliconFlow](https://usemagpie.ai/docs/siliconflow) · [ModelScope](https://usemagpie.ai/docs/modelscope) · [Huawei Cloud MaaS](https://usemagpie.ai/docs/huaweicloud) · [Xiaomi MiMo](https://usemagpie.ai/docs/xiaomi-mimo) · [StepFun](https://usemagpie.ai/docs/stepfun) · [LongCat](https://usemagpie.ai/docs/longcat) · [Qwen](https://usemagpie.ai/docs/qwen) · [MiniMax](https://usemagpie.ai/docs/minimax) · [Anthropic](https://usemagpie.ai/docs/anthropic) · [OpenAI](https://usemagpie.ai/docs/openai) · [Gemini](https://usemagpie.ai/docs/gemini) · [Grok](https://usemagpie.ai/docs/grok) · [Mistral](https://usemagpie.ai/docs/mistral) · [OpenRouter](https://usemagpie.ai/docs/openrouter) · [GitHub Copilot](https://usemagpie.ai/docs/copilot) · [Ollama](https://usemagpie.ai/docs/ollama)

## FAQ

### Can Gemini CLI use models that aren’t Gemini?

Yes, through a gateway that serves the Gemini API. magpie runs one on your computer and points Gemini CLI at it, so any model of a provider you add works: DeepSeek, Kimi, GLM, Qwen, MiniMax, or a Claude, ChatGPT or Copilot subscription.

### Do I set `GOOGLE_GEMINI_BASE_URL` myself?

No. magpie writes it and `GEMINI_API_KEY` into `~/.gemini/.env`, and sets Gemini CLI to API-key auth in `~/.gemini/settings.json`. What you had there before is kept and comes back when you switch away.

### Why does Gemini CLI still send requests to Google?

Its sign-in choice is not the API key: with a Google sign-in or Vertex AI, Gemini CLI asks Google directly. Pick the model again in magpie, which sets it back to the API key; magpie’s Gemini CLI row tells you when this happens. Restart open `gemini` sessions after a change.

### Can I use my ChatGPT or Claude subscription in Gemini CLI?

Yes. Sign in to it in magpie and pick a `codex/…` or `claude/…` model on Gemini CLI’s row. Requests on a Claude subscription run through the Claude Code installed on your computer.

### Why doesn’t magpie show Gemini CLI?

magpie shows it when the `gemini` command is on your `PATH`. A `~/.gemini` folder alone doesn’t count, because it stays after Gemini CLI is uninstalled and Antigravity keeps folders there too.

### Does it work for Gemini CLI in WSL?

Yes. magpie sets up Gemini CLI inside a WSL distro the same way, writing the gateway’s address as that distro reaches it.

### How do I switch Gemini CLI back to Google?

Pick one of Gemini CLI’s own models in magpie, or run `magpie gemini default`. What magpie wrote comes out, and your own key, sign-in choice and model come back.

Using Claude Code or Codex too? See [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models) and [Models in Codex](https://usemagpie.ai/docs/codex-models). Stuck? Ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/subscriptions

# Use your Claude Pro/Max, ChatGPT Plus/Pro or GitHub Copilot subscription in any coding agent

Sign in to a subscription once, in magpie. Its models then show in every agent magpie sets up: GPT models from your ChatGPT plan in Claude Code, Claude models from your Claude plan in Codex or OpenCode, Copilot’s models in any of them. No API key.

magpie runs a gateway on your computer, at `127.0.0.1:3425`. It speaks the OpenAI, Anthropic and Gemini APIs and translates between them, streaming and tool calls included, so an agent that speaks one API can use a model served in another. magpie writes the gateway’s address and key into each agent’s own config file.

## Which subscriptions

| Subscription | Models are | Sign in from a terminal |
| --- | --- | --- |
| Claude (Pro, Max, Team) | `claude/…` | `magpie accounts add claude` |
| ChatGPT (Plus, Pro, Business) | `codex/…` | `magpie accounts add codex` |
| GitHub Copilot | `copilot/…` | `magpie accounts add copilot` |
| Gemini (Code Assist) | `gemini/…` | `magpie accounts add gemini` |

- **Claude..** Requests on a Claude subscription run through the Claude Code installed on your computer, so keep it installed.
- **Copilot..** Copilot gives you a code to enter on GitHub’s page. For GitHub Enterprise on its own domain: `magpie accounts add copilot --host <name>.ghe.com`.
- **Gemini..** This is Gemini CLI’s Google sign-in. Google answers it only for a Code Assist Standard or Enterprise account with a Google Cloud project of its own; `magpie accounts project gemini <email> <project>` names the project.
- **Antigravity..** Install Antigravity (local agy CLI) from Plugins (`magpie plugin add @magpie-community/opencode-agy-cli-auth`). It runs the agy CLI you installed and signed in to, so Google sees agy’s own requests. Signing in to Antigravity in magpie directly is retired: Google bans accounts used that way. If you already have the old Antigravity plugin, it keeps working, and the Providers page tells you the risk; it is no longer installed for anyone new.

Other subscriptions are added as plugins, from magpie’s Plugins page; see [Plugins](https://usemagpie.ai/docs/plugins).

## Sign in

1. **Open Add provider.** In magpie’s Providers tab, press ＋ Add provider.
2. **Click the subscription’s tile.** magpie opens the vendor’s own sign-in page in your browser. The account shows up as soon as you finish.
3. **Pick its model for an agent.** In the Agents tab, click the model on the agent’s row and choose one of the subscription’s models.

An agent you are already signed in to on this machine, such as Claude Code or Codex, shows up as a provider too, *signed in as …*. `magpie accounts discovery off` stops magpie reading those sign-ins.

## Use it in another agent

A subscription’s models are in every agent’s picker in magpie. A few pairs people ask for:

| Agent | Subscription | From a terminal |
| --- | --- | --- |
| Claude Code | ChatGPT | `magpie claude codex/gpt-5.5` |
| Codex | Claude | `magpie codex claude/claude-opus-5-5` |
| Gemini CLI | ChatGPT | `magpie gemini model codex/gpt-5.5` |
| OpenCode | Claude | Pick a `claude/…` model on OpenCode’s row |

`magpie models` lists every model you can pick, as `provider/model`. Each agent’s guide says what magpie changes in its config and how to undo it: [Claude Code](https://usemagpie.ai/docs/claude-code-models), [Codex](https://usemagpie.ai/docs/codex-models), [Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models). `magpie <agent> default` takes magpie’s wiring out of an agent and puts back what it had.

## Several accounts and failover

- **Add another account..** Click the Claude or ChatGPT tile again, or run `magpie accounts add` again. Each account is listed under the provider.
- **Spread requests over them..** Open the provider’s row and tick every account to use. Routing says how requests spread: Smart, the default, sends them to the account with quota to spare whose allowance renews soonest; In order, Until used up, In turn, Least used first, Use before expiry, By weight (a Max account 5, a Pro one 1) and Speed first are the others.
- **Fall back when they run out..** The provider’s Fallback lists models to use when it is out of quota, rate limited or down.
- **One model on two subscriptions..** Claude Opus from your Claude subscription and from Copilot become one group by themselves, `auto/<model>`. Pick it to use both.
- **See what’s left..** `magpie accounts` lists each account and how much of its allowance is used.

The routing modes are in [Get started](https://usemagpie.ai/docs/start#routing).

## Other tools

Any tool with a base-URL setting can use a subscription through the gateway too. The Gateway tab’s Connect section has the address and key to copy. The base URL is `http://127.0.0.1:3425/v1` for an OpenAI client and `http://127.0.0.1:3425` for an Anthropic or Gemini one. See [Integrate your app](https://usemagpie.ai/docs/integrate).

Several accounts or keys can share the load and stand in for each other. See [Round robin and failover across accounts, keys and providers](https://usemagpie.ai/docs/routing-groups).

## FAQ

### Can I use my ChatGPT Plus or Pro subscription in Claude Code?

Yes. Sign in to ChatGPT in magpie and pick a `codex/…` model on Claude Code’s row, or run `magpie claude codex/gpt-5.5`. magpie translates Claude Code’s Anthropic requests for the GPT model and the replies back, tool calls included. The whole setup, tiers and effort included, is in [ChatGPT in Claude Code](https://usemagpie.ai/docs/claude-code-chatgpt).

### Can I use my Claude Pro or Max subscription in Codex or OpenCode?

Yes. Sign in to Claude in magpie and pick a `claude/…` model on the agent’s row. Requests on a Claude subscription run through the Claude Code installed on your computer, so keep it installed.

### Can I use GitHub Copilot models outside VS Code?

Yes. Sign in to Copilot in magpie (GitHub gives you a code to enter), and its models are `copilot/…` in Claude Code, Codex, Gemini CLI, OpenCode and the other agents magpie sets up.

### Do I need an API key to use a subscription in another agent?

No. magpie signs in on the vendor’s own page and the agent gets the gateway’s key. Your sign-in stays in magpie.

### Can I use several Claude or ChatGPT accounts and switch when one hits its limit?

Yes. Add each account in magpie and tick them on the provider’s row. Smart routing, the default, uses an account with quota to spare, and moves on when one is out or rate limited. `magpie accounts` shows what each has left.

### Do my requests go through a magpie server?

No. The gateway runs on your computer. Your prompts, replies, keys and accounts go only to the providers you use; magpie has no server of its own in that path.

### Does each agent have to be signed in to the subscription?

No. Subscriptions are added in magpie, not by signing in inside another agent. One sign-in serves every agent you point at it.

Using a key instead? See [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models) and [Models in Codex](https://usemagpie.ai/docs/codex-models). Stuck? Ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/claude-code-chatgpt

# Use your ChatGPT Plus or Pro subscription in Claude Code

Claude Code can run on the GPT models of your ChatGPT Plus or Pro plan. Sign in to ChatGPT in magpie, pick a `codex/…` model for Claude Code, and keep working as before. No OpenAI API key.

Claude Code speaks Anthropic’s Messages API. magpie runs a gateway on your computer, at `127.0.0.1:3425`, that translates each of Claude Code’s requests for the GPT model and each reply back, streaming and tool calls included. magpie writes the gateway’s address and key into Claude Code’s `settings.json`, and your ChatGPT sign-in stays in magpie.

## Sign in to ChatGPT

1. **Open Add provider.** In magpie’s Providers tab, press ＋ Add provider.
2. **Click the ChatGPT tile.** magpie opens OpenAI’s own sign-in page in your browser. The account shows up as soon as you finish.

Or from a terminal:

```
magpie accounts add codex      # sign in to a ChatGPT account
```

The account’s models are `codex/…`.

## Pick a GPT model for Claude Code

In the Agents tab, click the model on Claude Code’s row and choose a `codex/…` model. From a terminal:

```
magpie models                  # every model, as provider/model
magpie claude codex/gpt-5.5
```

Inside Claude Code, `/model` lists magpie’s models too, marked “via magpie”, so you can switch there.

> **Only some sessions on GPT?** Leave Claude Code unconnected in magpie and run `claude-magpie` when you want it on a GPT model. It starts the same `claude` with magpie’s settings for that session only, and `settings.json` is not rewritten.

## How Opus, Sonnet and Haiku map

Claude Code asks for models by tier: `opus`, `sonnet`, `haiku` and `fable`. Its own small jobs, such as a session’s title and Explore subagents, go to the haiku tier. With a GPT model as the main model:

| Tier | Variable in `env` | By default |
| --- | --- | --- |
| opus | `ANTHROPIC_DEFAULT_OPUS_MODEL` | The GPT model you picked |
| sonnet | `ANTHROPIC_DEFAULT_SONNET_MODEL` | The GPT model you picked |
| haiku | `ANTHROPIC_DEFAULT_HAIKU_MODEL`, `ANTHROPIC_SMALL_FAST_MODEL` | The GPT model you picked |
| fable | `ANTHROPIC_DEFAULT_FABLE_MODEL` | Left unset |

To give a tier a model of its own, say a smaller one for haiku, set it on Claude Code’s row in magpie, or from a terminal:

```
magpie claude haiku codex/…    # one tier on its own model
magpie claude haiku ""         # back to the main model
```

## Reasoning effort

The effort Claude Code asks for goes to the GPT model as its reasoning effort, on requests where Claude Code has thinking on. magpie also tells Claude Code which effort levels each model has.

To hold one effort whatever Claude Code asks, set effort on Claude Code’s row. opus effort, sonnet effort, haiku effort, fable effort and subagent effort set it per tier. Each starts at the effort Claude Code asks for. An open Claude Code session keeps the effort it started with, so restart it to use a new one.

## Limits and usage

Requests are served on your ChatGPT account, so they count toward your plan’s usage limits, as Codex’s own requests do.

- **See what’s used..** Turn on status line on Claude Code’s row: it shows the 5h and 7d use of the accounts magpie serves, under Claude Code’s prompt. `magpie accounts` lists each account and how much of its allowance is used. The Usage tab has the history.
- **When an account runs out..** magpie sets it aside until the reset OpenAI’s refusal names, else until its full window renews, else for 5 hours, and sends requests to your next account or the provider’s Fallback. The account comes back on its own once its window renews.

## Several accounts and failover

- **Add another account..** Click the ChatGPT tile again, or run `magpie accounts add codex` again. Each account is listed under the provider.
- **Spread requests over them..** Open the provider’s row and tick every account to use. Smart routing, the default, sends requests to the account with quota to spare whose allowance renews soonest.
- **Fall back to another model..** The provider’s Fallback lists models to use when every account is out, rate limited or down, a model from another subscription or an API key included.

The routing modes are in [Get started](https://usemagpie.ai/docs/start#routing).

## Switch back

Pick one of Claude Code’s own models on its row, or run:

```
magpie claude default
```

That takes magpie’s wiring out of Claude Code and puts back what it had. Disconnect on Claude Code’s row does the same.

> **Your claude.ai sign-in.** On a magpie model, Claude Code’s sign-in setting is magpie’s key by default: claude.ai is signed out for it, so `/usage` plan limits, connectors, voice and `/teleport` are off. Set it to claude.ai to keep them.

## The other way round: Claude in Codex

A Claude Pro or Max subscription works in Codex the same way. Sign in to Claude in magpie and pick a `claude/…` model for Codex. Requests on a Claude subscription run through the Claude Code installed on your computer, so keep it installed.

```
magpie accounts add claude
magpie codex claude/claude-opus-5-5
```

See [Models in Codex](https://usemagpie.ai/docs/codex-models) and [Subscriptions in any agent](https://usemagpie.ai/docs/subscriptions).

## FAQ

### Can I use my ChatGPT Plus or Pro subscription in Claude Code?

Yes. Sign in to ChatGPT in magpie and pick a `codex/…` model on Claude Code’s row, or run `magpie claude codex/gpt-5.5`. magpie translates Claude Code’s requests for the GPT model and the replies back, tool calls included.

### Do I need an OpenAI API key?

No. magpie signs in on OpenAI’s own page, and Claude Code gets the gateway’s key. Your sign-in stays in magpie.

### Does it use my ChatGPT plan’s limits?

Yes. Requests are served on your ChatGPT account and count toward its usage limits. magpie’s status line shows each account’s 5h and 7d use under Claude Code’s prompt.

### Which model do Claude Code’s Haiku requests use?

The GPT model you picked, unless you give the haiku tier a model of its own with `magpie claude haiku <model>`.

### How do I go back to Claude’s own models?

Run `magpie claude default`, or pick one of Claude Code’s own models on its row in magpie.

### Do my requests go through a magpie server?

No. The gateway runs on your computer. Requests go from it to OpenAI; magpie has no server of its own in that path.

Using an API key instead? See [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/local-models

# Use Ollama or LM Studio models in Claude Code and Codex

Claude Code speaks Anthropic Messages and Codex speaks OpenAI Responses. A local model server speaks OpenAI Chat Completions, and some speak Anthropic Messages too. magpie sits between them on your computer, so Claude Code and Codex can run on the models you pulled in Ollama or loaded in LM Studio.

The gateway runs at `127.0.0.1:3425`. magpie points the agent at it and sends each request on to your server. When the server speaks the agent’s API itself, the request is passed on as it is. When it doesn’t, magpie translates the request and the reply, streaming and tool calls included.

### Ollama, LM Studio

Presets with their default ports and no key. magpie asks the server which models it has.

### oMLX, MLX-Serve

MLX servers for Apple silicon, also presets.

### Anything else

vLLM, llama.cpp’s server or any OpenAI-compatible URL, on this computer or another.

## Supported servers

These are under On this machine when you add a provider:

| Server | Default address | APIs magpie uses |
| --- | --- | --- |
| Ollama | `http://localhost:11434` | Chat Completions, Anthropic Messages |
| LM Studio | `http://localhost:1234` | Chat Completions |
| oMLX | `http://localhost:8000` | Chat Completions, Responses, Anthropic Messages |
| MLX-Serve | `http://localhost:11234` | Chat Completions, Responses, Anthropic Messages |

So Claude Code on Ollama, oMLX or MLX-Serve sends its requests to the server as they are, and on LM Studio magpie translates them. Codex on oMLX or MLX-Serve goes as it is, and on Ollama or LM Studio magpie turns its Responses requests into Chat Completions.

## Set it up

1. **Start the server.** Pull or load a model in Ollama or LM Studio and leave the server running.
2. **Add it in magpie.** In the Providers tab, press ＋ Add provider and pick Ollama or LM Studio under On this machine. No key is needed. magpie asks the server which models it has, and they show as `ollama/…` or `lmstudio/…`.
3. **Pick the model for the agent.** In the Agents tab, click the model on the Claude Code or Codex row and choose the local one. magpie writes Claude Code’s `settings.json` or Codex’s `config.toml`. Start a new session to use it.

The same from a terminal:

```
ollama pull qwen3
magpie provider add ollama
magpie models                     # every model, as provider/model
magpie claude ollama/qwen3        # Claude Code
magpie codex ollama/qwen3         # Codex
```

Inside the agent, Claude Code’s and Codex’s `/model` list magpie’s models too, so you can move between a local model and a cloud one there. What changes in each agent’s config is in [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models#settings) and [Models in Codex](https://usemagpie.ai/docs/codex-models).

## Another port or another computer

If the server listens on another port, or runs on another computer such as a GPU box or a NAS, change Server address in the provider’s editor. Each of its URLs moves there and keeps its path.

```
magpie provider add lmstudio address=http://192.168.1.5:1234
magpie provider set ollama address=192.168.1.20:11434
magpie provider set ollama address=     # back to the default
```

A server behind HTTPS with a self-signed certificate can be reached with Don't check its certificate in the editor; it applies to that provider’s own hosts only.

## vLLM, llama.cpp and other servers

A server with no preset is added as Custom: paste its URL, such as `http://localhost:8080/v1`, and press Detect APIs. magpie sends the smallest request to Chat Completions, Responses, Anthropic Messages and Gemini at that URL and keeps the ones that answer. The key can be left empty for a server that needs none.

## Context window

Agents plan around how long a request the model takes. Claude Code takes a model it doesn’t know for 200K, and Codex compacts a conversation at 90% of the window it is told. A local model is often loaded with a much smaller window, so tell magpie the real one: Context window under Advanced in the provider’s editor, for every model or one of them. magpie passes it on to the agents.

```
magpie provider set ollama context=32k
magpie provider set ollama context.qwen3=128k
```

## Masking

magpie’s [privacy masking](https://usemagpie.ai/docs/masking) replaces keys, tokens and other secrets with placeholders before a request leaves the gateway, a request to a local server too. When the model runs on your own computer or network, you can turn on Send requests unmasked in its editor, or run `magpie provider set ollama unmasked=yes`. It is your call: Ollama’s cloud models, or a relay you run locally, pass a request on to a vendor whatever the address.

## FAQ

### Can Claude Code use Ollama?

Yes. Add Ollama in magpie and pick one of its models for Claude Code. magpie writes the gateway’s address into Claude Code’s `settings.json`, and Ollama’s Anthropic-compatible API takes Claude Code’s requests as they are.

### Can Codex use Ollama or LM Studio?

Yes. Codex speaks only the Responses API, so magpie turns its requests into Chat Completions for Ollama and LM Studio, and the replies back, tool calls included. oMLX and MLX-Serve take Responses themselves.

### Do I need an API key?

No. The local presets take none. A server you secured with a key can have it in the provider’s editor.

### Can the model run on another computer?

Yes. Set the provider’s Server address to that computer, such as `http://192.168.1.20:11434`.

### Why does Claude Code fail on long conversations with a local model?

It assumes a model it doesn’t know takes 200K. Set the real Context window on the provider in magpie, and Claude Code and Codex compact before they reach it.

### How do I go back?

Pick one of the agent’s own models in magpie, or run `magpie claude default` or `magpie codex default`. What magpie wrote comes out, and what it replaced comes back.

Looking for cloud models? See [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models) and [Models in Codex](https://usemagpie.ai/docs/codex-models). Stuck? Ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/opencode-models

# Use DeepSeek, Kimi, GLM or your Claude and ChatGPT subscription in OpenCode

OpenCode reaches a model through a provider in its config. magpie adds one provider, named `magpie`, that leads to a gateway on your computer. Every model you have in magpie is listed under it: DeepSeek, Kimi, GLM and Qwen keys, and the models of a Claude, ChatGPT or Copilot sign-in.

The gateway runs at `127.0.0.1:3425`. OpenCode sends it OpenAI Chat Completions, and magpie passes each request on in the API its provider speaks, translating the request and the reply where they differ, streaming and tool calls included. OpenCode’s own providers stay as they were, next to magpie’s.

### Chinese models

DeepSeek, Kimi and Kimi Code, Zhipu GLM (pay as you go or Coding Plan), Z.ai, MiniMax and Qwen.

### Subscriptions

Claude Pro/Max, ChatGPT Plus/Pro and GitHub Copilot, signed in once in magpie.

### Anything else

Any OpenAI- or Anthropic-compatible URL and key, Ollama and LM Studio.

## Set it up

1. **Add the provider.** In magpie’s Providers tab, press ＋ Add provider, pick DeepSeek, Kimi, Zhipu GLM, MiniMax or Qwen, paste your API key and save. magpie asks the vendor which models it serves.
2. **Pick the model for OpenCode.** In the Agents tab, click the model on OpenCode’s row and choose one, such as `deepseek/deepseek-v4-pro`. magpie writes `"model": "magpie/deepseek/deepseek-v4-pro"` into OpenCode’s config, with the `magpie` provider beside it.
3. **Or pick it in OpenCode.** Once the provider is there, magpie’s models are in OpenCode’s own `/models` list under `magpie`, so you can switch there too.

The same from a terminal:

```
magpie provider add deepseek sk-…
magpie models                                    # every model, as provider/model
magpie opencode deepseek/deepseek-v4-pro         # OpenCode's model
magpie opencode small deepseek/deepseek-v4-flash # its small_model
```

OpenCode’s `small_model` is a field of its own on the row, so it can run on a cheaper model than the main one.

> **Zhipu GLM Coding Plan.** When you add Zhipu GLM or Z.ai, pick the plan your key is for. A Coding Plan key has its own endpoints, and sent to the pay-as-you-go one it is told it has no balance.

## Subscriptions

Sign in once in magpie, from ＋ Add provider or a terminal, and the subscription’s models are listed under `magpie` in OpenCode like any other. No API key.

| Subscription | Models are | From a terminal |
| --- | --- | --- |
| Claude (Pro, Max, Team) | `claude/…` | `magpie accounts add claude` `magpie opencode claude/claude-opus-5-5` |
| ChatGPT (Plus, Pro, Business) | `codex/…` | `magpie accounts add codex` `magpie opencode codex/gpt-5.5` |
| GitHub Copilot | `copilot/…` | `magpie accounts add copilot` |

Requests on a Claude subscription run through the Claude Code installed on your computer, so keep it installed. Copilot gives you a code to enter on GitHub’s page. Several accounts of one subscription can share the load and fail over; see [Subscriptions in any agent](https://usemagpie.ai/docs/subscriptions#accounts).

## What changes in opencode.json

magpie writes to the config file OpenCode reads from its config folder, `$OPENCODE_CONFIG_DIR` when that is set and `~/.config/opencode` otherwise: the first of `opencode.jsonc`, `opencode.json` and `config.json` that exists, or a new `opencode.json`. It changes only these keys; your other settings stay.

| Key | Set to |
| --- | --- |
| `model` | `magpie/<provider>/<model>` |
| `small_model` | The same form, when you set one |
| `provider.magpie.npm` | `@ai-sdk/openai-compatible` |
| `provider.magpie.options.baseURL` | `http://127.0.0.1:3425/v1` |
| `provider.magpie.options.apiKey` | The gateway’s key |
| `provider.magpie.models` | Every model magpie lists for OpenCode |

Each model carries its context window and output limit, so OpenCode knows when to compact; whether it takes images; its reasoning levels; and its price. magpie keeps the list up to date as you add providers and accounts. With OpenCode 2 installed, magpie writes OpenCode 2’s own keys instead: the provider under `providers.magpie` and the small model as `agents.title.model`. OpenCode in a WSL distro on Windows is set up the same way, in the distro’s `~/.config/opencode`.

## Reasoning levels and cost

- **Reasoning levels..** A model’s reasoning efforts are written as its variants in OpenCode, each one asking for that `reasoningEffort`. A model that offers fast processing, such as a GPT model from a ChatGPT plan, also gets a `fast` variant for each level.
- **Cost..** magpie writes each model’s price per million tokens, input, output, cache read and cache write, so OpenCode’s session cost counts, where without it every model costs 0.
- **Prompt caching..** magpie turns on OpenCode’s prompt cache key for its provider, so a provider that caches by it keeps the cache between turns.

## A shorter model list

By default OpenCode is shown every model you have in magpie. To show it only some providers or groups:

```
magpie visible opencode deepseek,claude   # only these providers
magpie visible opencode all               # every model again
```

A model left out of the list still answers when OpenCode asks for it by name.

## Switch back

On OpenCode’s row in magpie, the model picker lists OpenCode’s own providers too, the ones signed in in its `auth.json`. Pick one of them, or run:

```
magpie opencode default
```

It puts back the `model` and `small_model` OpenCode had before magpie, and takes the `magpie` provider out of the file.

**By provider:** [DeepSeek](https://usemagpie.ai/docs/deepseek) · [Kimi and Kimi Code](https://usemagpie.ai/docs/kimi) · [GLM Coding Plan](https://usemagpie.ai/docs/glm) · [Volcengine Ark](https://usemagpie.ai/docs/volcengine) · [Tencent Cloud](https://usemagpie.ai/docs/tencent-cloud) · [Baidu Qianfan](https://usemagpie.ai/docs/baidu-qianfan) · [SiliconFlow](https://usemagpie.ai/docs/siliconflow) · [ModelScope](https://usemagpie.ai/docs/modelscope) · [Huawei Cloud MaaS](https://usemagpie.ai/docs/huaweicloud) · [Xiaomi MiMo](https://usemagpie.ai/docs/xiaomi-mimo) · [StepFun](https://usemagpie.ai/docs/stepfun) · [LongCat](https://usemagpie.ai/docs/longcat) · [Qwen](https://usemagpie.ai/docs/qwen) · [MiniMax](https://usemagpie.ai/docs/minimax) · [Anthropic](https://usemagpie.ai/docs/anthropic) · [OpenAI](https://usemagpie.ai/docs/openai) · [Gemini](https://usemagpie.ai/docs/gemini) · [Grok](https://usemagpie.ai/docs/grok) · [Mistral](https://usemagpie.ai/docs/mistral) · [OpenRouter](https://usemagpie.ai/docs/openrouter) · [GitHub Copilot](https://usemagpie.ai/docs/copilot) · [Ollama](https://usemagpie.ai/docs/ollama)

[OpenCode Go and ClinePass in Claude Code, Codex and other agents](https://usemagpie.ai/docs/coding-plans)

## FAQ

### How do I use DeepSeek in OpenCode?

Add DeepSeek with your API key in magpie, then pick a DeepSeek model on OpenCode’s row in the Agents tab, or run magpie opencode deepseek/deepseek-v4-pro. magpie adds a magpie provider to `opencode.json` and sets the model.

### Can I use Kimi or GLM in OpenCode?

Yes. Add Kimi or Zhipu GLM in magpie and pick its model for OpenCode. For a GLM Coding Plan key, pick the Coding Plan when you add it, since it has its own endpoints.

### Can I use my Claude Pro or Max subscription in OpenCode?

Yes. Sign in to Claude in magpie (magpie accounts add claude) and pick a claude/… model for OpenCode. Requests on a Claude subscription run through the Claude Code installed on your computer, so keep it installed.

### Can I use my ChatGPT Plus or Pro subscription in OpenCode?

Yes. Sign in to ChatGPT in magpie (magpie accounts add codex) and pick a codex/… model, such as codex/gpt-5.5. Its reasoning levels show as the model’s variants in OpenCode.

### Which file does magpie change?

OpenCode’s config in ~/.config/opencode (or $OPENCODE_CONFIG_DIR): the first of `opencode.json`c, `opencode.json` and config.json, or a new `opencode.json`. It sets model and `small_model` and adds provider.magpie; other settings stay.

### How do I switch back to OpenCode’s own model?

Pick one of OpenCode’s own models on its row in magpie, or run `magpie opencode default`. It puts back the model and `small_model` you had and removes magpie’s provider.

Other agents: [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Models in Codex](https://usemagpie.ai/docs/codex-models), [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models), [OpenClaw on any model](https://usemagpie.ai/docs/openclaw), [OpenChamber on any model](https://usemagpie.ai/docs/openchamber). Stuck? Ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/alternatives

# magpie, CC Switch and Claude Code Router compared

magpie, [CC Switch](https://github.com/farion1231/cc-switch) and [Claude Code Router](https://github.com/musistudio/claude-code-router) (CCR) all help you run AI coding agents on the providers and models you choose. They overlap, and each is good at something. This page puts them side by side, using each project’s own README for the other two and magpie’s source for magpie.

### CC Switch

A desktop app (Tauri 2) that manages twelve tools, from Claude Code, Codex and Gemini CLI to OpenCode, OpenClaw, Hermes, Pi and Kimi Code. It switches a tool’s provider by writing only the key fields of its config, backing it up first, and keeps MCP servers, skills and prompts for every tool in one place. An optional local routing mode converts API formats and fails over through a queue. It ships over 90 provider presets.

### Claude Code Router

A local model gateway and control plane at `127.0.0.1:3456`. Agents such as Claude Code, Codex, Kimi CLI, Kilo Code, OpenCode and Pi get one stable endpoint through an agent profile, and routing rules decide where each request goes: conditions on headers and bodies, rewrites, retries, credential pools and ordered fallbacks. It adds tools to models (vision, web search, MCP, browser automation) and logs every request with its cost. Desktop app, npm CLI with a web UI, or Docker.

### magpie

A menu bar (tray) app with a window, a TUI and a CLI. It points each agent at a local gateway at `127.0.0.1:3425` that speaks OpenAI Chat Completions, OpenAI Responses, Anthropic Messages and Gemini and translates between them, so any agent can use any model, including a Claude, ChatGPT, GitHub Copilot or Gemini sign-in. Several keys and sign-ins can stand behind one model, with failover before the agent sees an error.

## Side by side

|  | magpie | CC Switch as of its README, Nov 2026 | Claude Code Router as of its README, Nov 2026 |
| --- | --- | --- | --- |
| Agents | Over 20, among them Claude Code, Codex, Gemini CLI, OpenCode, Pi, Goose, Crush, GitHub Copilot CLI, VS Code, Kimi Code, Hermes Agent and Snow CLI | 12: Claude Code, Claude Desktop, Codex, Gemini CLI, Grok Build, OpenCode, OpenClaw, Hermes, Pi, MiniMax Code, Kimi Code, Oh My Pi | Claude Code, Claude Design, Codex, Grok CLI, Kimi CLI, Kilo Code, OpenCode, Pi, ZCode, WorkBuddy, and compatible API clients |
| How it switches | Edits the one setting it changes in each agent’s config and points the agent at its local gateway | Direct: rewrites the key fields of the tool’s config. Routing (optional): a local proxy, default port 15721 | Local gateway; an agent profile connects the agent to it |
| Protocol translation | OpenAI Chat Completions, OpenAI Responses, Anthropic Messages and Gemini, both directions | In Routing mode, for Claude Code, Codex, Gemini CLI and Grok Build | Providers in OpenAI Chat / Responses, Anthropic Messages or Gemini format behind one endpoint |
| Subscription sign-ins | Claude Pro/Max, ChatGPT Plus/Pro, GitHub Copilot, Gemini Code Assist, Antigravity | Accounts (Beta): GitHub Copilot, ChatGPT, xAI (Grok), Kimi Code | Not stated (providers can import a local login where supported) |
| Routing and failover | Several keys and sign-ins behind one model; picks by intent, order, round robin, least used or quota; rests rate-limited accounts and fails over | Failover queue per tool with a circuit breaker (Routing mode); Aggregation puts several providers’ models in one list | Conditions on headers and bodies, prefixes, rewrites, retries, credential pools, key rotation, ordered fallback models |
| GUI and CLI | Menu bar / tray app with a window, TUI, CLI; Docker | Desktop app with a tray menu; CLI not stated | Desktop app; npm CLI with a browser UI; Docker |
| Platforms | macOS (signed and notarised), Windows, Linux | Windows 10+, macOS 12+ (signed and notarized), Linux (glibc 2.35+, WebKitGTK 4.1) | Windows, Linux (AppImage), macOS (Apple Silicon, Intel); signing not stated |
| License | MIT | MIT | MIT |

The CC Switch and Claude Code Router columns say only what their READMEs said in November 2026; where a README doesn’t say, the cell says “not stated”. Both projects move quickly, so check their pages for what has changed since.

## Which one fits

- **CC Switch.** fits when you mostly switch each tool between providers by hand and want its config left close to how you wrote it, with MCP servers, skills and prompts managed for every tool from one app. Its provider presets are the largest of the three, and it reaches tools the others don’t list, such as Claude Desktop, OpenClaw and Oh My Pi.
- **Claude Code Router.** fits when you want a gateway you can program: rules on headers and bodies, request rewrites, credential pools, client keys with their own quotas, and a log of every request with its cost. It also adds tools such as web search and browser automation to models that lack them, and runs headless from npm or Docker.
- **magpie.** fits when you use several agents and want each on a different model, Codex on DeepSeek and Claude Code on Kimi, say, or a Claude or ChatGPT subscription in another agent. Every agent goes through one translating gateway, and one model can be served by several accounts that take turns and fail over.

They can sit side by side. magpie’s gateway is an OpenAI-, Anthropic- and Gemini-compatible endpoint, so a tool that takes a custom base URL can use it as a provider.

## FAQ

### What is a CC Switch alternative?

magpie and Claude Code Router both cover part of what CC Switch does. magpie switches the model of each agent and runs every agent through one translating gateway with subscription sign-ins and failover; Claude Code Router is a programmable local gateway with routing rules and request logs.

### What is a claude-code-router alternative?

CC Switch, if you mostly want to switch each tool’s provider and keep its config as written; magpie, if you want a translating gateway for many agents with Claude, ChatGPT, Copilot or Gemini sign-ins and accounts that fail over.

### CC Switch vs claude-code-router: what is the difference?

By their READMEs, CC Switch is a desktop manager that rewrites each tool’s config and offers an optional local routing proxy, while Claude Code Router is a local gateway at `127.0.0.1:3456` that agents connect to through profiles and that routes each request by rules.

### Does magpie rewrite my agent’s config like CC Switch?

It edits only the one setting it changes in each agent’s config file, keeping comments and order, and points the agent at its gateway at `127.0.0.1:3425`. Picking the agent’s own model again puts the old value back.

### Is magpie a proxy like claude-code-router?

Yes, magpie runs a local gateway too. It speaks OpenAI Chat Completions, OpenAI Responses, Anthropic Messages and Gemini and translates between them, so Codex, which speaks only Responses, and Claude Code, which speaks only Messages, can use any provider’s model.

### Are all three free and open source?

Yes. magpie, CC Switch and Claude Code Router are each released under the MIT license.

Guides: [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Models in Codex](https://usemagpie.ai/docs/codex-models), [Subscriptions in any agent](https://usemagpie.ai/docs/subscriptions). Ask on [Discord](https://discord.gg/vGSnD3ZKQF) if you get stuck.

---

Source: https://usemagpie.ai/docs/deepseek

# DeepSeek in Claude Code, Codex, Gemini CLI and OpenCode

DeepSeek serves an OpenAI-compatible API and an Anthropic-compatible one. Add your key to magpie once, and Claude Code, Codex, Gemini CLI, OpenCode and every other agent you connect can use DeepSeek’s models through magpie’s gateway at `127.0.0.1:3425`.

## Add DeepSeek

1. **Get an API key.** Create one at [platform.deepseek.com/api_keys](https://platform.deepseek.com/api_keys).
2. **Add the provider.** In magpie’s Providers tab, press ＋ Add provider, pick DeepSeek, paste the key and save. magpie asks DeepSeek which models it serves, such as `deepseek-v4-pro` and `deepseek-v4-flash`.
3. **Pick it for an agent.** In the Agents tab, click the model on the agent’s row and choose a DeepSeek model.

```
magpie provider add deepseek sk-…
magpie models        # every model, as provider/model
```

Model ids in magpie are `provider/model`, so DeepSeek’s are `deepseek/…`. Adding the preset again adds a second DeepSeek provider for another key; to spread requests over several keys, add them all to the one provider instead.

## Endpoints

DeepSeek has one plan, pay as you go, and magpie uses these endpoints for it:

| API | Base URL |
| --- | --- |
| OpenAI Chat Completions and Responses | `https://api.deepseek.com/v1` |
| Anthropic Messages | `https://api.deepseek.com/anthropic` |

## In each agent

Pick the model on an agent’s row in the Agents tab, or from a terminal. Each guide says what magpie writes in that agent’s config and how to switch back.

```
magpie claude deepseek/deepseek-v4-pro
magpie codex deepseek/deepseek-v4-pro
magpie gemini model deepseek/deepseek-v4-flash
magpie opencode deepseek/deepseek-v4-pro
```

- **Claude Code.** speaks Anthropic Messages, and so does DeepSeek’s Anthropic endpoint, so its requests are passed on as they are. Every tier (opus, sonnet, haiku) runs on the model you pick unless you give one its own. [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models).
- **Codex.** speaks only OpenAI Responses. DeepSeek serves the Responses API itself, so Codex’s requests are passed on as they are. The model shows in Codex’s `/model` with its reasoning efforts. [Models in Codex](https://usemagpie.ai/docs/codex-models).
- **Gemini CLI.** speaks Gemini’s API. magpie points it at its gateway and translates. [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models).
- **OpenCode.** gets the model in `opencode.json`, with its reasoning variants and cost. [Models in OpenCode](https://usemagpie.ai/docs/opencode-models).

## Thinking, effort and the prompt cache

- **Thinking on tool turns..** DeepSeek’s Anthropic endpoint wants a thinking block on every assistant turn that calls a tool, and on turns that only answer tool results. When an agent’s history has none, magpie adds one, and turns a Claude `redacted_thinking` block into one. So a routing group can fall back from Claude to DeepSeek in the middle of a conversation.
- **Effort..** DeepSeek thinks at three levels, `low`, `high` and `max`, set in `output_config.effort`, and ignores `budget_tokens`. A token budget an agent sends is fitted to one of the three.
- **Prompt cache..** With several keys, magpie keeps a conversation on the same DeepSeek key for an hour after its last turn, so the next turn reads its prompt from DeepSeek’s cache instead of sending it uncached to another key.
- **Images..** magpie uploads each image an agent sends to DeepSeek’s API once and names it by its file id on later turns. `magpie provider set deepseek image-files=off` sends images inline on every turn instead.

## Balance and usage

The DeepSeek row shows your balance, read from DeepSeek: the total, what was granted and what you topped up. The Usage tab counts tokens, cache hits and cost for each agent and model that went through magpie.

DeepSeek's API doesn't search the web by itself; through magpie, Claude Code's WebSearch and Codex's web_search still work. See [Web search for any model](https://usemagpie.ai/docs/web-search).

## FAQ

### How do I use DeepSeek in Claude Code?

Add your DeepSeek API key in magpie (Providers, Add provider, DeepSeek), then pick a DeepSeek model such as `deepseek-v4-pro` on Claude Code’s row, or run `magpie claude deepseek/deepseek-v4-pro`. magpie writes Claude Code’s `settings.json` and passes its requests to DeepSeek’s Anthropic endpoint, `https://api.deepseek.com/anthropic`.

### Can Codex use DeepSeek?

Yes. DeepSeek serves the OpenAI Responses API that Codex speaks, so magpie passes Codex’s requests on as they are. Pick the model on Codex’s row or run `magpie codex deepseek/deepseek-v4-pro`; it shows in Codex’s `/model` list.

### Do I need to set ANTHROPIC_BASE_URL to DeepSeek myself?

No. magpie points Claude Code at its own gateway at `127.0.0.1:3425` and keeps your DeepSeek key itself. Picking one of Claude Code’s own models again puts back what you had.

### Can I switch between Claude and DeepSeek in one conversation?

Yes. DeepSeek’s Anthropic endpoint wants a thinking block on tool-calling turns, and a conversation that started on Claude doesn’t have one it can read. magpie adds it, so a routing group can fall back from Claude to DeepSeek mid-conversation.

### Which reasoning effort does DeepSeek take?

DeepSeek thinks at three levels, low, high and max, set in `output_config.effort`, and ignores `budget_tokens`. magpie fits the level or token budget an agent asks for to one of those three.

### Can I use several DeepSeek keys?

Yes. Add them all to the DeepSeek provider and tick each one. magpie spreads requests over them, keeps a conversation on one key so its prompt cache is reused, and moves on when a key runs out of balance.

Every agent: [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Models in Codex](https://usemagpie.ai/docs/codex-models), [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models), [Models in OpenCode](https://usemagpie.ai/docs/opencode-models). Ask on [Discord](https://discord.gg/vGSnD3ZKQF) if you get stuck.

---

Source: https://usemagpie.ai/docs/kimi

# Kimi K2 and Kimi Code in Claude Code, Codex, Gemini CLI and OpenCode

Kimi, from Moonshot AI, comes two ways: the Kimi API, paid as you go, and the Kimi Code membership, each with a global and a China endpoint. magpie has a preset for each of the four. Add a key once, and Claude Code, Codex, Gemini CLI, OpenCode and your other agents can use Kimi’s models through magpie’s gateway at `127.0.0.1:3425`.

## Add Kimi

1. **Get a key.** For the Kimi API, from the Kimi platform’s API keys page; for Kimi Code, from the Kimi Code console. The table below links each.
2. **Add the provider.** In Providers, press ＋ Add provider and pick the preset that issued your key: Kimi, Kimi (China), Kimi Code or Kimi Code (China). Paste the key and save. magpie asks Kimi which models it serves.
3. **Pick it for an agent.** In the Agents tab, choose a Kimi model on the agent’s row: `kimi-k2.6` on the API, say, or `kimi-for-coding` on Kimi Code.

```
magpie provider add moonshot sk-…        # Kimi API (platform.kimi.ai)
magpie provider add moonshot-cn sk-…     # Kimi API, China (platform.kimi.com)
magpie provider add kimi-code sk-…       # Kimi Code membership
magpie provider add kimi-code-cn sk-…    # Kimi Code membership, China
```

Model ids are `provider/model`: `moonshot/kimi-k2.6`, `kimi-code/kimi-for-coding`. The models listed are the ones Kimi serves your key at the time.

## Plans and endpoints

| Preset | Plan | OpenAI Chat Completions | Anthropic Messages | Key from |
| --- | --- | --- | --- | --- |
| Kimi | Kimi API, pay as you go | `https://api.moonshot.ai/v1` | `https://api.moonshot.ai/anthropic` | [platform.kimi.ai](https://platform.kimi.ai/console/api-keys?aff=magpie) |
| Kimi (China) | Kimi API, pay as you go | `https://api.moonshot.cn/v1` | `https://api.moonshot.cn/anthropic` | [platform.kimi.com](https://platform.kimi.com/console/api-keys?aff=magpie) |
| Kimi Code | Kimi Code membership | `https://api.kimi.ai/coding/v1` | `https://api.kimi.ai/coding` | [kimi.ai/code/console](https://www.kimi.ai/code/console?aff=magpie) |
| Kimi Code (China) | Kimi Code membership | `https://api.kimi.com/coding/v1` | `https://api.kimi.com/coding` | [kimi.com/code/console](https://www.kimi.com/code/console?aff=magpie) |

A key works only on the endpoints of the plan and region that issued it, so pick the preset that matches where you got it.

## In each agent

Pick the model on an agent’s row in the Agents tab, or from a terminal. Each guide says what magpie writes in that agent’s config and how to switch back.

```
magpie claude moonshot/kimi-k2.6
magpie codex moonshot/kimi-k2.6
magpie gemini model moonshot/kimi-k2.6
magpie opencode kimi-code/kimi-for-coding
```

- **Claude Code.** speaks Anthropic Messages, and so does Kimi’s Anthropic endpoint, so its requests are passed on as they are. Every tier (opus, sonnet, haiku) runs on the model you pick unless you give one its own. [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models).
- **Codex.** speaks only OpenAI Responses. Kimi serves Chat Completions and Anthropic Messages but not Responses, so magpie translates each request and the reply, streaming and tool calls included. The model shows in Codex’s `/model` with its reasoning efforts. [Models in Codex](https://usemagpie.ai/docs/codex-models).
- **Gemini CLI.** speaks Gemini’s API. magpie points it at its gateway and translates. [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models).
- **OpenCode.** gets the model in `opencode.json`, with its reasoning variants and cost. [Models in OpenCode](https://usemagpie.ai/docs/opencode-models).

## Thinking

Some Kimi models always think: Kimi Code (China)’s K3.1 turns away a request that switches thinking off. When an agent asks for it off and the model refuses, magpie asks again with thinking left on, so the agent gets an answer rather than the error.

## Balance, windows and search

- **Kimi API..** The row shows your balance: in ¥ for Kimi (China), in $ for Kimi.
- **Kimi Code..** The row shows the membership’s windows, read from Kimi: the weekly allowance, shorter windows such as five hours, the monthly allowance and a booster pack’s balance.
- **Cost..** Kimi Code’s models are listed at $0, so magpie’s Usage tab prices their calls at the Kimi API’s price for the same model.
- **Web search..** A Kimi Code key searches the web through the membership’s own search endpoint, and magpie gives that search to Kimi Code models that can’t search by themselves.

## FAQ

### How do I use Kimi K2 in Codex?

Add your Kimi key in magpie, then pick a Kimi model such as `kimi-k2.6` on Codex’s row, or run `magpie codex moonshot/kimi-k2.6`. Kimi serves Chat Completions and Anthropic Messages but not the Responses API Codex speaks, so magpie translates each request and the reply, streaming and tool calls included.

### Can I use my Kimi Code membership in Claude Code or Codex?

Yes. Add the Kimi Code preset (or Kimi Code (China)) with a key from the Kimi Code console. magpie sends requests to the membership’s own endpoints, `https://api.kimi.ai/coding` for Anthropic Messages and `https://api.kimi.ai/coding/v1` for Chat Completions, and shows the membership’s usage windows.

### Kimi or Kimi (China): which preset do I pick?

The one that issued your key. A key from platform.kimi.ai goes with Kimi (api.moonshot.ai); one from platform.kimi.com goes with Kimi (China) (api.moonshot.cn). Kimi Code has the same two: kimi.ai and kimi.com.

### Why does Kimi Code show a cost when the membership is prepaid?

Kimi Code’s model list prices its models at $0, so magpie prices each call at the Kimi API’s price for the same model. The figure shows what the work would have cost on the API; it isn’t charged.

### Can Kimi Code search the web for my agent?

Yes. A Kimi Code key searches the web through the membership’s own search endpoint, so a Kimi Code model that can’t search by itself is given magpie’s search on your plan.

Every agent: [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Models in Codex](https://usemagpie.ai/docs/codex-models), [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models), [Models in OpenCode](https://usemagpie.ai/docs/opencode-models), [Kimi Code on any model](https://usemagpie.ai/docs/kimi-code). Ask on [Discord](https://discord.gg/vGSnD3ZKQF) if you get stuck.

---

Source: https://usemagpie.ai/docs/glm

# GLM Coding Plan in Claude Code, Codex, Gemini CLI and OpenCode

Zhipu’s GLM models come from two places, Zhipu GLM at open.bigmodel.cn and Z.ai at api.z.ai, and each has two plans: pay as you go and the GLM Coding Plan. Add a key to magpie with its plan, and Claude Code, Codex, Gemini CLI, OpenCode and your other agents can use GLM through magpie’s gateway at `127.0.0.1:3425`.

## Add GLM

1. **Get a key.** From [open.bigmodel.cn](https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys) for Zhipu GLM, or [z.ai](https://z.ai/manage-apikey/apikey-list) for Z.ai.
2. **Add the provider and pick the plan.** In Providers, press ＋ Add provider, pick Zhipu GLM or Z.ai, choose the plan your key is for (Pay as you go or Coding Plan), paste the key and save.
3. **Pick it for an agent.** In the Agents tab, choose a GLM model such as `glm-5.3` on the agent’s row.

```
magpie provider add zhipu sk-… plan=coding   # GLM Coding Plan (open.bigmodel.cn)
magpie provider add zai sk-… plan=coding     # GLM Coding Plan (z.ai)
magpie provider add zhipu sk-… plan=api      # pay as you go
```

> **Pick the plan your key is for.** A Coding Plan key has its own endpoints. Sent to the pay-as-you-go one, it is told it has no balance (429, code 1113). If that happens, magpie tries the Coding Plan endpoint, and when the key is served there it moves the provider to the plan’s endpoints. When both refuse, the error says what each said and what to change.

## Plans and endpoints

| Preset | Plan | OpenAI Chat Completions | OpenAI Responses | Anthropic Messages |
| --- | --- | --- | --- | --- |
| Zhipu GLM | Pay as you go | `https://open.bigmodel.cn/api/paas/v4` | — | `https://open.bigmodel.cn/api/anthropic` |
| Zhipu GLM | Coding Plan | `https://open.bigmodel.cn/api/coding/paas/v4` | `https://open.bigmodel.cn/api/v1` | `https://open.bigmodel.cn/api/anthropic` |
| Z.ai | Pay as you go | `https://api.z.ai/api/paas/v4` | — | `https://api.z.ai/api/anthropic` |
| Z.ai | Coding Plan | `https://api.z.ai/api/coding/paas/v4` | `https://api.z.ai/api/v1` | `https://api.z.ai/api/anthropic` |

Both plans share the Anthropic endpoint, which bills the Coding Plan when the account has one. Each key on the provider says which plan it is for, so one provider can hold a pay-as-you-go key and a Coding Plan key, and each key’s requests, model list and windows are its own plan’s.

## In each agent

Pick the model on an agent’s row in the Agents tab, or from a terminal. Each guide says what magpie writes in that agent’s config and how to switch back.

```
magpie claude zhipu/glm-5.3
magpie codex zhipu/glm-5.3
magpie gemini model zhipu/glm-5.3
magpie opencode zhipu/glm-5.3
```

- **Claude Code.** speaks Anthropic Messages, and so does GLM’s Anthropic endpoint, so its requests are passed on as they are. Every tier (opus, sonnet, haiku) runs on the model you pick unless you give one its own. [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models).
- **Codex.** speaks only OpenAI Responses. The Coding Plan serves the Responses API itself, so Codex’s requests are passed on as they are; on pay as you go, magpie translates them to Chat Completions. The model shows in Codex’s `/model` with its reasoning efforts. [Models in Codex](https://usemagpie.ai/docs/codex-models).
- **Gemini CLI.** speaks Gemini’s API. magpie points it at its gateway and translates. [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models).
- **OpenCode.** gets the model in `opencode.json`, with its reasoning variants and cost. [Models in OpenCode](https://usemagpie.ai/docs/opencode-models).

## Thinking and effort

- **GLM-5.3 always thinks..** It turns away a request that switches thinking off. magpie asks again with thinking left on, so the agent gets an answer rather than the error.
- **Effort..** GLM-5.2 and GLM-5.3 take their reasoning level in `output_config.effort`, and magpie puts the agent’s level there.

## Usage windows and search

- **Coding Plan windows..** The row shows the plan’s windows, read from Zhipu or Z.ai: the hourly and weekly allowances, and the month’s MCP tool calls.
- **Web search..** With a Coding Plan key and no searcher chosen in Settings, magpie searches the web for GLM models through the plan’s own search service.

## FAQ

### How do I use the GLM Coding Plan in Claude Code?

Add Zhipu GLM (open.bigmodel.cn) or Z.ai (api.z.ai) in magpie, choose Coding Plan as the key’s plan, then pick a GLM model such as `glm-5.3` on Claude Code’s row, or run `magpie claude zhipu/glm-5.3`. Claude Code’s requests go to the Anthropic endpoint, which bills the Coding Plan when the account has one.

### Can Codex use GLM?

Yes. The GLM Coding Plan serves the OpenAI Responses API Codex speaks, so magpie passes Codex’s requests on as they are. On pay as you go, magpie translates Codex’s requests to Chat Completions. Run `magpie codex zhipu/glm-5.3` or pick it on Codex’s row.

### Why does my GLM Coding Plan key say insufficient balance (1113)?

A Coding Plan key sent to the pay-as-you-go endpoint, `https://open.bigmodel.cn/api/paas/v4`, is answered with 429 code 1113. magpie tries the Coding Plan endpoint, `https://open.bigmodel.cn/api/coding/paas/v4`, and when the key is served there it moves the provider to the plan’s endpoints. Choosing Coding Plan when you add the key avoids it.

### Can I have a Coding Plan key and a pay-as-you-go key together?

Yes. Each key on a Zhipu GLM or Z.ai provider says which plan it is for. Its requests go to that plan’s endpoints, and its model list and usage windows are that plan’s.

### Zhipu GLM or Z.ai: which preset do I pick?

The one that issued your key: Zhipu GLM for a key from open.bigmodel.cn, Z.ai for a key from z.ai.

### Does GLM-5.3 work with thinking turned off?

GLM-5.3 always thinks and turns away a request that switches thinking off. magpie asks again with thinking left on, so the agent gets an answer.

Every agent: [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Models in Codex](https://usemagpie.ai/docs/codex-models), [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models), [Models in OpenCode](https://usemagpie.ai/docs/opencode-models). Ask on [Discord](https://discord.gg/vGSnD3ZKQF) if you get stuck.

---

Source: https://usemagpie.ai/docs/volcengine

# Volcengine Ark Coding Plan in Claude Code and Codex

Volcengine Ark (火山方舟) is sold three ways: the Coding Plan, the Agent Plan and pay as you go. Each plan has endpoints of its own, and its quota is spent only there; a request to pay-as-you-go's /api/v3 is billed apart. Add the key in magpie with its plan, and Claude Code, Codex, Gemini CLI, OpenCode and other tools use Ark's Doubao, GLM, DeepSeek and Kimi models through magpie's local gateway on 127.0.0.1:3425.

## Add Volcengine Ark

1. **Get a key.** Create one on Ark's API key page (ark.volcengine.com). A plan's quota is spent only once the plan is subscribed on its own page.
2. **Add the provider and pick the plan.** On Providers, click ＋ Add provider, pick Volcengine Ark, set the key's plan to Coding Plan, Agent Plan or Pay as you go, and save.
3. **Pick it for a tool.** On Agents, pick a model such as ark-code-latest or doubao-seed-2.1-pro on a tool's row.

```
magpie claude volcengine/ark-code-latest
magpie codex volcengine/doubao-seed-2.1-pro
magpie opencode volcengine/glm-5.3
```

## Plans and endpoints

| Plan | Base URL (Chat Completions and Responses) | Anthropic Messages |
| --- | --- | --- |
| Coding Plan | `https://ark.cn-beijing.volces.com/api/coding/v3` | `https://ark.cn-beijing.volces.com/api/coding` |
| Agent Plan | `https://ark.cn-beijing.volces.com/api/plan/v3` | `https://ark.cn-beijing.volces.com/api/plan` |
| Pay as you go | `https://ark.cn-beijing.volces.com/api/v3` | — (no Anthropic endpoint in the preset) |

The plans' paths carry their version and are used as written; no `/v1` goes on them. Each key in the provider names its own plan, so one provider can hold Coding Plan, Agent Plan and pay-as-you-go keys, and each key's requests go to its own plan's endpoint.

## The plans' models

Both plans list the same models. Their `/models` doesn't give them (the Coding Plan's lists Ark's general catalog, the Agent Plan's answers 404), so magpie uses the text models Ark's plan docs list, ark-code-latest first: ark-code-latest, doubao-seed-evolving, doubao-seed-2.1-pro, doubao-seed-2.1-lite, doubao-seed-2.0-mini, glm-5.3, deepseek-v4-pro, deepseek-v4.1-flash, kimi-k3 and kimi-k3.1-pro, among others. Which of them take images is the docs' word too: glm-5.3-flash and deepseek-v4.1-flash take an image as it is. A pay-as-you-go key reads Ark's own model list.

## In each agent

- **Claude Code.** speaks Anthropic Messages. The plans have Anthropic endpoints of their own (`/api/coding`, `/api/plan`), so requests go as they are and spend the plan. See [Claude Code with other models](https://usemagpie.ai/docs/claude-code-models).
- **Codex.** speaks only OpenAI Responses. Ark's plan endpoints serve Responses themselves, so Codex's requests go as they are, and the models show in Codex's `/model`. See [Codex with other models](https://usemagpie.ai/docs/codex-models).
- **Gemini CLI.** speaks Gemini's API; magpie points it at the local gateway and translates. See [Gemini CLI with other models](https://usemagpie.ai/docs/gemini-cli-models).
- **OpenCode.** : magpie writes the models into opencode.json. See [OpenCode with other models](https://usemagpie.ai/docs/opencode-models).

## Web search

Ark's Responses API runs the `web_search` tool itself, on pay as you go and both plans; its Chat API doesn't. So Codex's web search goes to Ark to run instead of being taken out of the request. `include` values Ark refuses are left out, so the request isn't turned away whole.

## Images and video

The Agent Plan also has Seedream image models (doubao-seedream-5-0-pro, doubao-seedream-5.0-flash) and Seedance video models (doubao-seedance-2.0, 2.0-fast, 2.0-mini, 2.5). Pick them in Settings → Images to use them through magpie's image and video tools. Ark has no OpenAI-shaped videos API, so magpie starts and polls Ark's asynchronous generation tasks.

## Usage windows

The Coding Plan and Agent Plan have 5-hour, weekly and monthly windows. Ark tells them only to the account's control plane (open.volcengineapi.com), never to the inference key, so the provider's editor asks for the account's AccessKey ID and Secret. With them, the row shows what is left of the plan; pay as you go has no windows.

## FAQ

### How do I use the Volcengine Ark Coding Plan in Claude Code?

Add Volcengine Ark in magpie with the key's plan set to Coding Plan, then pick a model such as ark-code-latest on Claude Code's row, or run magpie claude volcengine/ark-code-latest. Requests go to the plan's Anthropic endpoint, https://ark.cn-beijing.volces.com/api/coding, and spend the plan.

### Why is a Coding Plan key billed as pay as you go?

A plan's quota is spent only at its own endpoints: /api/coding/v3 and /api/coding for the Coding Plan, /api/plan/v3 and /api/plan for the Agent Plan. /api/v3 is pay as you go. Set the key's plan in magpie and its requests go to the plan's endpoint.

### Does Volcengine Ark work in Codex?

Yes. The plan endpoints serve OpenAI Responses, so magpie passes Codex's requests through, and Ark runs web search itself. Run magpie codex volcengine/doubao-seed-2.1-pro, or pick it on Codex's row.

### How do I see what is left of an Ark plan?

Edit the Volcengine Ark provider and add the account's AccessKey ID and Secret. Ark tells the windows only through its control plane; the row then shows the 5-hour, weekly and monthly windows.

The same for other providers: [GLM Coding Plan](https://usemagpie.ai/docs/glm), [Kimi](https://usemagpie.ai/docs/kimi), [DeepSeek](https://usemagpie.ai/docs/deepseek), [Qwen](https://usemagpie.ai/docs/qwen). Per-agent guides: [Claude Code with other models](https://usemagpie.ai/docs/claude-code-models), [Codex with other models](https://usemagpie.ai/docs/codex-models). Hit an error? See [troubleshooting](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/tencent-cloud

# Tencent Cloud Token Plan in Claude Code and Codex

Tencent Cloud's models are on TokenHub: the Token Plan subscription (personal and enterprise) and pay as you go, each on keys of its own — an sk-tp- plan key, or TokenHub's own API key. Add one Tencent Cloud provider in magpie with each key's plan, and Claude Code, Codex, Gemini CLI, OpenCode and other tools use Hy, GLM, Kimi, DeepSeek and MiniMax through magpie's local gateway on 127.0.0.1:3425.

## Add Tencent Cloud

1. **Add the provider and pick the plan.** On Providers, click ＋ Add provider, pick Tencent Cloud, set the key's plan to Plan · China, Pay as you go · China, Pay as you go · Global, Enterprise plan · Global, paste the key and save.
2. **Pick it for a tool.** On Agents, pick a model such as tc-code-latest or glm-5.3 on a tool's row.

```
magpie claude tencent-cloud/tc-code-latest
magpie codex tencent-cloud/glm-5.3
magpie opencode tencent-cloud/kimi-k3
```

## Plans and endpoints

| Plan | Chat Completions and Responses | Anthropic Messages |
| --- | --- | --- |
| Token Plan (personal, enterprise) · China | `https://tokenhub.tencentmaas.com/plan/v3` | `https://tokenhub.tencentmaas.com/plan/anthropic` |
| Pay as you go · China | `https://tokenhub.tencentmaas.com/v1` | `https://tokenhub.tencentmaas.com` |
| Pay as you go · Global | `https://tokenhub-intl.tencentmaas.com/v1` | `https://tokenhub-intl.tencentmaas.com` |
| Enterprise · Singapore | `https://tokenhub-intl.tencentmaas.com/plan/v3` | `https://tokenhub-intl.tencentmaas.com/plan/anthropic` |

The personal and enterprise plans share endpoints; the key tells the plan. China is one region for both, so its models are the two plans' together; Singapore sells the enterprise plan alone. Each key in the provider names its plan, so pay-as-you-go and plan keys can share one provider.

The personal plan used to be at `api.lkeap.cloud.tencent.com` until Tencent moved it to TokenHub. A provider saved at the old host is moved to the new one.

## The plans' models

The plans give no model list of their own, and the public catalog names only their Hy models, so magpie gives the models from Tencent's plan docs: tc-code-latest, auto, glm-5.3, glm-5.3-flash, kimi-k3, kimi-k2.7-code, deepseek-v4-pro, deepseek-v4.1-flash, minimax-m3, hy4-preview, hy3, mimo-v2.6-pro, among others. tc-code-latest is whichever model the console has picked. A pay-as-you-go key reads TokenHub's `/v1/models`, which has other makers' models such as Qwen too.

## In each agent

- **Claude Code.** speaks Anthropic Messages. The plan and pay as you go both have Anthropic endpoints, so requests go as they are. See [Claude Code with other models](https://usemagpie.ai/docs/claude-code-models).
- **Codex.** speaks only OpenAI Responses. TokenHub's plan and pay as you go both serve Responses, so Codex's requests go as they are. The models show in Codex's `/model`. See [Codex with other models](https://usemagpie.ai/docs/codex-models).
- **Gemini CLI.** speaks Gemini's API; magpie points it at the local gateway and translates. See [Gemini CLI with other models](https://usemagpie.ai/docs/gemini-cli-models).
- **OpenCode.** : magpie writes the models into opencode.json. See [OpenCode with other models](https://usemagpie.ai/docs/opencode-models).

## Enterprise quota

The enterprise plan's cycle quota (credits on 专业套餐, tokens on 轻享套餐) is told only to Tencent Cloud's API, signed with the account's SecretId and SecretKey, never to the plan key. Add them in the provider's editor, and magpie's Usage page shows a card for each enterprise plan the SecretId can see: what the cycle has used and when it resets. The personal plan has no API for its usage, only the console; pay as you go has no windows.

## FAQ

### How do I use the Tencent Cloud Token Plan in Claude Code?

Add Tencent Cloud in magpie with the key's plan set to Plan · China, then pick tc-code-latest or glm-5.3 on Claude Code's row, or run magpie claude tencent-cloud/tc-code-latest. Requests go to the plan's Anthropic endpoint, https://tokenhub.tencentmaas.com/plan/anthropic.

### What is the difference between a Token Plan key and a TokenHub pay-as-you-go key?

A plan key starts with sk-tp- and works only at the plan endpoints under /plan; pay as you go uses TokenHub's own API key at /v1. Set each key's plan in magpie; both can share one provider.

### Does the personal plan's old host api.lkeap.cloud.tencent.com still work?

Tencent moved the personal plan to tokenhub.tencentmaas.com. A provider in magpie saved at the old host is moved to the new one by itself.

### Can magpie show what is left of a Tencent Cloud plan?

For the enterprise plan, yes: add the account's SecretId and SecretKey in the provider's editor, and the Usage page shows the cycle's use and its reset. The personal plan has no API for it; see Tencent Cloud's console.

The same for other providers: [Volcengine Ark](https://usemagpie.ai/docs/volcengine), [GLM Coding Plan](https://usemagpie.ai/docs/glm), [Kimi](https://usemagpie.ai/docs/kimi), [DeepSeek](https://usemagpie.ai/docs/deepseek), [Qwen](https://usemagpie.ai/docs/qwen). Tencent's own coding agent: [CodeBuddy on any model](https://usemagpie.ai/docs/codebuddy). Hit an error? See [troubleshooting](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/baidu-qianfan

# Baidu Qianfan Token Plan in Claude Code and Codex

Baidu Qianfan (百度千帆) has two Token Plans, personal and enterprise, and pay as you go, each with endpoints and keys of its own. Add Baidu Qianfan in magpie with each key's plan, and Claude Code, Codex, Gemini CLI, OpenCode and other tools use Qianfan's DeepSeek and GLM through magpie's local gateway on 127.0.0.1:3425.

## Add Baidu Qianfan

1. **Add the provider and pick the plan.** On Providers, click ＋ Add provider, pick Baidu Qianfan, set the key's plan to Token Plan Personal, Token Plan Enterprise, Pay as you go, paste the key and save.
2. **Pick it for a tool.** On Agents, pick a model such as qianfan-code-latest or deepseek-v4-pro on a tool's row.

```
magpie claude baidu-qianfan/qianfan-code-latest
magpie codex baidu-qianfan/deepseek-v4-pro
magpie opencode baidu-qianfan/glm-5.3
```

## Plans and endpoints

| Plan | Chat Completions and Responses | Anthropic Messages |
| --- | --- | --- |
| Token Plan personal | `https://qianfan.baidubce.com/v2/tokenplan/personal` | `https://qianfan.baidubce.com/anthropic/tokenplan/personal` |
| Token Plan enterprise | `https://qianfan.baidubce.com/v2/tokenplan/team` | `https://qianfan.baidubce.com/anthropic/tokenplan/team` |
| Pay as you go | `https://qianfan.baidubce.com/v2` | `https://qianfan.baidubce.com/anthropic` |

Each plan's key works at its own endpoints. Each key in the provider names its plan, so personal, enterprise and pay-as-you-go keys can share one provider, and each key's requests go to its own plan's endpoint.

## The plans' models

The plans' `/models` answers 404, so magpie gives the models from both plans' docs: qianfan-code-latest, deepseek-v4.1-flash, deepseek-v4-pro, deepseek-v4-pro-0813, deepseek-v4-flash-0731, glm-5.3, glm-5.3-flash, glm-5.2, glm-5.1, among others. deepseek-v4-flash, deepseek-v3.2 and glm-5 are the enterprise plan's alone. qianfan-code-latest is whichever model the console has picked. A pay-as-you-go key reads Qianfan's `/v2/models`.

## In each agent

- **Claude Code.** speaks Anthropic Messages. Qianfan's plans and pay as you go have Anthropic endpoints, so requests go as they are. See [Claude Code with other models](https://usemagpie.ai/docs/claude-code-models).
- **Codex.** speaks only OpenAI Responses. Qianfan's plan endpoints serve Responses too, so Codex's requests go as they are. The models show in Codex's `/model`. See [Codex with other models](https://usemagpie.ai/docs/codex-models).
- **Gemini CLI.** speaks Gemini's API; magpie points it at the local gateway and translates. See [Gemini CLI with other models](https://usemagpie.ai/docs/gemini-cli-models).
- **OpenCode.** : magpie writes the models into opencode.json. See [OpenCode with other models](https://usemagpie.ai/docs/opencode-models).

## FAQ

### How do I use the Baidu Qianfan Token Plan in Claude Code?

Add Baidu Qianfan in magpie with the key's plan set to Token Plan Personal or Enterprise, then pick qianfan-code-latest on Claude Code's row, or run magpie claude baidu-qianfan/qianfan-code-latest. Requests go to the plan's Anthropic endpoint, such as https://qianfan.baidubce.com/anthropic/tokenplan/personal.

### Which model is qianfan-code-latest?

The one you picked for the plan in Qianfan's console. Change it there; the name in magpie and your tools stays the same.

### Do the personal and enterprise plans have the same models?

Mostly. deepseek-v4-flash, deepseek-v3.2 and glm-5 are the enterprise plan's alone; deepseek-v4-pro, glm-5.3 and the others are in both.

### Does Baidu Qianfan work in Codex?

Yes. Qianfan's plan endpoints serve OpenAI Responses, so magpie passes Codex's requests through. Run magpie codex baidu-qianfan/deepseek-v4-pro, or pick it on Codex's row.

The same for other providers: [Volcengine Ark](https://usemagpie.ai/docs/volcengine), [Tencent Cloud](https://usemagpie.ai/docs/tencent-cloud), [GLM Coding Plan](https://usemagpie.ai/docs/glm), [Kimi](https://usemagpie.ai/docs/kimi), [DeepSeek](https://usemagpie.ai/docs/deepseek), [Qwen](https://usemagpie.ai/docs/qwen). Hit an error? See [troubleshooting](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/siliconflow

# SiliconFlow in Claude Code and Codex

SiliconFlow (硅基流动) serves open models such as DeepSeek, GLM, Kimi and Qwen on one API key, over OpenAI's Chat Completions. Claude Code wants Anthropic Messages and Codex wants Responses, and SiliconFlow serves neither; magpie's local gateway on 127.0.0.1:3425 converts between them, so these tools use SiliconFlow's models directly.

## Add SiliconFlow

1. **Add the provider.** On Providers, click ＋ Add provider, pick SiliconFlow, set the key to China or Global, paste the key and save.
2. **Pick it for a tool.** On Agents, pick a model such as deepseek-ai/DeepSeek-V4-Pro on a tool's row.

```
magpie claude siliconflow/deepseek-ai/DeepSeek-V4-Pro
magpie codex siliconflow/zai-org/GLM-5.3
magpie opencode siliconflow/moonshotai/Kimi-K3
```

## China and Global

| Site | Chat Completions | Console |
| --- | --- | --- |
| China | `https://api.siliconflow.cn/v1` | cloud.siliconflow.cn |
| Global | `https://api.siliconflow.com/v1` | cloud.siliconflow.com |

The Global site is another account, with keys and a balance (in $) of its own; a China key doesn't work there. Each key in the provider names its site, so keys from both can share one provider.

## Models

SiliconFlow's model names carry their maker, and go into magpie and your tools as written: deepseek-ai/DeepSeek-V4-Pro, deepseek-ai/DeepSeek-V4-Flash, zai-org/GLM-5.3, moonshotai/Kimi-K3, moonshotai/Kimi-K2.7-Code, Qwen/Qwen3-Coder-480B-A35B-Instruct, meituan-longcat/LongCat-2.0. magpie takes their names, context and prices from models.dev's siliconflow catalog. On the command line, write `siliconflow/` then the name.

## In each agent

- **Claude Code.** speaks Anthropic Messages, which this provider doesn't serve. magpie converts each request to Chat Completions and the reply back, reasoning included. [Claude Code with other models](https://usemagpie.ai/docs/claude-code-models).
- **Codex.** speaks OpenAI Responses. It has no Responses, so magpie converts to Chat Completions; Codex's custom tools such as `apply_patch` go to the model as functions, and its calls come back as Codex can run them. [Codex with other models](https://usemagpie.ai/docs/codex-models).
- **Gemini CLI.** speaks Gemini's API; magpie converts it to Chat Completions. [Gemini CLI with other models](https://usemagpie.ai/docs/gemini-cli-models).
- **OpenCode.** speaks Chat Completions, so requests go as they are. [OpenCode with other models](https://usemagpie.ai/docs/opencode-models).

## Balance

SiliconFlow retired its balance query, `/v1/user/info`, on 2026-08-14 (it answers 410) with nothing in its place yet, and its old granted balance is a voucher now. So magpie's usage card says where the balance is shown instead of an amount, and its button opens that site's console. A key refused for itself (401) is said as it came.

## FAQ

### How do I use SiliconFlow in Claude Code?

Add SiliconFlow in magpie with your key, then pick a model such as deepseek-ai/DeepSeek-V4-Pro on Claude Code's row, or run magpie claude siliconflow/deepseek-ai/DeepSeek-V4-Pro. SiliconFlow has no Anthropic endpoint, so magpie converts Claude Code's requests to Chat Completions.

### Does SiliconFlow work in Codex?

Yes. SiliconFlow has Chat Completions only, so magpie converts Codex's Responses requests, custom tools like apply_patch included. Run magpie codex siliconflow/zai-org/GLM-5.3.

### Does a China key work on the Global site?

No. cloud.siliconflow.com is another account, with its own keys and balance. Set each key's site to China or Global in magpie.

### Why doesn't magpie show my SiliconFlow balance?

SiliconFlow retired its balance API on 2026-08-14 and has no new one yet. magpie's card takes you to the console, where the balance and vouchers are shown.

The same for other providers: [ModelScope](https://usemagpie.ai/docs/modelscope), [Volcengine Ark](https://usemagpie.ai/docs/volcengine), [GLM Coding Plan](https://usemagpie.ai/docs/glm), [Kimi](https://usemagpie.ai/docs/kimi), [DeepSeek](https://usemagpie.ai/docs/deepseek), [Qwen](https://usemagpie.ai/docs/qwen). Hit an error? See [troubleshooting](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/modelscope

# ModelScope in Claude Code and Codex

ModelScope's (魔搭) API-Inference takes a ModelScope account's access token as its key and serves models such as Qwen and GLM over Chat Completions and Responses. Add ModelScope in magpie, and Claude Code, Codex, Gemini CLI and OpenCode use them through magpie's local gateway on 127.0.0.1:3425.

## Add ModelScope

1. **Add the provider.** On Providers, click ＋ Add provider, pick ModelScope, use your ModelScope access token as the key, paste the key and save.
2. **Pick it for a tool.** On Agents, pick a model such as Qwen/Qwen3-Coder-30B-A3B-Instruct on a tool's row.

```
magpie claude modelscope/Qwen/Qwen3-Coder-30B-A3B-Instruct
magpie codex modelscope/ZhipuAI/GLM-4.6
magpie opencode modelscope/Qwen/Qwen3-235B-A22B-Instruct-2507
```

## Endpoint and token

| API | Endpoint |
| --- | --- |
| Chat Completions | `https://api-inference.modelscope.cn/v1` |
| Responses | `https://api-inference.modelscope.cn/v1` |

The key is a ModelScope account's access token, made at modelscope.cn/my/myaccesstoken. ModelScope is not Alibaba Cloud's DashScope: a DashScope key goes in the [Qwen](https://usemagpie.ai/docs/qwen) provider, and neither works on the other. A provider added by hand at api-inference.modelscope.cn is taken as ModelScope too.

## Models

ModelScope's model names carry their organisation, written as they are: Qwen/Qwen3-Coder-30B-A3B-Instruct, Qwen/Qwen3-235B-A22B-Instruct-2507, Qwen/Qwen3-235B-A22B-Thinking-2507, ZhipuAI/GLM-4.6, ZhipuAI/GLM-4.5, among others. magpie takes their names and context from models.dev's modelscope catalog. On the command line, write `modelscope/` then the name.

## In each agent

- **Claude Code.** speaks Anthropic Messages, which this provider doesn't serve. magpie converts each request to Chat Completions and the reply back, reasoning included. [Claude Code with other models](https://usemagpie.ai/docs/claude-code-models).
- **Codex.** speaks OpenAI Responses. It serves Responses too, so Codex's requests go as they are. [Codex with other models](https://usemagpie.ai/docs/codex-models).
- **Gemini CLI.** speaks Gemini's API; magpie converts it to Chat Completions. [Gemini CLI with other models](https://usemagpie.ai/docs/gemini-cli-models).
- **OpenCode.** speaks Chat Completions, so requests go as they are. [OpenCode with other models](https://usemagpie.ai/docs/opencode-models).

## Images

ModelScope draws through async tasks of its own: a request starts a task and answers its task_id, which is asked about until it succeeds or fails. It runs one task of a user's at a time and answers bursts with 429, so magpie asks for one image at a time, waits a moment when it is busy, and hands the result to your tool as an image it can read.

[NVIDIA NIM in Claude Code, Codex and other agents](https://usemagpie.ai/docs/nvidia)

## FAQ

### How do I use ModelScope in Claude Code?

Add ModelScope in magpie with your access token as the key, then pick Qwen/Qwen3-Coder-30B-A3B-Instruct on Claude Code's row, or run magpie claude modelscope/Qwen/Qwen3-Coder-30B-A3B-Instruct. ModelScope has no Anthropic endpoint, so magpie converts to Chat Completions.

### Where do I get a ModelScope key?

ModelScope uses your account's access token, made at modelscope.cn/my/myaccesstoken. Paste it into magpie's ModelScope provider.

### Is ModelScope the same as Alibaba's DashScope?

No. ModelScope's API-Inference is at api-inference.modelscope.cn on a ModelScope access token; DashScope takes an Alibaba Cloud key and is magpie's Qwen provider.

### Does ModelScope work in Codex?

Yes. ModelScope serves Responses, so magpie passes Codex's requests through. Run magpie codex modelscope/ZhipuAI/GLM-4.6.

The same for other providers: [SiliconFlow](https://usemagpie.ai/docs/siliconflow), [Volcengine Ark](https://usemagpie.ai/docs/volcengine), [GLM Coding Plan](https://usemagpie.ai/docs/glm), [Kimi](https://usemagpie.ai/docs/kimi), [DeepSeek](https://usemagpie.ai/docs/deepseek), [Qwen](https://usemagpie.ai/docs/qwen). Hit an error? See [troubleshooting](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/huaweicloud

# Huawei Cloud MaaS Token Plan in Claude Code and Codex

Huawei Cloud ModelArts MaaS's Token Plan is for personal accounts in 西南-贵阳一 (Guiyang) and serves GLM, Kimi and DeepSeek over Chat Completions and Anthropic Messages. Add Huawei Cloud in magpie with the plan, and Claude Code, Codex, Gemini CLI and OpenCode use them through magpie's local gateway on 127.0.0.1:3425.

## Add Huawei Cloud

1. **Add the provider and pick the plan.** On Providers, click ＋ Add provider, pick Huawei Cloud MaaS, set the key's plan to Token Plan or Pay as you go, paste the key and save.
2. **Pick it for a tool.** On Agents, pick a model such as glm-5.3 on a tool's row.

```
magpie claude huaweicloud/glm-5.3
magpie codex huaweicloud/deepseek-v4.1-flash
magpie opencode huaweicloud/kimi-k2.6
```

## Plans and endpoints

| Plan | Chat Completions | Anthropic Messages |
| --- | --- | --- |
| Token Plan | `https://api.modelarts-maas.com/plan/v2` | `https://api.modelarts-maas.com/plan/anthropic` |
| Pay as you go | `https://api.modelarts-maas.com/openai/v1` | `https://api.modelarts-maas.com/anthropic` |

The Token Plan's quota is spent only at the endpoints under `/plan`, so magpie uses the plan's by default; pay as you go bills apart. Both take a MaaS API key, made under the ModelArts console's authentication management. Each key in the provider names its plan. Neither serves Responses.

## Models

Until its list is fetched, magpie gives the plan's models: glm-5.3, glm-5.1, kimi-k2.6, deepseek-v4.1-flash, deepseek-v4-flash, lowercase as Huawei's OpenClaw page writes them. Once the list is in, Huawei's own list is the one served.

## In each agent

- **Claude Code.** speaks Anthropic Messages, which the plan serves, so requests go as they are. See [Claude Code with other models](https://usemagpie.ai/docs/claude-code-models).
- **Codex.** speaks only OpenAI Responses, which Huawei Cloud doesn't serve, so magpie converts to Chat Completions; custom tools such as `apply_patch` go to the model as functions and come back as Codex can run them. See [Codex with other models](https://usemagpie.ai/docs/codex-models).
- **Gemini CLI.** speaks Gemini's API; magpie translates at the local gateway. See [Gemini CLI with other models](https://usemagpie.ai/docs/gemini-cli-models).
- **OpenCode.** : magpie writes the models into opencode.json. See [OpenCode with other models](https://usemagpie.ai/docs/opencode-models).

## FAQ

### How do I use the Huawei Cloud Token Plan in Claude Code?

Add Huawei Cloud MaaS in magpie with the key's plan set to Token Plan, then pick glm-5.3 on Claude Code's row, or run magpie claude huaweicloud/glm-5.3. Requests go to the plan's Anthropic endpoint, https://api.modelarts-maas.com/plan/anthropic.

### Does Huawei Cloud MaaS work in Codex?

Yes. Huawei Cloud has no Responses endpoint, so magpie converts Codex's requests to Chat Completions, custom tools included. Run magpie codex huaweicloud/deepseek-v4.1-flash.

### Why the endpoints under /plan?

The Token Plan's quota is spent only at /plan/v2 and /plan/anthropic; requests to pay as you go's /openai/v1 bill apart. magpie uses the plan's endpoints by default.

### Which models does the Huawei Cloud Token Plan have?

magpie gives glm-5.3, glm-5.1, kimi-k2.6, deepseek-v4.1-flash and deepseek-v4-flash until Huawei's list is fetched, and then serves that list.

The same for other providers: [Tencent Cloud](https://usemagpie.ai/docs/tencent-cloud), [Baidu Qianfan](https://usemagpie.ai/docs/baidu-qianfan), [Volcengine Ark](https://usemagpie.ai/docs/volcengine), [GLM Coding Plan](https://usemagpie.ai/docs/glm), [Kimi](https://usemagpie.ai/docs/kimi), [DeepSeek](https://usemagpie.ai/docs/deepseek), [Qwen](https://usemagpie.ai/docs/qwen). Hit an error? See [troubleshooting](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/xiaomi-mimo

# Xiaomi MiMo Token Plan in Claude Code and Codex

Xiaomi's MiMo platform has a Token Plan and pay as you go. A Token Plan's tp- key works only at its region's own host (China, Singapore or Europe); pay as you go is api.xiaomimimo.com. Each serves Chat Completions, Responses and Anthropic Messages, so Claude Code's, Codex's and OpenCode's requests go as they are, with magpie's local gateway on 127.0.0.1:3425 routing them and holding the key.

## Add Xiaomi MiMo

1. **Add the provider and pick the plan.** On Providers, click ＋ Add provider, pick Xiaomi MiMo, set the key's plan to Plan · China, Plan · Singapore, Plan · Europe, Pay as you go, paste the key and save.
2. **Pick it for a tool.** On Agents, pick a model such as mimo-v2.6-pro on a tool's row.

```
magpie claude xiaomi/mimo-v2.6-pro
magpie codex xiaomi/mimo-v2.6-pro
magpie opencode xiaomi/mimo-v2.6-flash
```

## Regions and endpoints

| Plan | Chat Completions and Responses | Anthropic Messages |
| --- | --- | --- |
| Token Plan · China | `https://token-plan-cn.xiaomimimo.com/v1` | `https://token-plan-cn.xiaomimimo.com/anthropic` |
| Token Plan · Singapore | `https://token-plan-sgp.xiaomimimo.com/v1` | `https://token-plan-sgp.xiaomimimo.com/anthropic` |
| Token Plan · Europe | `https://token-plan-ams.xiaomimimo.com/v1` | `https://token-plan-ams.xiaomimimo.com/anthropic` |
| Pay as you go | `https://api.xiaomimimo.com/v1` | `https://api.xiaomimimo.com/anthropic` |

A Token Plan's tp- key is spent only at the host of the region it was bought in. Each key in the provider names its region, so keys from several regions and pay as you go can share one provider. Plans and their keys are at platform.xiaomimimo.com/token-plan.

## Models

Each region names its own catalog: a plan's region lists the plan's models before Xiaomi's public catalog, and pay as you go uses the public one alone. The main chat models are mimo-v2.6-pro, mimo-v2.6-flash, mimo-v2.5-pro and mimo-v2.5. The plan catalogs price their models at $0, which magpie doesn't take as a price, so a pay-as-you-go call is counted at Xiaomi's own prices, not at $0. The model list is read from api.xiaomimimo.com.

## In each agent

- **Claude Code.** speaks Anthropic Messages. Each MiMo region has an Anthropic endpoint, so requests go as they are. See [Claude Code with other models](https://usemagpie.ai/docs/claude-code-models).
- **Codex.** speaks only OpenAI Responses. Each MiMo region serves Responses, so Codex's requests go as they are. The models show in Codex's `/model`. See [Codex with other models](https://usemagpie.ai/docs/codex-models).
- **Gemini CLI.** speaks Gemini's API; magpie points it at the local gateway and translates. See [Gemini CLI with other models](https://usemagpie.ai/docs/gemini-cli-models).
- **OpenCode.** : magpie writes the models into opencode.json. See [OpenCode with other models](https://usemagpie.ai/docs/opencode-models).

## The MiMo app subscription

This page is about the platform's API keys. The MiMo app subscription you sign in to with a Xiaomi account (mimo-app) is another thing: it moved out of magpie's built-ins into the community plugin `@magpie-community/opencode-mimo-auth`; install it from magpie's Plugins page and sign in.

## FAQ

### How do I use Xiaomi MiMo in Claude Code?

Add Xiaomi MiMo in magpie with your tp- key's region (say Plan · China), then pick mimo-v2.6-pro on Claude Code's row, or run magpie claude xiaomi/mimo-v2.6-pro. Requests go to that region's Anthropic endpoint, such as https://token-plan-cn.xiaomimimo.com/anthropic.

### Does a MiMo Token Plan key work in another region?

No. A tp- key is spent only at its own region's host. Set each key's region in magpie; keys from several regions can share one provider.

### Does MiMo work in Codex?

Yes. Each MiMo region serves OpenAI Responses, so magpie passes Codex's requests through. Run magpie codex xiaomi/mimo-v2.6-pro.

### Can I use the MiMo app subscription too?

Yes, but not in this provider. The MiMo app subscription signed in with a Xiaomi account is served by the community plugin @magpie-community/opencode-mimo-auth; install it from magpie's Plugins page.

The same for other providers: [Tencent Cloud](https://usemagpie.ai/docs/tencent-cloud), [Volcengine Ark](https://usemagpie.ai/docs/volcengine), [GLM Coding Plan](https://usemagpie.ai/docs/glm), [Kimi](https://usemagpie.ai/docs/kimi), [DeepSeek](https://usemagpie.ai/docs/deepseek), [Qwen](https://usemagpie.ai/docs/qwen). Hit an error? See [troubleshooting](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/stepfun

# StepFun Step Plan in Claude Code and Codex

StepFun has two sites with separate accounts: platform.stepfun.com in China and platform.stepfun.ai internationally. Each has a Step Plan and pay as you go; the Step Plan is served at its own step_plan endpoints, and its key is refused at pay as you go's. Add the provider for your site in magpie with the key's plan, and Claude Code, Codex, Gemini CLI and OpenCode use Step's models through magpie's local gateway on 127.0.0.1:3425.

## Add StepFun

1. **Add the provider and pick the plan.** On Providers, click ＋ Add provider, pick StepFun or StepFun (China), set the key's plan to Step Plan or Pay as you go, paste the key and save.
2. **Pick it for a tool.** On Agents, pick a model such as step-5-preview on a tool's row.

An international account is StepFun (provider id `stepfun`); a China account is StepFun (China) (`stepfun-cn`).

```
magpie claude stepfun-cn/step-5-preview
magpie codex stepfun-cn/step-3.7-flash
magpie opencode stepfun/step-5-preview
```

## Sites, plans and endpoints

| Site and plan | Chat Completions | Anthropic Messages |
| --- | --- | --- |
| China · Step Plan | `https://api.stepfun.com/step_plan/v1` | `https://api.stepfun.com/step_plan` |
| China · Pay as you go | `https://api.stepfun.com/v1` | `https://api.stepfun.com` |
| International · Step Plan | `https://api.stepfun.ai/step_plan/v1` | `https://api.stepfun.ai/step_plan` |
| International · Pay as you go | `https://api.stepfun.ai/v1` | `https://api.stepfun.ai` |

A Step Plan key works only at the endpoints under `step_plan` and is refused at pay as you go's, so magpie sends each request by the plan its key names. A Step Plan key and a pay-as-you-go key on one site can share one provider. Neither serves Responses.

## Models

The Step Plan catalogs' chat models are step-5-preview, step-3.7-flash, step-3.5-flash and step-3.5-flash-2603; the China Step Plan has step-router-v1 too. Pay as you go adds the speech models stepaudio-2.5-asr, stepaudio-2.5-tts and step-tts-2.

## Balance and Step Plan windows

- **Balance.** : magpie reads `/v1/accounts` with the API key, in yuan on the China site and dollars on the international one.
- **Step Plan windows.** : the 5-hour and weekly windows and the month's credits are told only to a sign-in on StepFun's platform, not to a key. Sign in on the platform in your own browser, run magpie's bookmarklet on that page, and paste what it copies into magpie. magpie then renews the sign-in and reads the windows itself; it is kept in stepfun-auth.json beside providers.json, readable by you alone. Two providers on one site can be two accounts, each with its own windows.

## In each agent

- **Claude Code.** speaks Anthropic Messages. Both StepFun sites have Anthropic endpoints, so requests go as they are. See [Claude Code with other models](https://usemagpie.ai/docs/claude-code-models).
- **Codex.** speaks only OpenAI Responses. StepFun doesn't serve Responses, so magpie converts Codex's requests to Chat Completions, custom tools such as `apply_patch` included. The models show in Codex's `/model`. See [Codex with other models](https://usemagpie.ai/docs/codex-models).
- **Gemini CLI.** speaks Gemini's API; magpie points it at the local gateway and translates. See [Gemini CLI with other models](https://usemagpie.ai/docs/gemini-cli-models).
- **OpenCode.** : magpie writes the models into opencode.json. See [OpenCode with other models](https://usemagpie.ai/docs/opencode-models).

## FAQ

### How do I use the StepFun Step Plan in Claude Code?

Add StepFun or StepFun (China) in magpie with the key's plan set to Step Plan, then pick step-5-preview on Claude Code's row, or run magpie claude stepfun/step-5-preview. Requests go to https://api.stepfun.ai/step_plan (api.stepfun.com in China).

### Why is my Step Plan key refused at /v1?

A Step Plan key works only at the endpoints under step_plan; pay as you go's /v1 refuses it. Set the key's plan to Step Plan in magpie and requests go to /step_plan/v1.

### Does StepFun work in Codex?

Yes. StepFun has no Responses endpoint, so magpie converts Codex's requests to Chat Completions. Run magpie codex stepfun/step-3.7-flash.

### Can magpie show the Step Plan's 5-hour and weekly windows?

Yes, once the platform's sign-in is brought over: sign in on platform.stepfun.ai or .com in your browser, run magpie's bookmarklet and paste what it copies into magpie. The balance needs only the key.

The same for other providers: [Xiaomi MiMo](https://usemagpie.ai/docs/xiaomi-mimo), [Huawei Cloud MaaS](https://usemagpie.ai/docs/huaweicloud), [MiniMax](https://usemagpie.ai/docs/minimax), [GLM Coding Plan](https://usemagpie.ai/docs/glm), [Kimi](https://usemagpie.ai/docs/kimi), [DeepSeek](https://usemagpie.ai/docs/deepseek), [Qwen](https://usemagpie.ai/docs/qwen). Hit an error? See [troubleshooting](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/longcat

# Meituan LongCat in Claude Code and Codex

LongCat is Meituan's model platform, serving its own LongCat models at api.longcat.chat. Accounts from longcat.chat and longcat.ai share that host: Chat Completions and Responses under /openai/v1, Anthropic Messages under /anthropic. Add LongCat in magpie, and Claude Code's, Codex's, Gemini CLI's and OpenCode's requests go as they are, with magpie's local gateway on 127.0.0.1:3425 routing them and holding the key.

## Add LongCat

1. **Add the provider.** On Providers, click ＋ Add provider, pick LongCat, paste the key and save.
2. **Pick it for a tool.** On Agents, pick a model such as LongCat-2.0 on a tool's row.

Keys are made at longcat.chat/platform/api_keys.

```
magpie claude longcat/LongCat-2.0
magpie codex longcat/LongCat-2.0
magpie opencode longcat/LongCat-2.5-Preview
```

## Endpoints

| API | Endpoint |
| --- | --- |
| Chat Completions | `https://api.longcat.chat/openai/v1` |
| Responses | `https://api.longcat.chat/openai/v1` |
| Anthropic Messages | `https://api.longcat.chat/anthropic` |
| /models | `https://api.longcat.chat/openai/v1/models` |

Both take the key as `Authorization: Bearer`; with `x-api-key` alone LongCat answers missing_api_key, and magpie's Anthropic requests carry the key in both x-api-key and a Bearer by default, so they pass. An entry another app has at these endpoints is imported as LongCat.

## Models

magpie gives LongCat-2.0 and LongCat-2.5-Preview, then reads LongCat's list from `/openai/v1/models` and serves that. Model names are case-sensitive; write them as the list does.

## In each agent

- **Claude Code.** speaks Anthropic Messages. LongCat has an Anthropic endpoint, so requests go as they are. See [Claude Code with other models](https://usemagpie.ai/docs/claude-code-models).
- **Codex.** speaks only OpenAI Responses. LongCat serves Responses, so Codex's requests go as they are. The models show in Codex's `/model`. See [Codex with other models](https://usemagpie.ai/docs/codex-models).
- **Gemini CLI.** speaks Gemini's API; magpie points it at the local gateway and translates. See [Gemini CLI with other models](https://usemagpie.ai/docs/gemini-cli-models).
- **OpenCode.** : magpie writes the models into opencode.json. See [OpenCode with other models](https://usemagpie.ai/docs/opencode-models).

## FAQ

### How do I use LongCat in Claude Code?

Add LongCat in magpie with your longcat.chat platform key, then pick LongCat-2.0 on Claude Code's row, or run magpie claude longcat/LongCat-2.0. Requests go to https://api.longcat.chat/anthropic.

### Does LongCat work in Codex?

Yes. LongCat serves Responses under /openai/v1, so magpie passes Codex's requests through. Run magpie codex longcat/LongCat-2.0.

### Why does Claude Code get missing_api_key from LongCat directly?

LongCat takes the key only as Authorization: Bearer and refuses x-api-key alone. Through magpie, the key goes in both x-api-key and a Bearer by default.

### Does a longcat.ai account work?

Yes. longcat.chat and longcat.ai accounts share api.longcat.chat; add LongCat in magpie for either.

The same for other providers: [StepFun](https://usemagpie.ai/docs/stepfun), [Xiaomi MiMo](https://usemagpie.ai/docs/xiaomi-mimo), [DeepSeek](https://usemagpie.ai/docs/deepseek), [GLM Coding Plan](https://usemagpie.ai/docs/glm), [Kimi](https://usemagpie.ai/docs/kimi), [DeepSeek](https://usemagpie.ai/docs/deepseek), [Qwen](https://usemagpie.ai/docs/qwen). Hit an error? See [troubleshooting](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/qwen

# Qwen in Claude Code, Codex, Gemini CLI and OpenCode

Alibaba serves Qwen through DashScope, on Alibaba Cloud Model Studio, Bailian and Qwen Cloud, pay as you go or on a Token Plan. Every one of them speaks OpenAI Chat Completions and Anthropic Messages. Add your key to magpie once, and Claude Code, Codex, Gemini CLI, OpenCode and every other agent you connect can use Qwen through magpie’s gateway at `127.0.0.1:3425`.

## Add Qwen

1. **Get a key.** Pay as you go: [Model Studio](https://modelstudio.console.alibabacloud.com/?tab=playground#/api-key) (international) or [Bailian](https://bailian.console.aliyun.com/?tab=model#/api-key) (China). A Token Plan’s key comes from its own plan page.
2. **Add the provider.** In magpie’s Providers tab, press ＋ Add provider, pick the Qwen preset your key is from (the table below), paste the key and save. magpie asks the endpoint which models it serves.
3. **Pick it for an agent.** In the Agents tab, click the model on the agent’s row and choose a Qwen model such as `qwen3.8-max`.

```
magpie provider add qwen sk-…                     # Model Studio, international
magpie provider add qwen-cn sk-…                  # Bailian, China
magpie provider add bailian-token-plan sk-sp-…    # Bailian Token Plan
magpie provider add qwencloud sk-ws-… region=us-east-1
```

> **Each key works on its own host only.** A Token Plan key (`sk-sp-…`) is refused by pay-as-you-go endpoints and by the other Token Plans, and a Qwen Cloud key is refused outside its region. If a request comes back 401, check that the key sits under the preset it was made for.

## Plans and endpoints

| Preset | Plan and key | Endpoints (Chat Completions, Anthropic Messages) |
| --- | --- | --- |
| Qwen qwen | pay as you go, international (Model Studio) | `https://dashscope-intl.aliyuncs.com/compatible-mode/v1` `https://dashscope-intl.aliyuncs.com/apps/anthropic` |
| Qwen (China) qwen-cn | pay as you go, China (Bailian) | `https://dashscope.aliyuncs.com/compatible-mode/v1` `https://dashscope.aliyuncs.com/apps/anthropic` |
| Qwen Token Plan qwen-token-plan | subscription, `sk-sp-` | `https://token-plan.maas.qianwenaiapi.com/compatible-mode/v1` `https://token-plan.maas.qianwenaiapi.com/apps/anthropic` |
| Bailian Token Plan bailian-token-plan | subscription, `sk-sp-` | `https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1` `https://token-plan.cn-beijing.maas.aliyuncs.com/apps/anthropic` |
| Qwen Cloud qwencloud | pay as you go, `sk-ws-`, six regions, Singapore the default | `https://{region}.maas.qwencloudapi.com/compatible-mode/v1` `https://{region}.maas.qwencloudapi.com/apps/anthropic` |
| Qwen Cloud Token Plan qwencloud-token-plan | subscription, `sk-sp-`, Singapore | `https://token-plan.maas.qwencloudapi.com/compatible-mode/v1` `https://token-plan.maas.qwencloudapi.com/apps/anthropic` |

When a Token Plan’s host gives no model list, magpie offers the plan’s text models as its overview lists them: auto, qwen3.8-max, qwen3.8-flash, qwen3.7-max, qwen3.7-plus, qwen3.6-flash, and the DeepSeek and GLM models the plan includes. The Bailian Token Plan also serves a decision model that can classify turns for [intent routing](https://usemagpie.ai/docs/intent).

## In each agent

Pick the model on an agent’s row in the Agents tab, or from a terminal. Each guide says what magpie writes in that agent’s config and how to switch back.

```
magpie claude qwen/qwen3.8-max
magpie codex qwen/qwen3.8-max
magpie gemini model qwen/qwen3.7-plus
magpie opencode qwen/qwen3.8-max
```

- **Claude Code.** speaks Anthropic Messages, and so does Qwen’s Anthropic endpoint, so its requests are passed on as they are. Every tier (opus, sonnet, haiku) runs on the model you pick unless you give one its own. [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models).
- **Codex.** speaks only OpenAI Responses. DashScope serves Chat Completions and Anthropic Messages but not Responses, so magpie translates each request and the reply, streaming and tool calls included. The model shows in Codex’s `/model` with its reasoning efforts. [Models in Codex](https://usemagpie.ai/docs/codex-models).
- **Gemini CLI.** speaks Gemini’s API. magpie points it at its gateway and translates. [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models).
- **OpenCode.** gets the model in `opencode.json`, with its reasoning variants and cost. [Models in OpenCode](https://usemagpie.ai/docs/opencode-models).

Qwen Code is one of the agents magpie connects too: its row takes Qwen’s models or any other vendor’s.

## Thinking and images

- **Whole replies..** DashScope answers a thinking Qwen model only as a stream, and turns away a request for one whole reply. When an agent or a routing group’s classifier asks for one, magpie asks DashScope for a stream and gives the agent the whole reply, thinking included.
- **Models that always think..** Some models on DashScope refuse to have thinking turned off, such as its `glm-5.3`. When an agent asks for it off and the model refuses, magpie asks again with thinking left on.
- **Images..** The Qwen-Image and `wan2.7-image` models draw through DashScope’s own image API, on any of the six presets. Choose one in magpie’s Settings → Models → Images. Give a size as `WIDTHxHEIGHT`, at most 2048×2048.

## Balance and usage

magpie shows no balance or plan card for Qwen: DashScope has no API for a key’s balance, and neither Token Plan has one for its credits, which the plan’s subscription page in Alibaba’s console shows. The Usage tab counts tokens, cache hits and cost for each agent and model that went through magpie.

## FAQ

### How do I use Qwen in Claude Code?

Add your key in magpie (Providers, Add provider, then the Qwen preset your key is from), then pick a Qwen model such as `qwen3.8-max` on Claude Code’s row, or run `magpie claude qwen/qwen3.8-max`. magpie writes Claude Code’s `settings.json` and passes its requests to DashScope’s Anthropic endpoint.

### Can Codex use Qwen, Qwen3 Coder included?

Yes. magpie lists the models DashScope gives your key, coder models included, and Codex can use any of them: magpie translates Codex’s Responses requests to Chat Completions and the replies back. Pick the model on Codex’s row or run `magpie codex qwen/qwen3.8-max`; it shows in Codex’s `/model` list.

### Which preset do I pick for my key?

The one whose site the key is from. A Token Plan key (`sk-sp-…`) works only on its own plan’s host, and a Qwen Cloud pay-as-you-go key (`sk-ws-…`) only in its own region, so a key added to another preset is turned away with 401.

### Can Qwen Code use other models?

Yes. Qwen Code is one of the agents magpie connects, so its row in the Agents tab takes any model you have added, Qwen’s or another vendor’s.

### Why does a Qwen request without streaming work in magpie?

DashScope turns away a thinking Qwen model asked for one whole reply (`enable_thinking` must be false for non-streaming calls). magpie asks for it streamed and hands the agent the whole reply, thinking included.

### Does magpie show my Token Plan credits?

No. Neither Token Plan has an API for its credits; the plan’s subscription page in Alibaba’s console shows them. magpie’s Usage tab still counts the tokens each agent spent.

Every agent: [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Models in Codex](https://usemagpie.ai/docs/codex-models), [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models), [Models in OpenCode](https://usemagpie.ai/docs/opencode-models), [Qwen Code on any model](https://usemagpie.ai/docs/qwen-code). Ask on [Discord](https://discord.gg/vGSnD3ZKQF) if you get stuck.

---

Source: https://usemagpie.ai/docs/minimax

# MiniMax and the MiniMax Coding Plan in Claude Code, Codex, Gemini CLI and OpenCode

MiniMax serves an OpenAI-compatible Chat API and an Anthropic-compatible one, on a global site and a China site, for pay-as-you-go keys and Coding Plan keys alike. Add your key to magpie once, and Claude Code, Codex, Gemini CLI, OpenCode and every other agent you connect can use models such as `MiniMax-M3` and `MiniMax-M2.7` through magpie’s gateway at `127.0.0.1:3425`.

## Add MiniMax

1. **Get a key.** Create one at [platform.minimax.io](https://platform.minimax.io/user-center/basic-information/interface-key), or [platform.minimaxi.com](https://platform.minimaxi.com/user-center/basic-information/interface-key) for the China site. A Coding Plan key starts with `sk-cp-`.
2. **Add the provider.** In magpie’s Providers tab, press ＋ Add provider, pick MiniMax or MiniMax (China), paste the key and save. A pay-as-you-go key and a Coding Plan key go in the same way.
3. **Pick it for an agent.** In the Agents tab, click the model on the agent’s row and choose a MiniMax model.

```
magpie provider add minimax sk-…        # platform.minimax.io
magpie provider add minimax-cn sk-cp-…  # Coding Plan, platform.minimaxi.com
```

## Plans and endpoints

| Preset | Site | Chat Completions | Anthropic Messages |
| --- | --- | --- | --- |
| MiniMax minimax | platform.minimax.io | `https://api.minimax.io/v1` | `https://api.minimax.io/anthropic` |
| MiniMax (China) minimax-cn | platform.minimaxi.com | `https://api.minimaxi.com/v1` | `https://api.minimaxi.com/anthropic` |

The Coding Plan uses the same endpoints as pay as you go; the key decides which one a request is billed to. A global key and a China key are different accounts, so each goes under its own site’s preset.

## In each agent

Pick the model on an agent’s row in the Agents tab, or from a terminal. Each guide says what magpie writes in that agent’s config and how to switch back.

```
magpie claude minimax/MiniMax-M3
magpie codex minimax/MiniMax-M3
magpie gemini model minimax/MiniMax-M2.7
magpie opencode minimax/MiniMax-M3
```

- **Claude Code.** speaks Anthropic Messages, and so does MiniMax’s Anthropic endpoint, so its requests are passed on as they are. Every tier (opus, sonnet, haiku) runs on the model you pick unless you give one its own. [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models).
- **Codex.** speaks only OpenAI Responses. MiniMax serves Chat Completions and Anthropic Messages but not Responses, so magpie translates each request and the reply, streaming and tool calls included. The model shows in Codex’s `/model` with its reasoning efforts. [Models in Codex](https://usemagpie.ai/docs/codex-models).
- **Gemini CLI.** speaks Gemini’s API. magpie points it at its gateway and translates. [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models).
- **OpenCode.** gets the model in `opencode.json`, with its reasoning variants and cost. [Models in OpenCode](https://usemagpie.ai/docs/opencode-models).

MiniMax Code is one of the agents magpie connects too: its row takes MiniMax’s models or any other vendor’s.

## Thinking and effort

- **Interleaved thinking..** MiniMax’s Chat API gives a model’s thinking in the reply text, between `<think>` tags, and wants it back there on later turns. magpie hands it to the agent as thinking and puts it back where MiniMax expects it.
- **Effort..** `MiniMax-M3.1-Flash` and its preview think at levels from low to max. magpie sends the level an agent asks for in `output_config.effort`, as MiniMax Code does, so it isn’t lost to a token budget.
- **Models that always think..** `MiniMax-M3.1-Flash-Preview` refuses to have thinking turned off. When an agent asks for it off, magpie asks again with thinking left on, so the agent gets an answer rather than the error.

## Coding Plan windows and usage

- **Coding Plan windows..** A Coding Plan key’s row shows what is left of each window MiniMax reports, a rolling one and a weekly one, read from MiniMax. Models draw on the general bucket; a bucket metered apart, such as video, shows as a count, like 4 / 5. A pay-as-you-go key has no windows and no card.
- **Routing..** With several Coding Plan keys, magpie weighs them by their windows and rests one that has used a window up until it resets.
- **Usage..** The Usage tab counts tokens, cache hits and cost for each agent and model that went through magpie.

## FAQ

### How do I use MiniMax M2.7 or M3 in Claude Code?

Add your MiniMax key in magpie (Providers, Add provider, MiniMax or MiniMax (China)), then pick a model such as `MiniMax-M3` on Claude Code’s row, or run `magpie claude minimax/MiniMax-M3`. magpie writes Claude Code’s `settings.json` and passes its requests to MiniMax’s Anthropic endpoint, `https://api.minimax.io/anthropic`.

### How do I use the MiniMax Coding Plan?

Add the Coding Plan key (`sk-cp-…`) to the MiniMax preset of the site you bought it on, the same as a pay-as-you-go key. magpie tells the two apart by what MiniMax says about the key, and shows a Coding Plan key’s usage windows on its row.

### Can Codex use MiniMax?

Yes. MiniMax serves Chat Completions and Anthropic Messages but not Responses, so magpie translates Codex’s requests and MiniMax’s replies. Pick the model on Codex’s row or run `magpie codex minimax/MiniMax-M3`; it shows in Codex’s `/model` list.

### Can MiniMax Code use other models?

Yes. MiniMax Code is one of the agents magpie connects, so its row in the Agents tab takes any model you have added, MiniMax’s or another vendor’s.

### Why does MiniMax’s thinking show up in the text?

MiniMax’s Chat API puts a model’s thinking in the reply text between `<think>` tags. magpie takes it out and gives it to the agent as thinking, then puts it back on the next turns, where MiniMax wants it.

### Can I use several MiniMax keys?

Yes. Add them all to the MiniMax provider and tick each one. magpie spreads requests over them, and weighs and rests Coding Plan keys by their windows, so a key that has used up its window sits out until it resets.

Every agent: [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Models in Codex](https://usemagpie.ai/docs/codex-models), [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models), [Models in OpenCode](https://usemagpie.ai/docs/opencode-models). Ask on [Discord](https://discord.gg/vGSnD3ZKQF) if you get stuck.

---

Source: https://usemagpie.ai/docs/openrouter

# OpenRouter in Claude Code, Codex, Gemini CLI and OpenCode

OpenRouter sells many vendors’ models behind one key and serves them on OpenAI Chat Completions and Anthropic Messages. Add the key to magpie once, and Claude Code, Codex, Gemini CLI, OpenCode and every other agent you connect can use any OpenRouter model through magpie’s gateway at `127.0.0.1:3425`, each agent on a model of its own.

## Add OpenRouter

1. **Get a key.** Make one on [openrouter.ai/keys](https://openrouter.ai/keys).
2. **Add the provider.** In magpie’s Providers tab, press ＋ Add provider, pick OpenRouter, paste the key and save. magpie asks OpenRouter which models it serves.
3. **Pick it for an agent.** In the Agents tab, click the model on the agent’s row and choose an OpenRouter model such as `anthropic/claude-opus-5.5`.

```
magpie provider add openrouter sk-…
magpie provider test openrouter
```

Model ids in magpie are `provider/model`, so OpenRouter’s read `openrouter/anthropic/claude-opus-5.5`: the provider, then OpenRouter’s own id. The key is kept in magpie’s settings; magpie doesn’t take it from your shell.

OpenRouter documents two optional headers that credit an app in its rankings, `HTTP-Referer` and `X-OpenRouter-Title`. magpie doesn’t send them. The provider editor’s Headers field offers them if you want your requests credited.

## Endpoints

| API | Base URL | Used for |
| --- | --- | --- |
| Chat Completions | `https://openrouter.ai/api/v1` | the model list, requests to non-Claude models, image models |
| Anthropic Messages | `https://openrouter.ai/api` | Claude Code’s requests, and Claude models from any agent |
| Decisions | `https://openrouter.ai/api/v1` | decision models for [intent routing](https://usemagpie.ai/docs/intent) |

magpie doesn’t use OpenRouter’s Responses API. An agent that speaks Responses, such as Codex, is translated to one of the two above.

## Model list

- **Where it comes from..** magpie fetches the list from `https://openrouter.ai/api/v1/models`, which gives each model’s context length. Names, reasoning levels and prices come from the `openrouter` catalog on models.dev.
- **Which models agents see..** OpenRouter lists hundreds. Unless you pick some, magpie shows agents the first 24 OpenRouter lists, newest first. Pick the rest in the provider’s model list, or turn on Best in family to keep only the newest of each family.
- **New models..** `auto-include` rules expose matching models now and each one a later fetch lists for the first time, and `refresh-every` has magpie fetch the list again by itself.
- **Image models..** OpenRouter’s `/models` lists text models only, so magpie reads image models such as FLUX, Seedream, Riverflow, Recraft and GPT Image, and their free variants, from `/api/v1/models?output_modalities=image`. Choose one in Settings → Models → Images.
- **Decision models..** OpenRouter’s decision models (`liquid/d1`, `cloudflare/clef`, `~typesafe/jev-latest`…) are listed too, so a routing group can classify turns with the same key.

```
magpie provider models openrouter +anthropic/claude-opus-5.5   # expose one more
magpie provider models openrouter best                          # newest of each family
magpie provider auto-include openrouter '*:free'               # every free model, now and later
magpie provider refresh-every openrouter 1d
```

## In each agent

Pick the model on an agent’s row in the Agents tab, or from a terminal. Each guide says what magpie writes in that agent’s config and how to switch back.

```
magpie claude openrouter/anthropic/claude-opus-5.5
magpie codex openrouter/anthropic/claude-opus-5.5
magpie gemini model openrouter/google/gemini-3-pro
magpie opencode openrouter/anthropic/claude-opus-5.5
```

- **Claude Code.** speaks Anthropic Messages, and so does OpenRouter at `https://openrouter.ai/api`, so its requests are passed on as they are. [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models).
- **Codex.** speaks only OpenAI Responses. magpie translates each request and the reply, streaming and tool calls included: a Claude model goes to OpenRouter’s Anthropic endpoint, every other model to Chat Completions. [Models in Codex](https://usemagpie.ai/docs/codex-models).
- **Gemini CLI.** speaks Gemini’s API. magpie translates it the same way as Codex’s requests. [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models).
- **OpenCode.** speaks Chat Completions, so its requests go to OpenRouter as they are, except for Claude models, which magpie sends to the Anthropic endpoint for their prompt cache (see below). [Models in OpenCode](https://usemagpie.ai/docs/opencode-models).

If OpenRouter says a model isn’t served on the endpoint magpie chose, magpie builds the request again for the other one and remembers that for the model.

## Reasoning

- **Models that always reason..** Some OpenRouter models refuse to have reasoning turned off (“reasoning is mandatory for this endpoint and cannot be disabled”). When an agent asks for it off, magpie asks again with the level left to the model, on Chat Completions and on Messages alike.
- **Effort mid-conversation..** Claude Code sends a turn’s effort inside the conversation. OpenRouter’s Anthropic endpoint refuses that on some models, such as DeepSeek and GLM. magpie asks again at once without it, and doesn’t send it to OpenRouter again until magpie restarts.
- **Earlier thinking..** OpenRouter’s Anthropic endpoint turns away a thinking block without a signature, so magpie always sends one. On Chat Completions, earlier reasoning that an agent sends back in OpenRouter’s `reasoning` or `reasoning_details` fields is read as the model’s thinking.

## Cache, cost and credits

- **Claude’s prompt cache..** On Chat Completions, a relay that serves both APIs drops `cache_control`, and every turn is billed uncached. So magpie asks Claude models on OpenRouter’s Messages endpoint, from any agent, with the cache breakpoints the translation adds.
- **Cache tokens..** magpie reads cache reads and OpenRouter’s `cache_write_tokens` from each reply, so the Usage tab counts cache hits and writes apart from the rest.
- **Cost..** The Usage tab prices each call with OpenRouter’s prices from models.dev, or the model maker’s list price when the catalog has none. A model listed at $0, such as one ending in `:free`, shows free beside it in magpie’s pickers.
- **Which provider answered..** OpenRouter names the provider that served each reply. magpie keeps it, and the call’s details in the Usage tab show it as Upstream provider.
- **Credits..** The OpenRouter row shows what is left on the account, in dollars: total credits less total usage, read from `/api/v1/credits`. It’s the whole account’s figure, so each key of one account shows the same.

## Several keys and free models

One OpenRouter provider can hold several keys: press Add another key under it, or paste several at once. Requests go to the first key that’s on, and when it runs out or is rate limited the next one takes over. The provider’s routing can also rotate, weight or drain them instead. Adding the preset again makes a second OpenRouter provider; to spread requests over several keys, add them all to the one provider.

- **Spend caps..** `spend-cap` stops a key at a dollar amount a day, a month or in all, as the Usage tab prices its calls; routing then goes on to the other keys and the fallbacks.
- **Fallbacks..** `fallback` names where requests go when OpenRouter is out of quota or down: another provider’s model or a routing group.
- **Free models..** OpenRouter’s free models take 20 requests a minute. `rpm` holds each key to a rate: one request more waits for room, up to 2 minutes, then gets a 429 with a `Retry-After`.
- **Free-model 429s..** When a free model is refused by the shared pool of the provider serving it, magpie rests that model only and keeps the other free models in use. Any other 429 on a free model is OpenRouter’s account-wide free limit, and the key rests.
- **A pool of free models..** A routing group can take every free model OpenRouter lists with the pattern `openrouter/*:free`, today’s and those it lists later.

```
magpie provider rpm openrouter 20
magpie provider spend-cap openrouter <key> 20 month
magpie provider fallback openrouter deepseek/deepseek-v4-pro
magpie group add my-free-pool models='openrouter/*:free' routing=order
magpie group set opus-anywhere stays=session models+=openrouter/anthropic/claude-opus-5.5
```

## Troubleshooting

- **The model list has only `anthropic/` ids, or fails to load..** A provider given only `https://openrouter.ai/api` gets OpenRouter’s catalog under `anthropic/` names it doesn’t serve. Give it the Chat Completions base, `https://openrouter.ai/api/v1`, or use the OpenRouter preset, which has both.
- **“Mid-conversation reasoning effort (configuration_update) is not supported”..** OpenRouter says this about Claude Code’s per-turn effort on models such as DeepSeek and GLM. magpie asks again at once without the effort, so the agent gets its answer, and stops sending it to OpenRouter until magpie restarts.
- **402 with “can only afford” or “fewer max_tokens”..** OpenRouter refused the request’s size or its in-flight budget, not because the balance is spent. magpie rests the key for half an hour and tries it again then; unlike a key out of credit, its rest doesn’t grow with each refusal.
- **Web search asks a model you didn’t pick..** It doesn’t: when OpenRouter answers magpie’s web search, magpie asks one of the OpenRouter models you have picked, since OpenRouter can refuse others for your region. For that search magpie turns on OpenRouter’s own `web` plugin, which works with any of its models.
- **Checking a key..** `magpie provider test openrouter` sends a tiny request through each endpoint, or to each model you name. Add `--as codex` or `--as claude-code` to send it the way that agent would.

[Vercel AI Gateway in Claude Code, Codex and other agents](https://usemagpie.ai/docs/vercel)

[API relays in Claude Code, Codex and other agents](https://usemagpie.ai/docs/relay)

## FAQ

### How do I use OpenRouter in Claude Code?

Add your OpenRouter key in magpie (Providers, Add provider, OpenRouter), then pick a model such as `anthropic/claude-opus-5.5` on Claude Code’s row, or run `magpie claude openrouter/anthropic/claude-opus-5.5`. magpie writes Claude Code’s `settings.json` and passes its requests on to OpenRouter’s Anthropic endpoint as they are.

### Can Codex use OpenRouter models?

Yes. Codex speaks only the Responses API, which magpie doesn’t use at OpenRouter. magpie translates each Codex request: a Claude model goes to OpenRouter’s Anthropic endpoint and every other model to Chat Completions, and the reply comes back to Codex as Responses.

### Can Gemini CLI and OpenCode use OpenRouter?

Yes. Gemini CLI’s requests are translated the same way as Codex’s. OpenCode speaks Chat Completions, so its requests go to OpenRouter as they are, except for Claude models, which magpie sends to the Anthropic endpoint so the prompt cache works.

### How do I use only OpenRouter’s free models?

Make a routing group from the pattern `openrouter/*:free`, for example `magpie group add my-free-pool models='openrouter/*:free' routing=order`. It takes every free model OpenRouter lists, including ones it lists later. Models priced at $0 show free in magpie’s pickers.

### Why do OpenRouter’s free models answer 429?

OpenRouter’s free models take 20 requests a minute. Set `magpie provider rpm openrouter 20` and magpie holds requests back to that rate. When the 429 comes from the shared pool of the provider serving one free model, magpie rests only that model and keeps the other free models in use.

### Does magpie show my OpenRouter credits?

Yes. magpie reads OpenRouter’s credits endpoint and shows what is left in dollars: total credits less total usage. The figure is for the whole account, so every key of one account shows the same.

### Why does magpie fetch OpenRouter’s model list from /api/v1?

Asked at the Anthropic base, OpenRouter answers with its catalog under `anthropic/` names it doesn’t serve. magpie fetches the list from the Chat Completions base, `https://openrouter.ai/api/v1`, and a provider given only OpenRouter’s Anthropic base is told to add that Chat base.

**By provider:** [DeepSeek](https://usemagpie.ai/docs/deepseek) · [Kimi and Kimi Code](https://usemagpie.ai/docs/kimi) · [GLM Coding Plan](https://usemagpie.ai/docs/glm) · [Volcengine Ark](https://usemagpie.ai/docs/volcengine) · [Tencent Cloud](https://usemagpie.ai/docs/tencent-cloud) · [Baidu Qianfan](https://usemagpie.ai/docs/baidu-qianfan) · [SiliconFlow](https://usemagpie.ai/docs/siliconflow) · [ModelScope](https://usemagpie.ai/docs/modelscope) · [Huawei Cloud MaaS](https://usemagpie.ai/docs/huaweicloud) · [Xiaomi MiMo](https://usemagpie.ai/docs/xiaomi-mimo) · [StepFun](https://usemagpie.ai/docs/stepfun) · [LongCat](https://usemagpie.ai/docs/longcat) · [Qwen](https://usemagpie.ai/docs/qwen) · [MiniMax](https://usemagpie.ai/docs/minimax) · [Anthropic](https://usemagpie.ai/docs/anthropic) · [OpenAI](https://usemagpie.ai/docs/openai) · [Gemini](https://usemagpie.ai/docs/gemini) · [Grok](https://usemagpie.ai/docs/grok) · [Mistral](https://usemagpie.ai/docs/mistral) · [GitHub Copilot](https://usemagpie.ai/docs/copilot) · [Ollama](https://usemagpie.ai/docs/ollama)

Every agent: [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Models in Codex](https://usemagpie.ai/docs/codex-models), [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models), [Models in OpenCode](https://usemagpie.ai/docs/opencode-models). Ask on [Discord](https://discord.gg/vGSnD3ZKQF) if you get stuck.

---

Source: https://usemagpie.ai/docs/copilot

# GitHub Copilot in Claude Code, Codex, Gemini CLI and OpenCode

A Copilot seat comes with Claude, GPT and Gemini models, among others. Sign in to Copilot once in magpie, and Claude Code, Codex, Gemini CLI, OpenCode and every other agent you connect can use the models your plan gets, through magpie’s gateway at `127.0.0.1:3425`. No API key.

## Sign in to Copilot

1. **Open Add provider.** In magpie’s Providers tab, press ＋ Add provider and click the Copilot tile.
2. **Enter the code on GitHub.** magpie shows a code and opens GitHub’s device page, `github.com/login/device`. Enter the code and approve. magpie then asks GitHub whose account it is and which plan it has, and the account shows under Copilot.
3. **Pick a model for an agent.** In the Agents tab, click the model on the agent’s row and choose a `copilot/…` model.

```
magpie accounts add copilot                        # github.com
magpie accounts add copilot --host acme.ghe.com    # GitHub Enterprise on GHE.com
magpie accounts copilot                            # each account and what it has used
```

magpie serves a Copilot sign-in from three places:

- **Copilot’s editor plugins..** The sign-in they keep in `~/.config/github-copilot` (`apps.json` or `hosts.json`).
- **The Copilot CLI..** Its sign-in in `~/.copilot/config.json`, with the token in the system keychain or in that file. magpie on Windows also reads the Copilot CLI sign-in of a running WSL distro, from `config.json` only.
- **magpie’s own..** Each account you sign in with a code in magpie. Its token is kept in magpie’s own `logins.json`.

The editors’ and the CLI’s sign-ins are only read; magpie never writes them. When both are there, the editors’ github.com sign-in comes first, then the CLI’s, then an editor’s GHE.com sign-in. If GitHub turns away the editors’ token, magpie uses the CLI’s sign-in of the same account instead, never another account’s.

> **GitHub Enterprise on GHE.com.** An enterprise with data residency signs in at its own `<name>.ghe.com`, so add the account with `--host` (or answer the GHE.com question in the sign-in sheet). magpie accepts github.com or a `<name>.ghe.com` address and nothing else, so a GitHub token is never sent to a host of your choosing. The account is served at its enterprise’s `copilot-api.<name>.ghe.com`. One login on github.com and on GHE.com is two accounts: `you` and `you@acme.ghe.com`.

## The models your seat gets

magpie asks Copilot’s `/models` for each account and lists what comes back, so the list follows your plan rather than a fixed table. The models are named `copilot/` and Copilot’s own id: `copilot/claude-opus-5.5`, `copilot/gpt-5.4`, `copilot/gpt-5.3-codex`. `magpie models` prints them all.

- **Chat models only..** Copilot’s internal models and the ones no model picker offers are left out, and so is a model the account isn’t allowed to turn on.
- **Terms to accept..** A model whose terms are still waiting is listed anyway. The first request for it accepts them, as turning it on in Copilot’s editor would.
- **Reasoning efforts.** come from what Copilot lists for each model, and show in each agent’s picker.
- **Auto.** is always on the list; see Copilot Auto.
- **Image models.** such as GPT Image 2.5 Flare are listed for drawing (Settings → Models → Images), and are never offered as a chat model.
- **Older models..** A model for which Copilot names no API, such as GPT-4.1 and GPT-4o on a Student plan, is asked on Chat Completions only.

Claude Code reads a Claude version written with a dot as an older model, so magpie gives it Copilot’s Claude models with dashes (`claude-opus-5-5`) and turns the name back before the request reaches Copilot. Other agents see Copilot’s own spelling.

## In each agent

Pick the model on an agent’s row in the Agents tab, or from a terminal. Each guide says what magpie writes in that agent’s config and how to switch back.

```
magpie claude copilot/claude-opus-5.5
magpie codex copilot/gpt-5.4
magpie gemini model copilot/gpt-5.4-mini
magpie opencode copilot/claude-opus-5.5
```

- **Claude Code.** speaks Anthropic Messages. Copilot serves its Claude models on Messages too, so Claude Code’s requests go to them as they are; a GPT or Gemini model gets them translated. [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models).
- **Codex.** speaks only OpenAI Responses, and magpie asks Copilot’s OpenAI models on Responses, so they pass through. Codex’s web search runs on Copilot’s side for those models, and Codex’s native compaction works with them too, but not with Copilot’s Claude models. [Models in Codex](https://usemagpie.ai/docs/codex-models).
- **Gemini CLI.** speaks Gemini’s API. magpie points it at its gateway and translates. [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models).
- **OpenCode.** gets the model in `opencode.json`, with its reasoning variants. [Models in OpenCode](https://usemagpie.ai/docs/opencode-models).

The Copilot CLI is one of the agents magpie connects, too. Its row offers `auto` (Copilot picks) and Copilot’s own models, plus every other model you have added to magpie, which reach it through the Copilot CLI’s `providers.json`.

## How requests reach Copilot

Copilot doesn’t serve every model on every API. Its newest OpenAI models answer only on Responses; its Claude models on Chat Completions and Anthropic Messages; its Gemini models and the older ones on Chat Completions only. magpie sends each request on an API the model is served on, and translates between that API and the agent’s when they differ, streaming and tool calls included.

- **Wrong API..** When Copilot answers that a model isn’t served on the API it was asked on, magpie rebuilds the request for the next one and remembers which one worked.
- **Pin one yourself..** `magpie model api copilot/<model> chat` (or `responses`, `anthropic`) asks the model on that API only; `auto` hands the choice back to magpie.
- **Tool schemas for Gemini..** Copilot turned some of Codex’s tool schemas away for its Gemini models with 400 “invalid request body”. magpie rewrites the ones it can prove safe to rewrite, so those tools reach the model.

## Copilot Auto

`copilot/auto` is the model Copilot chooses for your account. It isn’t in Copilot’s `/models`, so magpie always adds it. On a Student plan it is the only model you may choose.

- magpie asks Copilot for a pick with the turn’s prompt, at Copilot Chat’s default setting, and keeps a pick for at most an hour.
- If Copilot has no Auto for the account, or picks a model the account was refused, a model the account may pick by hand stands in for 10 minutes: Copilot’s base model, its default, `gpt-4.1`, a model that isn’t premium, then the rest.
- If Copilot then refuses the model Auto picked, magpie picks another and sends the request again.
- The model Auto chose is noted on the request’s route, so you can see what answered.

## Premium requests, usage and cost

Each Copilot account has a card with three allowances, as GitHub reports them: Premium requests, Chat requests and Completions, each as used / allowance. `magpie accounts copilot` prints the same.

- **Monthly..** The allowances renew each month, on the date GitHub gives.
- **Unlimited.** shows as Unlimited. A window GitHub gives no figure for is left off the card, never shown as unlimited.
- **One request a turn..** A turn you type is billed as one request; the tool replies that carry it on are not.
- **Business and Enterprise..** A seat that uses up its allowance is paused, so magpie counts the account as used up and moves on to the next one. An organization’s pooled premium allowance shows as used up once the pool is spent.
- **Other plans..** When your plan lets you pay past the premium allowance, using it up doesn’t stop the account. Completions are counted too, but no request through magpie uses them.
- **No allowance..** Copilot’s base model, `gpt-4.1`, is billed to no allowance on any plan.

The Usage tab counts tokens, cache hits and cost for each agent and model that went through magpie. Cost on a subscription is an estimate at the model maker’s list price, or at the price you set for the model. One difference from Anthropic’s own pricing: Copilot bills a cache write at one price however long it is kept, so magpie prices a 1-hour write at the 5-minute rate. For `claude-opus-5.5` that is $5 per million tokens, where Anthropic’s 2× input would be $8.

## Several accounts and failover

- **Add another..** Click the Copilot tile again, or run `magpie accounts add copilot` again. The one in use is listed first, then the rest in the order you added them.
- **Choose which goes first..** `magpie accounts switch copilot <login>`; `magpie accounts forget copilot <login>` removes one. With the same login on github.com and GHE.com, name it in full (`you@acme.ghe.com`) or add `--host`.
- **Spread requests..** Tick the accounts to use on Copilot’s row. Routing sets how requests spread over them, Smart by default; the provider’s Fallback lists models to use when every account is out, rate limited or down. See [Subscriptions in any agent](https://usemagpie.ai/docs/subscriptions#accounts).
- **One model from two subscriptions..** Claude Opus from your Claude subscription and from Copilot become one group by themselves, `auto/<model>`. To set the order yourself: `magpie group add "Opus anywhere" models=claude/claude-opus-5-5,copilot/claude-opus-5.5 routing=order`.
- **A stale editor sign-in..** When GitHub refuses the token Copilot’s editors keep, an account you signed in to magpie with the same login is kept and used.

## Troubleshooting

| What you see | What it means |
| --- | --- |
| GitHub refused this Copilot sign-in; sign in again | GitHub turned the account’s token away. Sign in again from its row: the account is signed in again in place, and its settings stay. A network error or a 5xx from GitHub never marks an account, and the mark goes when a request is served. |
| the GitHub token Copilot’s editors keep in … was refused | The editors’ sign-in has lapsed. Sign in to Copilot again in your editor or in magpie, or move that file aside. |
| <login> has no Copilot subscription | The GitHub account you approved has no Copilot plan. Sign in with the account that has the seat. |
| Copilot doesn’t serve this model on Anthropic’s Messages API; it isn’t about your plan | Copilot serves that model on other APIs only. `magpie model api copilot/<model> chat` sends it on Chat Completions. |
| The requested model is not supported. | Copilot won’t serve that model to this account now. magpie leaves it out of the account’s models and the agents’ pickers for 6 hours, then tries it again. Under Auto, another model is picked and the request is sent again. |
| Copilot doesn’t offer Auto to this account … | Copilot made no pick and the account lists no model it may pick by hand. Check the plan at `github.com/settings/copilot`. |
| the code expired; start again · the sign-in was declined on GitHub | The device code ran out before it was entered, or the request was declined on GitHub’s page. Start the sign-in again. |
| Copilot signs in on github.com or an enterprise’s <name>.ghe.com, not … | The `--host` given isn’t github.com or a GHE.com address. |
| subscription accounts are off in magpie | Settings → Privacy → Subscription accounts is off (or `magpie accounts discovery off` was run), so magpie reads no sign-in and serves no subscription, Copilot included. Turn it on, or run `magpie accounts discovery on`. |

## FAQ

### How do I use GitHub Copilot in Claude Code?

Sign in to Copilot in magpie (Providers, Add provider, Copilot; GitHub gives you a code to enter), then pick a `copilot/…` model such as `copilot/claude-opus-5.5` on Claude Code’s row, or run `magpie claude copilot/claude-opus-5.5`. magpie writes Claude Code’s `settings.json`. Copilot’s Claude models get Claude Code’s Anthropic requests as they are; its GPT and Gemini models get them translated.

### Can Codex use Copilot’s models?

Yes. Codex speaks OpenAI Responses, and magpie asks Copilot’s OpenAI models on Responses too, so they pass through, web search included. Copilot’s Claude and Gemini models are translated. Pick one on Codex’s row or run `magpie codex copilot/gpt-5.4`; it shows in Codex’s `/model` list.

### Can I use Copilot in Gemini CLI and OpenCode?

Yes. Run `magpie gemini model copilot/gpt-5.4-mini` or `magpie opencode copilot/claude-opus-5.5`, or pick the model on the agent’s row. magpie translates Gemini CLI’s requests, and writes the model into OpenCode’s `opencode.json`.

### Do I need VS Code or another editor signed in to Copilot?

No. magpie signs in to GitHub itself with a device code. If Copilot’s editor plugins or the Copilot CLI are already signed in on this computer, magpie reads that sign-in too, and never changes it.

### Does it spend my premium requests?

Requests go to Copilot on your account, so they count against your plan as Copilot counts them. A turn you type is billed as one request; the tool replies that carry it on are not. magpie shows each account’s Premium requests, Chat requests and Completions as used out of the allowance.

### Does it work with Copilot Business, Enterprise and GHE.com?

Yes. magpie reads the plan from GitHub: Free, Pro, Pro+, Max, Education, Business or Enterprise. An enterprise on GHE.com signs in with `magpie accounts add copilot --host <name>.ghe.com`. A Business or Enterprise seat that uses up its allowance is paused, and magpie counts the account as used up until it renews.

### Why is a Copilot model missing from my list?

magpie lists what Copilot’s `/models` gives the account: chat models only, without the ones no model picker offers or the account can’t turn on. A model Copilot answered with “The requested model is not supported.” is left out for 6 hours, then tried again in case your plan changed.

**By provider:** [DeepSeek](https://usemagpie.ai/docs/deepseek) · [Kimi and Kimi Code](https://usemagpie.ai/docs/kimi) · [GLM Coding Plan](https://usemagpie.ai/docs/glm) · [Qwen](https://usemagpie.ai/docs/qwen) · [MiniMax](https://usemagpie.ai/docs/minimax) · [Anthropic](https://usemagpie.ai/docs/anthropic) · [OpenAI](https://usemagpie.ai/docs/openai) · [Gemini](https://usemagpie.ai/docs/gemini) · [Grok](https://usemagpie.ai/docs/grok) · [Mistral](https://usemagpie.ai/docs/mistral) · [OpenRouter](https://usemagpie.ai/docs/openrouter) · [Ollama](https://usemagpie.ai/docs/ollama)

Every agent: [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Models in Codex](https://usemagpie.ai/docs/codex-models), [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models), [Models in OpenCode](https://usemagpie.ai/docs/opencode-models), [Copilot CLI on any model](https://usemagpie.ai/docs/copilot-cli). Ask on [Discord](https://discord.gg/vGSnD3ZKQF) if you get stuck.

---

Source: https://usemagpie.ai/docs/gemini

# Gemini in Claude Code, Codex, Gemini CLI and OpenCode

Google serves Gemini on the Gemini Developer API, the one an AI Studio key opens, and on Vertex AI in your own Google Cloud project. Add either to magpie once, and Claude Code, Codex, Gemini CLI, OpenCode and every other agent you connect can use Gemini 3 models such as `gemini-3.1-pro-preview` through magpie’s gateway at `127.0.0.1:3425`, each agent on a model of its own.

## Add a Gemini API key

1. **Get a key.** Make one on [aistudio.google.com/apikey](https://aistudio.google.com/apikey).
2. **Add the provider.** In magpie’s Providers tab, press ＋ Add provider, pick Google Gemini, paste the key and save. magpie asks Google which models it serves.
3. **Pick it for an agent.** In the Agents tab, click the model on the agent’s row and choose a Gemini model such as `gemini-3.1-pro-preview`.

```
magpie provider add google AIza…
magpie provider test google
```

Model ids in magpie are `provider/model`, so the Gemini API’s read `google/gemini-3.1-pro-preview`: the provider, then Google’s own id. The key is kept in magpie’s settings; magpie doesn’t take it from your shell.

## Endpoints

| API | Base URL | Used for |
| --- | --- | --- |
| Chat Completions (OpenAI-compatible) | `https://generativelanguage.googleapis.com/v1beta/openai` | the model list, and requests from Claude Code, Codex, OpenCode and other agents |
| Gemini API | `https://generativelanguage.googleapis.com/v1beta` | Gemini CLI’s requests, Google Search, image models |

The preset fills in the Gemini API URL once. If you clear it, it stays empty. Every request that doesn’t come from a Gemini client goes to Chat Completions.

## Model list

- **Where it comes from..** magpie asks the OpenAI-compatible endpoint for the list once. It is the Gemini API’s list too, so magpie doesn’t ask twice. Names, reasoning levels and prices come from the `google` catalog on models.dev.
- **Image models..** At Google, a Gemini image model draws on the Gemini API. Choose one in Settings → Models → Images.

## In each agent

Pick the model on an agent’s row in the Agents tab, or from a terminal. Each guide says what magpie writes in that agent’s config and how to switch back.

```
magpie claude google/gemini-3.1-pro-preview
magpie codex google/gemini-3.1-pro-preview
magpie gemini model google/gemini-3.8-flash
magpie opencode google/gemini-3.1-pro-preview
```

- **Claude Code.** speaks Anthropic Messages. magpie translates each request to Gemini’s Chat Completions and the reply back to Messages, streaming and tool calls included. [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models).
- **Codex.** speaks only OpenAI Responses. magpie translates it to Chat Completions the same way, and the reply comes back to Codex as Responses. [Models in Codex](https://usemagpie.ai/docs/codex-models).
- **Gemini CLI.** speaks Gemini’s own API, so its requests go to the Gemini API as it sends them, and its Google Search runs there. [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models).
- **OpenCode.** speaks Chat Completions, so its requests go to Google as they are. [Models in OpenCode](https://usemagpie.ai/docs/opencode-models).

## Thinking

- **Visible thoughts..** Gemini’s OpenAI-compatible API gives the model’s thoughts only when asked in `thinking_config`. When an agent asks for visible reasoning, magpie asks for the thoughts with `include_thoughts`, so a long think shows as thinking instead of a first word that comes late.
- **Levels and budgets..** Gemini 3 and later are sent a thinking level. Gemini 2 models are sent a budget instead: 1024 tokens for minimal and low, 8192 for medium and 24576 for high. xhigh and max are sent as high, and an effort with no level is left to the model.
- **Reasoning off..** Gemini 3 can’t stop thinking. When an agent turns reasoning off, magpie asks for the model’s lowest level instead.
- **A level the model doesn’t have..** Not every Gemini 3 has every level: `gemini-3.8-flash` has no minimal. When Google turns a level away with a 400, magpie asks again at the nearest level the model has and remembers it until magpie restarts.
- **`thinking_config` turned away..** That is a different 400: a server in front of Gemini that refuses the field itself. magpie asks again with `reasoning_effort` alone and stops sending `thinking_config` there.
- **Proxies..** A Gemini model behind a proxy on this computer or your network, such as one on `localhost` or a private address, is handled the same way.

## Thought signatures and tools

- **Thought signatures..** Gemini 3 signs the first function call of each step, and the next request fails with 400 “Function call is missing a thought_signature in functionCall parts” if the signature is gone. Agents don’t keep it. magpie carries it in the call id the agent gets, as a short reference to a file in magpie’s folder, and puts it back on the way to Gemini. Signatures are kept for 90 days.
- **Calls Gemini didn’t sign..** A call from another model earlier in the conversation, or one whose id an agent shortened, goes with Google’s documented `skip_thought_signature_validator`, so a conversation can move to Gemini halfway.
- **One provider’s signature..** A signature goes back only to the provider that gave it. In a routing group of Vertex AI and the Gemini API, the other provider gets the call as unsigned history instead of answering “Corrupted thought signature”.
- **Tool schemas..** magpie gives each untyped schema in an agent’s tools a type, which Vertex AI needs, and removes boolean schemas and `x-` keywords such as MCP’s `x-mcp-header`. Tools that need none of this go as they came.
- **The end of a stream..** Gemini’s OpenAI-compatible API sends a whole function call in one chunk and its `finish_reason` in the next. If that reason is lost after the usage arrived, magpie fills it in; without the usage, the reply is reported as cut off rather than passed on as complete.

## Cache, cost and search

- **Prompt cache..** Gemini keeps a prompt cached without saying so on that turn. magpie counts such a turn as a cache write and keeps the next turn on the same provider and key, and remembers which one answered across restarts.
- **Cached and thinking tokens..** magpie reads cached tokens and reasoning tokens from each reply, on Chat Completions and on the Gemini API alike, and the Usage tab counts them.
- **Cost..** The Usage tab prices each call from the `google` catalog on models.dev.
- **Web search..** Gemini runs Google Search on the Gemini API only for a request that declares no function tools. Claude Code’s and Codex’s requests declare tools, so their web search is magpie’s own, which the Google provider answers itself on your key: those searches spend your Gemini API credit.

## Several keys and rate limits

One Google Gemini provider can hold several keys: press Add another key under it, or paste several at once. Requests go to the first key that’s on, and when it runs out or is rate limited the next one takes over. The provider’s routing can also rotate, weight or drain them instead.

- **Per-minute 429s..** Gemini’s 429 “You exceeded your current quota … Please retry in 33s” for a per-minute limit is read as a rate limit, not a used-up plan, and so is Vertex AI’s `requests_per_minute_per_project`. The key rests from a minute, doubling, up to `rest-cap`.
- **Holding to a rate..** `rpm` holds each key to a number of requests a minute: one request more waits for room, up to 2 minutes, then gets a 429.
- **Out of quota..** `quota-rest` sets how long a key rests once its quota is spent: 15 minutes by default, up to 8 days, or until a time of day.
- **Spend caps and fallbacks..** `spend-cap` stops a key at a dollar amount a day, a month or in all, and `fallback` names where requests go when Gemini is out of quota or down.

```
magpie provider rpm google 10
magpie provider spend-cap google <key> 20 month
magpie provider fallback google google-vertex/gemini-3.1-pro-preview
```

## Vertex AI

The Google Vertex AI preset asks Gemini in your Google Cloud project, with no API key. Give it the project’s id; the project in each request is the one billed.

```
gcloud auth application-default login
magpie provider add google-vertex project=my-project
magpie claude google-vertex/gemini-3.1-pro-preview
```

- **Credentials..** magpie signs with gcloud’s Application Default Credentials, or with the file `credentials=` names by its full path: a user sign-in, a service account key or an impersonated service account. `impersonate=` takes a service account’s email, and needs `roles/iam.serviceAccountTokenCreator` on it. The metadata server, workload identity federation and Vertex AI’s express-mode API keys aren’t read.
- **Location..** `location=` is `global` (the default), `us`, `eu` or a region such as `us-central1`.
- **Models..** The preset has its own list, among them `gemini-3.8-flash`, `gemini-3.1-pro-preview`, `gemini-2.5-pro`, partner models such as `zai-org/glm-5.2-maas`, and Claude models such as `claude-opus-5-5`. Gemini goes to Vertex AI’s Gemini API, a partner model to its OpenAI-compatible chat completions, and Claude to Anthropic’s Messages API, all in your project.
- **Thinking on Vertex AI..** A Gemini 3 level is fitted to the levels that model has, and reasoning off asks for its lowest. Gemini 2.5 takes a budget: Pro from 128 to 32768 tokens (128 when off), Flash up to 24576 (0 when off), Flash-Lite from 512 to 24576 (0 when off).

## Google sign-ins

Two Google sign-ins give Gemini models without a key. They are subscriptions, set up as on [Subscriptions in any agent](https://usemagpie.ai/docs/subscriptions).

- **Gemini (Code Assist)..** Gemini CLI’s Google sign-in, as `gemini/…`: `magpie accounts add gemini`. Google answers it only for a Code Assist Standard or Enterprise account with a Google Cloud project of its own; `magpie accounts project gemini <email> <project>` names the project.
- **Antigravity..** As `antigravity/…`: `magpie accounts add antigravity`. Its sign-in gives Antigravity’s Claude and Gemini models.

## Troubleshooting

- **“Thinking level MINIMAL is not supported for this model”..** The model has no minimal level. magpie asks again at the nearest level it has, so the agent gets its answer, and remembers the level until magpie restarts. Only when no level is left does the error reach the agent as Google sent it.
- **“Function call is missing a thought_signature in functionCall parts”..** A Gemini 3 call lost its signature. Through magpie the signature rides in the call id and is put back, and a call with none goes with `skip_thought_signature_validator`.
- **“Corrupted thought signature”..** The signature was cut short or came from another provider. magpie sends a signature only to the provider that gave it.
- **429 with “Please retry in 33s”..** A per-minute limit, not a spent plan. The key rests for a short while, and `rpm` keeps requests under the limit from then on.
- **Vertex AI: a schema “didn’t specify the schema type field”..** magpie types every untyped tool schema it sends to Gemini, so this shouldn’t reach the agent.
- **Vertex AI won’t save..** “Google Vertex AI needs the id of your Google Cloud project”: add `project=`. A credentials file has to be given by its full path.
- **Checking a key..** `magpie provider test google` sends a tiny request through each endpoint, or to each model you name. Add `--as codex` or `--as claude-code` to send it the way that agent would.

More on Vertex AI: [Google Vertex AI in Claude Code, Codex and other agents](https://usemagpie.ai/docs/vertex).

## FAQ

### How do I use Gemini in Claude Code?

Add a Gemini API key in magpie (Providers, Add provider, Google Gemini), then pick a model such as `gemini-3.1-pro-preview` on Claude Code’s row, or run `magpie claude google/gemini-3.1-pro-preview`. magpie writes Claude Code’s `settings.json` and translates each Messages request to Gemini’s Chat Completions, tool calls and streaming included.

### Can Codex use Gemini models?

Yes. Codex speaks only the Responses API. magpie translates each Codex request to Gemini’s Chat Completions and the reply back to Responses. Run `magpie codex google/gemini-3.1-pro-preview`, or pick the model on Codex’s row.

### Does Gemini 3 Pro keep working across tool calls in Claude Code?

Yes. Gemini 3 signs its function calls and refuses the next request without the signature. magpie carries each signature in the call id the agent gets and puts it back on the way to Gemini, so tool loops keep going, and a call from another model is sent as unsigned.

### Can Gemini CLI and OpenCode use my Gemini key through magpie?

Yes. Gemini CLI’s requests go to the Gemini API as it sends them, Google Search included. OpenCode speaks Chat Completions, so its requests go to Gemini’s OpenAI-compatible API as they are.

### Why does Gemini answer 429 with “Please retry in 33s”?

That is a per-minute limit, not a spent quota. magpie reads it as a rate limit and rests the key briefly. Run `magpie provider rpm google 10`, with your own limit, and magpie holds requests to that rate.

### Can I use Gemini through Vertex AI instead of an API key?

Yes. Add the Google Vertex AI preset with your project’s id, for example `magpie provider add google-vertex project=my-project`. magpie signs with gcloud’s Application Default Credentials or a credentials file, and your project is billed.

### Can I use my Gemini Code Assist or Antigravity sign-in instead?

Yes. Both are subscriptions: `magpie accounts add gemini` or `magpie accounts add antigravity`, then pick a `gemini/…` or `antigravity/…` model. Code Assist needs a Standard or Enterprise account with a Google Cloud project of its own.

**By provider:** [DeepSeek](https://usemagpie.ai/docs/deepseek) · [Kimi and Kimi Code](https://usemagpie.ai/docs/kimi) · [GLM Coding Plan](https://usemagpie.ai/docs/glm) · [Volcengine Ark](https://usemagpie.ai/docs/volcengine) · [Tencent Cloud](https://usemagpie.ai/docs/tencent-cloud) · [Baidu Qianfan](https://usemagpie.ai/docs/baidu-qianfan) · [SiliconFlow](https://usemagpie.ai/docs/siliconflow) · [ModelScope](https://usemagpie.ai/docs/modelscope) · [Huawei Cloud MaaS](https://usemagpie.ai/docs/huaweicloud) · [Xiaomi MiMo](https://usemagpie.ai/docs/xiaomi-mimo) · [StepFun](https://usemagpie.ai/docs/stepfun) · [LongCat](https://usemagpie.ai/docs/longcat) · [Qwen](https://usemagpie.ai/docs/qwen) · [MiniMax](https://usemagpie.ai/docs/minimax) · [Anthropic](https://usemagpie.ai/docs/anthropic) · [OpenAI](https://usemagpie.ai/docs/openai) · [Grok](https://usemagpie.ai/docs/grok) · [Mistral](https://usemagpie.ai/docs/mistral) · [OpenRouter](https://usemagpie.ai/docs/openrouter) · [GitHub Copilot](https://usemagpie.ai/docs/copilot) · [Ollama](https://usemagpie.ai/docs/ollama)

Every agent: [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Models in Codex](https://usemagpie.ai/docs/codex-models), [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models), [Models in OpenCode](https://usemagpie.ai/docs/opencode-models). To run Google’s Antigravity app on other models, see [Antigravity on any model](https://usemagpie.ai/docs/antigravity). Ask on [Discord](https://discord.gg/vGSnD3ZKQF) if you get stuck.

---

Source: https://usemagpie.ai/docs/grok

# Grok in Claude Code, Codex, Gemini CLI and OpenCode

xAI serves its Grok models on three APIs at once: OpenAI Chat Completions, OpenAI Responses and Anthropic Messages. Add an xAI API key to magpie once, and Claude Code, Codex, Gemini CLI, OpenCode and every other agent you connect can use Grok through magpie’s local gateway at `127.0.0.1:3425`, each agent with a model of its own.

## Add xAI

1. **Get a key.** Make one on [console.x.ai](https://console.x.ai).
2. **Add the provider.** In magpie’s Providers tab, press ＋ Add provider, pick xAI, paste the key and save. magpie asks xAI which models the key can use.
3. **Pick it for an agent.** In the Agents tab, click the model on the agent’s row and choose a Grok model such as `grok-4.7`.

```
magpie provider add xai xai-…
magpie provider test xai
```

Model ids in magpie are `provider/model`, so xAI’s read `xai/grok-4.7`: the provider, then xAI’s own id. The key is kept in magpie’s settings; magpie doesn’t take it from your shell.

## Endpoints

| API | Base URL | Used for |
| --- | --- | --- |
| Chat Completions | `https://api.x.ai/v1` | the model list, OpenCode’s requests, and every request magpie translates, Gemini CLI’s among them |
| Responses | `https://api.x.ai/v1` | Codex’s requests, and web search that xAI runs itself |
| Anthropic Messages | `https://api.x.ai` | Claude Code’s requests |

An agent whose API xAI serves is passed on to that API. When magpie has to translate, it uses Chat Completions: it keeps Responses first only for OpenAI’s own models at OpenAI, and Messages first only for Claude models, and Grok is neither.

## Model list

magpie fetches the list from xAI, at `https://api.x.ai/v1/models`, so agents see the models your key can use. Names, reasoning levels and prices come from models.dev’s `xai` catalog. Pick the models agents see in the provider’s model list, or from the terminal:

```
magpie provider models xai +grok-4.7
magpie provider refresh-every xai 1d
```

## In each agent

```
magpie claude xai/grok-4.7
magpie codex xai/grok-4.7
magpie gemini model xai/grok-4.7
magpie opencode xai/grok-4.7
```

- **Claude Code.** speaks Anthropic Messages, and so does xAI at `https://api.x.ai`, so its requests go there as they are, with the fixes below. [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models).
- **Codex.** speaks OpenAI Responses, which xAI serves at `https://api.x.ai/v1`, so its requests go there as they are too. If xAI turns away Codex’s custom tools (“unknown variant `custom`”), magpie translates that model’s Codex requests from then on and offers those tools as ordinary functions. [Models in Codex](https://usemagpie.ai/docs/codex-models).
- **Gemini CLI.** speaks Google’s Gemini API, which xAI doesn’t serve. magpie translates each request to Chat Completions and the reply back, streaming and tool calls included. [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models).
- **OpenCode.** speaks Chat Completions, so its requests go to xAI as they are. [Models in OpenCode](https://usemagpie.ai/docs/opencode-models).

Grok Build, xAI’s own CLI, can take magpie’s models too: magpie adds them to `~/.grok/config.toml`, so they join its `/model` picker.

## What magpie fixes for xAI

xAI’s API turns away a few things that agents send. magpie changes them on the way, on requests it passes on and on those it translates alike, so the agent never sees these errors:

- **Tool patterns..** xAI reads a tool’s `pattern` with a different regex engine, so a pattern such as Claude Code’s `^[^\s[\]]+$` on Windows failed with “Schema validation failed: … is not a "regex"”. magpie escapes it so xAI reads it as JavaScript does.
- **Tool roots..** A tool whose parameters start with `anyOf`, `oneOf` or `allOf`, such as a Codex desktop automation tool, is folded into an object from the first request. xAI otherwise answers “tool parameter root must be an object type”.
- **Empty fields..** `"required": null` in a tool’s schema, and `"content": null` on a Codex reasoning item, are left out. xAI otherwise answers “/required: null is not of type "array"” or “Could not decode the compaction blob”.
- **System turns..** Claude Code’s system turns in the middle of a conversation are folded into the top-level system prompt. xAI otherwise answers “Invalid request content: Invalid message role.”
- **A tool choice with no tools..** A request that sets `tool_choice` but offers no tools, such as Codex’s compaction summary, goes without it. xAI otherwise answers “A tool_choice was set on the request but no tools were specified”.
- **Codex’s added tools..** xAI’s Responses API doesn’t know Codex’s `additional_tools` items, so magpie puts their tools in the request’s `tools`.
- **Whole numbers..** Grok writes whole numbers in tool-call arguments with a fraction, such as `2500.0`, which Codex’s whole-number fields refuse. magpie writes `2500`, in streamed replies too.

## Reasoning

- **Effort..** The effort an agent asks for is fitted to the nearest level the model has, as the catalog lists them. A model whose levels aren’t known is asked as the agent asked.
- **Reasoning off..** When an agent whose requests magpie translates, such as Gemini CLI, turns reasoning off and the model lists `none` among its levels, magpie asks for none.
- **Switching models mid-conversation..** xAI reads only the sealed reasoning it wrote itself. When a Codex conversation moves to Grok from GPT or from another account, xAI answers “Could not decrypt the provided encrypted_content”. magpie asks again without those items at once, and leaves them out for the rest of that conversation.

## Web search

- **Codex..** xAI runs web search itself on its Responses API, so Codex’s `web_search` is done by xAI.
- **Claude Code, Gemini CLI and OpenCode..** xAI’s Messages and Chat Completions APIs don’t search, so magpie gives the model its own search tool, answered by the searcher chosen in Settings, or by one magpie picks when none is chosen.
- **xAI as the searcher..** Because xAI searches by itself, magpie can pick an xAI key to search for models that can’t.

## Cache, cost and usage

- **Cache tokens..** magpie reads the cached tokens xAI reports in each reply, so the Usage tab counts cache hits apart from the rest of the prompt.
- **Keeping the cache..** With several keys, a conversation stays on its key while its cache is worth keeping, 1,024 tokens or more, and still warm, read within the last five minutes, so a turn isn’t sent to a key with a cold cache.
- **Cost..** The Usage tab prices each Grok call with xAI’s prices from models.dev.
- **Balance..** magpie reads no balance from xAI. Type it in yourself with `key-balance`, and the Usage page shows it less what magpie has priced the key’s calls at since.

## Several keys and failover

One xAI provider can hold several keys: press Add another key under it, or paste several at once. Requests go to the first key that’s on, and when it runs out or is rate limited the next one takes over.

- **Spend caps..** `spend-cap` stops a key at a dollar amount a day, a month or in all, as the Usage tab prices its calls; routing then goes on to the other keys and the fallbacks.
- **Fallbacks..** `fallback` names where requests go when xAI is out of quota or down: another provider’s model or a routing group.
- **A request xAI can’t read..** When xAI answers 422 “Failed to deserialize the JSON body … unknown item type”, the request goes to the next member of the routing group, and the key isn’t rested for it.

```
magpie provider spend-cap xai <key> 20 month
magpie provider key-balance xai <key> 25
magpie provider fallback xai deepseek/deepseek-v4-pro
```

## Troubleshooting

- **“maximum prompt length is …”..** The conversation is longer than the model takes. magpie tells the agent so the way it understands, `context_length_exceeded` or Anthropic’s “prompt is too long”, so the agent compacts and tries again.
- **“Could not decrypt the provided encrypted_content”..** Codex moved to Grok mid-conversation with another vendor’s reasoning in it. magpie asks again without it; see Reasoning.
- **“unknown variant `custom`”..** xAI turned away Codex’s custom tools. magpie translates that model’s Codex requests from then on; the first refusal is the last.
- **Checking a key..** `magpie provider test xai` sends a tiny request through each endpoint, or to each model you name. Add `--as codex` or `--as claude-code` to send it the way that agent would.

## FAQ

### How do I use Grok in Claude Code?

Add your xAI API key in magpie (Providers, Add provider, xAI), then pick a Grok model such as `grok-4.7` on Claude Code’s row, or run `magpie claude xai/grok-4.7`. Claude Code’s requests go through magpie’s gateway to xAI’s Anthropic Messages endpoint, `https://api.x.ai`.

### Can Codex use Grok 4?

Yes. xAI serves the Responses API that Codex speaks, so `magpie codex xai/grok-4.7` sends Codex’s requests to `https://api.x.ai/v1` as they are, with what xAI would refuse fixed on the way: tool schemas, a tool choice with no tools, and whole numbers Grok writes as `2500.0`.

### Can Gemini CLI and OpenCode use Grok?

Yes. Gemini CLI speaks Google’s API, so magpie translates its requests to xAI’s Chat Completions and the replies back. OpenCode speaks Chat Completions, so its requests go to xAI as they are. Run `magpie gemini model xai/grok-4.7` or `magpie opencode xai/grok-4.7`.

### Does web search work with Grok?

Yes. Codex’s web search is run by xAI itself on its Responses API. For Claude Code, Gemini CLI and OpenCode, magpie gives the model its own search tool, answered by the searcher chosen in Settings, or by one magpie picks.

### Why did Codex fail after switching from GPT to Grok mid-conversation?

xAI can’t read reasoning that another vendor sealed, and answers “Could not decrypt the provided encrypted_content”. magpie asks again without those items and leaves them out for the rest of the conversation.

### Does magpie show my xAI balance?

No. The Usage tab counts tokens, cache and cost for every Grok call, priced from models.dev, but magpie reads no balance from xAI. You can type the balance in with `magpie provider key-balance`, and the Usage page shows it less what magpie has priced since.

**By provider:** [DeepSeek](https://usemagpie.ai/docs/deepseek) · [Kimi and Kimi Code](https://usemagpie.ai/docs/kimi) · [GLM Coding Plan](https://usemagpie.ai/docs/glm) · [Volcengine Ark](https://usemagpie.ai/docs/volcengine) · [Tencent Cloud](https://usemagpie.ai/docs/tencent-cloud) · [Baidu Qianfan](https://usemagpie.ai/docs/baidu-qianfan) · [SiliconFlow](https://usemagpie.ai/docs/siliconflow) · [ModelScope](https://usemagpie.ai/docs/modelscope) · [Huawei Cloud MaaS](https://usemagpie.ai/docs/huaweicloud) · [Xiaomi MiMo](https://usemagpie.ai/docs/xiaomi-mimo) · [StepFun](https://usemagpie.ai/docs/stepfun) · [LongCat](https://usemagpie.ai/docs/longcat) · [Qwen](https://usemagpie.ai/docs/qwen) · [MiniMax](https://usemagpie.ai/docs/minimax) · [Anthropic](https://usemagpie.ai/docs/anthropic) · [OpenAI](https://usemagpie.ai/docs/openai) · [Gemini](https://usemagpie.ai/docs/gemini) · [Mistral](https://usemagpie.ai/docs/mistral) · [OpenRouter](https://usemagpie.ai/docs/openrouter) · [GitHub Copilot](https://usemagpie.ai/docs/copilot) · [Ollama](https://usemagpie.ai/docs/ollama)

Every agent: [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Models in Codex](https://usemagpie.ai/docs/codex-models), [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models), [Models in OpenCode](https://usemagpie.ai/docs/opencode-models). Ask on [Discord](https://discord.gg/vGSnD3ZKQF) if you get stuck.

---

Source: https://usemagpie.ai/docs/mistral

# Mistral in Claude Code, Codex, Gemini CLI and OpenCode

Mistral serves its models on one API, OpenAI-style Chat Completions, at `api.mistral.ai`. Add a Mistral API key to magpie once, and Claude Code, Codex, Gemini CLI, OpenCode and every other agent you connect can use Mistral through magpie’s local gateway at `127.0.0.1:3425`, each agent with a model of its own. Agents that speak another API are translated on the way.

## Add Mistral

1. **Get a key.** Make one on [console.mistral.ai](https://console.mistral.ai/api-keys). A Le Chat plan’s Vibe key goes in the same provider.
2. **Add the provider.** In magpie’s Providers tab, press ＋ Add provider, pick Mistral, paste the key and save. magpie asks Mistral which models the key can use.
3. **Pick it for an agent.** In the Agents tab, click the model on the agent’s row and choose a Mistral model such as `mistral-large-4`.

```
magpie provider add mistral <key>
magpie provider test mistral
```

Model ids in magpie are `provider/model`, so Mistral’s read `mistral/mistral-large-4`: the provider, then Mistral’s own id. The key is kept in magpie’s settings; magpie doesn’t take it from your shell.

Already set Mistral up in OpenCode or Alma? magpie’s import from those apps brings it in as the Mistral provider. An app that keeps one entry per key (“Mistral #0001”, “Mistral #0002”…) becomes one Mistral provider with that many keys, listed once in every agent’s picker.

## Endpoints

| API | Address | Used for |
| --- | --- | --- |
| Chat Completions | `https://api.mistral.ai/v1` | the model list and every agent’s requests: OpenCode’s as they are, Claude Code’s, Codex’s and Gemini CLI’s translated |
| Billing | `https://api.mistral.ai/v1/billing/budget`, `/v1/billing/subscription` | a key’s month of Vibe or API budget, and the plan it is on |

magpie’s Mistral provider has no Anthropic Messages or Responses address, so an agent that speaks either is translated to Chat Completions and the reply translated back, streaming and tool calls included.

## Model list

magpie fetches the list from Mistral, at `https://api.mistral.ai/v1/models`, so agents see the models your key can use. Names, reasoning levels and prices come from models.dev’s `mistral` catalog, and Devstral, Codestral and Magistral models carry Mistral’s logo in every picker. Mistral also serves models from other labs, such as GLM and DeepSeek’s `deepseek-v4.1-flash-1017`; they come through the same key, and the fixes below apply to them too. Pick the models agents see in the provider’s model list, or from the terminal:

```
magpie provider models mistral +mistral-large-4 +mistral-medium-3.5
magpie provider refresh-every mistral 1d
```

## In each agent

```
magpie claude mistral/mistral-large-4
magpie codex mistral/mistral-large-4
magpie gemini model mistral/mistral-large-4
magpie opencode mistral/mistral-large-4
```

- **Claude Code.** speaks Anthropic Messages, which Mistral doesn’t serve. magpie translates each request to Chat Completions and the reply back; a reasoning model’s thinking reaches Claude Code as thinking, then the text. [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models).
- **Codex.** speaks OpenAI Responses, which Mistral doesn’t serve either, so its requests are translated too. Codex’s custom tools, such as `apply_patch`, are offered to the model as functions, and its calls come back as the custom tool calls Codex runs. [Models in Codex](https://usemagpie.ai/docs/codex-models).
- **Gemini CLI.** speaks Google’s Gemini API. magpie translates each request to Chat Completions and the reply back. [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models).
- **OpenCode.** speaks Chat Completions, so its requests go to Mistral as they are, with the fixes below. [Models in OpenCode](https://usemagpie.ai/docs/opencode-models).

## What magpie fixes for Mistral

Mistral’s API is strict about what it takes and sends a reasoning model’s thinking in a shape of its own. magpie changes both on the way, on requests it passes on and on those it translates alike:

- **Thinking in typed parts..** Mistral sends a reasoning model’s thinking as typed parts in `content`, thinking and text sometimes in one chunk, where the Chat contract has a string. OpenCode turned the first such chunk away (“Invalid … stream event”). magpie moves the thinking to `reasoning_content` and the text to a plain string, streamed or not.
- **Thinking sent back..** OpenCode sends an earlier turn’s thinking back in `reasoning_content`, which Mistral refuses with 422 `extra_forbidden`. magpie puts it in the thinking part Mistral itself returns, ahead of the turn’s text, so the thinking stays in context. Translated requests get the same, so a Codex tool loop keeps going on a DeepSeek model served by Mistral.
- **Fields Mistral doesn’t know..** OpenCode’s `store` and Kimi Code’s thinking switch got 422 `extra_forbidden`. magpie asks again without the optional fields Mistral named, and doesn’t send them to it again once that works.
- **Ollama options..** An agent that took the gateway for an Ollama server, such as Hermes Agent, sends Ollama’s `options` (its `num_ctx`) beside the Chat fields. magpie leaves them out, so Mistral never sees them.

## Reasoning

- **Effort..** The effort an agent asks for is fitted to the nearest level the model has, as the catalog lists them. A model whose levels aren’t known is asked as the agent asked.
- **Reasoning off..** When an agent whose requests magpie translates, such as Gemini CLI, turns reasoning off and the model lists `none` among its levels, magpie asks for none.
- **Thinking across turns..** Each agent sees a reasoning model’s thinking in its own shape: `reasoning_content` for OpenCode, thinking blocks for Claude Code, reasoning for Codex. When it comes back in a later turn, Mistral gets it as a thinking part; see What magpie fixes.

## Web search

Mistral’s Chat Completions API doesn’t search the web for magpie, so magpie gives the model its own search tool in every agent, answered by the searcher chosen in Settings, or by one magpie picks when none is chosen.

## Vibe, cost and usage

- **Vibe month..** A Le Chat plan (Pro, Student or Team) comes with a month of Mistral Vibe. Its Vibe key’s row shows how much of the month’s budget is used, in the currency Mistral bills in, when it resets, and the plan’s name.
- **API month..** A Studio key made in the console shows the organization’s API budget, as “API · Month”, apart from a Vibe month. The budget is the organization’s, so every key of one organization shows the same numbers. A key with no budget has no card.
- **Pay as you go..** With pay-as-you-go on, what goes past the budget is billed rather than stopped, so a used-up month doesn’t stop the key’s models.
- **Cache tokens..** When a reply reports cached prompt tokens, the Usage tab counts them apart from the rest of the prompt.
- **Keeping the cache..** With several keys, a conversation stays on its key while its cache is worth keeping, 1,024 tokens or more, and still warm, read within the last five minutes.
- **Cost..** The Usage tab prices each call with Mistral’s prices from models.dev. magpie reads no balance from Mistral; type it in with `key-balance`, and the Usage page shows it less what magpie has priced the key’s calls at since.

## Several keys and failover

One Mistral provider can hold several keys: press Add another key under it, or paste several at once. Requests go to the first key that’s on, and when it runs out or is rate limited the next one takes over.

- **Spend caps..** `spend-cap` stops a key at a dollar amount a day, a month or in all, as the Usage tab prices its calls; routing then goes on to the other keys and the fallbacks.
- **Fallbacks..** `fallback` names where requests go when Mistral is out of quota or down: another provider’s model or a routing group.

```
magpie provider spend-cap mistral <key> 20 month
magpie provider key-balance mistral <key> 25
magpie provider fallback mistral deepseek/deepseek-v4-pro
```

## Troubleshooting

- **422 `extra_forbidden`, “Extra inputs are not permitted”..** Mistral turned away a field it doesn’t know. magpie fixes the ones agents are known to send and asks again without an optional field Mistral names; see What magpie fixes.
- **“Invalid … stream event” in OpenCode..** That was Mistral’s thinking in typed parts. magpie sends OpenCode the thinking in `reasoning_content` and the text as a string.
- **No Vibe card..** magpie shows the month only for a key Mistral says is a Vibe key or a Studio key, and only when its budget is more than zero.
- **Checking a key..** `magpie provider test mistral` sends a tiny request through each endpoint, or to each model you name. Add `--as codex` or `--as claude-code` to send it the way that agent would.

[Groq in Claude Code, Codex and other agents](https://usemagpie.ai/docs/groq)

## FAQ

### How do I use Mistral in Claude Code?

Add your Mistral API key in magpie (Providers, Add provider, Mistral), then pick a Mistral model such as `mistral-large-4` on Claude Code’s row, or run `magpie claude mistral/mistral-large-4`. Mistral serves Chat Completions only, so magpie translates Claude Code’s Anthropic Messages requests to `https://api.mistral.ai/v1` and the replies back, thinking included.

### Can Codex use Devstral and other Mistral models?

Yes. Codex can use any model your Mistral key lists, Devstral among them. Codex speaks OpenAI Responses, which Mistral doesn’t serve, so magpie translates each request to Chat Completions, offers Codex’s custom tools such as apply_patch as functions, and gives the calls back the way Codex runs them.

### How do I use Codestral or other Mistral models in OpenCode?

Pick the model in magpie, or run `magpie opencode mistral/mistral-large-4`; Codestral and Devstral work the same way when your key lists them. OpenCode speaks Chat Completions, so its requests go to Mistral as they are, with what Mistral would refuse fixed on the way: OpenCode’s `store` field, and earlier turns’ thinking sent back in `reasoning_content`.

### Can Gemini CLI use Mistral?

Yes. Gemini CLI speaks Google’s Gemini API, so magpie translates its requests to Mistral’s Chat Completions and the replies back, streaming and tool calls included. Run `magpie gemini model mistral/mistral-large-4`.

### Why does Mistral answer 422 extra_forbidden?

Mistral turns away any field it doesn’t know. magpie sends an earlier turn’s thinking as the thinking part Mistral takes, leaves out Ollama options some agents add, and asks again without an optional field Mistral names, such as OpenCode’s `store`, then stops sending it.

### Does magpie show my Le Chat plan’s Vibe budget?

Yes. A Vibe key from a Le Chat plan (Pro, Student or Team) shows how much of the month’s Vibe budget is used, in the currency Mistral bills in, and when it resets, with the plan’s name. A Studio key made in the console shows the organization’s API budget instead, as “API · Month”.

**By provider:** [DeepSeek](https://usemagpie.ai/docs/deepseek) · [Kimi and Kimi Code](https://usemagpie.ai/docs/kimi) · [GLM Coding Plan](https://usemagpie.ai/docs/glm) · [Volcengine Ark](https://usemagpie.ai/docs/volcengine) · [Tencent Cloud](https://usemagpie.ai/docs/tencent-cloud) · [Baidu Qianfan](https://usemagpie.ai/docs/baidu-qianfan) · [SiliconFlow](https://usemagpie.ai/docs/siliconflow) · [ModelScope](https://usemagpie.ai/docs/modelscope) · [Huawei Cloud MaaS](https://usemagpie.ai/docs/huaweicloud) · [Xiaomi MiMo](https://usemagpie.ai/docs/xiaomi-mimo) · [StepFun](https://usemagpie.ai/docs/stepfun) · [LongCat](https://usemagpie.ai/docs/longcat) · [Qwen](https://usemagpie.ai/docs/qwen) · [MiniMax](https://usemagpie.ai/docs/minimax) · [Anthropic](https://usemagpie.ai/docs/anthropic) · [OpenAI](https://usemagpie.ai/docs/openai) · [Gemini](https://usemagpie.ai/docs/gemini) · [Grok](https://usemagpie.ai/docs/grok) · [OpenRouter](https://usemagpie.ai/docs/openrouter) · [GitHub Copilot](https://usemagpie.ai/docs/copilot) · [Ollama](https://usemagpie.ai/docs/ollama)

Every agent: [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Models in Codex](https://usemagpie.ai/docs/codex-models), [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models), [Models in OpenCode](https://usemagpie.ai/docs/opencode-models). Ask on [Discord](https://discord.gg/vGSnD3ZKQF) if you get stuck.

---

Source: https://usemagpie.ai/docs/ollama

# Ollama in Claude Code, Codex, Gemini CLI and OpenCode

Ollama serves the models you pull on two APIs, OpenAI Chat Completions and Anthropic Messages, at `http://localhost:11434`. Ollama Cloud serves its models the same way at `ollama.com`, with an API key. Add either to magpie once, and Claude Code, Codex, Gemini CLI, OpenCode and every other agent you connect can use them through magpie’s local gateway at `127.0.0.1:3425`, each agent with a model of its own.

## Add Ollama

1. **Pull a model.** Pull a model in Ollama, such as `qwen3`, and leave the server running.
2. **Add the provider.** In magpie’s Providers tab, press ＋ Add provider and pick Ollama under On this machine. No key is needed. magpie asks the server which models it has, and they show as `ollama/…`.
3. **Pick it for an agent.** In the Agents tab, click the model on the agent’s row and choose an Ollama model.

```
ollama pull qwen3
magpie provider add ollama
magpie provider test ollama
```

Model ids in magpie are `provider/model`, so a model you pulled as `qwen3` reads `ollama/qwen3`. A tag stays in the id, as in `ollama/qwen3:8b`. In the terminal UI, magpie asks for the server’s address when you add it. LM Studio, oMLX, vLLM and llama.cpp’s server are in [Local models](https://usemagpie.ai/docs/local-models).

## Another port or another computer

If Ollama listens on another port, or runs on another computer such as a GPU box or a NAS, change Server address in the provider’s editor. Only the scheme, host and port change; each API keeps its path. The scheme can be left out, and `http` is taken; a path pasted with the address, such as `/v1`, is dropped.

```
magpie provider set ollama address=192.168.1.20:11434
magpie provider set ollama address=     # back to the default
```

- **Proxies..** A server on your own network is reached directly, whatever proxy Settings or the system name. A proxy you set on the provider itself is still used.
- **HTTPS..** An Ollama behind HTTPS with a self-signed certificate can be reached with Don't check its certificate in the editor. It applies to that provider’s own hosts only.

## Ollama Cloud

1. **Get a key.** Make one at [ollama.com/settings/keys](https://ollama.com/settings/keys).
2. **Add the provider.** In the Providers tab, press ＋ Add provider, pick Ollama Cloud, paste the key and save. magpie asks Ollama Cloud which models the key can use.
3. **Pick it for an agent.** Choose an Ollama Cloud model, such as `deepseek-v4-pro`, on the agent’s row.

```
magpie provider add ollama-cloud <key>
magpie claude ollama-cloud/deepseek-v4-pro
```

Names, reasoning levels and prices come from models.dev’s `ollama-cloud` catalog. The key is kept in magpie’s settings.

## Endpoints

| Provider | Chat Completions | Anthropic Messages |
| --- | --- | --- |
| Ollama | `http://localhost:11434/v1` | `http://localhost:11434` |
| Ollama Cloud | `https://ollama.com/v1` | `https://ollama.com` |

An agent whose API Ollama serves is passed on to that API. magpie uses no Responses endpoint for either, so when it has to translate, it uses Chat Completions: it keeps Responses first only for OpenAI’s own models, and Messages first only for Claude models.

## Model list

magpie asks the server for its list at the Chat Completions base: `http://localhost:11434/v1/models`, or `https://ollama.com/v1/models` for Ollama Cloud. A model shows in magpie once Ollama has it. After you pull another, press Fetch models in the provider’s editor, or run `magpie provider refresh ollama`. Pick the models agents see in the provider’s model list, or from the terminal:

```
magpie provider refresh ollama
magpie provider models ollama +qwen3
```

Ollama 0.35.0 and later (0.40.5 for its cloud models) also serves decision models, such as Nimble, Clef and Tev. magpie reads Ollama’s `/api/tags` as well, and a model marked there as a decision model becomes one of the provider’s decision models for [intent routing](https://usemagpie.ai/docs/intent), never an agent’s model. An older Ollama lists none.

## In each agent

```
magpie claude ollama/qwen3
magpie codex ollama/qwen3
magpie gemini model ollama/qwen3
magpie opencode ollama/qwen3
```

- **Claude Code.** speaks Anthropic Messages, and so does Ollama at `http://localhost:11434`, so its requests go there as they are. [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models).
- **Codex.** speaks OpenAI Responses, which magpie doesn’t send to Ollama. magpie turns each request into Chat Completions and the reply back, streaming and tool calls included. [Models in Codex](https://usemagpie.ai/docs/codex-models).
- **Gemini CLI.** speaks Google’s Gemini API. magpie translates each request to Chat Completions and the reply back. [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models).
- **OpenCode.** speaks Chat Completions, so its requests go to Ollama’s `/v1` as they are. [Models in OpenCode](https://usemagpie.ai/docs/opencode-models).

Inside the agent, Claude Code’s and Codex’s `/model` list magpie’s models too, so you can move between a local model and a cloud one there. To go back to the agent’s own models, run `magpie claude default` or `magpie codex default`.

## Context window and num_ctx

Agents plan around how long a request the model takes. Claude Code takes a model it doesn’t know for 200K, and Codex compacts a conversation at 90% of the window it is told. magpie doesn’t read an Ollama chat model’s window, so tell it the real one: Context window under Advanced in the provider’s editor, for every model or one of them. magpie passes it on to the agents.

```
magpie provider set ollama context=32k
magpie provider set ollama context.qwen3=128k
```

- **`num_ctx`..** Some clients send Ollama’s per-request options, such as `{"num_ctx": …}`, beside the Chat Completions fields. magpie leaves them out of every request it sends on: no Chat Completions API reads them, Ollama’s own `/v1` included. The window the model runs with is Ollama’s to set; give magpie the same number.
- **Too long..** When a conversation outgrows the window, Ollama answers “exceeded max context length”. magpie tells the agent so the way it understands, `context_length_exceeded` or Anthropic’s “prompt is too long”, so the agent compacts and tries again.

## Reasoning

- **Effort..** The effort an agent asks for is fitted to the nearest level the model has, as the catalog lists them. A model whose levels magpie doesn’t know is asked as the agent asked.
- **Reasoning off..** When an agent whose requests magpie translates, such as Codex or Gemini CLI, turns reasoning off and the model lists `none` among its levels, magpie asks for none.
- **Your own levels..** `magpie model efforts` offers only the levels you name, or sends a model no reasoning field at all.

```
magpie model efforts ollama/qwen3 low,medium,high
magpie model efforts ollama/qwen3 off
```

## Tool calls

Claude Code’s and OpenCode’s tool calls reach Ollama as the agent wrote them. For Codex and Gemini CLI, magpie translates the tools, the model’s calls and their results to Chat Completions and back, in streamed replies too.

## Privacy masking

magpie’s [privacy masking](https://usemagpie.ai/docs/masking) replaces keys, tokens and other secrets with placeholders before a request leaves the gateway, a request to a local Ollama too. When the model runs on your own computer or network, you can turn on Send requests unmasked in its editor, or run `magpie provider set ollama unmasked=yes`.

- **Cloud models..** Ollama’s cloud models pass a request on to a vendor whatever the address, so it is your call. The editor warns you while it is on for a provider that isn’t local, such as Ollama Cloud.
- **Tool arguments..** In a request in Ollama’s own format, a tool call’s arguments are masked as tool arguments, as in every other API.
- **Anonymous stats..** magpie’s daily stats name an Ollama model only when models.dev knows it; any other counts as “other”. See [Privacy](https://usemagpie.ai/docs/privacy).

## Usage and cost

- **Usage..** The Usage tab counts the tokens of every Ollama call. A model is priced at the price magpie finds for its id, which for a local model can be its maker’s list price. To count a local model at nothing, give it your own price.
- **Free first..** `free=yes` counts every model of the provider as free, so a Free first routing spends it before paid ones. Prices and Usage’s costs stay as listed.
- **Ollama Cloud’s allowance..** magpie reads the account’s balance from Ollama Cloud. The included allowance shows as a plan, in dollars used, with when it resets; an older plan shows its session and weekly limits instead. Credits you bought show as a balance. Past the allowance Ollama Cloud draws on those credits, so a spent allowance with credits left doesn’t stop the key.
- **Peak hours..** On Ollama Cloud, `deepseek-v4.1-flash` and `deepseek-v4-pro` (with their tags) cost double from 12:00 to 18:00 UTC, Monday to Friday. models.dev lists the off-peak price; the Usage tab doubles it in those hours, and a Cheapest first routing counts it.
- **Out of allowance..** When Ollama Cloud says a key is out without saying when it comes back, as its weekly limit does, magpie rests the key for 15 minutes. `quota-rest` sets how long, up to 8 days. With several keys (Add another key) the next one takes over; when every key is out, the gateway answers at once with Retry-After.

```
magpie model price ollama/qwen3 0,0,0,0
magpie provider set ollama free=yes
magpie provider quota-rest ollama-cloud 7d
magpie provider fallback ollama-cloud ollama/qwen3
```

## magpie as an Ollama server

Some apps take a custom model only as an Ollama server: VS Code’s Copilot Ollama provider, Visual Studio’s Copilot BYOK, Zed’s Ollama provider and the `ollama` CLI. Point them at magpie’s gateway, `http://127.0.0.1:3425`, and they see magpie’s models, from every provider, not only Ollama.

- **Routes..** magpie answers `/api/version`, `/api/tags`, `/api/show`, `/api/chat` and `/api/generate`.
- **The same path..** A chat there is served as `/v1/chat/completions` is, so key limits, routing, fallbacks and usage are the same. A gateway key held to some models lists only those.
- **What it tells..** `/api/tags` and `/api/show` mark tools, vision when the model reads images, and thinking when it reasons. `/api/show` also gives the model’s window, or 32768 for one magpie doesn’t know. The `ollama` CLI’s `name:latest` finds a model called `name`.

## Troubleshooting

- **A model you pulled isn’t listed..** The list comes from the server. Press Fetch models, or run `magpie provider refresh ollama`, and pick it in the provider’s model list. Use the name Ollama lists, tag included.
- **Ollama isn’t running..** `magpie provider test ollama` sends a tiny request through each endpoint, or to each model you name; add `--as codex` or `--as claude-code` to send it the way that agent would. Start Ollama, or check Server address. `fallback` names where requests go while it is down.
- **“exceeded max context length”..** The conversation is longer than the model was loaded for. Set the real Context window on the provider, and the agents compact before they reach it.
- **Another computer can’t be reached..** Check the address and port in Server address; for HTTPS with a self-signed certificate, turn on Don't check its certificate.

## FAQ

### How do I use Ollama in Claude Code?

Add Ollama in magpie (Providers, Add provider, Ollama under On this machine), then pick one of its models on Claude Code’s row, or run `magpie claude ollama/qwen3`. Claude Code’s requests go through magpie’s gateway to Ollama’s Anthropic Messages API at `http://localhost:11434` as they are.

### Can Codex use Ollama?

Yes. Codex speaks only the Responses API, so magpie turns its requests into Chat Completions for Ollama, and the replies back, tool calls included. Run `magpie codex ollama/qwen3`.

### Can Gemini CLI and OpenCode use Ollama?

Yes. Gemini CLI speaks Google’s API, so magpie translates its requests to Ollama’s Chat Completions and the replies back. OpenCode speaks Chat Completions, so its requests go to Ollama as they are. Run `magpie gemini model ollama/qwen3` or `magpie opencode ollama/qwen3`.

### How do I run qwen3-coder from Ollama in Claude Code?

Pull it in Ollama, press Fetch models in the provider’s editor in magpie (or run `magpie provider refresh ollama`), and pick it on Claude Code’s row. Its id in magpie is `ollama/` and the name Ollama lists it under, tag included. Set its Context window too: Claude Code takes a model it doesn’t know for 200K.

### Can magpie use Ollama on another computer?

Yes. Set the provider’s Server address to that computer, such as `magpie provider set ollama address=192.168.1.20:11434`. A server on your own network is reached directly, not through a proxy set in Settings or the system.

### Does magpie work with Ollama Cloud?

Yes. Add Ollama Cloud with a key from `ollama.com/settings/keys`. magpie lists the models the key can use, prices them from models.dev, and shows the account’s included allowance and the credits you bought.

### Do I need an API key for a local Ollama?

No. The Ollama preset takes none. Ollama Cloud needs one.

Other local servers, such as LM Studio, oMLX, vLLM and llama.cpp’s server, are in [Local models](https://usemagpie.ai/docs/local-models). To let a local model classify each request for routing, see [Intent routing](https://usemagpie.ai/docs/intent).

**By provider:** [DeepSeek](https://usemagpie.ai/docs/deepseek) · [Kimi and Kimi Code](https://usemagpie.ai/docs/kimi) · [GLM Coding Plan](https://usemagpie.ai/docs/glm) · [Volcengine Ark](https://usemagpie.ai/docs/volcengine) · [Tencent Cloud](https://usemagpie.ai/docs/tencent-cloud) · [Baidu Qianfan](https://usemagpie.ai/docs/baidu-qianfan) · [SiliconFlow](https://usemagpie.ai/docs/siliconflow) · [ModelScope](https://usemagpie.ai/docs/modelscope) · [Huawei Cloud MaaS](https://usemagpie.ai/docs/huaweicloud) · [Xiaomi MiMo](https://usemagpie.ai/docs/xiaomi-mimo) · [StepFun](https://usemagpie.ai/docs/stepfun) · [LongCat](https://usemagpie.ai/docs/longcat) · [Qwen](https://usemagpie.ai/docs/qwen) · [MiniMax](https://usemagpie.ai/docs/minimax) · [Anthropic](https://usemagpie.ai/docs/anthropic) · [OpenAI](https://usemagpie.ai/docs/openai) · [Gemini](https://usemagpie.ai/docs/gemini) · [Grok](https://usemagpie.ai/docs/grok) · [Mistral](https://usemagpie.ai/docs/mistral) · [OpenRouter](https://usemagpie.ai/docs/openrouter) · [GitHub Copilot](https://usemagpie.ai/docs/copilot)

Every agent: [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Models in Codex](https://usemagpie.ai/docs/codex-models), [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models), [Models in OpenCode](https://usemagpie.ai/docs/opencode-models). Ask on [Discord](https://discord.gg/vGSnD3ZKQF) if you get stuck.

---

Source: https://usemagpie.ai/docs/anthropic

# Anthropic in Claude Code, Codex, Gemini CLI and OpenCode

Anthropic serves Claude on its Messages API, at `api.anthropic.com`. Add an Anthropic API key to magpie once, and Claude Code, Codex, Gemini CLI, OpenCode and every other agent you connect can use Claude models through magpie’s local gateway at `127.0.0.1:3425`, each agent with a model of its own. Agents that speak another API are translated on the way.

## Add Anthropic

1. **Get a key.** Make one on [console.anthropic.com](https://console.anthropic.com/settings/keys). An API key starts with `sk-ant-api`.
2. **Add the provider.** In magpie’s Providers tab, press ＋ Add provider, pick Anthropic, paste the key and save. magpie asks Anthropic which models the key can use.
3. **Pick it for an agent.** In the Agents tab, click the model on the agent’s row and choose a Claude model such as `claude-opus-5-5`.

```
magpie provider add anthropic <key>
magpie provider test anthropic
```

Model ids in magpie are `provider/model`, so Anthropic’s read `anthropic/claude-opus-5-5`: the provider, then Anthropic’s own id. The key is kept in magpie’s settings; magpie doesn’t take it from your shell.

Already set Anthropic up in OpenCode or Alma? magpie’s import from those apps brings it in as the Anthropic provider.

This page is about an API key. A Claude Pro or Max subscription is signed in to separately; see [Subscriptions in any agent](https://usemagpie.ai/docs/subscriptions).

## Endpoints

| API | Address | Used for |
| --- | --- | --- |
| Messages | `https://api.anthropic.com/v1/messages` | every agent’s requests: Claude Code’s as sent, Codex’s, Gemini CLI’s and OpenCode’s translated |
| Models | `https://api.anthropic.com/v1/models` | the model list |

magpie’s Anthropic provider has no Chat Completions or Responses address, so an agent that speaks either, or Google’s Gemini API, is translated to Messages and the reply translated back, streaming and tool calls included.

## Model list

magpie fetches the list from Anthropic, at `https://api.anthropic.com/v1/models`, every page of it, so agents see the models your key can use. Names, context windows and prices come from models.dev’s `anthropic` catalog. Pick the models agents see in the provider’s model list, or from the terminal:

```
magpie provider models anthropic +claude-opus-5-5 +claude-sonnet-5-5 +claude-haiku-5-5
magpie provider refresh-every anthropic 1d
```

Claude Opus 5.5, Sonnet 5.5 and Haiku 5.5 take 1M tokens. On a window that long, Codex compacts a conversation at 272K rather than send ever more of it on every turn; `magpie model compact off` lets it run to the whole window. In Claude Code a Claude model runs to its own window, as Anthropic runs it: 200K unless a `[1m]` one is picked.

## In each agent

```
magpie claude anthropic/claude-opus-5-5
magpie codex anthropic/claude-opus-5-5
magpie gemini model anthropic/claude-sonnet-5-5
magpie opencode anthropic/claude-sonnet-5-5
```

- **Claude Code.** speaks Anthropic Messages, so its requests go to Anthropic as Claude Code sent them, its own cache marks, thinking and betas included, with the fixes below. [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models).
- **Codex.** speaks OpenAI Responses, which Anthropic doesn’t serve. magpie translates each request to Messages and the reply back, marks the prompt for Anthropic’s cache, and keeps Claude’s signed thinking across a tool loop. [Models in Codex](https://usemagpie.ai/docs/codex-models).
- **Gemini CLI.** speaks Google’s Gemini API. magpie translates each request to Messages and the reply back. [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models).
- **OpenCode.** speaks Chat Completions to magpie, so its requests are translated to Messages too. [Models in OpenCode](https://usemagpie.ai/docs/opencode-models).

## What magpie does for Anthropic

A request magpie translates is built the way Anthropic’s Messages API wants it, and a few things Anthropic would refuse are fixed on Claude Code’s requests too:

- **Prompt caching..** Anthropic caches a prompt only up to a block marked with `cache_control`, and a request from another API has no marks. magpie marks the system prompt (or the last tool, when there is no system prompt) and the conversation’s last block, two marks at most, so the next turn reads what came before from the cache. A request that brings `cache_control` of its own keeps its marks, and magpie adds none.
- **An hour’s cache for Codex..** Codex’s turns are often more than five minutes apart, so the marks magpie adds to its requests last an hour, unless Codex asks `prompt_cache_retention` `in_memory`. An upstream that turns the hour’s `ttl` away is asked again with five-minute marks, and magpie remembers it.
- **Signed thinking..** Claude signs its thinking and wants it back on a tool loop’s next turn. Codex gets each thinking block, signature included, in its reasoning item’s `encrypted_content`, and magpie sends it back to Anthropic as it was; redacted thinking goes back sealed. Thinking with no signature is left out, and so is thinking another vendor signed, such as DeepSeek’s earlier in a routing group, which Claude refuses.
- **Tool calls..** A call an interrupted turn left unanswered gets a result saying it is unavailable, and a result for a call Anthropic never saw becomes text, where Anthropic would refuse the request. A history with calls but no tools declared declares them, with `tool_choice` none. A required tool goes as `any`, a named one as `tool`, and parallel calls turned off as `disable_parallel_tool_use`.
- **Sampling..** Opus 4.7 and later, Sonnet 5 and 5.5, Haiku 5.5 and Fable 5 refuse `temperature`, `top_p` and `top_k`, which Claude Code’s auto mode classifier sends. magpie leaves them out for those models.
- **Betas..** The betas an agent asks in `anthropic-beta` go on to Anthropic, save Claude Code’s own sign-in beta (`oauth-…`), which names a credential that never leaves magpie.
- **Structured output..** A request for JSON in a schema goes to Anthropic as `output_config.format`.

## Reasoning

- **Effort..** Claude models from 4.6 on think adaptively. A translated request’s effort goes as `output_config.effort`, with thinking adaptive and its summary shown (`display: summarized`), since Opus 4.7 and later leave the thinking text out unless asked. Opus and Sonnet 4.6 have no xhigh, so xhigh is asked as max.
- **Budgets..** Older Claude models get a thinking budget: 4,096 tokens at low, 10,000 at medium, 24,000 at high, 32,000 at xhigh and max, fitted under the request’s `max_tokens`.
- **A budget to a newer model..** A request with a thinking budget to a model from 4.6 on, which Claude Opus 5.5 refuses (“requires adaptive thinking”), goes as adaptive thinking, the budget asked as the nearest effort.
- **Reasoning off..** Codex’s or a Chat client’s effort none turns thinking off, not down to a low budget. Each model takes off its own way: Sonnet 5.5 is sent `between_tools`, an effort above high asked as high; Opus 5.5 and Fable 5 always think, so thinking is left out; Opus 5 and Haiku 5.5 are asked high in place of xhigh or max; older Claudes take it as sent. Claude Code’s requests with thinking off are fitted the same way.

## Web search

Anthropic searches the web itself. Claude Code’s WebSearch goes to Anthropic as it is. When Codex, Gemini CLI or a Chat client asks to search, magpie offers Claude Anthropic’s own `web_search_20250305` tool, up to five searches a request, rather than magpie’s searcher.

## Cost and usage

- **Cache tokens..** The Usage tab counts cache reads, five-minute cache writes and hour-long cache writes apart from the rest of the prompt, as Anthropic reports them.
- **Cost..** The Usage tab prices each call with Anthropic’s prices from models.dev. An hour-long write is priced at twice the input price where the catalog gives none, as Anthropic bills it. magpie reads no balance from Anthropic; type it in with `key-balance`, and the Usage page shows it less what magpie has priced the key’s calls at since.
- **Keeping the cache..** With several keys, a conversation stays on its key while its cache is worth keeping, 1,024 tokens or more, and still warm: read within the last five minutes, or within the hour when it was written for an hour.

## Several keys and failover

One Anthropic provider can hold several keys: press Add another key under it, or paste several at once. Requests go to the first key that’s on, and when it runs out or is rate limited the next one takes over.

- **Spend caps..** `spend-cap` stops a key at a dollar amount a day, a month or in all, as the Usage tab prices its calls; routing then goes on to the other keys and the fallbacks.
- **Fallbacks..** `fallback` names where requests go when Anthropic is out of quota or down: another provider’s model or a routing group.
- **Workspaces..** A key that reaches several workspaces names the one each request is for with the `anthropic-workspace-id` header. Add the provider again under an id of its own, with the header set in its Headers field or from the terminal; its models then read `anthropic-ws2/…`.

```
magpie provider spend-cap anthropic <key> 20 month
magpie provider key-balance anthropic <key> 25
magpie provider fallback anthropic deepseek/deepseek-v4-pro
magpie provider add anthropic <key> id=anthropic-ws2 name="Anthropic WS2" header.anthropic-workspace-id=wrkspc_…
```

## Troubleshooting

- **“requires adaptive thinking”..** A thinking budget sent to a model from 4.6 on. magpie sends it as adaptive thinking with the nearest effort; see Reasoning.
- **400 when thinking is turned off..** Sonnet 5.5, Opus 5.5 and Fable 5 each refuse `disabled`, and Opus 5 and Haiku 5.5 refuse it at xhigh and max. magpie sends each model off the way it takes it.
- **“`temperature` is deprecated for this model”..** magpie leaves `temperature`, `top_p` and `top_k` out for the models that refuse them.
- **“`tool_use` ids were found without `tool_result` blocks”..** An interrupted turn left a call unanswered. In a request magpie translates, the call gets a result saying it is unavailable.
- **“Invalid `signature` in `thinking` block”..** The conversation ran on another vendor first. magpie leaves thinking another vendor signed, or left unsigned, out of what goes to Claude.
- **A 400 about `cache_control` and `ttl`..** The upstream doesn’t take the hour-long marks magpie adds for Codex. magpie asks again with five-minute marks and keeps to them for that provider.
- **“this is an Anthropic API key, not a setup-token”..** The key went to the Claude subscription’s sign-in. Add it as the Anthropic provider instead.
- **Checking a key..** `magpie provider test anthropic` sends a tiny request through each endpoint, or to each model you name. Add `--as codex` or `--as claude-code` to send it the way that agent would.

Claude on AWS: [Amazon Bedrock in Claude Code, Codex and other agents](https://usemagpie.ai/docs/bedrock).

## FAQ

### How do I use an Anthropic API key in Claude Code?

Add your Anthropic API key in magpie (Providers, Add provider, Anthropic), then pick a Claude model such as `claude-opus-5-5` on Claude Code’s row, or run `magpie claude anthropic/claude-opus-5-5`. Claude Code speaks Anthropic Messages, so its requests go to `https://api.anthropic.com` as it sent them, with what the model would refuse fixed on the way.

### Can Codex use Claude models?

Yes. Codex speaks OpenAI Responses, which Anthropic doesn’t serve, so magpie translates each request to the Messages API and the reply back. It marks the prompt for Anthropic’s cache with marks that last an hour, and keeps Claude’s signed thinking across a tool loop in Codex’s `encrypted_content`. Run `magpie codex anthropic/claude-opus-5-5`.

### How do I use Claude in OpenCode through magpie?

Pick the model in magpie, or run `magpie opencode anthropic/claude-sonnet-5-5`. OpenCode speaks Chat Completions to magpie, so magpie translates its requests to Anthropic’s Messages API, marks the prompt for the cache and fits the reasoning effort to the model.

### Can Gemini CLI use Claude?

Yes. Gemini CLI speaks Google’s Gemini API, so magpie translates its requests to Anthropic’s Messages API and the replies back, streaming and tool calls included. Run `magpie gemini model anthropic/claude-sonnet-5-5`.

### Does magpie keep Anthropic’s prompt cache for agents it translates?

Yes. A request from Codex, Gemini CLI or OpenCode has no cache marks of its own, so magpie marks the system prompt and the conversation’s last block, two marks at most, and the next turn reads what came before from the cache. A request that brings its own `cache_control` keeps its marks. Codex’s marks last an hour, the rest five minutes.

### Why does Claude answer 400 when thinking is turned off?

Newer Claude models don’t all take `thinking` `disabled`. magpie sends Sonnet 5.5 `between_tools`, leaves thinking out for Opus 5.5 and Fable 5, which always think, and asks Opus 5 and Haiku 5.5 at high in place of xhigh or max. Older Claudes get it as sent.

**By provider:** [DeepSeek](https://usemagpie.ai/docs/deepseek) · [Kimi and Kimi Code](https://usemagpie.ai/docs/kimi) · [GLM Coding Plan](https://usemagpie.ai/docs/glm) · [Volcengine Ark](https://usemagpie.ai/docs/volcengine) · [Tencent Cloud](https://usemagpie.ai/docs/tencent-cloud) · [Baidu Qianfan](https://usemagpie.ai/docs/baidu-qianfan) · [SiliconFlow](https://usemagpie.ai/docs/siliconflow) · [ModelScope](https://usemagpie.ai/docs/modelscope) · [Huawei Cloud MaaS](https://usemagpie.ai/docs/huaweicloud) · [Xiaomi MiMo](https://usemagpie.ai/docs/xiaomi-mimo) · [StepFun](https://usemagpie.ai/docs/stepfun) · [LongCat](https://usemagpie.ai/docs/longcat) · [Qwen](https://usemagpie.ai/docs/qwen) · [MiniMax](https://usemagpie.ai/docs/minimax) · [OpenAI](https://usemagpie.ai/docs/openai) · [Gemini](https://usemagpie.ai/docs/gemini) · [Grok](https://usemagpie.ai/docs/grok) · [Mistral](https://usemagpie.ai/docs/mistral) · [OpenRouter](https://usemagpie.ai/docs/openrouter) · [GitHub Copilot](https://usemagpie.ai/docs/copilot) · [Ollama](https://usemagpie.ai/docs/ollama)

Every agent: [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Models in Codex](https://usemagpie.ai/docs/codex-models), [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models), [Models in OpenCode](https://usemagpie.ai/docs/opencode-models). Ask on [Discord](https://discord.gg/vGSnD3ZKQF) if you get stuck.

---

Source: https://usemagpie.ai/docs/openai

# OpenAI in Claude Code, Codex, Gemini CLI and OpenCode

OpenAI serves its models on two APIs at `api.openai.com`: Responses and Chat Completions. Its own models are best asked on Responses, and its newest answer only there. Add an OpenAI API key to magpie once, and Claude Code, Codex, Gemini CLI, OpenCode and every other agent you connect can use OpenAI’s models through magpie’s local gateway at `127.0.0.1:3425`, each agent with a model of its own. Codex’s requests go to OpenAI as they are; the other agents’ are translated on the way.

This page is about an API key from platform.openai.com. A ChatGPT Plus or Pro subscription is signed in to separately; see [Subscriptions in any agent](https://usemagpie.ai/docs/subscriptions).

## Add OpenAI

1. **Get a key.** Make one on [platform.openai.com](https://platform.openai.com/api-keys). It starts with `sk-`.
2. **Add the provider.** In magpie’s Providers tab, press ＋ Add provider, pick OpenAI, paste the key and save. magpie asks OpenAI which models the key can use.
3. **Pick it for an agent.** In the Agents tab, click the model on the agent’s row and choose an OpenAI model such as `gpt-6.1-sol`.

```
magpie provider add openai <key>
magpie provider test openai
```

Model ids in magpie are `provider/model`, so OpenAI’s read `openai/gpt-6.1-sol`: the provider, then OpenAI’s own id. The key is kept in magpie’s settings; magpie doesn’t take it from your shell.

Already set OpenAI up in OpenCode or another app magpie imports from? The import brings it in as the OpenAI provider.

## Endpoints

| API | Address | Used for |
| --- | --- | --- |
| Responses | `https://api.openai.com/v1` | OpenAI’s own models, ids starting `gpt-`, `codex` or `o` and a digit: Codex’s requests as they are, Claude Code’s, Gemini CLI’s and OpenCode’s translated |
| Chat Completions | `https://api.openai.com/v1` | the model list, and any other model the key lists |

magpie’s OpenAI provider has no Anthropic Messages address, so Claude Code’s requests are always translated. For OpenAI’s own models magpie keeps Responses first even for an agent that speaks Chat Completions. When OpenAI answers that a model is served only on `/v1/responses`, magpie asks again there and remembers it. To send a model on one API yourself:

```
magpie model api openai/gpt-5.5 chat
magpie model api openai/gpt-5.5 --reset
magpie model apis openai
```

**Azure OpenAI** is a provider of its own, Azure OpenAI. Give it your resource’s endpoint, `https://<resource>.openai.azure.com`, and its key. magpie uses the v1 API under `/openai/v1` for Chat Completions and Responses, sends the key in the `api-key` header, and lists the resource’s deployments as its models. A deployment named for its model, such as `gpt-5-codex`, goes to Responses first too.

## Model list

magpie fetches the list from OpenAI, at `https://api.openai.com/v1/models`, so agents see the models your key can use. Names, context windows, reasoning levels and prices come from models.dev’s `openai` catalog. A reasoning model OpenAI has just listed, before its levels are known, gets those of the newest reasoning model in its family: `gpt-6.1-sol` got `gpt-6-sol`’s. Pick the models agents see in the provider’s model list, or from the terminal:

```
magpie provider models openai +gpt-6.1-sol +gpt-6-luna +gpt-5.5
magpie provider refresh-every openai 1d
```

## In each agent

```
magpie claude openai/gpt-6.1-sol
magpie codex openai/gpt-6.1-sol
magpie gemini model openai/gpt-6.1-sol
magpie opencode openai/gpt-6.1-sol
```

- **Claude Code.** speaks Anthropic Messages, which OpenAI doesn’t serve. magpie translates each request to Responses and the reply back; the model’s reasoning summary reaches Claude Code as thinking, then the text. [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models).
- **Codex.** speaks Responses, so its requests go to OpenAI as they are: its custom tools such as `apply_patch`, its reasoning items and its own `prompt_cache_key` included. Codex is also offered Fast here; see Reasoning. [Models in Codex](https://usemagpie.ai/docs/codex-models).
- **Gemini CLI.** speaks Google’s Gemini API. magpie translates each request to Responses and the reply back. [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models).
- **OpenCode.** speaks Chat Completions. OpenAI’s own models go to Responses first, so magpie translates its requests there and the replies back; any other model the key lists gets OpenCode’s requests as they are. [Models in OpenCode](https://usemagpie.ai/docs/opencode-models).

## What magpie does for OpenAI

- **A prompt cache key..** A translated request to OpenAI that carries no `prompt_cache_key` gets one, made from the session the agent names, or else its first user message, and hashed, so it names nothing of the agent. Codex sends its own, which goes on as it is, and one you set yourself wins. If OpenAI answers 400 over the field, magpie asks again without it.
- **Tools loaded where they were loaded..** A tool that Claude Code’s tool search loads mid-conversation is sent to OpenAI’s Responses API as an `additional_tools` item at that point, not added to the tool list, which keeps the cached prefix. `additional-tools=off` puts it with the other tools.
- **Sealed reasoning from elsewhere..** OpenAI reads only its own sealed reasoning (`encrypted_content`). An item sealed under another key, organization or account is refused (“could not be verified”); magpie asks again without those items and remembers it for the conversation. Claude’s thinking, which Codex carries in a reasoning item after a turn on a Claude model, is taken out before the request reaches OpenAI.
- **Earlier responses..** A Responses client may send only a turn’s new input and name the response it follows (`previous_response_id`). magpie keeps each response it gave such a client, in memory and under the caller’s gateway key. OpenAI keeps responses too, so when the same key answered the one named, OpenAI is sent only the new input after its own id. Codex over HTTP says `store` false and names none.
- **Codex’s own compaction..** With `compaction=native`, Codex’s compaction is asked of OpenAI as Codex sent it and the sealed item comes back to Codex as it came. Only the key that sealed it can read it, so later requests carrying it go only there. The default, `compaction=magpie`, has magpie summarise.

```
magpie provider set openai compaction=native
magpie provider set openai additional-tools=off
```

## Reasoning

- **Effort..** The effort an agent asks for is fitted to the nearest level the model has, as the catalog lists them: `gpt-6-sol` has `none`, `low`, `medium`, `high`, `xhigh` and `max`. On Responses it is sent as `reasoning.effort`, with `summary` set to `auto`, so the model’s reasoning summary comes back.
- **Reasoning off..** When an agent whose requests magpie translates, such as Gemini CLI, turns reasoning off and the model lists `none` among its levels, magpie asks for none.
- **Encrypted reasoning..** magpie passes on what an agent asks to include, but asks for `reasoning.encrypted_content` only with reasoning: OpenAI refuses it of a model that doesn’t reason. Codex sends the sealed items back on the next turn, and magpie passes them on as they are.
- **Fast..** On an OpenAI key, Codex is offered Fast for GPT and o-series models. magpie sends it as `service_tier: "priority"`, OpenAI’s priority processing. A service tier set for Codex in magpie overrides what Codex asked.

## Web search

OpenAI’s Responses API searches the web itself. When an agent offers its model web search, as Codex and Claude Code do, magpie gives the model OpenAI’s own `web_search` tool on Responses, and OpenAI runs the search.

## Cost and usage

- **Cost..** The Usage tab prices each call with OpenAI’s prices from models.dev.
- **Cache tokens..** When a reply reports cached prompt tokens, the Usage tab counts them apart from the rest of the prompt.
- **Keeping the cache..** With several keys, a conversation stays on its key while its cache is worth keeping, 1,024 tokens or more, and still warm, read within the last five minutes.
- **Service tier..** Each call records the tier the agent asked for, the one magpie sent, and the one OpenAI’s reply says it ran at.
- **Balance..** magpie reads no balance from OpenAI; type it in with `key-balance`, and the Usage page shows it less what magpie has priced the key’s calls at since.

## Several keys and failover

One OpenAI provider can hold several keys: press Add another key under it, or paste several at once. Requests go to the first key that’s on, and when it runs out or is rate limited the next one takes over. To keep keys apart instead, say from two organizations, add the provider again: the second is `openai-2`.

- **Spend caps..** `spend-cap` stops a key at a dollar amount a day, a month or in all, as the Usage tab prices its calls; routing then goes on to the other keys and the fallbacks.
- **Fallbacks..** `fallback` names where requests go when OpenAI is out of quota or down: another provider’s model or a routing group.

```
magpie provider spend-cap openai <key> 20 month
magpie provider key-balance openai <key> 25
magpie provider fallback openai deepseek/deepseek-v4-pro
```

## Troubleshooting

- **“The encrypted content for item rs_… could not be verified”..** The conversation carries reasoning sealed under another key, organization or account. magpie asks again without those items; see What magpie does.
- **A model that answers only on `/v1/responses`..** magpie moves it to Responses and remembers it. `magpie model apis openai` shows which API each model is asked on.
- **A 400 over `prompt_cache_key`..** magpie asks again without the key it added.
- **Checking a key..** `magpie provider test openai` sends a tiny request through each endpoint, or to each model you name. Add `--as codex` or `--as claude-code` to send it the way that agent would.

[Azure OpenAI in Codex, Claude Code and other agents](https://usemagpie.ai/docs/azure)

## FAQ

### How do I use OpenAI’s models in Claude Code?

Add your OpenAI API key in magpie (Providers, Add provider, OpenAI), then pick a model such as `gpt-6.1-sol` on Claude Code’s row, or run `magpie claude openai/gpt-6.1-sol`. OpenAI serves no Anthropic Messages API, so magpie translates Claude Code’s requests to OpenAI’s Responses API at `https://api.openai.com/v1` and the replies back, the reasoning summary as thinking.

### Can Codex use an OpenAI API key instead of a ChatGPT sign-in?

Yes. Add the key, then run `magpie codex openai/gpt-6.1-sol`. Codex speaks Responses, so its requests go to OpenAI as they are, custom tools and reasoning included, and Fast is sent as priority processing. A ChatGPT Plus or Pro sign-in is set up separately, in Subscriptions.

### How do I use GPT models in OpenCode?

Pick the model in magpie, or run `magpie opencode openai/gpt-6.1-sol`. OpenCode speaks Chat Completions, but OpenAI’s own models go to Responses first, so magpie translates OpenCode’s requests there and the replies back. To send a model on Chat Completions instead, run `magpie model api openai/gpt-5.5 chat`.

### Can Gemini CLI use OpenAI?

Yes. Gemini CLI speaks Google’s Gemini API, so magpie translates its requests to OpenAI’s Responses API and the replies back, streaming and tool calls included. Run `magpie gemini model openai/gpt-6.1-sol`.

### Does magpie keep OpenAI’s prompt cache?

Yes. Codex’s own `prompt_cache_key` goes on as it is. A translated request without one gets a key made from its session or first user message, hashed so it names nothing of the agent. With several keys, a conversation stays on its key while its cache is warm.

### Why does OpenAI say the encrypted content could not be verified?

OpenAI reads only reasoning it sealed for the same key, organization or account. When a conversation carries reasoning sealed elsewhere, magpie asks again without those items and remembers it for the conversation.

### Does magpie support Azure OpenAI?

Yes, as its own provider, Azure OpenAI. Give it the resource’s endpoint and key; magpie uses the v1 API under `/openai/v1`, sends the key in the `api-key` header and lists the resource’s deployments as models.

**By provider:** [DeepSeek](https://usemagpie.ai/docs/deepseek) · [Kimi and Kimi Code](https://usemagpie.ai/docs/kimi) · [GLM Coding Plan](https://usemagpie.ai/docs/glm) · [Volcengine Ark](https://usemagpie.ai/docs/volcengine) · [Tencent Cloud](https://usemagpie.ai/docs/tencent-cloud) · [Baidu Qianfan](https://usemagpie.ai/docs/baidu-qianfan) · [SiliconFlow](https://usemagpie.ai/docs/siliconflow) · [ModelScope](https://usemagpie.ai/docs/modelscope) · [Huawei Cloud MaaS](https://usemagpie.ai/docs/huaweicloud) · [Xiaomi MiMo](https://usemagpie.ai/docs/xiaomi-mimo) · [StepFun](https://usemagpie.ai/docs/stepfun) · [LongCat](https://usemagpie.ai/docs/longcat) · [Qwen](https://usemagpie.ai/docs/qwen) · [MiniMax](https://usemagpie.ai/docs/minimax) · [Anthropic](https://usemagpie.ai/docs/anthropic) · [Gemini](https://usemagpie.ai/docs/gemini) · [Grok](https://usemagpie.ai/docs/grok) · [Mistral](https://usemagpie.ai/docs/mistral) · [OpenRouter](https://usemagpie.ai/docs/openrouter) · [GitHub Copilot](https://usemagpie.ai/docs/copilot) · [Ollama](https://usemagpie.ai/docs/ollama)

Every agent: [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Models in Codex](https://usemagpie.ai/docs/codex-models), [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models), [Models in OpenCode](https://usemagpie.ai/docs/opencode-models). Ask on [Discord](https://discord.gg/vGSnD3ZKQF) if you get stuck.

---

Source: https://usemagpie.ai/docs/intent

# Intent routing

Send a turn to a model by what the user asks for: tests to the strong model, quick questions to the fast cheap one. You describe each kind in a few words. When a turn begins, a small model you choose picks which kind the message is.

Intent is one of the conditions a [routing group’s rule](https://usemagpie.ai/docs/start#rules) can have, next to length, images, reasoning and agent. This page describes exactly what magpie does with it, as of v0.1.99, so you can predict every decision and check it in the Routing tab.

> **In one paragraph.** magpie decides once per turn: when you send a message, not while the agent works through tool calls. If a rule with an intent could be the first to match, magpie asks the group’s *classifier* model one short question through its own gateway. The question holds the intents as a numbered list plus the text of your latest message, and the classifier answers with a number. magpie reads that number and checks the rules top first with it. The first rule that matches puts its model first, and the group’s other models stay behind it for failover. The turn then stays on that model until you speak again. If the classifier fails, times out or answers something else, no intent matches and the turn is routed as if those rules weren’t there. There are no embeddings, no keyword lists and no training: the model you pick reads your message and picks a number.

## Set it up

You need a [routing group](https://usemagpie.ai/docs/start#routing) with at least two models, and one more model to classify with. The classifier can be any model magpie has, in the group or not.

1. **Open the group.** Go to Routing, find the group under *Routing groups* and click Edit.
2. **Add a rule with an intent.** Click Add a rule. The new rule reads asks for → a model, with the intent box ready: type what the message asks for, such as *writing or fixing tests*, then pick the model after →. More conditions come from the rule’s +, and must hold too.
3. **Pick the classifier.** Intent told by appears once a rule has an intent, set to Jev when you have a TypeSafe provider. Otherwise choose a small, fast model without reasoning. A group whose effort Jev already picks offers the same under its classifier: It can pick the model too. A group can’t be saved with an intent and no classifier.
4. **Save, and send a message.** Changes apply from the next turn, with no restart. The Routing tab shows what the classifier said and where the turn went.

The timeout is global: in Settings → Models → Replies → Intent classifier timeout, choose 8, 15, 30 or 60 seconds. It defaults to 15 seconds and applies to the next classifier call, including Jev, with no restart. A slow classifier may need longer, but the turn waits for it before routing. In `~/.config/magpie/settings.json`, `"classifyTimeout"` accepts whole seconds from 1 to 60; 0 or a missing field uses 15. A custom value in that range appears as its own choice in Settings.

The same from a terminal:

```
magpie group rule add coder use=deepseek/deepseek-v4-flash intent="a quick question" classifier=groq/llama-3.1-8b-instant
magpie group rule add coder use=deepseek/deepseek-v4-pro intent="writing or fixing tests"
magpie group rule add coder use=deepseek/deepseek-v4-pro use-effort=low intent="a simple edit"   # the same model, asked for low reasoning
magpie group rule coder                           # the rules, numbered, and the classifier
magpie group rule classifier coder groq/llama-3.1-8b-instant   # change the classifier
magpie group rule mv coder 3 1                    # order matters: top first
magpie group rule rm coder 2
```

`intent=` also takes the spellings `asks=` and `about=`. `classifier=` also takes `classify=` and `by=`. `classifier=` on `rule add` sets the group’s classifier and is needed only the first time. The classifier is saved in the group’s record in `~/.config/magpie/providers.json` as `"classifier"`, and each rule as `{"use": …, "intent": …}`.

A rule can also set the reasoning its model is asked for, so an intent picks the model and the effort as a pair: `use-effort=` (`low`, `medium`, `high`, `xhigh` or `max`), saved as `"useEffort"`, such as `{"use": "deepseek/deepseek-v4-pro", "intent": "a simple edit", "useEffort": "low"}`. In the editor it is set from the rule’s ⋯ menu, Set its reasoning, and shows beside the model. The rule’s model is then asked for that effort on the turn’s requests, whatever the agent asked, at the model’s nearest level. A model whose levels magpie doesn’t know is asked as the agent asked, and so are the models the group fails over to. A model fixed at an effort in the group keeps its own. Without it, the model is asked as the agent asked. The Routing tab says when a rule set the effort.

## How a turn is routed

Every request an agent sends to a group with rules goes through these steps, in this order:

1. **Is this a new turn?.** magpie looks at the request’s last user message. If it carries text or an image and no tool result, you just spoke, so a new turn begins. If it carries tool results, the agent is continuing a turn already under way (see The rest of the turn). Turns are counted per conversation. A subagent is its own conversation: it shares its agent’s session but starts with different words.
2. **Which intents could decide?.** magpie walks the rules top first and ignores intent for now: a rule is a candidate if its other conditions (tokens, images, reasoning, agents) hold for this request. Each candidate’s intent is collected, and duplicates spelled the same apart from case count once. The walk stops at the first candidate *without* an intent, because that rule matches outright and nothing below it could come first. If no intents were collected, the classifier isn’t asked and costs nothing.
3. **Ask the classifier.** magpie sends the classifier the collected intents and the text of your message. The exact prompt is shown below. The call goes through magpie’s own gateway, like a request from an agent, so it uses that model’s provider with its keys or accounts and their failover. It has the configured timeout to answer (15 seconds by default).
4. **Read the answer.** magpie takes the first whole number in the reply. `1` to `n` names that intent, and `0` means none of them. Anything else, such as no number or one out of range, counts as a failure. The answer is kept for 10 minutes for the same message and intents.
5. **Match the rules.** The rules are checked top first with the answer. A rule with an intent matches only when the classifier named its intent, compared without case, and all its other conditions hold. The first rule that matches wins. If none matches, the group routes the turn as it always does.
6. **Order the models.** The winning rule’s model goes first, and the group’s other models follow in their usual order as failover. This holds even if another model answered the conversation’s last turn: a rule outranks the Stays setting as a turn begins. If the rule’s model has nothing ready right now (every key resting, the provider off), the group’s usual order stands and the trace says so.
7. **Remember the decision.** magpie keeps the decision for this conversation (the group, the agent’s session and the conversation’s first words) with the classifier’s answer, so the rest of the turn follows it.

### An example

The Coder group above has three rules:

| # | When | Send to |
| --- | --- | --- |
| 1 | ≥ 128000 tokens | kimi/kimi-k2.5 |
| 2 | asks for “a quick question” | deepseek/deepseek-v4-flash |
| 3 | asks for “writing or fixing tests” | deepseek/deepseek-v4-pro |

- A 20k-token turn: rule 1 doesn’t hold, so both intents are candidates. The classifier is asked to choose between “a quick question” and “writing or fixing tests”.
- A 150k-token turn: rule 1 has no intent and holds, so the walk stops there. The classifier isn’t asked, and the turn goes to Kimi.
- The classifier says `0` (none): no rule matches, and the turn goes by the group’s routing (here *In order*, so deepseek-v4-pro first).

### In the app

A real request through a group with two intent rules (“a quick question or explanation, with no code to write or change” and “writing or fixing tests”), sent from Claude Code: “Add unit tests for the LRU cache in cache.go, covering eviction and concurrent reads and writes”. The Routing tab shows it as it happens.

## What the classifier sees

This is the whole request, and nothing else is sent. The system message is fixed. The user message lists your intents in rule order, as they were collected in step 2:

```
You route a user's message to a coding assistant by what it asks for. Given numbered kinds of request and the user's message, answer with the number of the kind the message is, or 0 if it is none of them. Answer with the number only.
```

```
Kinds:
1. a quick question
2. writing or fixing tests

The user's message:
<message>
Write unit tests for the parseTokens function and fix any that fail.
</message>

The number of its kind (0 for none):
```

- **Only your latest message..** magpie sends the text parts of the last user message and nothing else: no earlier turns, no system prompt, no tool definitions, no files.
- **Images aren’t sent..** A message that is only an image has no words to classify, so no intent matches. To route by images, use the rule’s has an image condition.
- **Agent reminders are removed..** `<system-reminder>…</system-reminder>` blocks, which Claude Code adds to your message, are stripped. Other text an agent puts in the same message is kept.
- **Long messages are shortened..** Over 4,000 characters, magpie keeps the first 3,000 and the last 1,000, joined by `…`. The start and the end usually say what is being asked.
- **The request settings..** An OpenAI-style chat completion, not streamed, with `temperature 0`, `max_tokens 2048` and User-Agent `magpie-router/1`. When magpie knows the classifier’s reasoning levels, it asks for the least: `none` if the model has it, else its lowest level (for example `low`). When the levels aren’t known, nothing is sent and the vendor’s default applies. magpie translates it for the classifier’s provider, like any other request, so an Anthropic, Gemini or other model works too.

## When it can’t say

A classifier is a helper, not a gate. Whatever happens to it, the turn is still answered: the intent rules just don’t match.

| What happens | What magpie does |
| --- | --- |
| It answers `0` | No intent matches. Rules without an intent and the group’s usual order decide. |
| No answer within the configured timeout | Treated as a failure: no intent matches, and the turn goes on at once. |
| An error (quota, 5xx, bad key) | Its provider’s own failover is tried first, within the configured timeout. If it still fails, no intent matches. |
| An answer that isn’t a number from 0 to n | No intent matches this turn. The classifier did answer, so it isn’t rested: the next turn asks it again. |
| An error or a timeout | That classifier model is left alone for 30 s: turns in that time don’t wait on it, and the trace says it wasn’t asked. The first good answer clears this. |
| The message has no words | Not asked. No intent matches. |

Each case is written in the turn’s trace with the reason. An intent rule can therefore make a turn go to a different model than you hoped, but it can’t make it fail.

## The rest of the turn

A turn is often dozens of requests: the agent calls a tool, sends the result back, calls another, and so on. magpie deals with them like this:

- **Held..** Every request within the turn goes to the model the turn began on, and the classifier isn’t asked again. Switching models mid-turn would throw away what the vendor cached of the conversation (prompt caching), and some vendors reject reasoning that another one wrote.
- **Failover sticks..** If the rule’s model failed and another member answered, that member keeps the rest of the turn (with Stays on *Auto*, *Session* or *Within a turn*). The rule decides again at your next message.
- **Outgrown..** The one exception: if the conversation grows within the turn to 95% of the current model’s context, magpie checks the rules again, keeping the classifier’s earlier answer. If a rule sends it to a model with *more* context, it moves. It never moves to a model with less.
- **Waits..** If magpie didn’t see the turn begin (it was started or restarted in the middle of one), or the rule that decided it was removed or now sends to another model, no rule moves the turn. The rules decide again at your next message.
- **Subagents..** A subagent’s turns are decided on their own, from the subagent’s own messages. A rule can send a subagent elsewhere while its agent stays where it is.

Decisions are kept in memory for 24 hours after a conversation’s last request. Restarting magpie clears them, and the next message decides afresh.

## Reading the trace

The Routing tab shows each group’s latest request: who answered it, and under How the last request was routed, why.

The lines you can see about intent:

| The trace says | Meaning |
| --- | --- |
| … was asked which of “A”, “B” turn 1 is, and said “B” (in 323 ms). | The classifier was asked, with these candidates, and named B. |
| … and said none (…). | It answered 0. |
| … (said before, for the same message). | The answer came from the 10-minute cache, so no call was made. |
| … was to tell which … but couldn’t — *reason* — so no rule with an intent matches it. | It failed. The reason is the error, the timeout, what it answered, or that it is resting after a failure. |
| Turn N begins and rule R matches — asks for “B” — so M goes first … | The rule that won, and the model put first. |
| Rule R matches, but M has no account or key that can take this request, so the group’s order stands. | No account or key for the rule’s model can take this request. |
| Rule R (…) sent turn N to M as it began; the turn stays there. | A tool round within the turn, held on its decision. |
| This turn began before magpie saw it, so the rules wait for the next one. | See *Waits* above. |

The classifier’s own calls appear in Usage under the agent *magpie*, with their tokens and cost, so you can see what classifying costs.

## Latency, cost, privacy

- **Latency..** Only the first request of a turn waits for the classifier, typically a few hundred milliseconds on a fast provider (323 ms in the screenshot) with a configured timeout of 15 seconds by default. Tool rounds within the turn, turns where no intent could decide, and cached answers add nothing.
- **Cost..** One short call per turn: roughly the size of your message plus the intents in, and one or two tokens out. In the example above that was 212 tokens in and 1 out. With a subscription model as the classifier, these calls count against that subscription’s limits.
- **Privacy..** The text of your message (up to about 4,000 characters) goes to the classifier’s provider. To keep it on your machine, use a local model from Ollama or LM Studio as the classifier. magpie keeps only a hash of the message and the answer, in memory, for 10 minutes. The message itself isn’t stored or logged.

## Writing good intents

- **Describe the request, not the model..** Write “writing or fixing tests”, not “hard tasks for Opus”. The classifier sees only your words and the message.
- **Keep kinds apart..** If two intents overlap (“a question”, “a question about the code”), a small model will choose between them unpredictably. Merge them, or make the difference plain.
- **Few and broad beats many and narrow..** Two to five intents are easy for an 8B model. Up to 200 characters each is allowed, but a few words are usually enough.
- **Order still matters..** Only the first matching rule counts, so put a rule that must win (such as a long-context rule) above the intent rules. The classifier is then skipped whenever that rule holds.
- **“None” is a real answer..** A turn that fits no intent goes to the group’s usual order, so let that order be your default choice.
- **Any language..** Intents and messages can be in any language the classifier understands. The fixed prompt is in English, and small models read mixed languages well.
- **Choosing a classifier..** Pick a small, fast model without reasoning: Llama 3.1 8B on Groq, a Flash-Lite, nano or mini model, Claude Haiku, DeepSeek’s non-reasoning chat model, or a local model. A reasoning model is slower; magpie asks it for its least reasoning and leaves it 2048 tokens, but a slow one can still miss the configured timeout. Check the trace for a few turns: if it guesses wrong, rewrite the intents before switching models.

## Numbers

| What | Value |
| --- | --- |
| Classifier timeout | 15 s by default; configurable from 1 to 60 s, including its provider’s failover |
| Rest after a failure | 30 s, per classifier model |
| Answer cache | 10 min, per classifier + intents + message; in memory |
| Turn decisions kept | 24 h after the conversation’s last request; in memory |
| Message sent | Up to 4,000 characters; longer is first 3,000 + last 1,000 |
| Classifier request | temperature 0, max_tokens 2048, the least reasoning the model has, not streamed |
| Intent length | Up to 200 characters; spaces collapsed, compared without case |
| Outgrown | At 95% of the current model’s context, only to a model with more |

## FAQ

### Is this embeddings or a vector search?

No. There is no embedding model, no similarity threshold, no keyword list and nothing to train. The classifier is an ordinary chat model that reads your intents and your message and answers with a number. It is only as good as that model and your wording, and the trace shows every answer.

### Does it look at the whole conversation?

No, only the message you just sent. So a follow-up like “now do the same for the other file” is judged on those words alone. Give that turn a clearer message, or add an intent that fits follow-ups.

### My agent made 40 requests for one message. Was the classifier asked 40 times?

No, once. The other 39 carried tool results, so they belong to the same turn and follow its decision. You can see this in the trace (“the turn stays there”) and in Usage (one *magpie* call).

### Can a turn switch models halfway?

Only in two cases: the model it is on fails and another member takes over, or the conversation outgrows the model’s context and a rule sends it to one with more room. Intent is never re-asked mid-turn.

### What if the classifier is down or slow?

The turn still goes through. After waiting up to the configured timeout (15 s by default), no intent matches and the group’s other rules and order decide. For the next 30 s magpie doesn’t ask that classifier again, so turns don’t each wait out the timeout. The trace gives the reason.

### Why did the turn not go to the rule’s model when the classifier named its intent?

Check the trace. The usual causes are:

- a rule above it matched first;
- another condition on the rule didn’t hold (tokens, images, reasoning or agent);
- no account or key for the rule’s model could take this request;
- it was a tool round in a turn that began elsewhere;
- magpie didn’t see the turn begin (“the rules wait”).

### Two rules have the same intent. What happens?

The intent is offered to the classifier once. If it is chosen, the first of those rules whose other conditions hold wins. Use this to send, for example, “writing or fixing tests” from Codex to one model and from Claude Code to another.

### Does changing a rule affect a turn already running?

No. Saving applies from the next turn. A turn whose rule you removed, or pointed at another model, keeps where it is until then; the trace says the rules wait.

### Can the classifier be a routing group, or one of the group’s own models?

It can’t be a group: it must be one model, `provider/model`, which magpie checks when you save. It can be any model magpie has, including one of the group’s members, a subscription model or a local model.

### Can I use a reasoning model?

Yes, if it answers within the configured timeout (15 s by default). magpie asks it for the least reasoning it has (`none`, else its lowest level) and leaves 2048 tokens, so thinking doesn’t crowd out the answer. A small, fast model is still the better choice: cheaper, and every turn waits for it.

### How well does it work with real models?

We ran 20 real coding messages (English and Chinese: quick questions, test work, and ordinary coding tasks, including “Fix the bug in parseTokens and add a test for it”) through a group with two intent rules. DeepSeek V4 Flash, GLM-5.3 Flash and MiMo v2.6 Flash each classified all 20 correctly; the median classifier time was 0.75 s, 1.3 s and 1.9 s. Gemini 3.8 Flash through one reseller took 11 s even at `low` reasoning, so with the 8 s timeout that was the default then every turn timed out and routed as if there were no intents — the trace said so each time. That is the pattern to expect: a wrong classifier costs you the routing, never the turn.

### Does retrying the same message ask again?

Not within 10 minutes: the same message with the same intents and the same classifier is answered from the cache, and the trace says “said before”. Changing an intent or the classifier makes it ask again.

### Which agents does it work with?

Any agent that sends to a routing group through magpie: Claude Code, Codex, OpenCode, Gemini CLI and the rest. Turns are detected from the request itself (a message with text and no tool results), whatever API the agent speaks.

### Is my message stored anywhere?

magpie keeps a hash of it (for the cache) and the classifier’s answer, in memory only. The text goes to the classifier’s provider, like any request, under that provider’s terms. The classifier’s usage record holds its token counts, not the text.

### How accurate is it?

That depends on the classifier and on how distinct your intents are. With a few clearly different kinds, a small model picks well; with overlapping ones it will sometimes guess. Since a wrong or missing answer only changes which model answers, start with two or three broad intents, watch the trace for a day and adjust the wording.

Questions or a setup worth sharing? Ask on [Discord](https://discord.gg/vGSnD3ZKQF). Routing groups in general are covered in [Get started](https://usemagpie.ai/docs/start#routing).

---

Source: https://usemagpie.ai/docs/masking

# Privacy masking

magpie can mask what your agents send before it leaves this computer. API keys, passwords and tokens, and when you ask, emails, phone numbers and words of your own, go to the vendor as placeholders such as `{{API_KEY_es6eu6jk}}`. In the reply each placeholder turns back into its value, so your agent and your files keep the real thing and the vendor never sees it. It runs on this computer, in magpie’s gateway, and is **off by default**.

> **It covers what goes through magpie.** An agent [connected to magpie](https://usemagpie.ai/docs/start) sends its requests through the gateway, and they are masked whichever provider or account answers. An agent that calls a vendor directly, not through magpie, is not covered.

## Turn it on

1. **Open the page.** Go to Settings → Privacy.
2. **Mask secrets.** Under What to mask, set Mask secrets to On: API keys, private keys, tokens and passwords.
3. **Personal data, if you want it.** Set Mask personal data to On for emails, phone numbers, ID and bank card numbers. Each further kind of personal data then gets its own switch below it.
4. **Your own words.** In Masked words, list names, codenames or hosts to keep from vendors, one on each row (several pasted with commas between become a row each). Masked words in any case makes *Nightjar* mask *NIGHTJAR* too. A secret magpie doesn’t know, such as your gateway’s own keys, goes under Masking rules: what it starts with, or a regular expression.
5. **Try it.** Paste a text into Try it to see exactly what the vendor would get. What you paste there isn’t kept.

It applies from the next request, with no restart and nothing to change in your agent. The work is done by the built-in plugin Privacy masking (`redact`, in Settings → Plugins), which is on whenever any masking is asked for.

There is no CLI command for it. Without the window (`magpie serve`, [Docker](https://usemagpie.ai/docs/docker)), open the same page with `magpie web`, or set it in `~/.config/magpie/settings.json` (`/config/magpie/settings.json` in Docker). The masker reads the file on every request:

```
{
  "redact": true,
  "redactPersonal": true,
  "redactWords": ["Nightjar", "db.acme-corp.cn"]
}
```

## What is masked

| Switch | What it finds |
| --- | --- |
| Mask secrets | Private key blocks (`-----BEGIN … PRIVATE KEY-----`). API keys by their shape: `sk-…` (OpenAI, Anthropic, OpenRouter), `ghp_`/`github_pat_`, `glpat-`, `AIza…`, `xox…-`, `sk_live_`, `AKIA`/`ASIA`, `hf_`, `gsk_`, `xai-`, `npm_`, `pypi-`, `dop_v1_`, `SG.`, Cloudflare's (`cfut_`, `cfat_`, `cfk_`, `cfoat_`, Origin CA `v1.0-`, tunnel tokens), and relay keys like `oc_sk_…`. JWTs. The password in `user:password@host`. The value of a field named for a secret, as `.env` files and configs have them: `DB_PASSWORD=…`, `api_key: …`, `client_secret`, `token`, `credential`. Your own Masking rules. Wallet private keys by the shape their wallets export: a Bitcoin WIF, a BIP32 `xprv`, an Ethereum or TRON `0x` key, a Solana key or `id.json` keypair, a Sui `suiprivkey1…`, an Aptos `ed25519-priv-0x…`, a Stellar seed, a NEAR `ed25519:…` key, a Nostr `nsec1…`, an age identity, a Zcash extended spending key, and a 12 to 25 word seed phrase after *seed* or *mnemonic* whose every word is in the BIP39 list. A key with no prefix of its own is masked only when it checks out: a WIF or `xprv` by its checksum, a Solana key by its public half, a Stellar seed by its CRC, so a Solana transaction signature goes as written. A `0x` key has the shape of a transaction hash, so it is masked only after a key&rsquo;s name (`PRIVATE_KEY=`, `--private-key`, `new Wallet(…)`, 私钥); a hash, a storage slot or a sha256 sum goes as written. An exchange&rsquo;s API key, secret and `passphrase` go by their fields&rsquo; names. |
| Mask personal data | Emails, mainland China mobile numbers (not an 11-digit id: one under `order_id` or after 订单号 goes as written), Chinese ID numbers and bank card numbers whose checksum adds up. Also on by default: US Social Security numbers, passport numbers (after *passport*, 护照 or パスポート), IBANs, birthdays (next to *birthday*, *DOB* or 生日, and over a year ago, so today&rsquo;s date stays), MAC addresses and serial numbers (after *S/N*). Off until you turn them on, since agents send them in nearly every request: the user name in home folders (sent as a made-up name, the same every turn, so the model reads a real folder rather than a placeholder), user and computer names (`user@host`), public IP addresses (sent as a name such as `public-ip-kvxqmrtz`, so the model still knows the address is public and connects with it, and the real address goes back into its commands) and cloud storage buckets. A wallet or contract address (`0x` and 40 hex digits) is public and goes as written; a private key is still masked. |
| Masked words | Each word you listed, exactly, as `{{TERM_…}}`. A date, such as *1990-05-12*, matches that day however it is written: *1990/5/12*, *1990.05.12*, *1990年5月12日*, *19900512*, *May 12, 1990*, and *13/05/1990* style only where the day can’t be read as a month. Never another date or a version like *1990.5.12.1*. |
| Find with a local model | Under How it’s found. A model on this computer finds what no rule can: a name or an address in free text. It is on unless you turned it off, and AstrLink Guard downloads with the first masked request; until it is on disk, the rules mask alone. It needs Mask secrets or Mask personal data on, and finds under the same switches. The menu beside it picks the model: AstrLink Guard (Chinese and English, a 39 MB download, few false alarms in code, on a Mac it runs on the Neural Engine; the default) or OpenAI’s Privacy Filter (1.6 GB, uses the GPU, masks more ordinary values in code). Confidence threshold under it is how sure the model must be before a value is masked: Privacy Filter’s default is 0.5, AstrLink Guard’s 0.8, its publisher’s. Higher masks fewer ordinary values, and lets more real names and addresses through: the rules after the model drop most false alarms already, so the default is where we measured the fewest real values lost. The models are kept in magpie’s cache folder. To keep them elsewhere (on Windows, off the C: drive), open Advanced under the model and choose Models folder › Move…: what is downloaded is copied there, checked, and only then deleted from the old place; Move back returns it. |

A placeholder is the kind plus eight characters of a keyed hash. The same value gets the same placeholder every time, so the conversation reads the same turn after turn and the vendor’s prompt cache stays valid. The values are held in memory only.

## An example

With Mask secrets and Mask personal data on and *Nightjar* in Masked words, your agent sends:

```
Deploy Nightjar with OPENAI_API_KEY=sk-proj-8fK2mQx7Lp4Rt9Vw3Yz6Ab1Cd, then mail li.wei@acme-corp.cn or call 13800138000.
```

```
Deploy {{TERM_5hmsrhdc}} with OPENAI_API_KEY={{API_KEY_srhjgvja}}, then mail {{EMAIL_eh5um6mb}} or call {{PHONE_uf7iy2qq}}.
```

When the model answers *“I set OPENAI_API_KEY to {{API_KEY_srhjgvja}} in .env”*, your agent reads the real key there, in streamed text and tool-call arguments alike, so the file it writes has the real key. A placeholder the model rewrote a little (spaces inside the braces, another case) is still turned back.

## Check that it works

- **Before:.** Try it on Settings → Privacy shows the text as the vendor would get it, with each value’s kind.
- **Each request:.** a shield badge with a count appears on the request in the Gateway page’s recent calls and in the Routing log. Point at it for the kinds; click it to open the request’s record.
- **Over time:.** Insights → Masking (also What was masked on the Privacy page) shows the values masked over 7 or 30 days by kind, agent and provider, and each request’s text as the vendor saw it, placeholders marked.

The records are kept in `~/.config/magpie/masking` for 30 days: the agent, provider, model, and each placeholder’s kind, length and first characters, never the value.

## When a value is found

Under When a value is found, choose per kind:

- Mask (the default): sent as a placeholder.
- Warn: sent as written, and the badge counts it in amber.
- Block: the request is held back with a 400, *“magpie held this request back: Settings › Privacy blocks API_KEY, and it has one (sk-…, 33 characters). Nothing was sent.”* The message never has the value.

A value the task needs as it is, such as a team address or a test key, goes in Never mask: it is sent as written wherever it is found whole.

## What it leaves alone, and limits

- **Thinking stays as the vendor wrote it..** A thinking block with its signature, Gemini’s thoughts and Responses’ encrypted reasoning are sealed by the vendor and go back unchanged, so the signature still matches. Only values already masked elsewhere in the request are swapped in them.
- **Ids and tool definitions go as written:.** model ids, message and call ids, UUIDs, tool names, MCP server names, and tool schemas (their descriptions are masked), so a vendor or a tool can still check them.
- **Images and file data are sent as they are..** Text inside a screenshot is not masked.
- **It fails closed..** If masking is on and can’t run (the Privacy masking plugin turned off by hand, or the local model you turned on can’t answer), the request gets a 503 that says nothing was sent. It is never sent unmasked instead. The model on by default that can’t answer leaves the rules to mask alone.
- **A provider can skip it..** Send requests unmasked on a provider sends its requests as written: a model on this computer or your local network (Ollama, LM Studio), and, if you choose, any other provider, a subscription or a plugin’s provider too. Turned on for one that isn’t local, the editor says its vendor gets your requests unmasked. A request that can fall back to a provider still masked is masked. `magpie provider set ollama unmasked=yes` does the same.
- **Or send what masking would change to one of them..** In Settings › Privacy, Instead of masking, send to picks such a model. An agent’s request that masking would change then goes to it as written, so it can answer about the real names, and a request with nothing to mask goes where it was going. If that model fails, the request fails: it is never masked and sent to a vendor instead. Off by default.
- **The model sees placeholders..** It can’t read or reason about a masked value; it can only pass it on. Put a value it must read under Never mask.
- **Rules find shapes..** A phone number in another country’s format or a name in free text needs Find with a local model, or your own Masked words and Masking rules. Try your own text in Try it first.

See also [Privacy](https://usemagpie.ai/docs/privacy) for everything magpie sends by itself. The code is [internal/redact](https://github.com/yetone/magpie/tree/main/internal/redact) and [internal/masking](https://github.com/yetone/magpie/blob/main/internal/masking/masking.go).

---

Source: https://usemagpie.ai/docs/claude-desktop

# Claude Desktop on any model

Claude Desktop has a third-party gateway mode: no Anthropic sign-in, and its Code and Cowork tabs work on any plan. magpie sets Desktop up in that mode with magpie’s gateway, so Desktop runs on any model you have in magpie: DeepSeek, Kimi, GLM, Qwen, an OpenAI key, or a ChatGPT or Copilot subscription.

In its gateway mode Claude Desktop sends every request to one address instead of Anthropic. magpie writes that mode and a profile named magpie, pointing at its gateway, `http://127.0.0.1:3425`, into Desktop’s configuration folders. The gateway speaks Anthropic’s Messages API and translates each request for the model you picked, streaming, tool calls and reasoning included. It works on macOS, Windows (the Store package too) and Linux.

## Turn it on

1. **Add providers in magpie.** In the Providers tab, add an API key or sign in to a subscription.
2. **Choose magpie on Claude Desktop’s row.** In the Agents tab, Claude Desktop’s row offers magpie: Desktop’s third-party gateway, Code and Cowork on magpie’s models, no Anthropic sign-in.
3. **Quit and reopen Claude Desktop.** Desktop reads this only as it starts.

```
magpie claude-desktop magpie      # Desktop on magpie's gateway
magpie claude-desktop default     # back to the Anthropic sign-in
```

## Pick a model

Desktop lists the gateway’s models when it starts, so its model picker shows the models you have in magpie. A model with a 1M context window is listed once, as its 1M entry. After you add a provider in magpie, quit and reopen Desktop to see its models.

## The Code tab’s tiers

The Code tab runs Claude Code, which asks for models by tier: opus, sonnet, haiku. Left unset, a tier runs on the chat’s model. Pick a model for a tier on Claude Desktop’s row, or from a terminal, and restart Desktop after a change:

```
magpie claude-desktop sonnet deepseek/deepseek-v4-pro
magpie claude-desktop haiku deepseek/deepseek-v4-flash
```

A picked model runs with the prompt of the Claude model of its tier. The row also has a subagent model, which takes effect without a restart.

## Your chats and projects

Desktop keeps its gateway mode in a profile of its own, so chats and projects from your Anthropic sign-in don’t show while it runs on magpie. Nothing is deleted, and switching back brings them back. To go on with them on magpie, use Settings → Import in Desktop, which copies in your Claude.ai chats and projects and leaves the originals as they are.

## A separate Claude Magpie app (Mac)

On a Mac, magpie can run Desktop’s gateway mode in a folder of its own, started by `~/Applications/Claude Magpie.app`. Your own Claude Desktop stays signed in with Anthropic, and both run side by side. It is off by default.

```
magpie claude-desktop launcher add      # make Claude Magpie.app
magpie claude-desktop launcher remove
```

## Switch back

Take Claude Desktop’s row off magpie, or run `magpie claude-desktop default`, then quit and reopen Desktop. magpie puts Desktop’s files back as they were, and your chats from before are there again.

## FAQ

### Do I need a Claude subscription for Cowork and the Code tab?

No. In gateway mode, Desktop’s Code and Cowork tabs work without an Anthropic sign-in, on whatever model magpie serves.

### Can I use my ChatGPT subscription in Claude Desktop?

Yes. Sign in to ChatGPT in magpie, and its GPT models appear in Desktop’s model picker after a restart.

### Why doesn’t Claude Desktop show a new model?

Desktop reads the model list as it starts. Quit and reopen it.

### Why is Claude Desktop in English on magpie?

Desktop’s gateway-mode window has no translation of its own. Switching back brings your language back.

### Are my old chats gone?

No. They stay in Desktop’s own profile and come back when you switch back, or you can import them with Settings → Import.

The same models in the terminal: [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models) and [ChatGPT in Claude Code](https://usemagpie.ai/docs/claude-code-chatgpt). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/openclaw

# OpenClaw on any model

OpenClaw answers you on WhatsApp, Telegram, Discord and more, on whatever model its config names. magpie adds itself to OpenClaw as one provider, so OpenClaw can run on any model you have in magpie: DeepSeek, Kimi, GLM, Qwen, an OpenAI key, or a ChatGPT or Copilot subscription, with no key pasted into OpenClaw.

OpenClaw keeps its settings in `~/.openclaw/openclaw.json`. magpie adds a provider named magpie there: its gateway’s `/v1` address, OpenAI’s chat completions API, a key of OpenClaw’s own, and one entry per model you have in magpie. Then it makes the model you pick OpenClaw’s default. The gateway translates each request for that model’s provider, tool calls and reasoning included.

## Connect OpenClaw

1. **Add providers in magpie.** In the Providers tab, add an API key or sign in to a subscription.
2. **Pick a model on OpenClaw’s row.** In the Agents tab, choose a model on OpenClaw’s row. OpenClaw takes it up without a restart.

```
magpie openclaw deepseek/deepseek-v4-pro    # OpenClaw on DeepSeek
magpie openclaw                             # what OpenClaw runs on now
```

## Pick a model

In OpenClaw a model is named `provider/model`, so magpie’s models show up as `magpie/deepseek/deepseek-v4-pro`, `magpie/openai/gpt-6.1` and so on. magpie sets the primary model and keeps your fallbacks. If your config has a list of allowed models, magpie adds `magpie/*` to it so its models aren’t refused. A model whose context magpie doesn’t know is given 128K.

## Chats that already have a model

A change to the default model reaches new chats at once. A chat that already has a model keeps it: send `/model default` in that chat to move it onto the new one.

## What magpie writes

Only `models.providers.magpie`, the default model, and the allow list when you have one. Your other providers, channels and keys stay as you wrote them, and so do keys you add to magpie’s provider yourself (headers, timeoutSeconds, a model’s maxTokens). A model set for one agent (`agents.entries.*.model`) stays yours, and a config split with `$include` isn’t changed.

magpie finds the file where OpenClaw does: `$OPENCLAW_CONFIG_PATH`, else `openclaw.json` in `$OPENCLAW_STATE_DIR`, else `~/.openclaw-<profile>` for `$OPENCLAW_PROFILE`, else `~/.openclaw`. A file written in JSON5 that isn’t plain JSON is left alone, and magpie says so.

## Switch back

Take OpenClaw’s row off magpie, or run `magpie openclaw default`. magpie removes its provider and puts back the model OpenClaw ran on before, as long as magpie’s model is still the default; a model you picked since stays.

## FAQ

### Can OpenClaw use my ChatGPT subscription?

Yes. Sign in to ChatGPT in magpie and pick a GPT model on OpenClaw’s row. OpenClaw sends its requests to magpie, which uses the subscription.

### Do I need to restart OpenClaw?

No. OpenClaw’s gateway takes up a change of models and default model by itself. Chats that already have a model keep it until you send /model default there.

### Does magpie touch my channels or other providers?

No. It writes only its own provider, the default model and, if you have one, the allow list.

### I use an OpenClaw profile. Does magpie find it?

Yes. It reads OPENCLAW_PROFILE, OPENCLAW_STATE_DIR, OPENCLAW_CONFIG_PATH and OPENCLAW_HOME the way OpenClaw does.

More agents on the same models: [Models in OpenCode](https://usemagpie.ai/docs/opencode-models), [Hermes Agent on any model](https://usemagpie.ai/docs/hermes), [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models) and [nanobot on any model](https://usemagpie.ai/docs/nanobot). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/hermes

# Hermes Agent on any model

Hermes Agent, from Nous Research, runs on the model its config.yaml names. magpie adds itself to Hermes as one provider, so Hermes and each of its bots can run on any model you have in magpie: DeepSeek, Kimi, GLM, Qwen, an OpenAI key, or a ChatGPT or Copilot subscription, with no key pasted into Hermes.

Hermes keeps its settings in `~/.hermes/config.yaml` (`%LOCALAPPDATA%\hermes` on Windows, or `$HERMES_HOME`). magpie adds a provider named magpie to its `providers`: the gateway, spoken to as chat completions, with your models in magpie as its models. Then it points `model.provider` at it and sets `model.default` to the model you pick. The provider and model you had are kept aside and put back when you switch back.

## Connect Hermes

1. **Add providers in magpie.** In the Providers tab, add an API key or sign in to a subscription.
2. **Pick a model on Hermes Agent’s row.** In the Agents tab, choose a model on Hermes Agent’s row.
3. **Restart open Hermes sessions.** Hermes reads its settings as it starts.

```
magpie hermes deepseek/deepseek-v4-pro    # Hermes on DeepSeek
magpie hermes                             # what Hermes runs on now
```

## Model and reasoning effort

In Hermes’s own model picker, magpie’s models are named `magpie/<provider>/<model>`. The row also sets the reasoning effort, the same setting as Hermes’s `/reasoning`: none, minimal, low, medium, high or xhigh. Left unset, Hermes asks for medium.

```
magpie hermes effort high
magpie hermes effort default    # back to Hermes's own
```

## Bots and profiles

Each Hermes bot is a profile with a config.yaml of its own. magpie connects the profile `hermes` starts in: the one `$HERMES_HOME` names, else the one `hermes profile use` made sticky, else the default. It also adds its provider to every other profile, so magpie’s models are in every bot’s picker. A bot’s own model is left as you set it. With more than one profile, each other bot gets a model picker of its own on the Agents page; a bot still on the model magpie last set follows the next one, until you pick one for it.

## Your own models stay

Pick one of your own models in Hermes, or on the Agents page, and Hermes runs on it, but magpie’s provider stays: Hermes is still connected, and its picker still offers magpie’s models beside yours. Only switching back takes the provider out.

Hermes inside WSL on Windows is found too: magpie writes the distro’s `~/.hermes`, with the gateway at the address the distro reaches it.

## Switch back

Take Hermes Agent’s row off magpie, or run `magpie hermes default`. magpie removes its provider from every profile, puts back the provider and model you had, and leaves each bot on a model it can start with. Connecting again puts the bots back on the models they had.

## FAQ

### Can Hermes Agent use my ChatGPT subscription?

Yes. Sign in to ChatGPT in magpie and pick a GPT model on Hermes Agent’s row. Hermes sends its requests to magpie, which uses the subscription.

### I picked a model in magpie but my bot still uses the old one.

Restart the bot’s Hermes session: Hermes reads config.yaml as it starts. A bot you gave a model of its own on the Agents page doesn’t follow the main one.

### Why does Hermes still say connected after I picked my own model?

magpie’s provider stays so its models remain in Hermes’s picker. Switch back to take it out.

### Does magpie touch my other Hermes providers?

No. It adds its own provider and changes only model.provider, model.default and, when you set it, the reasoning effort.

More agents on the same models: [OpenClaw on any model](https://usemagpie.ai/docs/openclaw), [Models in OpenCode](https://usemagpie.ai/docs/opencode-models) and [Cline on any model](https://usemagpie.ai/docs/cline). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/cline

# Cline on any model

Cline runs on the provider and model in its settings. magpie sets Cline’s built-in OpenAI-compatible provider to magpie’s gateway, so Cline’s CLI, VS Code extension and desktop app can run on any model you have in magpie: DeepSeek, Kimi, GLM, Qwen, an OpenAI key, or a ChatGPT or Copilot subscription, with no key pasted into Cline.

Cline keeps its providers in `~/.cline/data/settings/providers.json` (or under `$CLINE_DIR`). magpie sets Cline’s own openai-compatible provider to the gateway’s address with a key of Cline’s own, makes it the provider in use, and lists magpie’s models for it in `models.json`, in place of the one model that provider lists by itself. What was there, and the provider you used, are kept aside and put back when you switch back. The gateway translates each request for the model’s provider, tool calls and reasoning included.

## Connect Cline

1. **Add providers in magpie.** In the Providers tab, add an API key or sign in to a subscription.
2. **Pick a model on Cline’s row.** In the Agents tab, choose a model on Cline’s row.
3. **Start a new Cline session.** Cline reads its provider as a session starts: open sessions keep the model they have, new ones use this.

```
magpie cline deepseek/deepseek-v4-pro    # Cline on DeepSeek
magpie cline                             # what Cline runs on now
```

## Model and reasoning effort

The row also sets the reasoning effort Cline asks for: none, low, medium, high or xhigh. None turns thinking off, as Cline’s own picker does.

```
magpie cline effort high
magpie cline effort default    # back to Cline's own
```

## The VS Code extension

Cline’s VS Code extension uses the same folder but reads the provider, model, address and key from its own state first: the Act and Plan modes’ provider and model, and the OpenAI-compatible key. magpie sets those too, keeping what they were. The extension reads them once, as it starts, so after a change run Developer: Reload Window in VS Code.

## The desktop app

Cline’s desktop app keeps the model and effort you pick in its own composer and doesn’t read them from these files. magpie’s models are in its picker, under magpie: pick one there. magpie’s row sets the CLI and the VS Code extension.

## Switch back

Take Cline’s row off magpie, or run `magpie cline default`. magpie puts back the provider you used, the model list, and the extension’s settings as they were.

## FAQ

### Can Cline use my ChatGPT subscription?

Yes. Sign in to ChatGPT in magpie and pick a GPT model on Cline’s row. Cline sends its requests to magpie, which uses the subscription.

### I changed the model but Cline still uses the old one.

A session keeps the model it started with. Start a new one; for the VS Code extension, reload the window.

### Why doesn’t magpie add its own provider to Cline?

Cline refuses a provider it doesn’t know when a session starts, so magpie uses Cline’s built-in OpenAI-compatible provider instead.

### Does this work in Cline’s desktop app?

Its picker lists magpie’s models under magpie; pick the model there, since the app doesn’t read it from Cline’s files.

More agents on the same models: [Models in OpenCode](https://usemagpie.ai/docs/opencode-models), [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Hermes Agent on any model](https://usemagpie.ai/docs/hermes), [Goose on any model](https://usemagpie.ai/docs/goose) and [Zoo Code on any model](https://usemagpie.ai/docs/zoo-code). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/goose

# Goose on any model

Goose, Block’s open-source agent, runs on the provider and model in its config. magpie adds itself to Goose as a custom provider, so Goose’s CLI and desktop app can run on any model you have in magpie: DeepSeek, Kimi, GLM, Qwen, an OpenAI key, or a ChatGPT or Copilot subscription, with no key pasted into Goose.

Goose keeps its settings in `~/.config/goose/config.yaml` (under `$XDG_CONFIG_HOME` if set; `%APPDATA%\Block\goose\config` on Windows). magpie writes a custom provider, `custom_providers/magpie.json` beside it, with the gateway’s address, a key of Goose’s own and magpie’s models, then makes it the provider Goose uses. The gateway translates each request for the model’s provider, tool calls and reasoning included. A Goose in WSL is set up the same way, reaching the gateway as the distro sees it.

## Connect Goose

1. **Add providers in magpie.** In the Providers tab, add an API key or sign in to a subscription.
2. **Pick a model on Goose’s row.** In the Agents tab, choose a model on Goose’s row. The picker also lists the models of providers Goose is set up with itself.
3. **Restart Goose.** Goose loads its custom providers as it starts: quit and reopen the desktop app, and open `goose` sessions again.

```
magpie goose deepseek/deepseek-v4-pro    # Goose on DeepSeek
magpie goose                             # what Goose runs on now
```

## Model and thinking effort

Each model magpie lists for Goose carries its context window, so Goose doesn’t have to guess it, and whether it takes a thinking level. The row also sets `GOOSE_THINKING_EFFORT`, the effort Goose asks of a model that thinks: off, low, medium, high or max.

```
magpie goose effort high
magpie goose effort default    # back to Goose's own
```

## What magpie writes

Goose has two layouts for the provider in use: `active_provider` with `providers.magpie.model`, and the older `GOOSE_PROVIDER` and `GOOSE_MODEL`. magpie writes the one your config already uses. Keys you added to magpie’s provider file yourself, such as `timeout_seconds`, `headers` or `toolshim`, stay when magpie rewrites the models.

## Switch back

Pick one of your own providers’ models on Goose’s row, take the row off magpie, or run `magpie goose default`. Once Goose no longer uses a model of magpie’s, magpie removes its provider file.

## FAQ

### Can Goose use my ChatGPT subscription?

Yes. Sign in to ChatGPT in magpie and pick a GPT model on Goose’s row. Goose sends its requests to magpie, which uses the subscription.

### Goose doesn’t show magpie’s models.

Goose reads custom providers only as it starts. Quit and reopen Goose, and start a new goose session.

### Does this work in the Goose desktop app?

Yes. The CLI and the desktop app read the same config, so both use the model on Goose’s row after a restart.

### Does it work with goose in WSL?

Yes. magpie sets up a Goose in a WSL distro too, with the gateway’s address as the distro reaches it.

More agents on the same models: [Models in OpenCode](https://usemagpie.ai/docs/opencode-models), [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Cline on any model](https://usemagpie.ai/docs/cline) and [Droid on any model](https://usemagpie.ai/docs/droid). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/droid

# Droid on any model

Droid, Factory’s coding agent, can run on custom models of your own. magpie adds the models you have in magpie to Droid as custom models, so droid can run on DeepSeek, Kimi, GLM, Qwen, an OpenAI key, or a ChatGPT or Copilot subscription, with no key pasted into Droid.

Droid keeps its settings in `~/.factory/settings.json` (under `$FACTORY_HOME_OVERRIDE` when set). magpie adds one entry to its `customModels` per model in magpie, with the gateway’s address and a key of Droid’s own, and sets `sessionDefaultSettings.model`, the model sessions start on. Each model goes on the API its provider speaks, Anthropic Messages, OpenAI Responses or Chat Completions, so the gateway relays it as it is. A droid in WSL is set up the same way, reaching the gateway as the distro sees it.

## Connect Droid

1. **Add providers in magpie.** In the Providers tab, add an API key or sign in to a subscription.
2. **Pick a model on Droid’s row.** In the Agents tab, choose a model on Droid’s row.
3. **Restart droid.** Droid reads its settings as it starts: open sessions keep what they have, so start droid again.

```
magpie droid deepseek/deepseek-v4-pro    # Droid on DeepSeek
magpie droid                             # what Droid runs on now
```

## Models and thinking levels

magpie’s models are in droid’s `/model` picker too, under Custom models, so you can switch inside a session. A model that reasons is given a starting effort, so the picker offers its levels (off, low, medium and high); one that is a model Droid has built in takes Droid’s own levels and default. A model whose name Droid reads as OpenAI’s or Claude’s is written on the API Droid expects for it, so Droid doesn’t warn at each session start.

## Your own models

Custom models you added yourself stay as they were, ahead of magpie’s, so their ids don’t move. If you change a field of one of magpie’s entries in settings.json, such as its name or effort, magpie keeps your value; only the address and key are put back at each sync. The older `~/.factory/config.json` is left alone.

## Switch back

Take Droid’s row off magpie, or run `magpie droid default`. magpie removes its custom models and puts back the default model you had.

## FAQ

### Can Droid use my ChatGPT subscription?

Yes. Sign in to ChatGPT in magpie and pick a GPT model on Droid’s row. droid sends its requests to magpie, which uses the subscription.

### I changed the model but droid still uses the old one.

Droid reads its settings as it starts. Restart droid, or switch with /model inside the session.

### Why does /model show no thinking levels for a model?

That model doesn’t reason. For one that does, magpie gives it a starting effort, and droid then offers its levels.

### Will magpie touch my own BYOK models?

No. Your custom models stay as they were and in front of magpie’s.

More agents on the same models: [Models in OpenCode](https://usemagpie.ai/docs/opencode-models), [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Goose on any model](https://usemagpie.ai/docs/goose) and [Zed on any model](https://usemagpie.ai/docs/zed). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/zed

# Zed on any model

Zed’s agent panel runs on the language model provider in its settings. magpie adds itself to Zed as an OpenAI-compatible provider, so Zed’s agent can run on any model you have in magpie: DeepSeek, Kimi, GLM, Qwen, an OpenAI key, or a ChatGPT or Copilot subscription, with no key pasted into Zed.

Zed keeps its settings in `~/.config/zed/settings.json` on macOS and Linux (under `$XDG_CONFIG_HOME` if set) and in `%APPDATA%\Zed` on Windows. magpie adds `language_models.openai_compatible.magpie`, with the gateway’s address and magpie’s models, and sets `agent.default_model` to the model you pick. Zed reads the change as it runs. The gateway translates each request for the model’s provider, tool calls and reasoning included.

## Connect Zed

1. **Add providers in magpie.** In the Providers tab, add an API key or sign in to a subscription.
2. **Pick a model on Zed’s row.** In the Agents tab, choose a model on Zed’s row.
3. **Open Zed’s agent panel.** The model is the panel’s default, and magpie’s models are in its model picker under magpie.

```
magpie zed deepseek/deepseek-v4-pro    # Zed's agent on DeepSeek
magpie zed                             # what Zed runs on now
```

## The API key

Zed keeps an OpenAI-compatible provider’s key in the system’s credential store, keyed by the provider’s address, not in settings.json. magpie saves a key of Zed’s own there for you: in the Keychain on macOS, in the Secret Service on Linux and in the Credential Manager on Windows. If Zed still asks for an API key, restart Zed.

## Models and thinking

Each model carries its context window and reply limit, so Zed knows when to compact, and whether it takes images. A model that thinks is written with `reasoning_effort` high, or the strongest level it has, so Zed shows its thinking switch and levels. A level you set on a model in settings.json yourself, `none` included, stays when magpie rewrites the list. If Zed reaches the gateway through a proxy of yours, magpie keeps that address.

## Switch back

Pick one of Zed’s own models on its row, take the row off magpie, or run `magpie zed default`. magpie puts back the default model, and the provider entry, you had before.

## FAQ

### Can Zed use my ChatGPT subscription?

Yes. Sign in to ChatGPT in magpie and pick a GPT model on Zed’s row. Zed sends its requests to magpie, which uses the subscription.

### Zed asks for an API key for magpie.

magpie saved the key in the system credential store. Restart Zed so it reads it.

### Why doesn’t Zed show a thinking switch for a model?

That model doesn’t think. For one that does, magpie sets reasoning_effort, and Zed then shows the switch.

### Does this change Zed’s edit predictions?

No. magpie sets the agent panel’s default model and adds a provider; edit predictions are left as they were.

More agents on the same models: [Models in OpenCode](https://usemagpie.ai/docs/opencode-models), [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Droid on any model](https://usemagpie.ai/docs/droid) and [Crush on any model](https://usemagpie.ai/docs/crush). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/crush

# Crush on any model

Crush, Charm’s coding agent for the terminal, runs on the providers in its config. magpie adds itself to Crush as a provider, so Crush can run on any model you have in magpie: DeepSeek, Kimi, GLM, Qwen, an OpenAI key, or a ChatGPT or Copilot subscription, with no key pasted into Crush.

Crush’s config is `~/.config/crush/crush.json` (under `$XDG_CONFIG_HOME` if set; `%LOCALAPPDATA%\crush` on Windows). magpie adds `providers.magpie` there, with the gateway’s address, a key of Crush’s own and magpie’s models, and sets the models Crush runs on. The gateway translates each request for the model’s provider, tool calls and reasoning included. A Crush in WSL is set up the same way, reaching the gateway as the distro sees it.

## Connect Crush

1. **Add providers in magpie.** In the Providers tab, add an API key or sign in to a subscription.
2. **Pick a model on Crush’s row.** In the Agents tab, choose Crush’s large model, and its small one if you like.
3. **Start crush.** magpie’s models are in Crush’s own model picker too, under magpie.

```
magpie crush deepseek/deepseek-v4-pro     # Crush's large model on DeepSeek
magpie crush small deepseek/deepseek-v4-flash
magpie crush                              # what Crush runs on now
```

## Large, small and effort

Crush has two model slots: `large` for the work and `small` for lighter tasks. Each can be any model, magpie’s or one of your own providers’. The row also sets the large model’s `reasoning_effort`: low, medium or high.

```
magpie crush effort high
magpie crush effort default    # back to Crush's own
```

## The two files

Crush saves the models its own picker chooses to a data file, `~/.local/share/crush/crush.json` (under `$XDG_DATA_HOME` if set), which wins over the config. So magpie writes the picks there too, where Crush writes them, and its provider stays in the config. When magpie picks a model, settings Crush’s picker saved for the previous model, such as its `max_tokens`, are dropped, so a limit meant for one model doesn’t reach another. Keys you added to magpie’s provider yourself stay when magpie rewrites the models.

## Switch back

Pick one of your own providers’ models for both slots, take the row off magpie, or run `magpie crush default`. Once neither slot uses a model of magpie’s, magpie removes its provider from crush.json.

## FAQ

### Can Crush use my ChatGPT subscription?

Yes. Sign in to ChatGPT in magpie and pick a GPT model on Crush’s row. Crush sends its requests to magpie, which uses the subscription.

### Which wins, a pick in magpie or one in Crush?

The latest. Both are saved to Crush’s data file, so the last model picked, on Crush’s row or in Crush’s own picker, is the one Crush uses.

### What is Crush’s small model for?

Lighter tasks next to the main work. Set it on Crush’s row as small, to any model.

### Does it work with Crush in WSL?

Yes. magpie sets up a Crush in a WSL distro too, with the gateway’s address as the distro reaches it.

More agents on the same models: [Models in OpenCode](https://usemagpie.ai/docs/opencode-models), [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Zed on any model](https://usemagpie.ai/docs/zed), [Raycast on any model](https://usemagpie.ai/docs/raycast) and [jcode on any model](https://usemagpie.ai/docs/jcode). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/raycast

# Raycast on any model

Raycast AI takes models of your own as custom providers (Raycast Pro, on Mac and Windows). magpie adds itself to Raycast as one, so Quick AI, AI Chat and AI Commands can run on any model you have in magpie: DeepSeek, Kimi, GLM, Qwen, an OpenAI key, or a ChatGPT or Copilot subscription, with no key pasted into Raycast.

Raycast reads its custom providers from `~/.config/raycast/ai/providers.yaml` in your user folder, on Mac and on Windows. magpie adds one entry to its `providers` list, with the id `magpie`: the gateway’s OpenAI-compatible address, a key of Raycast’s own and magpie’s models. Raycast watches the file, so the models show up without a restart. The gateway translates each request for the model’s provider, tool calls and reasoning included.

## Connect Raycast

1. **Add providers in magpie.** In the Providers tab, add an API key or sign in to a subscription.
2. **Put magpie on Raycast’s row.** In the Agents tab, set Raycast’s provider to magpie.
3. **Pick a model in Raycast.** Open Raycast’s model picker in Quick AI, AI Chat or an AI Command. magpie’s models are listed under magpie.

```
magpie raycast magpie     # magpie's models in Raycast AI's picker
magpie raycast            # what Raycast is set to now
```

On Windows, Raycast makes its config folder when you open Reveal Providers Config in its settings; magpie finds Raycast by that folder there.

## Which models it lists

The model is picked in Raycast, not in a file, so Raycast’s picker lists the models picked for Raycast on the Agents page. Hide one there and it leaves Raycast’s list. Each model comes with its name, context window and abilities, all spelled out, because Raycast assumes tools and vision off when they aren’t:

- **Tools.** on for every model, so AI Extensions work.
- **Vision.** on for a model that takes images.
- **Reasoning effort.** on for a model with effort levels.
- **Temperature.** off for a model that refuses it.

## Your providers.yaml

magpie writes only its own entry. Your other providers, the top-level `tools` block and your comments stay. So do keys you add to magpie’s entry yourself, such as `include_user_email`, `additional_parameters` or a model’s `description`. The file is written only when magpie’s entry would change.

## Switch back

Take Raycast’s row off magpie, or run `magpie raycast default`. magpie removes its entry, the `providers` list too if it was the only one, and the file if nothing else is left in it.

## FAQ

### Do I need Raycast Pro?

Yes. Custom providers are a Raycast Pro feature, so magpie’s models show in Raycast’s picker on a Pro plan.

### Can Raycast use my ChatGPT subscription?

Yes. Sign in to ChatGPT in magpie and put magpie on Raycast’s row, then pick a GPT model in Raycast. Raycast sends its requests to magpie, which uses the subscription.

### Do I need to restart Raycast?

No. Raycast watches providers.yaml and picks up magpie’s entry when it changes.

### Do AI Extensions work?

Yes. Every model is listed with tools on, and the gateway carries tool calls to each model’s provider.

More agents on the same models: [Models in OpenCode](https://usemagpie.ai/docs/opencode-models), [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Obsidian on any model](https://usemagpie.ai/docs/obsidian), [Crush on any model](https://usemagpie.ai/docs/crush) and [Copilot CLI on any model](https://usemagpie.ai/docs/copilot-cli). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/copilot-cli

# Copilot CLI on any model

GitHub Copilot CLI can run on model providers of your own (bring your own key), which needs no GitHub sign-in. magpie adds itself to Copilot CLI as one, so `copilot` can run on any model you have in magpie: DeepSeek, Kimi, GLM, Qwen, an OpenAI key, or a ChatGPT subscription, with no key pasted into Copilot.

Copilot CLI keeps its folder in `~/.copilot` (or `$COPILOT_HOME`). Its own providers are in `providers.json` there (or `$COPILOT_PROVIDERS_CONFIG`). magpie adds a provider named `magpie` to that file, OpenAI-compatible, with the gateway’s address and a key of Copilot’s own, and adds magpie’s models beside it, each with its name, context window and output limit. Then it sets `model` in `settings.json` to `magpie/<model>`. The gateway translates each request for the model’s provider, tool calls and reasoning included.

## Connect Copilot CLI

1. **Add providers in magpie.** In the Providers tab, add an API key or sign in to a subscription.
2. **Pick a model on Copilot CLI’s row.** In the Agents tab, choose a model under magpie.
3. **Start copilot.** It runs on that model. Copilot’s own `/model` lists magpie’s models too.

```
magpie copilot deepseek/deepseek-v4-pro    # settings.json: magpie/deepseek/deepseek-v4-pro
magpie copilot                             # what Copilot CLI runs on now
```

The row also lists Copilot’s own models and `auto`, Copilot’s own choice, for when you want GitHub’s models back.

## Effort

The row sets `effortLevel`, which Copilot saves beside the model: the model’s own levels, or low, medium, high and xhigh when Copilot’s list doesn’t name them. Copilot clears it when its own `/model` changes the model.

```
magpie copilot effort high
magpie copilot effort default
```

## Your providers.json

magpie owns only the provider named magpie and the models that name it. Your other providers, their models and any other key in the file stay where they are, and so does a key you add to magpie’s provider yourself. A providers.json that isn’t valid JSON is left alone, never written over. When magpie’s models change, magpie brings its entries up to date, and writes the file only when they would change.

## Switch back

Pick one of Copilot’s own models on the row, or run `magpie copilot default`. That removes `model` from settings.json and takes magpie’s provider and models out of providers.json, leaving the rest.

## FAQ

### Do I need a GitHub Copilot subscription?

No. Copilot CLI’s own providers need no GitHub sign-in, so magpie’s models work without a Copilot plan.

### Can Copilot CLI use my ChatGPT subscription?

Yes. Sign in to ChatGPT in magpie and pick a GPT model under magpie on Copilot CLI’s row. Copilot sends its requests to magpie, which uses the subscription.

### Why does settings.json say magpie/deepseek/…?

Copilot names a model of one of its providers as provider/model, and magpie’s provider is called magpie. On the command line you can leave the magpie/ out.

### Can I keep my own BYOK providers?

Yes. magpie only touches its own provider and models in providers.json; yours stay as they are.

More agents on the same models: [Models in OpenCode](https://usemagpie.ai/docs/opencode-models), [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Raycast on any model](https://usemagpie.ai/docs/raycast) and [Qwen Code on any model](https://usemagpie.ai/docs/qwen-code). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/qwen-code

# Qwen Code on any model

Qwen Code, the `qwen` coding agent from the Qwen team, takes models of your own in its settings. magpie adds its models there, so qwen can run on any model you have in magpie, not only Qwen: DeepSeek, Kimi, GLM, an OpenAI or Anthropic key, or a ChatGPT or Copilot subscription, with no key pasted into qwen.

Qwen Code keeps its settings in `~/.qwen/settings.json` (under `$QWEN_HOME` if set). magpie appends one entry per model to `modelProviders.openai` there, each with the gateway’s address, the model’s id, its name as qwen’s `/model` shows it, and its context window. Then it points `model` at your pick. The gateway translates each request for the model’s provider, tool calls and reasoning included. A Qwen Code in WSL is set up the same way.

## Connect Qwen Code

1. **Add providers in magpie.** In the Providers tab, add an API key or sign in to a subscription.
2. **Pick a model on Qwen Code’s row.** In the Agents tab, choose a model under magpie.
3. **Start a new qwen session.** Qwen Code reads a session’s model when it starts, so start a new session, or pick the model again with `/model`, where magpie’s models are listed too.

```
magpie qwen deepseek/deepseek-v4-pro    # Qwen Code on DeepSeek
magpie qwen                             # what Qwen Code runs on now
```

## The key and /auth

Every magpie entry takes its key from `MAGPIE_QWEN_API_KEY`, which magpie sets in the settings’ `env` object. The name is Qwen Code’s own, so a variable you exported in your shell or in `~/.qwen/.env` is unlikely to shadow it. magpie also sets `security.auth.selectedType` to `openai`, so qwen starts without asking `/auth`.

## Your own models

Your own `modelProviders` entries stay as they were, in front of magpie’s, so their ids don’t move, and they are listed on Qwen Code’s row beside magpie’s. When you pick a model of magpie’s, the model and auth type you had, with their address, are kept aside to be put back.

## Switch back

Pick one of your own models on the row, take the row off magpie, or run `magpie qwen default`. magpie puts back the model and auth type you had before, and removes its entries and its key once no model of magpie’s is in use.

## FAQ

### Can Qwen Code run on models other than Qwen?

Yes. Any model you have in magpie is in qwen’s list: DeepSeek, Kimi, GLM, GPT, Claude and more.

### Can Qwen Code use my ChatGPT subscription?

Yes. Sign in to ChatGPT in magpie and pick a GPT model under magpie on Qwen Code’s row. qwen sends its requests to magpie, which uses the subscription.

### Why doesn’t a running session change model?

Qwen Code reads a session’s model when the session starts. Start a new one, or pick the model with /model.

### Does it work with Qwen Code in WSL?

Yes. magpie sets up a Qwen Code in a WSL distro too.

More agents on the same models: [Models in OpenCode](https://usemagpie.ai/docs/opencode-models), [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Copilot CLI on any model](https://usemagpie.ai/docs/copilot-cli) and [Kimi Code on any model](https://usemagpie.ai/docs/kimi-code). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/kimi-code

# Kimi Code on any model

Kimi Code, Moonshot’s `kimi` coding agent, takes providers and models of your own in its config. magpie adds its models there, so kimi can run on any model you have in magpie, not only Kimi: DeepSeek, GLM, Qwen, an OpenAI or Anthropic key, or a ChatGPT or Copilot subscription, with no key pasted into kimi. For Kimi’s own models in other agents, see [Kimi in Claude Code, Codex and more](https://usemagpie.ai/docs/kimi).

Kimi Code keeps its settings in `~/.kimi-code/config.toml` (`$KIMI_CODE_HOME`). magpie adds a provider named `magpie`, of Kimi’s own type, with the gateway’s address and a key of its own, then one `[models."magpie/<provider>/<model>"]` table per model, so magpie’s models join kimi’s `/model` picker. Then it sets `default_model` to your pick. Thinking travels both ways as `reasoning_content`, and the gateway translates each request for the model’s provider. The old Python `kimi-cli` is set up in `~/.kimi` (`$KIMI_SHARE_DIR`) only where there is no Kimi Code folder, since Kimi Code reads `~/.kimi-code` alone once it has taken over. A Kimi Code in WSL is set up the same way.

## Connect Kimi Code

1. **Add providers in magpie.** In the Providers tab, add an API key or sign in to a subscription.
2. **Pick a model on Kimi Code’s row.** In the Agents tab, choose a model under magpie.
3. **Use it in kimi.** Kimi Code picks the change up as it runs. Every model of magpie’s is in `/model` too.

```
magpie kimi deepseek/deepseek-v4-pro    # Kimi Code on DeepSeek
magpie kimi                             # what Kimi Code runs on now
```

## What each model gets

- **Name and context.** The name kimi’s picker and status line show, and `max_context_size`, so kimi compacts in time.
- **Thinking levels.** A model with levels gets `thinking`, with `support_efforts` and a `default_effort` for Kimi Code’s thinking picker. A model that always thinks gets `always_thinking`.
- **Images and tools.** `image_in` for models that take images, `tool_use` on Kimi Code, and `max_output_size` where magpie knows the model’s reply limit.

A value you set in one of magpie’s tables yourself, such as a `default_effort`, stays there on the next sync.

## When it takes effect

Kimi Code 2.x watches its config, so an open session has the new models at once. In its web or desktop app, open Settings › Providers again, or reload the page, to see them in the picker. The old `kimi-cli` reads its config at start-up: restart open kimi sessions.

## Your own settings

Your Kimi Code sign-in, your own providers and models stay, and are listed on Kimi Code’s row beside magpie’s. Keys you added to the `magpie` provider table, such as `custom_headers` or `env`, stay too. The `default_model` you had is kept aside to be put back.

## Switch back

Pick one of your own models on the row, take the row off magpie, or run `magpie kimi default`. magpie puts back the default model you had, if Kimi still has it, then removes its model tables and its provider.

## FAQ

### Can Kimi Code run on models other than Kimi?

Yes. Any model you have in magpie is in kimi’s /model list: DeepSeek, GLM, Qwen, GPT, Claude and more.

### Can Kimi Code use my ChatGPT subscription?

Yes. Sign in to ChatGPT in magpie and pick a GPT model under magpie on Kimi Code’s row. kimi sends its requests to magpie, which uses the subscription.

### Does it work with the old Python kimi-cli?

Yes. Where there is no ~/.kimi-code, magpie writes to kimi-cli’s ~/.kimi, without the keys only Kimi Code reads. Restart open sessions after a change.

### Does it work with Kimi Code in WSL?

Yes. magpie sets up a Kimi Code in a WSL distro too, its provider pointing at the gateway as the distro reaches it.

More agents on the same models: [Models in OpenCode](https://usemagpie.ai/docs/opencode-models), [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Qwen Code on any model](https://usemagpie.ai/docs/qwen-code) and [Pi on any model](https://usemagpie.ai/docs/pi). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/pi

# Pi on any model

Pi, the `pi` coding agent, takes providers of your own in its `models.json`. magpie adds itself there, so pi can run on any model you have in magpie: DeepSeek, GLM, Qwen, an OpenAI or Anthropic key, or a ChatGPT or Copilot subscription, with no key pasted into pi.

Pi keeps its settings in `~/.pi/agent`, or in the folder `$PI_CODING_AGENT_DIR` names. magpie adds a provider named `magpie` to `models.json`, with the gateway’s address, a key of its own and the models you have in magpie, so they join pi’s model picker. Then it sets `defaultProvider` and `defaultModel` in `settings.json` to your pick. A Pi in WSL is set up the same way.

## Connect Pi

1. **Add providers in magpie.** In the Providers tab, add an API key or sign in to a subscription.
2. **Pick a model on Pi’s row.** In the Agents tab, choose a model under magpie.
3. **Run pi.** It starts on that model, and every model of magpie’s is in its model picker.

```
magpie pi deepseek/deepseek-v4-pro    # Pi on DeepSeek
magpie pi                             # what Pi runs on now
```

## What each model gets

- **Its own API.** Each model is asked on its provider’s native API: GPT and ChatGPT models on Responses, Claude on Messages, the rest on Chat Completions. A Claude model that thinks only adaptively gets `forceAdaptiveThinking`.
- **Name, context and replies.** The name pi shows, `reasoning` for models that think, `contextWindow`, image input where the model takes images, and `maxTokens`. A `maxTokens` you typed in yourself stays.
- **Thinking level.** The level you pick in magpie goes in `defaultThinkingLevel`, held to the levels Pi offers.

Pi sends its session with each request (`sendSessionAffinityHeaders`), so magpie’s usage shows each pi session and Record gateway conversations keeps them. A value you set there yourself stays.

## The Ctrl+P list

Pi cycles models with Ctrl+P through `enabledModels`, the list `/scoped-models` edits. If you have such a list, magpie adds the model you picked to it. If you don’t, magpie never makes one, so Ctrl+P keeps cycling every model.

## Decision and image models

magpie also puts an extension, `extensions/magpie.ts`, in Pi’s folder. It adds magpie’s decision models and image models, for codemode. It is there while the `magpie` provider is, and goes with it.

## Your own files

Before its first write, magpie copies `settings.json` and `models.json` to `.before-magpie` files beside them. Your own providers and settings stay as they are, and Pi’s row lists your models beside magpie’s.

## Switch back

Pick one of your own models on the row, take the row off magpie, or run `magpie pi default`. If you changed nothing since, magpie puts both files back byte for byte. Otherwise it removes only its own provider and keeps your changes.

## FAQ

### Can Pi run on DeepSeek or GLM?

Yes. Any model you have in magpie is in pi’s model picker: DeepSeek, GLM, Qwen, GPT, Claude and more.

### Can Pi use my ChatGPT subscription?

Yes. Sign in to ChatGPT in magpie and pick a GPT model under magpie on Pi’s row. pi sends its requests to magpie, which uses the subscription on the Responses API.

### Where does magpie write if I set PI_CODING_AGENT_DIR?

In that folder, with ~ expanded. A relative path is ignored, and magpie uses ~/.pi/agent.

### Does it work with Pi in WSL?

Yes. magpie sets up a Pi in a WSL distro too, its provider pointing at the gateway as the distro reaches it.

More agents on the same models: [Models in OpenCode](https://usemagpie.ai/docs/opencode-models), [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Kimi Code on any model](https://usemagpie.ai/docs/kimi-code), [Cursor Private Inference on any model](https://usemagpie.ai/docs/cursor-private-inference) and [Prime Agent on any model](https://usemagpie.ai/docs/prime-agent). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/cursor-private-inference

# Cursor Private Inference on any model

Cursor Private Inference is a build of Cursor whose agent runs on your own machine and asks a model endpoint of yours instead of Cursor’s backend. magpie is such an endpoint, so its agent can run on any model you have in magpie: DeepSeek, GLM, Qwen, an OpenAI or Anthropic key, or a ChatGPT or Copilot subscription.

The build takes its endpoint from `CURSOR_LOCAL_AGENT_BASE_URL` and `CURSOR_LOCAL_AGENT_API_KEY`. magpie sets the two for your user, to the gateway’s `/v1` and a key of its own: through launchctl on the Mac, the registry’s Environment on Windows and environment.d on Linux. So the app has them when you open it from the Dock or the Start menu. magpie writes none of Cursor’s files, since regular Cursor shares them, and only this build reads the two variables. magpie finds the build by its `product.json`, in your apps folders, and on Linux as its AppImage where you downloaded it.

## Connect it

1. **Add providers in magpie.** In the Providers tab, add an API key or sign in to a subscription.
2. **Pick magpie on its row.** In the Agents tab, set Cursor Private Inference’s provider to magpie.
3. **Quit it and open it again.** Quit the app, not only its window, then open it. magpie’s models are in its model picker.

To start it from a shell instead, the row gives the command that starts it with both variables set.

## Its models

Its model picker lists the gateway’s models, the ones its key is shown. The row’s Models button picks which. For each model the gateway also says which APIs it is served on and its limits, so the build asks Claude on Anthropic Messages, GPT on Responses and the rest on Chat, with the right context.

## Effort

Neither the build’s environment nor, for most models, its app says how hard a model should reason. Pick the effort on the row instead, among the levels its models have, and the gateway asks each request for it. Left on the default, requests go as the app sends them.

## When it takes effect

The build keeps the model list it was first given until it quits, so quit it and open it again after a change. On the Mac, launchctl’s variables are gone after a restart: magpie sets them again when it starts, with the gateway’s address then, and the app takes them the next time it opens.

## Settings that come first

A base URL or API key set in the build’s Open configuration dialog, or in a model’s own settings, comes before the variables. Leave both empty, or set them to the gateway’s `/v1` address and the key the row shows.

## Switch back

Take the row off magpie. magpie clears both variables for your user. Quit the app and open it again.

## FAQ

### Can Cursor’s agent run on DeepSeek or GLM?

Yes, in Cursor Private Inference. Any model you have in magpie can be in its model picker: DeepSeek, GLM, Qwen, GPT, Claude and more.

### Does it change my regular Cursor?

No. magpie writes none of Cursor’s settings. It sets two variables that only the Private Inference build reads.

### Why don’t the new models show?

The build keeps its first model list until it quits. Quit the app itself, not only its window, and open it again. Check that no base URL or key is set in its Open configuration.

### Does it work on Windows and Linux?

Yes. magpie sets the variables in the registry’s Environment on Windows and in environment.d on Linux, and finds the Linux AppImage where you downloaded it.

More agents on the same models: [Models in OpenCode](https://usemagpie.ai/docs/opencode-models), [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Pi on any model](https://usemagpie.ai/docs/pi) and [Antigravity on any model](https://usemagpie.ai/docs/antigravity). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/antigravity

# Antigravity on any model

Antigravity, Google’s agent app, can send its requests to a gateway of yours instead of Google, through its Enterprise Gateway setting. magpie is such a gateway, so Antigravity and its CLI, `agy`, can run on any model you have in magpie: DeepSeek, GLM, Qwen, an OpenAI or Anthropic key, or a ChatGPT or Copilot subscription.

Antigravity 2.15 and later reads a `gateway` block from its settings file: `~/.antigravity/settings.json` up to 2.29, `~/.gemini/config/config.json` from 2.30. magpie writes that block, turned on, with its gateway’s address, a key that names the app and the `openai` wire protocol, and sets `models.defaultModelId` to the model you pick. The app then lists the gateway’s models in its picker and sends its chats to magpie, which translates each one for the model’s provider. Your own gateway, default model, model list and catalog are kept aside and put back when magpie steps out.

## Connect the app

1. **Add providers in magpie.** In the Providers tab, add an API key or sign in to a subscription.
2. **Pick a model on Antigravity’s row.** In the Agents tab, choose a model under magpie.
3. **Restart Antigravity.** It reads its gateway at start-up. magpie’s models are then in its model picker.

```
magpie antigravity deepseek/deepseek-v4-pro    # the app on DeepSeek
magpie agy deepseek/deepseek-v4-pro            # agy on DeepSeek
```

## Its models

The picker lists the gateway’s models, the ones the app’s key is shown, under the names magpie’s catalog gives them. On its own the app gives every model it doesn’t know a 200K window. magpie points its `models.listSource` at the gateway’s catalog, which gives each model its real context window, so long sessions compact when they should.

## Effort

The catalog lists a model at each of its reasoning levels, so the app’s own picker offers them, and the level picked there goes with the request. The effort on magpie’s row is the level the app starts on, and what a model with no levels in the picker is asked for. Left on the default, requests go as the app sends them.

## Your Google sign-in

On a gateway, Antigravity uses no Google sign-in and its backend asks Google for nothing. What Google turns on for your account, its experiments and commands such as `/boost`, `/teamwork`, `/plugin` and `/generative_ui`, is gone while it is on magpie. Taking the row off magpie gives it back.

The models your own sign-in gave the app leave its picker too. To have them back on magpie, sign the same Google account in under magpie’s Antigravity subscription in the Providers tab: its models are then in the app’s list, served on that account’s quota, beside any other Google account you add there.

## The agy CLI

`agy` follows the app’s gateway unless it is connected on its own row. Connected there, it runs on magpie through the Gemini API: magpie keeps its models in `magpie-settings.json`, beside agy’s own `~/.gemini/antigravity-cli/settings.json`, and starts agy with that file, `GOOGLE_GEMINI_BASE_URL`, `GEMINI_API_KEY` and `--model` for that session. So that typing `agy` just works, magpie adds a function named `agy` to each shell’s profile while agy is on one of its models. A terminal opened before takes the command from the row. Your `settings.json` stays yours, so `agy remote-control` still runs on your Google sign-in.

## Settings that come first

An `admin_settings.json` your organisation installs, and the `AGY_LLM_GATEWAY_*` variables, win over the settings file field by field. If either sets a gateway of its own, Antigravity doesn’t reach magpie, and the row says so.

## Switch back

Pick one of your own models on the row, or take the row off magpie. magpie puts back your own gateway, default model, model list and catalog. For agy, it removes the shell function too. Restart Antigravity.

## FAQ

### Can Antigravity run on models other than Gemini?

Yes. Any model you have in magpie is in its picker: DeepSeek, GLM, Qwen, GPT, Claude and more.

### Do I still need to sign in with Google?

No. On a gateway Antigravity uses no Google sign-in. What Google turns on for your account, such as /boost and /teamwork, is off while it is on magpie.

### Why does every model show a 200K context?

That is the app’s default for models it doesn’t know. magpie points its catalog at the gateway, which gives each model its real window. Restart Antigravity after connecting.

### Does the agy CLI work too?

Yes. agy follows the app’s gateway, or runs on its own row through the Gemini API, with an agy shell function so the command just works.

More agents on the same models: [Models in OpenCode](https://usemagpie.ai/docs/opencode-models), [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models), [Cursor Private Inference on any model](https://usemagpie.ai/docs/cursor-private-inference) and [Snow CLI on any model](https://usemagpie.ai/docs/snow-cli). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/snow-cli

# Snow CLI on any model

Snow CLI (`snow`, the npm package `snow-ai`) keeps each API setup as a profile. magpie adds one of its own that points Snow at magpie’s gateway, so Snow can run on any model you have in magpie: DeepSeek, GLM, Qwen, an OpenAI or Anthropic key, or a ChatGPT or Copilot subscription.

Snow keeps its settings in `~/.snow` (or `$SNOW_CONFIG_DIR`). Each profile is a file in `profiles/`, `active-profile.json` names the one in use, and `config.json` is a copy of it. magpie writes `profiles/magpie.json`: a copy of the profile you were on, with magpie’s gateway as its base URL, a key that names Snow, Chat Completions as its protocol and the model you pick as its model. It makes that profile the active one and copies it to `config.json`, as Snow’s own profile switch does. The gateway then sends each request to the model’s provider.

## Connect Snow

1. **Add providers in magpie.** In the Providers tab, add an API key or sign in to a subscription.
2. **Pick a model on Snow CLI’s row.** In the Agents tab, choose a model under magpie.
3. **Restart open snow sessions.** Snow reads its profile at start-up.

```
magpie snow deepseek/deepseek-v4-pro    # Snow on DeepSeek
magpie snow default                     # back to your own profile
```

It works the same for Snow in a WSL distro on Windows: the profile there names the gateway as the distro reaches it.

## Your profiles

Your own profiles are not changed. magpie’s copies your other settings from the one you were on, but leaves out a subscription sign-in of yours (`snowcfg.oauth`). A profile of your own that happens to be named `magpie` is kept and put back. On the row, the models of your own profiles are listed too: picking one makes Snow switch to that profile.

## Windows and images

magpie sets `maxContextTokens`, `maxTokens` and `supportsVision` from its catalog for the model you pick, so Snow knows its real window and whether it takes images. A model magpie knows no limits for gets Snow’s own defaults, 200K and 64K. If you change one of these in Snow’s settings, it stays as you set it. A vision model of your own is kept only with an endpoint and key of its own. Images for a model that can’t see go through magpie’s Vision, which describes them at the gateway.

## The light model

Snow asks a light model (`basicModel`) for summaries, compaction and file search. On magpie’s profile it follows the main model, unless you pick another magpie model in the row’s small field. That pick stays when you change the main model.

## Thinking

The row’s thinking field sets `chatThinking` on magpie’s profile: a level sends `reasoning_effort` with each request, and off is Snow’s default. Only models that list reasoning levels offer it.

## Snow App

Snow App keeps API setups of its own. Its Sync Snow CLI API config button copies Snow CLI’s profiles into it, magpie’s among them, so the app can use magpie’s models too.

## Switch back

Pick one of your own models on the row, run `magpie snow default`, or take the row off magpie. Snow goes back to the profile you were on, `profiles/magpie.json` is removed, and `config.json` is a copy of your profile again.

## FAQ

### Can Snow CLI use DeepSeek, GLM or Qwen?

Yes. Any model you have in magpie can be Snow’s model: DeepSeek, GLM, Qwen, GPT, Claude and more.

### Does magpie change my own Snow profiles?

No. It adds a profile of its own, profiles/magpie.json, and makes it the active one. Switching back makes your profile active again.

### Why does Snow show the wrong context size?

magpie sets maxContextTokens and maxTokens from its catalog for the model you pick. A value you changed in Snow yourself stays as you set it.

### Which protocol does Snow use with magpie?

Chat Completions (requestMethod chat). The row warns when magpie’s profile is set to another one.

More agents on the same models: [Models in Gemini CLI](https://usemagpie.ai/docs/gemini-cli-models), [Cursor Private Inference on any model](https://usemagpie.ai/docs/cursor-private-inference), [Antigravity on any model](https://usemagpie.ai/docs/antigravity) and [JetBrains Air on any model](https://usemagpie.ai/docs/jetbrains-air). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/jetbrains-air

# JetBrains Air on any model

JetBrains Air runs its own agents (Claude Agent, Codex, Gemini CLI, Junie) on accounts signed in under its settings, with no base URL to point elsewhere. It also takes any agent that speaks the Agent Client Protocol. magpie adds one, named Magpie, so Air can run on any model you have in magpie: DeepSeek, GLM, Qwen, an OpenAI or Anthropic key, or a ChatGPT or Copilot subscription.

Air lists custom ACP agents from `acp.json` in its config folder: `~/Library/Application Support/JetBrains/Air` on macOS, `$XDG_CONFIG_HOME/JetBrains/Air` on Linux, `%APPDATA%\JetBrains\Air` on Windows. magpie adds an entry named `Magpie` there that starts `opencode acp`, OpenCode’s ACP server, with `OPENCODE_CONFIG` set to `magpie-opencode.json`, a file magpie keeps beside `acp.json`. That file holds magpie’s provider, its models, the model a task starts on, and `enabled_providers` narrowed to magpie. OpenCode merges it over your own config and leaves your plugins, agents and MCP servers as they are. Air’s own agents, and the accounts they run on, aren’t touched.

## Connect Air

1. **Add providers in magpie.** In the Providers tab, add an API key or sign in to a subscription.
2. **Pick a model on JetBrains Air’s row.** In the Agents tab, choose a model under magpie.
3. **Start a new task in Air.** Pick Magpie in its agent menu. magpie’s models and routing groups are in its model menu.

```
magpie air deepseek/deepseek-v4-pro        # the Air app
magpie air-ide deepseek/deepseek-v4-pro    # Air in JetBrains IDEs
```

## OpenCode

The Magpie agent is OpenCode, so OpenCode has to be installed. magpie gives Air its full path, since an app may not have your shell’s PATH: the one on PATH, else `~/.opencode/bin`, else one a JetBrains IDE or Zed installed from the ACP registry. If none is found, the row says to install it:

```
npm i -g --allow-scripts=@opencode/cli @opencode/cli
```

## The model menu

Air’s model menu for the Magpie agent is the list OpenCode reports, which is magpie’s models and routing groups and nothing of OpenCode’s own. The model picked on the row is the one a new task starts on, and also OpenCode’s small model for titles and summaries. You can pick another in Air’s menu for each task.

## Air in JetBrains IDEs

Air is also a plugin in JetBrains IDEs: bundled with 2026.3, and installed from JetBrains Marketplace in 2026.2. The plugin reads custom agents from `~/.jetbrains/acp.json` on every system, so it has a row of its own, Air (JetBrains IDEs), which adds the same Magpie agent there. Restart the IDE if Magpie isn’t listed yet. In the IDE, Air’s own Codex and Claude Agent, on their own login, run this computer’s `codex` and `claude`, so they are on magpie too while Codex and Claude Code are connected in magpie. The model on Air’s row is the Magpie agent’s alone.

## WSL projects

An IDE on Windows starts the agent of a project that lives in a WSL distro inside that distro, and refuses a Windows command there. So each running distro with OpenCode gets an entry of its own, such as `Magpie (WSL Ubuntu)`, with OpenCode’s path in the distro and a config that names the gateway as the distro reaches it.

## Provider keys in the environment

One gap is OpenCode’s: when a provider’s key is set in the environment Air starts it with (`OPENAI_API_KEY`, `DEEPSEEK_API_KEY` and so on, not empty), its ACP server lists that provider and none from its config, so magpie’s models don’t show. Unset the variable, or keep the key in OpenCode’s `auth.json` instead.

## Switch back

Take the row off magpie. magpie removes the Magpie entry from `acp.json` and deletes `magpie-opencode.json`. Air’s own agents were never changed. If the Magpie entry is removed by hand, the row says Air no longer reaches magpie.

## FAQ

### Can JetBrains Air use DeepSeek, GLM or Qwen?

Yes. Pick the Magpie agent in a new Air task, and every model you have in magpie is in its model menu: DeepSeek, GLM, Qwen, GPT, Claude and more.

### Does magpie change Air’s own agents or accounts?

No. It adds one ACP agent, Magpie, to acp.json. Claude Agent, Codex, Gemini CLI and Junie keep their own accounts.

### Why doesn’t the Magpie agent show magpie’s models?

Usually a provider key such as OPENAI_API_KEY is set in the environment Air starts with. OpenCode then lists only that provider. Unset it, or keep the key in OpenCode’s auth.json.

### Does it work in IntelliJ IDEA, PyCharm and other JetBrains IDEs?

Yes, through the Air plugin (bundled with 2026.3, from Marketplace in 2026.2). Connect the Air (JetBrains IDEs) row and restart the IDE.

More agents on the same models: [Models in OpenCode](https://usemagpie.ai/docs/opencode-models), [Antigravity on any model](https://usemagpie.ai/docs/antigravity), [CodeBuddy on any model](https://usemagpie.ai/docs/codebuddy) and [Snow CLI on any model](https://usemagpie.ai/docs/snow-cli). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/codebuddy

# CodeBuddy on any model

CodeBuddy is Tencent's AI coding tool: the CodeBuddy Code CLI (`codebuddy`, `cbc`) and the CodeBuddy IDE. Both the international edition (codebuddy.ai) and the China one (codebuddy.cn) take custom models. magpie writes your magpie models into that list, so CodeBuddy runs on DeepSeek, GLM, Kimi, Qwen, an OpenAI or Anthropic key, or a ChatGPT or Copilot subscription, and those models need no CodeBuddy sign-in.

CodeBuddy Code is one npm package, `@tencent-ai/codebuddy-code`, for both editions; the China one is told apart by `CODEBUDDY_INTERNET_ENVIRONMENT=internal`. Both read custom models from `~/.codebuddy/models.json` (or `$CODEBUDDY_CONFIG_DIR`), and the CodeBuddy IDE reads the same file. So magpie has one row, CodeBuddy, for the CLI and the IDE.

## Set up CodeBuddy

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick a model on CodeBuddy's row.** On the Agents page, pick a model under magpie. magpie writes every model into models.json and the one you picked into settings.json's `model`.
3. **Start a new session.** CodeBuddy Code reads its model when a session starts: restart `codebuddy`, or run `/clear` in an open session.

```
magpie codebuddy deepseek/deepseek-v4-pro
magpie codebuddy            # show what it is set to
```

## models.json

Each model magpie writes points at the magpie gateway on this computer and is asked under a Bearer key magpie gives CodeBuddy. CodeBuddy calls that address itself, not through Tencent's servers, with no CodeBuddy sign-in.

```
{"models": [{
  "id": "deepseek/deepseek-v4-pro", "name": "DeepSeek V4 Pro", "vendor": "magpie",
  "apiKey": "…", "url": "http://127.0.0.1:3425/v1/chat/completions",
  "maxInputTokens": …, "maxOutputTokens": …,
  "supportsToolCall": true, "supportsImages": …, "reasoning": {…}
}, …]}
```

`maxInputTokens` and `maxOutputTokens` come from magpie's catalog; without `maxOutputTokens` CodeBuddy caps every reply at its own default. A model that thinks carries its levels (`supportedEfforts`, `defaultEffort`) and `canDisableThinking` when thinking can be turned off; a model with a window over 200K offers two sizes in `contextWindow`. CodeBuddy picks up a change to the file without a restart.

## CodeBuddy Code

In the CLI, the model a session starts on is `settings.json`'s `model`: one of magpie's ids from models.json, or one of CodeBuddy's own. magpie tells CodeBuddy's requests apart by their key, so Usage counts them under CodeBuddy.

## CodeBuddy IDE

CodeBuddy.app (codebuddy.ai) and CodeBuddy CN.app (codebuddy.cn) read the same `~/.codebuddy/models.json`. They watch the file, sync their model list when it changes, and list magpie's models in the IDE's own model picker. The IDE needs no CLI; with only the IDE installed, magpie still shows the CodeBuddy row. Two differences: the IDE always reads `.codebuddy` in your home folder, whatever `CODEBUDDY_CONFIG_DIR` says, and it doesn't read settings.json's `model`, so the model is picked in the IDE.

## Your own models

Models you added to models.json yourself stay as they are; magpie updates only its own, in the place they were. A magpie model you turned off in CodeBuddy stays off, and a default thinking level you set on one stays while the model still offers it. When the file has `availableModels` (the models to show), magpie's are added to it and the rest you listed stay.

## WSL

On Windows, a WSL distro with CodeBuddy Code installed has its own row. It writes the distro's `~/.codebuddy/models.json`, naming the gateway as the distro reaches it, with the key it takes from there. `CODEBUDDY_CONFIG_DIR` isn't read there.

## Switching back

Pick one of CodeBuddy's own models on the row: magpie takes its models out of models.json and sets settings.json's `model` to yours. Or from a terminal:

```
magpie codebuddy default
```

## FAQ

### Can CodeBuddy use DeepSeek, GLM, Kimi or Qwen?

Yes. magpie writes them as custom models into ~/.codebuddy/models.json, and they show in both CodeBuddy Code's and the CodeBuddy IDE's model list.

### Do magpie's models need a CodeBuddy sign-in?

No. They call the magpie gateway on this computer under the key magpie gives CodeBuddy, not through a CodeBuddy account.

### Does the China edition and CodeBuddy CN work?

Yes. Both CLI editions are one npm package, and CodeBuddy.app and CodeBuddy CN.app read the same models.json, so one row covers them all.

### I changed the model and nothing happened.

CodeBuddy Code reads its model when a session starts. Restart codebuddy or run /clear. In the IDE, pick the model in its model picker.

More agents on the same models: [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Kimi Code on any model](https://usemagpie.ai/docs/kimi-code), [Qwen Code on any model](https://usemagpie.ai/docs/qwen-code) and [T3 Code on any model](https://usemagpie.ai/docs/t3-code). Tencent Cloud's models: [Tencent Cloud](https://usemagpie.ai/docs/tencent-cloud). Notes on the same models: [Obsidian on any model](https://usemagpie.ai/docs/obsidian). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/obsidian

# Obsidian on any model

Obsidian has no AI of its own; its community plugins bring it. magpie wires Copilot for Obsidian (logancyang/obsidian-copilot), which takes an OpenAI-compatible endpoint you name. magpie adds a provider called magpie in every vault that has Copilot, so Obsidian's AI chat runs on any model you have in magpie: DeepSeek, GLM, Kimi, Qwen, an OpenAI or Anthropic key, or a ChatGPT or Copilot subscription.

## Set up Obsidian

1. **Install Copilot in Obsidian.** Install and turn on Copilot from Obsidian's Settings › Community plugins. magpie shows the Obsidian row once a vault has Copilot.
2. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
3. **Pick magpie on Obsidian's row.** On the Agents page, pick magpie. Then reload Copilot in Obsidian, and magpie's models are in its model menu.

```
magpie obsidian provider magpie
```

## Vaults

Obsidian lists its vaults in `obsidian.json` in its config folder: `~/Library/Application Support/obsidian` on a Mac, `%APPDATA%\obsidian` on Windows, `$XDG_CONFIG_HOME/obsidian` on Linux, or the Flatpak's and the Snap's own folders. Copilot keeps its settings in each vault's `.obsidian/plugins/copilot/data.json`. magpie wires every vault that has Copilot; after that it keeps the wired vaults up to date and wires none you haven't asked for.

## The model list

This is what magpie writes into data.json. Only these keys change; everything else in the file stays as written:

```
"providers": {"magpie": {
  "providerType": "openai-compatible", "displayName": "magpie",
  "baseUrl": "http://127.0.0.1:3425/agent/obsidian/v1",
  "requiresApiKey": false, …}},
"configuredModels": [{"providerId": "magpie", "info": {"id": "deepseek/deepseek-v4-pro", …}}, …],
"backends": {"chat": {"enabledModels": […]}},
"defaultModelKey": "…"
```

Each model carries its context size, output limit, images and thinking levels from magpie's catalog. A model new in magpie comes on in chat; a magpie model you turned off in Copilot stays off; one gone from magpie leaves every backend. Models and providers you added in Copilot yourself are untouched. The first time, Copilot's default model becomes magpie's first, and the one it had is kept to put back when you switch back.

## No key to enter

Copilot keeps API keys in Obsidian's keychain, which magpie doesn't write. So magpie's provider needs no key (`requiresApiKey: false`): its requests carry no Authorization, and the gateway takes a call with no key from this computer. Copilot calls it with fetch from Obsidian's window, so replies stream, and the gateway answers that window's CORS. The `/agent/obsidian` in the address is how magpie knows it is Obsidian, since the window's User-Agent is a browser's.

## Reloading Copilot

While Obsidian runs, Copilot holds its settings and writes data.json whole when it saves. So after wiring, reload Copilot in Settings › Community plugins (or restart Obsidian) before changing Copilot's settings, or the old settings write over magpie's. magpie says so while Obsidian is running.

## Copilot 3

magpie writes only Copilot 4's format (`providers` and `configuredModels`). Copilot 3 kept models in `activeModels`; magpie leaves such a vault alone and names it in the error. Update Copilot to 4, which moves the settings itself when it first loads.

## Switching back

Turn the row off in magpie. magpie takes its provider, its models and their places in every backend out of each vault's data.json, and puts back the default model you had while magpie's is still the default. A provider you added by hand under the name magpie, at an address that isn't magpie's Obsidian route, is yours and stays.

```
magpie obsidian default
```

## FAQ

### Can Obsidian use DeepSeek, GLM, Kimi or Qwen?

Yes, through the Copilot for Obsidian plugin. magpie adds a magpie provider in every vault with Copilot, and every model you have in magpie is in Copilot's model menu.

### Do I enter an API key in Copilot?

No. magpie's provider needs no key: requests go to the magpie gateway on this computer, which calls the model with your key or subscription.

### Why doesn't Copilot show magpie's models?

Reload Copilot in Obsidian's Settings › Community plugins, or restart Obsidian. A vault on Copilot 3 needs Copilot 4 first.

### Does Smart Connections work?

No. Its free plugin embeds with a local model only; its API providers are in the closed Pro plugin, with keys in the keychain magpie can't write.

More apps on the same models: [Raycast](https://usemagpie.ai/docs/raycast), [Cherry Studio](https://usemagpie.ai/docs/cherry-studio) and [CodeBuddy on any model](https://usemagpie.ai/docs/codebuddy). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/t3-code

# T3 Code on any model

T3 Code (pingdotgg/t3code) is a GUI that drives Claude Code, Codex, Cursor and others. Each provider it lists is an instance of a driver, and it takes instances of your own. magpie adds two: **magpie**, on Claude Code, and **magpie · Codex**, on Codex. So T3 Code's model picker lists every model you have in magpie: DeepSeek, GLM, Kimi, Qwen, an OpenAI or Anthropic key, or a ChatGPT or Copilot subscription, on the harness you choose.

## Set up T3 Code

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick magpie on T3 Code's row.** On the Agents page, pick magpie. magpie writes both instances into T3 Code's settings.json.
3. **Pick a model in T3 Code.** T3 Code's server watches the file and reloads it on an outside edit. In the model picker, models under magpie run on Claude Code, those under magpie · Codex on Codex.

```
magpie t3code provider magpie
```

The settings file is `~/.t3/userdata/settings.json` (`$T3CODE_HOME/userdata` when set). These are the two instances magpie writes:

```
"providerInstances": {
  "magpie": {"driver": "claudeAgent", "displayName": "magpie",
    "environment": [{"name": "ANTHROPIC_BASE_URL", "value": "http://127.0.0.1:3425", …}, …],
    "config": {"customModels": [{"slug": "deepseek/deepseek-v4-pro", "name": …,
      "capabilities": {"optionDescriptors": […]}}, …]}},
  "magpie-codex": {"driver": "codex", "displayName": "magpie · Codex",
    "config": {"launchArgs": […]}}
}
```

## magpie, on Claude Code

The magpie instance is a `claudeAgent` instance: T3 Code runs Claude Code through Anthropic's Agent SDK, reading your `~/.claude` settings, with the instance's environment added. magpie sets `ANTHROPIC_BASE_URL` to the gateway and the token Claude Code is routed with, so its requests are Claude Code's to the gateway. Every magpie model is one of its custom models, a 1M one marked `[1m]` as magpie marks it for Claude Code. A binary path or Claude home you gave T3's own Claude is carried over, so it runs the same Claude Code.

## magpie · Codex, on Codex

T3 Code runs each thread on the harness of the instance its model is picked from, so with the Claude Code instance alone every magpie model ran there. So magpie adds a `codex` instance, magpie · Codex. Its `launchArgs`, which T3 passes to `codex app-server` and `codex exec`, are Codex's own `-c` overrides: magpie as its model provider, and `magpie-codex-models.json` beside settings.json as its catalog, so T3 lists every magpie model under it from Codex's model list. Your `~/.codex/config.toml` isn't written, and T3's own Codex stays as it is. If you remove the instance in T3, a sync doesn't bring it back; turning T3 Code's row on again in magpie does.

## Reasoning

Without capabilities, T3 Code shows no picks beside a custom model and sends no effort. So each of magpie's custom models gets a Reasoning pick of the Claude Code levels it takes, medium first (else the lowest), which T3 hands to Claude Code as it is. A model that thinks also gets a Thinking switch, on at first; T3 sets Claude Code's `alwaysThinkingEnabled` by it, and with it off requests ask for no thinking.

## Your own settings

The instances' names, whether they are on, and every key magpie doesn't write (such as `autoCompactWindow` and `accentColor`) are yours, and what you change in T3 Code stays. Environment variables you add on magpie's instance stay too. Your own instances, their custom models and T3's other settings are untouched. magpie's are only the custom models, the gateway's variables, and the Codex instance's launch arguments and catalog.

## Claude Code's own routing

The `env` in `~/.claude/settings.json` is applied over the process', so a Claude Code routed elsewhere in its own settings takes the magpie instance's requests there; one routed through magpie or not routed at all asks the gateway. A provider switch on there, such as `CLAUDE_CODE_USE_BEDROCK`, takes it to that cloud, and magpie's check says so.

## Switching back

Turn the row off in magpie. magpie takes out only its two instances; your others and your settings stay.

```
magpie t3code default
```

## FAQ

### Can T3 Code use DeepSeek, GLM, Kimi or Qwen?

Yes. magpie adds two provider instances to T3 Code's settings.json, and every model you have in magpie is in T3's model picker, on Claude Code or on Codex.

### What is the difference between magpie and magpie · Codex?

The same models on a different harness: those under magpie run on Claude Code, those under magpie · Codex on Codex.

### Does it change my ~/.codex/config.toml or T3's own Claude and Codex?

No. Codex's settings are launch arguments of the magpie · Codex instance alone; T3's own instances and yours stay as they are.

### Why don't requests go through magpie?

Check the env in ~/.claude/settings.json: a Claude Code routed elsewhere there, or with a cloud switch such as Bedrock on, takes the magpie instance's requests there.

More agents on the same models: [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [Models in Codex](https://usemagpie.ai/docs/codex-models), [CodeBuddy on any model](https://usemagpie.ai/docs/codebuddy), [Craft Agents on any model](https://usemagpie.ai/docs/craft-agents) and [Every magpie model in Paseo](https://usemagpie.ai/docs/paseo). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/craft-agents

# Craft Agents on any model

Craft Agents (lukilabs/craft-agents-oss) is an Electron app that runs Claude and Pi sessions. Its models come from connections, and a custom endpoint is one. magpie adds a connection named magpie and makes it the one new sessions start on, so Craft Agents runs on any model you have in magpie: DeepSeek, GLM, Kimi, Qwen, an OpenAI or Anthropic key, or a ChatGPT or Copilot subscription.

## Set up Craft Agents

1. **Open Craft Agents once.** Craft Agents won't load a config.json without its workspaces, so magpie never makes one. It is there once Craft Agents has run.
2. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
3. **Pick a model on Craft Agents' row.** On the Agents page, pick a magpie model for Craft Agents. Craft Agents watches config.json, so a running app takes it at once, from its next new session.

```
magpie craft-agents deepseek/deepseek-v4-pro
```

## The magpie connection

Connections are in `config.json` in Craft Agents' config folder (`CRAFT_CONFIG_DIR` when set, else `~/.craft-agent`). magpie's is a `pi_compat` connection on OpenAI-compatible Chat Completions; its `models` are the models picked for Craft Agents in magpie, and `defaultModel` is the one you chose.

```
"llmConnections": [
  …,
  {"slug": "magpie", "name": "magpie", "providerType": "pi_compat",
   "authType": "none",
   "baseUrl": "http://127.0.0.1:3425/agent/craft-agents/v1",
   "customEndpoint": {"api": "openai-completions"},
   "models": [{"id": "deepseek/deepseek-v4-pro", "name": …}, …],
   "defaultModel": "deepseek/deepseek-v4-pro"}
],
"defaultLlmConnection": "magpie"
```

Craft Agents resets a `defaultModel` that isn't in `models` to the first one there, so magpie always puts the model you picked in the list. A name or other field you give the connection in Craft Agents is kept when magpie syncs it.

## No key to enter

Craft Agents keeps keys apart from config.json, sealed in `credentials.enc`, which magpie doesn't open. magpie's connection has `authType: none`, which is what Craft Agents itself saves for an endpoint on this computer with no key ("Local Model"); its Pi server then sends a placeholder key, which the gateway takes from this computer. Craft Agents sends no User-Agent of its own, so `/agent/craft-agents` in the address tells the gateway which agent is asking.

## New and open sessions

New sessions start on the connection `defaultLlmConnection` names; a workspace's own default goes over it. A session keeps the connection it started on, so start a new one after switching to magpie. magpie says so while Craft Agents is running.

## Your own connections

Your connections and every other key in config.json stay as written. Before taking over the default, magpie stashes the one you had and puts it back when it steps out, where that connection is still there (else Craft Agents picks its first). If you delete the magpie connection in Craft Agents, magpie's check says it no longer reaches magpie.

## Switching back

Set the row back to default in magpie: magpie takes its connection out and puts your default back. Or pick a model of one of your own connections, and magpie makes it that connection's default model.

```
magpie craft-agents default
```

## FAQ

### Can Craft Agents use DeepSeek, GLM, Kimi or Qwen?

Yes. magpie adds a magpie connection to Craft Agents' config.json and makes it the default for new sessions; every model you picked in magpie is in it.

### Do I enter an API key in Craft Agents?

No. magpie's connection has authType none, as Craft Agents saves an endpoint on this computer with no key, and the gateway takes requests from this computer.

### Why is a session still on my old model?

A session keeps the connection it started on. Start a new session; a workspace's own default connection goes over the global one.

### magpie says to open Craft Agents first?

Craft Agents won't load a config.json without its workspaces, so magpie never makes one. Run Craft Agents once, then set it up.

More agents on the same models: [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [T3 Code on any model](https://usemagpie.ai/docs/t3-code) and [CodeBuddy on any model](https://usemagpie.ai/docs/codebuddy). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/openchamber

# OpenChamber on any model

OpenChamber is a desktop, web and VS Code front end for OpenCode. It runs an OpenCode of its own (the desktop app bundles OpenCode 2) on your OpenCode config. magpie sets OpenChamber's default model to one of magpie's and puts magpie's provider in the OpenCode config, so OpenChamber runs on any model you have in magpie: DeepSeek, GLM, Kimi, Qwen, an OpenAI or Anthropic key, or a ChatGPT or Copilot subscription.

## Set up OpenChamber

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick a model on OpenChamber's row.** On the Agents page, pick OpenChamber's default model, and a small model if you like.
3. **Start a new session.** OpenChamber takes the new model for new sessions.

```
magpie openchamber deepseek/deepseek-v4-pro          # new sessions
magpie openchamber small deepseek/deepseek-v4-flash  # titles, commit messages
```

OpenChamber's settings are under `$OPENCHAMBER_DATA_DIR`, `~/.config/openchamber` by default (not moved by `XDG_CONFIG_HOME`). magpie writes its profile, `preferences.json`, and the copy in `settings.json` that older builds read, where that file is:

```
// ~/.config/openchamber/preferences.json
{"version": 1, "fields": {
  "defaultModel": {"value": "magpie/deepseek/deepseek-v4-pro", "updatedAt": …},
  "smallModelUseDefault": {"value": false, …},
  "smallModelOverride": {"value": "magpie/deepseek/deepseek-v4-flash", …}
}}
```

## Which model a session gets

OpenChamber sends each new session the model it picks, in this order: the project's `defaultModel` (settings.json's projects), the profile's `defaultModel`, the agent's own, and only then OpenCode's `model`. So setting OpenCode's model alone doesn't reach OpenChamber; magpie sets the profile's `defaultModel`. A project with a default model of its own keeps it there, and magpie names the project and its model. On a new model magpie also clears the old one's `defaultVariant`, as OpenChamber's own picker does.

## The small model

OpenChamber's small model writes session titles and commit messages. It is `smallModelOverride` once `smallModelUseDefault` is false, else OpenCode's `small_model`. Picking a small model in magpie writes those two keys; switching back takes both out and leaves it to OpenCode.

## The OpenCode config

A model in OpenChamber is OpenCode's `provider/model`, so one of magpie's needs magpie's provider in the OpenCode config: `$OPENCODE_CONFIG_DIR`, else `$XDG_CONFIG_HOME/opencode`. A provider of your own that already sends that model to magpie's gateway is used instead of a second list of the same models. An OpenCode 2 config is written in OpenCode 2's words. Once OpenChamber steps off magpie, magpie's provider goes too, when nothing else in the OpenCode config names one of its models. Its requests count as OpenCode's, since OpenChamber's OpenCode sends them.

## New and open sessions

OpenChamber takes the new model for new sessions; sessions already open keep theirs. magpie says so while OpenChamber is running.

## Switching back

Set the row back to default in magpie: magpie takes out the profile's `defaultModel` and `defaultVariant`, and OpenChamber goes back to the OpenCode config's model.

```
magpie openchamber default
```

## FAQ

### Can OpenChamber use DeepSeek, GLM, Kimi or Qwen?

Yes. magpie sets OpenChamber's default model to the one you pick in magpie and puts magpie's provider in the OpenCode config.

### OpenCode is on magpie already; why is OpenChamber still on my old model?

OpenChamber takes a project's and its profile's own defaultModel before OpenCode's model. Pick a model on OpenChamber's own row in magpie.

### One project is still on the old model?

That project has a default model of its own in settings.json, which goes first there. magpie names the project.

### Which model writes session titles and commit messages?

The small model: smallModelOverride once smallModelUseDefault is false, else OpenCode's small_model.

More agents on the same models: [Models in OpenCode](https://usemagpie.ai/docs/opencode-models), [T3 Code on any model](https://usemagpie.ai/docs/t3-code) and [Craft Agents on any model](https://usemagpie.ai/docs/craft-agents). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/nanobot

# nanobot on any model

nanobot (HKUDS/nanobot, `pip install nanobot-ai`) is a personal AI assistant that answers in chat apps, its CLI and its WebUI. Its model comes from `~/.nanobot/config.json`, where any key under `providers` that isn't one of its own is an OpenAI-compatible endpoint. magpie adds a magpie provider there and sets the default model to one of magpie's, so nanobot runs on any model you have in magpie: DeepSeek, GLM, Kimi, Qwen, an OpenAI or Anthropic key, or a ChatGPT or Copilot subscription.

## Set up nanobot

1. **Run nanobot once.** `nanobot onboard` or its first run makes `~/.nanobot`.
2. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
3. **Pick a model on nanobot's row.** On the Agents page, pick a magpie model for nanobot. A nanobot in WSL is set up there too.

```
pip install nanobot-ai && nanobot onboard   # nanobot makes ~/.nanobot
magpie nanobot deepseek/deepseek-v4-pro
```

## What goes in config.json

magpie adds `providers.magpie` at the gateway's `/v1`, with the gateway's key and a User-Agent of `nanobot` (the OpenAI SDK's otherwise, which tells it from no one), and sets `agents.defaults` to provider magpie, model `magpie/<model id>` and the context window magpie knows the model to take. nanobot strips the `magpie/` prefix before it sends the model.

```
// ~/.nanobot/config.json
{
  "providers": {
    …,
    "magpie": {"apiBase": "http://127.0.0.1:3425/v1", "apiKey": "…",
               "extraHeaders": {"User-Agent": "nanobot"}}
  },
  "agents": {"defaults": {
    "provider": "magpie",
    "model": "magpie/deepseek/deepseek-v4-pro",
    "contextWindowTokens": …
  }}
}
```

nanobot's pydantic models read camelCase and snake_case keys alike. magpie writes nanobot's own camelCase, and takes out a snake_case spelling of the same key, so no two settings disagree.

## modelPreset

When `agents.defaults.modelPreset` names one of `modelPresets`, it goes over both provider and model. So magpie stashes it and takes it out while magpie's model is on, and puts it back when it steps out; your `modelPresets` stay as they are.

## When it takes effect

nanobot's gateway (`nanobot gateway`, the WebUI's) watches the file and takes a change at its next reply. `nanobot agent` reads it once, so restart an open `nanobot agent` chat. magpie says so while nanobot is running.

## Your own settings

The provider, model, context window and modelPreset you had under `agents.defaults` are stashed and put back when magpie steps out. Your other providers, presets and keys stay as they are. A config.json magpie made goes again once nothing is left in it. If you delete the magpie provider in nanobot, magpie's check says it no longer reaches magpie.

## Switching back

Set the row back to default in magpie: magpie takes out `providers.magpie` and puts `agents.defaults` back. Or pick a model of your own, and magpie puts things back and then sets it as the model.

```
magpie nanobot default
```

## FAQ

### Can nanobot use DeepSeek, GLM, Kimi or Qwen?

Yes. magpie adds an OpenAI-compatible magpie provider to ~/.nanobot/config.json and sets the default model to the one you pick in magpie.

### Why is nanobot still on the old model?

nanobot's gateway and WebUI take the change at their next reply; nanobot agent reads its config once, so restart the chat.

### Do I lose my modelPreset?

No. magpie stashes agents.defaults.modelPreset and takes it out (it would go over magpie's model), and puts it back when it steps out; modelPresets stay.

### Does it work for nanobot in WSL?

Yes. magpie sets up a nanobot in a WSL distro too.

More agents on the same models: [OpenClaw on any model](https://usemagpie.ai/docs/openclaw), [Hermes Agent on any model](https://usemagpie.ai/docs/hermes), [OpenChamber on any model](https://usemagpie.ai/docs/openchamber) and [AstrBot on any model](https://usemagpie.ai/docs/astrbot). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/astrbot

# AstrBot on any model

AstrBot (AstrBotDevs/AstrBot) is a chatbot framework that puts a model on QQ, Telegram, Discord, Lark and other platforms. It keeps every setting in one file, `data/cmd_config.json`. magpie adds an OpenAI-compatible magpie source there, an entry for each of magpie's models, and makes the one you pick AstrBot's default chat model. So your bot runs on any model you have in magpie: DeepSeek, GLM, Kimi, Qwen, an OpenAI or Anthropic key, or a ChatGPT or Copilot subscription, with no key typed into AstrBot's WebUI.

## Set up AstrBot

1. **Start AstrBot once.** Its first start writes `data/cmd_config.json`. It needs 4.10 or later (a config with `provider_sources`).
2. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
3. **Pick a model on AstrBot's row.** On the Agents page, pick a magpie model for AstrBot.
4. **Restart AstrBot.** AstrBot reads its config at start-up only; after a restart the bot is on the new model.

```
magpie astrbot deepseek/deepseek-v4-pro
# then restart AstrBot
```

magpie finds AstrBot's root in this order: `ASTRBOT_ROOT`; the desktop app's `~/.astrbot`; a folder where `astrbot init` was run, either your home, `~/astrbot` or `~/AstrBot` (where its README and a clone of its source put it). For AstrBot run anywhere else, start magpie with `ASTRBOT_ROOT` set to that folder.

## What goes in cmd_config.json

Since 4.10 AstrBot splits a chat provider into two lists: `provider_sources` holds endpoints and keys, and each entry of `provider` is one model of a source. magpie adds a source with id `magpie` (OpenAI Compatible, at the gateway's `/v1`, with a key naming AstrBot, so its requests count as AstrBot's in magpie's usage), an entry `magpie/<provider>/<model>` for each model, and sets `agent_runner.config.model.provider_id` to the one you pick (`provider_settings.default_provider_id` in a file from before agent_runner).

```
// /data/cmd_config.json
{
  "provider_sources": [
    …,
    {"id": "magpie", "provider": "openai", "type": "openai_chat_completion",
     "provider_type": "chat_completion", "enable": true,
     "key": ["…"], "api_base": "http://127.0.0.1:3425/v1", …}
  ],
  "provider": [
    …,
    {"id": "magpie/deepseek/deepseek-v4-pro", "provider_source_id": "magpie",
     "model": "deepseek/deepseek-v4-pro",
     "modalities": ["text", "tool_use"], "max_context_tokens": …}
  ],
  "agent_runner": {"runner_type": "local",
    "config": {"model": {"provider_id": "magpie/deepseek/deepseek-v4-pro"}}}
}
```

Every model is marked `tool_use`: without it AstrBot drops the model's tools, and the gateway passes a tool call on whatever the model. Images are marked as magpie knows the model sees them. A context window magpie doesn't know is 0, and AstrBot looks it up itself.

## Why it needs a restart

AstrBot reads the whole file into memory at start, and its WebUI writes the whole of it back on every save. So magpie's change needs AstrBot restarted, and a WebUI save made before that restart writes over it. magpie's check notices that its source is gone and asks you to connect again.

When `agent_runner.runner_type` isn't `local` (an outside agent runner), AstrBot doesn't ask its chat model, and magpie's check says so.

## Your own settings

Before it first writes the file, magpie copies it to `cmd_config.json.before-magpie`. Your own sources and models stay byte for byte, and so do changes you make to magpie's entries in the WebUI (a source's timeout or proxy, a model switched off, its extra body). A model picked for one chat with `/provider` lives in AstrBot's own database; it is yours and stands. AstrBot writes the file with a UTF-8 BOM, which magpie keeps.

## AstrBot in Docker

AstrBot in Docker isn't one magpie wires: its data folder is a volume magpie can't know, and the gateway on this machine's loopback isn't the container's.

## Switching back

Set the row back to default in magpie: magpie takes its source and models out and puts the default chat model back to the one AstrBot was on, unless you have picked another in AstrBot since, which stands. Or pick a model of your own; magpie's models stay in the list beside it until you disconnect. Restart AstrBot after either.

```
magpie astrbot default
# then restart AstrBot
```

## FAQ

### Can AstrBot use DeepSeek, GLM, Kimi or Qwen?

Yes. magpie adds an OpenAI-compatible magpie source to cmd_config.json, an entry for each of magpie's models, and sets the one you pick as the default chat model. Restart AstrBot to use it.

### Why is my bot still on the old model?

AstrBot reads cmd_config.json at start-up only, so restart it. Don't save anything in the WebUI before that, or it writes over magpie's change.

### magpie's source is gone. What now?

A WebUI save most likely wrote the whole file back. Connect AstrBot again in magpie, then restart AstrBot.

### Does it work for AstrBot in Docker?

Not on its own: magpie can't know the container's data volume, and this machine's loopback isn't the container's.

More agents on the same models: [nanobot on any model](https://usemagpie.ai/docs/nanobot), [QwenPaw on any model](https://usemagpie.ai/docs/qwenpaw), [OpenClaw on any model](https://usemagpie.ai/docs/openclaw) and [Every model in Cherry Studio, through magpie](https://usemagpie.ai/docs/cherry-studio). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/aionui

# AionUi on any model

AionUi is an Electron desktop app that runs Claude Code, Codex and Gemini CLI, and has a chat of its own. It keeps its model providers in its own database, their keys encrypted, so magpie writes nothing there. It opens AionUi's own add-provider link instead, which brings up AionUi's add-model form with magpie filled in, for you to confirm in AionUi. AionUi then has every model in magpie: DeepSeek, GLM, Kimi, Qwen, an OpenAI or Anthropic key, and the Claude, ChatGPT or Copilot subscription you signed in to.

## Add magpie to AionUi

1. **Open AionUi once.** Once AionUi has run, its data folder has an `aionui` folder and magpie's Agents page lists it.
2. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
3. **Click Add magpie.** On AionUi's row, click Add magpie. AionUi opens Settings → Model's add form with magpie filled in: name magpie, platform custom (OpenAI-compatible), the gateway's address and a key.
4. **Confirm it in AionUi.** Nothing is added until you do.

The link magpie opens looks like this:

```
aionui://add-provider?api_key=…&base_url=http%3A%2F%2F127.0.0.1%3A3425%2Fv1&name=magpie&platform=custom
```

If nothing opens, nothing on this computer handles AionUi's links yet: open AionUi once or install it again, then click Add magpie again.

## Picking models

The magpie provider's address ends in `/v1`, as AionUi's own OpenAI preset does, and it lists every model in magpie from the gateway, named provider/model (for example `deepseek/deepseek-v4-pro`). A provider you add to magpie later shows up when AionUi fetches the list again, with nothing changed in AionUi. Several accounts behind one model, the rest after a 429 and fallback work as they do for every other agent.

## From the command line

```
magpie aionui add      # opens AionUi to add magpie; confirm it there
```

## How magpie knows it was added

magpie reads AionUi's database (`aionui/aionui-backend.db` in AionUi's data folder: `~/Library/Application Support/AionUi` on macOS, `%APPDATA%\AionUi` on Windows, `~/.config/AionUi` on Linux) read-only, for a provider at the gateway's address. It can read it while AionUi runs, and never writes it. Once there is one, the row says it's added, and you can click again to add it again. When the database can't be read, magpie says it doesn't know, not that it isn't added.

## Usage and keys

The key in the link is AionUi's own, so its requests are counted as AionUi's in magpie's usage, apart from other agents.

## FAQ

### Do I need an API key to use Claude or ChatGPT in AionUi?

No. Sign in to a Claude, ChatGPT or Copilot subscription in magpie and its models show up under AionUi's magpie provider.

### Does magpie change AionUi's settings?

No. magpie opens AionUi's own add-model form, and you confirm it. It only reads AionUi's database to show whether magpie was added.

### What address and platform does the magpie provider use?

Platform custom (OpenAI-compatible), at http://127.0.0.1:3425/v1, or the gateway address you set in magpie.

### AionUi isn't on magpie's Agents page.

magpie lists AionUi once it has run on this computer. Open AionUi once, then look again.

More desktop apps on the same models: [Every model in Cherry Studio, through magpie](https://usemagpie.ai/docs/cherry-studio) and [AstrBot on any model](https://usemagpie.ai/docs/astrbot). Using coding agents too? See [Subscriptions in any agent](https://usemagpie.ai/docs/subscriptions). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/qwenpaw

# QwenPaw on any model

QwenPaw (agentscope-ai/QwenPaw, formerly CoPaw) is a personal assistant app with agents of its own. magpie adds an OpenAI-compatible magpie provider to QwenPaw with every model in magpie listed, and sets the model you pick as an agent's `active_model`. So QwenPaw's agents run on any model you have in magpie: DeepSeek, GLM, Kimi, Qwen, an OpenAI or Anthropic key, or a ChatGPT or Copilot subscription, a different one for each agent if you like.

## Set up QwenPaw

1. **Start QwenPaw once.** Run `qwenpaw app` so it writes its agents' settings (`agent.json`).
2. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
3. **Pick a model on QwenPaw's row.** On the Agents page, pick a magpie model for QwenPaw, and an effort if you want one.
4. **Restart QwenPaw after the first connect.** QwenPaw reads its provider files at start-up only; after one restart it is on magpie.

```
magpie qwenpaw deepseek/deepseek-v4-pro          # the default agent
magpie qwenpaw#writer deepseek/deepseek-v4-flash  # the agent named writer
magpie qwenpaw effort high                        # thinking_level
```

## What magpie writes

QwenPaw's working folder is `QWENPAW_WORKING_DIR`; without it, a legacy `~/.copaw` when there is one, else `~/.qwenpaw`. Its secret folder is `QWENPAW_SECRET_DIR` (which the working folder's `.env` may set too), else `<working folder>.secret`, such as `~/.qwenpaw.secret`.

magpie writes `<secret folder>/providers/custom/magpie.json`, the way QwenPaw's console saves a provider from Add provider: OpenAI Chat Completions (`OpenAIChatModel`) at the gateway's `/v1`, a key naming QwenPaw, and each of magpie's models in `extra_models`. It then sets `active_model` in the agent's `agent.json` to provider magpie and the model you pick; the effort goes in `thinking_level` (minimal, low, medium, high, xhigh, max, or empty for inherit, the model's own).

```
// ~/.qwenpaw.secret/providers/custom/magpie.json
{"id": "magpie", "name": "magpie", "base_url": "http://127.0.0.1:3425/v1",
 "api_key": "…", "chat_model": "OpenAIChatModel", "is_custom": true,
 "extra_models": [{"id": "deepseek/deepseek-v4-pro", …}, …]}

// ~/.qwenpaw/workspaces/default/agent.json
{"active_model": {"provider_id": "magpie", "model": "deepseek/deepseek-v4-pro"},
 "thinking_level": "high", …}
```

QwenPaw keeps keys encrypted (starting `ENC:`). magpie writes the key in plain text and QwenPaw encrypts it at its next start, which is how its own files hold a key, so the key goes nowhere QwenPaw doesn't keep it. The provider file is readable by you alone (0600).

## When it takes effect

QwenPaw reads its provider files once, at start, so restart it after the first connect and after magpie's models change; until then a turn on magpie's model fails with `Provider 'magpie' not found`. A model picked for an agent after that needs no restart: QwenPaw reads `agent.json` again when it changes and asks for the model on every turn, so the new one is used from the next message.

## Several agents

Each of QwenPaw's agents is a row in magpie: `qwenpaw` is the default agent, which is always there, and any other is `qwenpaw#<id>`. Only an agent on QwenPaw's own backend (qwenpaw, the default) runs that model; one on an ACP backend runs another program, so magpie doesn't wire it and asks you to switch it to QwenPaw's own backend first.

## Your own settings

The agent's `active_model` from before is stashed and put back when magpie steps out. `fallback_models` and `subagent_model` are left alone. What you change in magpie's provider in QwenPaw's console (a model's window, its generation settings, the provider's headers) stays. If you switch magpie's provider off or delete it in QwenPaw, magpie's check says it no longer reaches magpie.

## Switching back

Set the row back to default in magpie: magpie puts the agent's `active_model` back. It removes `custom/magpie.json` only once no agent names magpie's provider any more, in a fallback or subagent model either. Or pick a model of one of your own providers; magpie's provider stays in the list until you disconnect.

```
magpie qwenpaw default
```

## FAQ

### Can QwenPaw use DeepSeek, GLM, Kimi or Qwen?

Yes. magpie writes an OpenAI-compatible magpie provider into QwenPaw's secret folder and sets the model you pick as the agent's active_model. Restart QwenPaw once after the first connect.

### Why does it say Provider 'magpie' not found?

QwenPaw reads its provider files at start-up only. Restart QwenPaw once after connecting; after that a new model is used from the next message, with no restart.

### Does it work for CoPaw?

Yes. QwenPaw was CoPaw; with a legacy ~/.copaw there, magpie uses it as the working folder, as QwenPaw does.

### Can each agent use a different model?

Yes. The default agent is the qwenpaw row in magpie and any other is qwenpaw#, each with its own model and effort.

More agents on the same models: [AstrBot on any model](https://usemagpie.ai/docs/astrbot), [nanobot on any model](https://usemagpie.ai/docs/nanobot) and [OpenClaw on any model](https://usemagpie.ai/docs/openclaw). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/zoo-code

# Zoo Code on any model

Zoo Code (Zoo-Code-Org/Zoo-Code, the VS Code extension ZooCodeOrganization.zoo-code, a fork of Roo Code) keeps its provider profiles in VS Code's secret storage, encrypted and out of reach. But on every start it imports the file its `zoo-code.autoImportSettingsPath` setting names, as its own Settings → Import does. magpie writes that file: one OpenAI-compatible profile named magpie, at the local gateway, on the model you pick. So Zoo Code runs on any model you have in magpie: DeepSeek, GLM, Kimi, Qwen, an OpenAI or Anthropic key, or a ChatGPT or Copilot subscription.

## Set up Zoo Code

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick a model on Zoo Code's row.** With the Zoo Code extension installed, magpie's Agents page has a Zoo Code row; pick a model.
3. **Reload the VS Code window.** Run **Developer: Reload Window** from the Command Palette; Zoo Code imports magpie's profile as it starts and switches to it.

```
magpie zoo-code deepseek/deepseek-v4-pro
# VS Code: Developer: Reload Window
```

## What magpie writes

magpie writes the file to import in Zoo Code's own folder in VS Code's User folder, `globalStorage/zoocodeorganization.zoo-code/settings/magpie-import.json`, beside the settings files Zoo Code keeps itself. It then points `zoo-code.autoImportSettingsPath` at it in VS Code's `settings.json`. A value of your own is kept aside and put back on Disconnect.

```
// /globalStorage/zoocodeorganization.zoo-code/settings/magpie-import.json
{"providerProfiles": {"currentApiConfigName": "magpie",
  "apiConfigs": {"magpie": {"id": "magpie", "apiProvider": "openai",
    "openAiBaseUrl": "http://127.0.0.1:3425/v1", "openAiApiKey": "…",
    "openAiModelId": "deepseek/deepseek-v4-pro", "openAiStreamingEnabled": true,
    "openAiCustomModelInfo": {"contextWindow": …, "maxTokens": …, "supportsImages": …}}}}}

// /settings.json
"zoo-code.autoImportSettingsPath": "…/magpie-import.json"
```

The profile uses Zoo Code's OpenAI Compatible provider on the gateway's Chat Completions (`/v1`), with a key naming Zoo Code; its requests say `ZooCode/<version>` as their User-Agent, so magpie's usage counts them under Zoo Code. `openAiCustomModelInfo` carries the model's window (Zoo Code trims a conversation to it; 128K when it isn't told), what a reply may take, and whether it sends images. Imported profiles are merged over yours, which stay.

## When it takes effect

Zoo Code reads the file only when it starts, so reload the window once after you pick. While connected it imports the file again on every start, so each start puts it back on magpie's profile; a profile you switch to inside Zoo Code meanwhile is one magpie can't see, and the next start comes back. When magpie's models or the key change, magpie updates the file, used from the next start.

## VS Code profiles

VS Code's default profile and each profile you made has its own `settings.json`; magpie points the setting at its file in every one, and in a profile made later too. If any of them can't be written, all are put back as they were.

## Zoo Code for JetBrains

Zoo Code for JetBrains runs the same extension in its own extension host, which is handed an empty configuration on every start, so the setting can't reach it; and it keeps its secrets in `~/.zoo-code/secrets.json`, a store of its own with no lock and no documented format. magpie writes neither, so the JetBrains build isn't wired.

## Switching back

Set the row back to default in magpie: magpie puts the setting back in every `settings.json` and removes the import file. A profile once imported lives in Zoo Code's secret storage, which magpie can't write, so the magpie profile stays in Zoo Code's list; switch from it or delete it in Zoo Code.

```
magpie zoo-code default
```

## FAQ

### Can Zoo Code use DeepSeek, GLM, Kimi or Qwen?

Yes. magpie writes a magpie profile Zoo Code imports when it starts, on the local gateway's Chat Completions and the model you pick in magpie. Reload the window once after you pick.

### Why didn't Zoo Code change after I picked a model?

Zoo Code imports profiles only when it starts. Run Developer: Reload Window from VS Code's Command Palette.

### Does it work in Zoo Code for JetBrains?

No. The JetBrains build is handed an empty configuration on every start, so the import setting can't reach it, and its secrets file has no documented format; magpie writes neither.

### Why is the magpie profile still there after Disconnect?

An imported profile lives in Zoo Code's encrypted secret storage, which magpie can't write. magpie stops the import and puts the setting back; the profile is yours to switch from or delete in Zoo Code.

More agents on the same models: [Cline on any model](https://usemagpie.ai/docs/cline), [Goose on any model](https://usemagpie.ai/docs/goose) and [Hermes Agent on any model](https://usemagpie.ai/docs/hermes). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/jcode

# jcode on any model

jcode (1jehuang/jcode) is a coding agent in Rust that keeps its settings in `config.toml`. A provider of your own is a named profile, `[providers.<name>]`, as `jcode provider add` writes it. magpie adds itself as the profile magpie, at the local gateway, with every magpie model listed, and starts jcode on the model you pick. So jcode runs on any model you have in magpie: DeepSeek, GLM, Kimi, Qwen, an OpenAI or Anthropic key, or a ChatGPT or Copilot subscription.

## Set up jcode

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick a model on jcode's row.** With jcode installed, magpie's Agents page has a jcode row; pick a model.
3. **Start jcode.** A new jcode starts on that model; restart a session that is already open.

```
magpie jcode deepseek/deepseek-v4-pro
jcode   # /model lists every magpie model, /effort its levels
```

## What magpie writes

jcode's folder is `$JCODE_HOME`, else `~/.jcode`. In its `config.toml` magpie writes `[providers.magpie]`: `type = "openai-compatible"` (jcode's Chat Completions client), `base_url` at the gateway's `/v1`, an `api_key` naming jcode, and `requires_api_key = true`. That last one is there because jcode takes a gateway on loopback as needing no key and then sends none, and the key is how the gateway knows the request is jcode's. It then sets `default_provider` and `default_model` in `[provider]` to magpie and the model you pick.

```
# ~/.jcode/config.toml
[provider]
default_provider = "magpie"
default_model = "deepseek/deepseek-v4-pro"

[providers.magpie]
type = "openai-compatible"
base_url = "http://127.0.0.1:3425/v1"
api_key = "…"
requires_api_key = true
models = [
  { id = "deepseek/deepseek-v4-pro", context_window = …, input = ["text"], reasoning = true },
  …
]
```

## /model and /effort

Each of magpie's models is an entry in `models`, so jcode's `/model` picker lists them all and switches between them. Each entry carries the context window (128K when magpie doesn't know it; jcode would take 200K) and whether it takes images; a model with effort levels gets `reasoning = true`, so jcode's `/effort` offers them. A `reasoning_effort` you set on one of magpie's models stays while the model has that level. When magpie's models change, magpie updates the list.

## When it takes effect

jcode reads its settings at start-up, so restart an open jcode session to use a new model or list; magpie says so while jcode is running.

## Your own settings

The profile and model `[provider]` named before are stashed and put back when magpie steps out. Every other key of the file is yours and stays as written, your own keys in magpie's profile too (headers, extra_body, a model's reasoning_effort). A `config.toml` that doesn't parse is an error and left as it is, never taken as empty. When jcode saves its settings itself it writes the models as `[[providers.magpie.models]]` tables; magpie folds them back into one array on its next write.

## Switching back

Set the row back to default in magpie: when jcode still starts on magpie, magpie puts `[provider]` back as it was; a pick you made in jcode since is yours and stands. Then the whole `[providers.magpie]` goes, with your own keys in it. Or pick one of jcode's own models, and magpie sets `default_model` to it.

```
magpie jcode default
```

## FAQ

### Can jcode use DeepSeek, GLM, Kimi or Qwen?

Yes. magpie writes an openai-compatible [providers.magpie] profile into jcode's config.toml at the local gateway, and starts jcode on the model you pick.

### Can I switch magpie's models in jcode's /model?

Yes. Every magpie model is in the magpie profile's models, so /model lists and switches them; a model with effort levels offers them in /effort.

### Why didn't jcode change after I picked a model?

jcode reads its settings at start-up. Restart the open jcode session.

### Do my settings stay after switching back?

Yes. magpie removes only [providers.magpie], and puts [provider] back when jcode still starts on magpie; every other key stays as written.

More agents on the same models: [Crush on any model](https://usemagpie.ai/docs/crush), [Models in OpenCode](https://usemagpie.ai/docs/opencode-models), [Goose on any model](https://usemagpie.ai/docs/goose) and [Reasonix Studio on any model](https://usemagpie.ai/docs/reasonix). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/paseo

# Every magpie model in Paseo

Paseo (getpaseo/paseo) is an app that runs Claude Code, Codex and others for you. It starts the same Claude Code, so a Claude Code connected to magpie goes through magpie in Paseo too. But Paseo lists models itself, and most of the models magpie serves aren't in its picker. magpie writes them into Paseo's own `additionalModels`, so Paseo's Claude model picker offers every model you have in magpie: DeepSeek, GLM, Kimi, Qwen, GPT or a ChatGPT subscription.

## Set up Paseo

1. **Connect Claude Code to magpie first.** On magpie's Agents page, pick a magpie model for Claude Code. The ids Paseo lists are served by a Claude Code that is on magpie.
2. **Switch Paseo's row on.** With a `~/.paseo` folder, magpie has a Paseo row. Pick magpie: every magpie model in Paseo's Claude model picker.
3. **Restart Paseo's daemon.** Paseo reads its model list when its daemon starts; after a restart magpie's models are there.

```
magpie claude deepseek/deepseek-v4-pro   # Claude Code on magpie first
magpie paseo magpie                      # every magpie model in Paseo's picker
```

## Why Paseo needs its own switch

Claude Code's own `/model` reads modelPicker in `~/.claude/settings.json`, where magpie writes every model when it connects Claude Code. Paseo never reads modelPicker: its list is its own first-party models plus settings.json's `model` and a few `ANTHROPIC_*_MODEL` tier variables. So with only Claude Code connected, magpie's models other than the main one and the tiers aren't in Paseo's picker. Paseo also appends `agents.providers.claude.additionalModels` from its own config, each id passed to Claude Code as written, and that is where magpie writes.

## What magpie writes

Paseo's folder is `PASEO_HOME`, else `~/.paseo`. In `config.json` magpie adds one `{id, label, description}` entry per model to `agents.providers.claude.additionalModels`: the same ids, [1m] marks and names as Claude Code's `/model`, with a description ending `via magpie`, which is how magpie knows its own entries.

```
// ~/.paseo/config.json
{"agents": {"providers": {"claude": {"additionalModels": [
  {"id": "my-own-model", "label": "…", "description": "…"},
  {"id": "…", "label": "…", "description": "via magpie"},
  {"id": "…", "label": "…", "description": "1M context · via magpie"}
]}}}}
```

Your own entries keep their place and come first. An id you listed yourself stays yours, and magpie doesn't add it again. A list magpie can't read is left as it is. When magpie's models change, magpie updates its entries.

## When it takes effect

Paseo reads its model list when its daemon starts, so restart Paseo's daemon to see magpie's models; magpie says so while Paseo is running. Claude Code itself must be connected to magpie too, for those ids to be served.

## Switching back

Set Paseo's row back to default in magpie: magpie takes out only the entries whose description ends `via magpie`, and yours stay; with none left, `additionalModels` goes.

```
magpie paseo default
```

## FAQ

### Why doesn't Paseo's model picker show magpie's models?

Paseo doesn't read Claude Code's modelPicker; it lists its own models, settings.json's model and a few ANTHROPIC_*_MODEL variables. Switch Paseo's row on in magpie and magpie writes every model into Paseo's additionalModels.

### Does Claude Code need to be connected first?

Yes. Paseo passes those ids as written to the Claude Code it starts, and magpie serves them once Claude Code is connected to magpie.

### I switched it on and still see nothing. Why?

Paseo reads its model list when its daemon starts. Restart Paseo's daemon.

### Will my own additionalModels be changed?

No. magpie adds and removes only entries whose description ends via magpie; yours come first and keep their place.

More agents on the same models: [Models in Claude Code](https://usemagpie.ai/docs/claude-code-models), [T3 Code on any model](https://usemagpie.ai/docs/t3-code) and [Craft Agents on any model](https://usemagpie.ai/docs/craft-agents). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/reasonix

# Reasonix Studio on any model

Reasonix Studio 2.x and its CLI share one `config.toml` and `.env`. magpie adds a provider named magpie there, pointing at magpie's local gateway, so Reasonix's executor and planner can each be any model you have in magpie: DeepSeek, GLM, Kimi, Qwen, GPT or a ChatGPT subscription. Your other providers, keys and project or session settings are left alone.

## Set up Reasonix

1. **Open magpie's Agents page.** Find the Reasonix Studio row. Its model field is called executor.
2. **Pick a magpie model.** The list has two groups: Reasonix Studio's own models and the ones via magpie. Pick one of the latter; magpie writes the provider and key, then sets `default_model` to `magpie/<model>`.
3. **Set effort and a planner if you want.** A model with effort levels can take an effort. The planner can be a different model, or off to turn the separate planner off.

```
magpie reasonix magpie/deepseek/deepseek-v4-pro   # executor
magpie reasonix effort high
magpie reasonix planner magpie/deepseek/deepseek-v4-flash # a separate planner, or: off
```

## What magpie writes

Reasonix's folder is `REASONIX_HOME`; without it, `%APPDATA%\reasonix` on Windows and `~/.reasonix` elsewhere. A Reasonix in WSL uses Linux's `~/.reasonix`, with the gateway as the distro reaches it. magpie writes:

```
# ~/.reasonix/config.toml
default_model = "magpie/deepseek/deepseek-v4-pro"

[[providers]]
name = "magpie"
kind = "openai"
base_url = "http://127.0.0.1:3425/v1"
api_key_env = "MAGPIE_REASONIX_API_KEY"
models = ["…", "…"]
default = "deepseek/deepseek-v4-pro"
reasoning_protocol = "openai"
no_proxy = true

[providers.model_overrides."deepseek/deepseek-v4-pro"]
supported_efforts = ["…"]
context_window = …
max_output_tokens = …

# ~/.reasonix/.env
MAGPIE_REASONIX_API_KEY=…
```

Each model carries its context window, max output, image support and effort levels; a model with no effort levels gets `reasoning_protocol = "none"`. When magpie's models change, magpie updates the provider. When Studio has a `[desktop] provider_access` list, magpie adds magpie to it. The key goes only in `.env`; config.toml names the variable.

magpie only touches its own entry. If there is already a magpie provider magpie didn't make, another provider uses `MAGPIE_REASONIX_API_KEY`, or `.env` sets it twice, magpie stops with an error rather than overwrite. magpie keeps a restore record in its own config folder (settings only, never an upstream credential) to put your `default_model` back when you switch back.

## Executor and planner

The executor is `default_model` and the planner is `[agent] planner_model`; each can come from magpie or from one of Reasonix's own providers. While the planner still uses magpie, magpie's provider stays, even with the executor back on your own model.

## When it takes effect

Reasonix Studio 2.x and the native 1.39.x/2.x CLI read global settings at startup, so start a new process after a change. A model set for a project or session overrides the executor and planner.

## Switching back

Switching back undoes only what magpie added: the magpie provider goes, `default_model` returns to what it was before (or goes if there was none), magpie leaves `provider_access`, and magpie's key leaves `.env`; a file magpie created is removed once empty. A model you picked later, and edits to other providers and keys, stay. You can also just pick a model from the Reasonix Studio group.

```
magpie reasonix default
```

## FAQ

### How do I use DeepSeek, GLM or a ChatGPT subscription in Reasonix Studio?

On magpie's Agents page, pick a via-magpie model as Reasonix Studio's executor. magpie adds a magpie provider to config.toml, the key to .env, and sets default_model to magpie/.

### Can the planner be a different model?

Yes. The planner field writes [agent] planner_model: another magpie model, one of Reasonix's own, or off.

### I changed it and Reasonix didn't notice. Why?

Reasonix reads global settings at startup. Start a new Studio or CLI process; a model set for a project or session also overrides the global one.

### Will my own providers and keys change?

No. magpie adds and removes only the provider named magpie and MAGPIE_REASONIX_API_KEY, and stops with an error on a same-named entry it didn't make.

More agents on the same models: [jcode on any model](https://usemagpie.ai/docs/jcode), [Crush on any model](https://usemagpie.ai/docs/crush), [Models in OpenCode](https://usemagpie.ai/docs/opencode-models) and [AtomCode on any model](https://usemagpie.ai/docs/atomcode). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/atomcode

# AtomCode on any model

AtomCode is a Rust terminal coding agent on AtomGit (atomgit.com/atomgit_atomcode/atomcode). Its models live in `config.toml`: a `[models."…"]` table names a `[provider_accounts.…]` table, the shape AtomCode's own CodingPlan sign-in writes since 5.0.7. magpie writes the same shape, a magpie account and one table per model, so AtomCode can use any model you have in magpie: DeepSeek, GLM, Kimi, Qwen, GPT or a ChatGPT subscription.

## Set up AtomCode

1. **Open magpie's Agents page.** Find the AtomCode row. Its list has the models you set up in AtomCode yourself, and the ones via magpie.
2. **Pick a magpie model.** magpie writes the account and model tables and points `default_provider` and `default_model` at your pick; with both set, AtomCode goes by `default_model`.
3. **Restart atomcode.** AtomCode reads its settings at start-up, so reopen any running session.

```
magpie atomcode deepseek/deepseek-v4-pro
magpie atomcode effort high
```

## What magpie writes

AtomCode's folder is `ATOMCODE_HOME` (an absolute path), else `~/.atomcode`. An AtomCode in WSL uses Linux's `~/.atomcode`, with the gateway as the distro reaches it. magpie writes:

```
# ~/.atomcode/config.toml
default_provider = "magpie/deepseek/deepseek-v4-pro"
default_model = "magpie/deepseek/deepseek-v4-pro"

[provider_accounts."magpie"]
provider = "openai-compatible"
base_url = "http://127.0.0.1:3425/v1"
api_key = "…"

[models."magpie/deepseek/deepseek-v4-pro"]
account = "magpie"
model = "deepseek/deepseek-v4-pro"
context_window = …
max_tokens = …
supports_vision = false
reasoning_effort_levels = ["…"]
```

The account uses `openai-compatible`, AtomCode's documented preset for a custom endpoint, at magpie's gateway `/v1`, with a key magpie issues to AtomCode alone. A model table's key is `magpie/<provider>/<model>`, and its `model` goes to the gateway as written. Each carries the context window (AtomCode compacts as it nears it; 128000 when magpie doesn't know it), the output limit (never above the window), image support and the effort levels on offer. When magpie's models change, magpie rewrites its own tables; your own model tables and legacy `providers.*` entries are left alone.

Requests are Chat Completions with Bearer auth and a User-Agent of `atomcode/<version>`; the key is AtomCode's own, so magpie knows a request is AtomCode's even when the header is changed.

## Effort

Effort is the current model table's `reasoning_effort`, sent with every request to it and kept per model. magpie picks none for you, so the vendor's default stands until you do. Only the levels that model supports (some of low, medium, high, xhigh, max) are offered.

## When it takes effect

AtomCode reads its settings at start-up. While atomcode is running, magpie tells you to restart open atomcode sessions.

## Switching back

Switching back removes magpie's account and model tables and puts back the `default_provider` and `default_model` you had before, where AtomCode still has that model (otherwise they go). Picking one of your own AtomCode models in magpie also removes magpie's tables.

```
magpie atomcode default
```

## FAQ

### How do I use DeepSeek, GLM or a ChatGPT subscription in AtomCode?

On magpie's Agents page, pick a via-magpie model for AtomCode. magpie adds [provider_accounts."magpie"] and one [models."magpie/…"] table per model to ~/.atomcode/config.toml and points the defaults at your pick.

### What context window does AtomCode get?

magpie writes each model's context_window, or 128000 when it doesn't know it. AtomCode compacts as it nears the window.

### I changed it and AtomCode didn't notice. Why?

AtomCode reads its settings at start-up. Restart the open atomcode sessions.

### Do my own defaults come back when I switch back?

Yes. magpie stashes default_provider and default_model when it steps in and puts them back when it steps out, where AtomCode still has that model.

More agents on the same models: [Reasonix Studio on any model](https://usemagpie.ai/docs/reasonix), [jcode on any model](https://usemagpie.ai/docs/jcode), [Crush on any model](https://usemagpie.ai/docs/crush) and [Shelley on any model](https://usemagpie.ai/docs/shelley). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/shelley

# Shelley on any model

Shelley (boldsoftware/shelley) is the coding agent for exe.dev, a web app that `shelley serve` runs. Its models live in its database, not in a file magpie can edit, so magpie tells it through the same API Shelley's own Models and Profiles pages use: a custom model at magpie's gateway, made the default. New Shelley conversations then run on any model you have in magpie: DeepSeek, GLM, Kimi, Qwen, GPT or a ChatGPT subscription.

## Set up Shelley

1. **Start Shelley first.** magpie talks to a running Shelley. When it isn't running, magpie says so: start `shelley serve` and try again.
2. **Pick a model on magpie's Agents page.** Shelley's row lists the models Shelley can use itself and the ones via magpie. Pick one of the latter.
3. **Start a new conversation.** New conversations start on the default profile's model, the one you just picked.

```
shelley serve                              # Shelley must be running
magpie shelley deepseek/deepseek-v4-pro
```

## How magpie tells Shelley

Shelley opens a Unix socket for its CLI: `$SHELLEY_SOCKET`, else `$XDG_CONFIG_HOME/shelley/shelley.sock` (`~/.config/shelley` by default, on a Mac too), or `shelley-2.sock` and on when a second server took the first. magpie tries them in the order Shelley's CLI does and calls `/api/custom-models` and `/api/profiles`:

```
POST /api/custom-models   (over ~/.config/shelley/shelley.sock)
{
  "display_name": "deepseek/deepseek-v4-pro (magpie)",
  "provider_type": "openai",
  "endpoint": "http://127.0.0.1:3425/v1",
  "api_key": "…",
  "model_name": "deepseek/deepseek-v4-pro",
  "reasoning_support": "yes",
  "image_support": "no",
  "max_tokens": …
}
```

Each model you pick in magpie is a custom model of type openai at the gateway's `/v1` (Shelley adds `/chat/completions`), with a key magpie issues to Shelley alone. Shelley usually learns reasoning and image support from models.dev by endpoint and name, which magpie's models aren't in, so magpie says what it knows. Then magpie sets the default profile's `model` to it; for a model that doesn't reason it clears `thinking_level`, which Shelley would refuse.

magpie keeps the ids of the models it made, so a model you made by hand at the gateway stays yours. When the gateway's address changes, magpie updates its models.

## Which conversations change

New conversations use the new model; an open one keeps its model until you pick another in its model menu. magpie says so after the switch.

## Switching back

Switching back puts the default profile's model and thinking level back to what they were (or to the server's default when that model can't be used any more), then deletes every custom model magpie made. You can also pick one of Shelley's own models in magpie. If Shelley was uninstalled, magpie notes it and takes its models out when Shelley runs again.

```
magpie shelley default
```

## FAQ

### How do I use DeepSeek, GLM or a ChatGPT subscription in Shelley?

Run shelley serve, then pick a via-magpie model for Shelley on magpie's Agents page. magpie adds an openai custom model at its gateway to Shelley and makes it the default profile's model.

### Why does magpie say Shelley isn't running?

Shelley's models are in its database, which magpie changes only through a running Shelley's socket. Start shelley serve and try again.

### Why is an open conversation still on the old model?

The default profile applies to new conversations. Change an open one in its own model menu.

### Will my own custom models be deleted?

No. magpie deletes only the model ids it made; one you made by hand, even at the gateway, stays yours.

More agents on the same models: [AtomCode on any model](https://usemagpie.ai/docs/atomcode), [Reasonix Studio on any model](https://usemagpie.ai/docs/reasonix), [jcode on any model](https://usemagpie.ai/docs/jcode) and [Cindy on any model](https://usemagpie.ai/docs/cindy). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/cindy

# Cindy on any model

Cindy is a desktop app that runs Claude Code, Codex and Pi. It keeps its providers in its own database, their keys encrypted, and takes a new one only through its own import link, which you confirm in Cindy. So magpie writes nothing into Cindy: it gives Cindy an import link with magpie as one custom provider, an endpoint for each runtime. Claude Code, Codex and Pi in Cindy then run on any model in magpie: DeepSeek, GLM, Kimi, Qwen, an OpenAI or Anthropic key, and the ChatGPT or Copilot subscription you signed in to.

## Add magpie to Cindy

1. **Open Cindy once.** Once Cindy has run, its data folder is there (`~/Library/Application Support/Cindy` on a Mac, `CindyGlobal` for its global build) and magpie's Agents page lists it.
2. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
3. **Click Add magpie.** On Cindy's row, click Add magpie; magpie hands the import link to Cindy.
4. **Confirm it in Cindy.** Nothing is added until you do. Then pick a model from the Magpie provider for Claude Code, Codex or Pi in Cindy.

If nothing happens, nothing on this computer opens Cindy's links (`cindy://`), or the program that registered them was moved. magpie checks for that first and says why instead of doing nothing: open Cindy once or install it again, then click again.

## What the link holds

The link's `data` is base64url-encoded JSON. Decoded, it is:

```
cindy://provider/import?v=1&data=
{
  "kind": "custom", "name": "Magpie", "id": "magpie",
  "auth": {"method": "apiKey", "apiKey": "…"},
  "endpoints": [
    {"protocol": "anthropic-messages", "baseUrl": "http://127.0.0.1:3425",
     "targets": ["claude-code"], "modelsUrl": "http://127.0.0.1:3425/v1/models"},
    {"protocol": "openai-responses", "baseUrl": "http://127.0.0.1:3425/v1",
     "targets": ["codex"], "modelsUrl": "http://127.0.0.1:3425/v1/models"},
    {"protocol": "openai-chat", "baseUrl": "http://127.0.0.1:3425/v1",
     "targets": ["pi"], "modelsUrl": "http://127.0.0.1:3425/v1/models"}
  ]
}
```

Claude Code speaks Anthropic Messages at the gateway itself; Codex speaks OpenAI Responses and Pi OpenAI Chat, both at the gateway's `/v1`. Each endpoint lists its models from the gateway's `/v1/models`, so a provider you add to magpie later shows up when Cindy fetches models again.

## From the command line

```
magpie cindy add      # opens Cindy to add magpie; confirm it there
```

The command prints the link it opened. When nothing here can open it, it says why rather than reporting success.

## How magpie knows it was added

magpie reads Cindy's databases read-only: one per account (`cindy-<account>.db`) once you sign in, `cindy-local-v1.db` before. When any of them has a custom provider with the id or name magpie, or the gateway's address in its endpoints, the row says it's added. It can read them while Cindy runs, and never writes them. When a database can't be read, magpie says it doesn't know, not that it isn't added.

## Usage and keys

The key in the link is Cindy's own, so its requests are counted as Cindy's in magpie's usage, apart from other agents.

## FAQ

### Can Claude Code in Cindy use DeepSeek or GLM?

Yes. Once magpie is added to Cindy, Claude Code uses any model in magpie, DeepSeek and GLM included, through the Magpie provider's Anthropic endpoint.

### Does magpie change Cindy's settings?

No. Cindy takes a new provider only through its own import link, which you confirm in Cindy. magpie only reads Cindy's databases to show whether magpie was added.

### Add magpie does nothing. What now?

Nothing on this computer opens cindy:// links, or the program that registered them is gone. Open Cindy once or install it again, then click again; magpie says which it is.

### Cindy isn't on magpie's Agents page.

magpie lists Cindy once it has run on this computer and made its data folder. Open Cindy once, then look again.

More desktop apps on the same models: [AionUi on any model](https://usemagpie.ai/docs/aionui), [Every model in Cherry Studio, through magpie](https://usemagpie.ai/docs/cherry-studio), [Shelley on any model](https://usemagpie.ai/docs/shelley) and [Lody on any model](https://usemagpie.ai/docs/lody). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/lody

# Lody on any model

Lody is a desktop app that runs coding agents such as Claude Code, Codex, Pi, dsh, Kimi Code, Grok and Bub. It adds a provider through its own import link, in a dialog you confirm. magpie gives it that link, with magpie as one custom provider named Magpie and three endpoints by protocol, covering every runtime it supports. Once confirmed, those agents in Lody run on any model in magpie: DeepSeek, GLM, Kimi, Qwen, an OpenAI or Anthropic key, and the ChatGPT or Copilot subscription you signed in to.

## Add magpie to Lody

1. **Open Lody once.** Once Lody has run, its home folder `~/.lody` (`~/.lody-oss` for its OSS build) or data folder (`~/Library/Application Support/Lody` on a Mac) is there, and magpie's Agents page lists it. Lody OSS and Lody Nightly count too.
2. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
3. **Click Add magpie.** On Lody's row, click Add magpie; magpie hands the import link to Lody.
4. **Confirm it in Lody.** Lody shows its local provider dialog, and nothing is added until you confirm. Then pick a model from the Magpie provider for each agent in Lody.

```
magpie lody add      # opens Lody to add magpie; confirm it there
```

The row never says it's added: Lody has no public status API, and magpie doesn't guess from a click, files it generates or Lody's private store. Click again whenever you need to.

## What the link holds

The link's `data` is base64url-encoded JSON. Decoded, it is:

```
lody://provider/import?v=1&data=
{
  "kind": "custom", "id": "magpie", "name": "Magpie",
  "auth": {"method": "apiKey", "apiKey": "…"},
  "endpoints": [
    {"protocol": "anthropic-messages", "baseUrl": "http://127.0.0.1:3425",
     "targets": ["claude-code"], "modelsUrl": "http://127.0.0.1:3425/v1/models"},
    {"protocol": "openai-responses", "baseUrl": "http://127.0.0.1:3425/v1",
     "targets": ["codex"], "modelsUrl": "http://127.0.0.1:3425/v1/models"},
    {"protocol": "openai-chat", "baseUrl": "http://127.0.0.1:3425/v1",
     "targets": ["pi", "dsh", "kimi-code", "grok", "bub"],
     "modelsUrl": "http://127.0.0.1:3425/v1/models"}
  ]
}
```

Claude Code speaks Anthropic Messages at the gateway itself; Codex speaks OpenAI Responses; Pi, dsh, Kimi Code, Grok and Bub speak OpenAI Chat, all at the gateway's `/v1`. Every endpoint lists its models from the gateway's `/v1/models`.

## Loopback addresses only

Lody takes only HTTP on a loopback address (127.0.0.1, localhost or ::1), and only its public attribution token as the key, never a LAN key or a vendor credential. So when the gateway isn't on loopback, say you set magpie's address to a LAN one, magpie doesn't open Lody and says why.

## Lody on Linux

On macOS and Windows, Lody's bundle and installer claim `lody://` themselves, and magpie opens the link. On Linux, Lody's AppImage makes itself the default only for its own channel's scheme and leaves `lody://` to the desktop database, which nothing builds without update-desktop-database, so xdg-open and browsers turn the link away (“failed to open uri”). So on Linux magpie runs Lody with the link, as its desktop entry (`ai.lody.desktop`, or the Nightly or OSS one) says; a Lody already running takes the link and the second one quits. With no entry of Lody's, it hands the link to the system.

## Usage and keys

The key in the link is Lody's own, so its requests are counted as Lody's in magpie's usage, apart from other agents.

## FAQ

### Can Claude Code in Lody use DeepSeek or GLM?

Yes. Once magpie is added to Lody, Claude Code uses any model in magpie, DeepSeek and GLM included, through the Magpie provider's Anthropic endpoint; Codex, Pi, Kimi Code and the rest do the same.

### Why does magpie say Lody takes only a loopback address?

Lody accepts HTTP providers on loopback only. Set magpie's gateway address back to 127.0.0.1 or localhost, then click Add magpie again.

### On Linux, Add magpie says failed to open uri.

That is xdg-open finding no handler for lody://. magpie runs Lody from its desktop entry instead; if that still fails, open Lody once so it writes its entry, then click again.

### Why doesn't Lody's row say it's added?

Lody has no public status API, and magpie doesn't guess. Once you've confirmed, Magpie is in Lody's provider list.

More desktop apps on the same models: [Cindy on any model](https://usemagpie.ai/docs/cindy), [AionUi on any model](https://usemagpie.ai/docs/aionui), [Shelley on any model](https://usemagpie.ai/docs/shelley) and [Empryo on any model](https://usemagpie.ai/docs/empryo). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/empryo

# Empryo on any model

Empryo keeps its settings in `~/.empryo/config.json` (a project's `.empryo/config.json` goes over it). Its providers are a `providers` array of OpenAI-compatible endpoints that it lists models from and sends `/chat/completions` to. magpie adds a provider of its own there and sets the model sessions start on to one of magpie's. Empryo then runs on any model in magpie: DeepSeek, GLM, Kimi, Qwen, GPT or a ChatGPT subscription.

## Set up Empryo

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick a model for Empryo on the Agents page.** Empryo's row lists your current Empryo model and the models via magpie. Pick one of the latter.
3. **Restart empryo.** Empryo reads its settings at start-up, so reopen sessions that are already open.

```
magpie empryo deepseek/deepseek-v4-pro
```

On Windows, Empryo in a WSL distro is found too and set up the same way, at a gateway address that distro can reach.

## What gets written

```
{
  "providers": [
    …your own providers, left as they are…,
    {"id": "magpie", "name": "Magpie",
     "baseURL": "http://127.0.0.1:3425/v1",
     "modelsAPI": "http://127.0.0.1:3425/v1/models"}
  ],
  "defaultModel": "magpie/deepseek/deepseek-v4-pro"
}
```

`defaultModel` is `<provider id>/<model id>`, split at the first `/`, so `magpie/deepseek/deepseek-v4-pro` is `deepseek/deepseek-v4-pro` under the magpie provider. Your own providers and other settings stay as they are.

magpie checks the wiring: when config.json's magpie provider is gone, or its `baseURL` isn't the gateway's address any more, Empryo's row says so.

## Why there is no envVar

An Empryo provider can name an `envVar` to read its key from; with none, Empryo sends no key of yours. magpie's provider has none, so you put no key in your environment. With no `envVar`, Empryo lists a provider only when its `baseURL` answers (2xx, 401 or 403), which the gateway's `GET /v1` does.

## When it takes effect

Empryo reads its settings only at start-up. While empryo is running, magpie reminds you to restart open empryo sessions.

## Switching back

Switching back puts `defaultModel` back to what it was and removes the magpie provider. If magpie made config.json and nothing is left in it, the file goes too. You can also pick your own Empryo model again.

```
magpie empryo default
```

## FAQ

### How do I use DeepSeek, GLM or a ChatGPT subscription in Empryo?

Pick a via-magpie model for Empryo on magpie's Agents page. magpie adds a provider with id magpie to ~/.empryo/config.json and sets defaultModel to magpie/provider/model. Restart empryo to use it.

### Do I need an API key environment variable?

No. magpie's provider has no envVar, so Empryo sends no key of yours; the magpie gateway forwards requests to the providers you added in magpie.

### Does a project's .empryo/config.json matter?

Yes. A project's .empryo/config.json goes over ~/.empryo/config.json; if it sets its own defaultModel, that one wins in that project.

### Is my old model still there after switching back?

Yes. magpie kept the defaultModel you had and puts it back; your own providers were never changed.

More agents on the same models: [Lody on any model](https://usemagpie.ai/docs/lody), [AtomCode on any model](https://usemagpie.ai/docs/atomcode), [Crush on any model](https://usemagpie.ai/docs/crush) and [miniQ on any model](https://usemagpie.ai/docs/miniq). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/miniq

# miniQ on any model

miniQ is a desktop AI coworker with a `miniq` terminal client, both clients of one miniq-daemon. Its models come from one OpenAI- or Anthropic-compatible endpoint, the `provider` in `settings.json`. magpie makes that provider the local gateway, so miniQ runs on any model in magpie: DeepSeek, GLM, Kimi, Qwen, GPT or a ChatGPT subscription.

## Set up miniQ

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick a model for miniQ on the Agents page.** miniQ's row lists your current miniQ model and the models via magpie. Pick one of the latter.
3. **Keep working.** A running daemon is told the new provider, and open chats move onto the new model, with no restart.

```
magpie miniq deepseek/deepseek-v4-pro
```

On Windows, miniQ in a WSL distro is found too and set up the same way.

## Where settings.json is

`settings.json` sits in the daemon's data folder, found as miniQ finds it. `MINIQ_DATA_DIR` comes first. Next is the folder named by `miniq-data-dir.json` beside the default, which exists when you moved the data folder in miniQ's Settings. Otherwise it is the default. macOS uses `~/.local/share/miniq` too.

```
macOS / Linux: ~/.local/share/miniq/settings.json
Windows:       %LOCALAPPDATA%\miniq\settings.json
MINIQ_DATA_DIR set: $MINIQ_DATA_DIR/settings.json
```

## What gets written

```
{
  "provider": {
    "baseUrl": "http://127.0.0.1:3425/v1",
    "apiKey": "",
    "model": "deepseek/deepseek-v4-pro",
    "apiProtocol": "chat_completions"
  }
}
```

`baseUrl` is the gateway's `/v1`. `apiKey` is magpie's own key for miniQ: miniQ sends no User-Agent of its own, so the key is how magpie knows the request is miniQ's. `model` is the model's catalog id. `apiProtocol` is `chat_completions`, because `auto` would guess Responses or Anthropic Messages from a model's name.

magpie changes only `provider`. It stashes your own provider whole. The rest of settings.json stays as it is: MCP servers, approvals, hooks and remote access. Where there is no file, magpie makes one with 0600 permissions, as miniQ does.

## A running daemon

The daemon reads settings.json once, when it starts, and writes its own copy back on every settings change. So after writing the file, magpie also calls `settings.update` over the local WebSocket that `daemon.json` names, as miniQ's own Settings does. A daemon magpie can't reach keeps the old provider until it restarts. magpie then asks you to restart miniQ.

## Switching back

Switching back puts your own provider back whole and tells the daemon. If you had no provider, magpie removes its own, and miniQ goes back to its default. If magpie made settings.json and nothing is left in it, the file goes too. You can also pick your own miniQ model in magpie; it goes into your restored provider.

```
magpie miniq default
```

## FAQ

### How do I use DeepSeek, GLM or a ChatGPT subscription in miniQ?

Pick a via-magpie model for miniQ on magpie's Agents page. magpie sets settings.json's provider to the local gateway's /v1 and tells the running miniq-daemon.

### Do I need to restart miniQ?

Usually not. magpie tells a running daemon through settings.update, and open chats move onto the new model. Only a daemon magpie can't reach needs a restart, and magpie says so.

### Why chat_completions and not auto?

auto guesses the protocol from a model's name and could pick Responses or Anthropic Messages. The gateway's /v1 speaks Chat Completions, so magpie names it.

### Are my MCP servers and other settings changed?

No. magpie changes only settings.json's provider, and switching back restores the one you had.

More agents on the same models: [Empryo on any model](https://usemagpie.ai/docs/empryo), [Lody on any model](https://usemagpie.ai/docs/lody), [Cindy on any model](https://usemagpie.ai/docs/cindy) and [OpenBot on any model](https://usemagpie.ai/docs/openbot). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/openbot

# OpenBot on any model

OpenBot is an Electron workspace that runs Codex, Claude, OpenCode and other agents. Its model picker lists the OpenAI-compatible endpoints you add yourself. magpie adds one named magpie, so the picker lists the models in magpie: DeepSeek, GLM, Kimi, Qwen, GPT or a ChatGPT subscription.

## Set up OpenBot

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Set OpenBot's provider to magpie on the Agents page.** magpie writes its endpoint into OpenBot's custom endpoints file.
3. **Restart OpenBot and pick a model in its own picker.** magpie's models show as `magpie/<id>`.

```
magpie openbot provider magpie
```

## Where the file is

OpenBot keeps custom endpoints in Electron's userData folder:

```
macOS:   ~/Library/Application Support/OpenBot/openbot-custom-providers-v1.json
Windows: %APPDATA%\OpenBot\openbot-custom-providers-v1.json
Linux:   ~/.config/OpenBot/openbot-custom-providers-v1.json
```

## What gets written

```
{
  "version": 1,
  "providers": [
    …your own endpoints, left as they are…,
    {
      "id": "magpie",
      "name": "magpie",
      "baseUrl": "http://127.0.0.1:3425/agent/openbot/v1",
      "models": [
        {"id": "deepseek/deepseek-v4-pro", "name": "DeepSeek V4 Pro", "contextWindow": 1000000},
        …
      ],
      "secret": null
    }
  ]
}
```

`version` must be 1. A file OpenBot can't parse leaves it with no endpoints and refuses every save, so magpie leaves alone a file it can't read either.

OpenBot keeps each endpoint's key and headers together in `secret`, sealed with Electron's safeStorage (the Keychain, DPAPI). magpie doesn't open it, so magpie's endpoint has no key (`secret` is `null`). OpenBot hands it to OpenCode keyless, and the gateway takes a request with no key from this computer.

OpenCode sends the requests, with OpenCode's User-Agent. The `/agent/openbot` in the address tells the gateway they are OpenBot's, and they are counted as OpenBot's. A name, harness or key you give magpie's endpoint in OpenBot stays. Your other endpoints stay as written.

## Which models show

OpenBot's list check fails closed: one endpoint or model it wouldn't accept empties the whole list. So magpie writes only the models picked for OpenBot in magpie, and:

1. **At most 64.** That is OpenBot's limit for one endpoint; a longer list hides them all.
2. **Ids OpenBot accepts.** ASCII letters, digits and `._:/[],=-`, at most 160 characters with the `magpie/` prefix.
3. **Context windows in range.** contextWindow is written only between 1,024 and 100,000,000.

## When it takes effect

OpenBot reads the file once, when it starts. It writes the file whole from what it holds only when an endpoint is saved, edited or removed there. So a change shows after a restart. An endpoint saved in OpenBot before the restart writes magpie's endpoint out again. While OpenBot is running, magpie reminds you to restart it before adding or editing an endpoint there.

MCP servers live in OpenBot's SQLite database, which magpie doesn't write. To use magpie's own MCP servers (`/mcp/magpie/…`), add them in OpenBot by hand as HTTP servers.

## Switching back

Switching back removes only magpie's endpoint. When nothing else is left in the file, magpie removes the file, since OpenBot starts with an empty list without one.

```
magpie openbot default
```

## FAQ

### How do I use DeepSeek, GLM or a ChatGPT subscription in OpenBot?

Set OpenBot's provider to magpie on magpie's Agents page, restart OpenBot, then pick a magpie/ model in its model picker.

### Why does magpie's endpoint have no API key?

OpenBot seals each endpoint's key with the system keychain, which magpie doesn't open. The gateway takes keyless requests from this computer, and /agent/openbot in the address tells it they are OpenBot's.

### Why don't I see every magpie model?

magpie writes only the models picked for OpenBot, at most 64, and skips ids OpenBot wouldn't accept. One bad model would make OpenBot empty the whole list.

### Why hasn't the change shown up?

OpenBot reads custom endpoints only at start-up, so restart it. Don't save an endpoint in OpenBot before that, or it writes magpie's endpoint out.

More desktop apps on the same models: [Lody on any model](https://usemagpie.ai/docs/lody), [Cindy on any model](https://usemagpie.ai/docs/cindy), [miniQ on any model](https://usemagpie.ai/docs/miniq) and [Tuanjie Cowork on any model](https://usemagpie.ai/docs/tuanjie-cowork). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/tuanjie-cowork

# Tuanjie Cowork on any model

Tuanjie Cowork is Unity China's AI coworker app, whose core runs Codely sessions. The Custom Models in its Settings are kept in `~/.codely/settings.json`. magpie adds a provider and a model of its own there, so Cowork runs on any model in magpie: DeepSeek, GLM, Kimi, Qwen, GPT or a ChatGPT subscription.

## Set up Tuanjie Cowork

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick a model for Tuanjie Cowork on the Agents page.** Pick a model via magpie; magpie writes it into Cowork's custom models.
3. **Pick it in Cowork's model menu.** Once, as below.

```
magpie tuanjie-cowork deepseek/deepseek-v4-pro
```

## What gets written

```
{
  "customModelProviders": [
    …your own providers, left as they are…,
    {"id": "magpie", "name": "magpie",
     "baseUrl": "http://127.0.0.1:3425/v1",
     "apiKey": "",
     "authType": "openai"}
  ],
  "customModels": [
    …your own models…,
    {"id": "magpie", "providerId": "magpie",
     "model": "deepseek/deepseek-v4-pro",
     "displayName": "deepseek/deepseek-v4-pro",
     "roles": ["model"], "wireApi": "chat",
     "supportsMultimodal": false}
  ]
}
```

The provider and the model both have the id `magpie`. The provider is the gateway's `/v1` with magpie's own key for Tuanjie Cowork, which is how the gateway knows the requests are Cowork's. The model is on Chat Completions (`wireApi` `chat`), with `supportsMultimodal` true when the model takes images.

Cowork reads the file afresh on every lookup and writes it whole, other keys kept. A session is started with its provider's `baseUrl` and key as `OPENAI_BASE_URL` and `OPENAI_API_KEY`. Your own providers and models stay as they are, and so does a name, roles or another field you give magpie's entries in Cowork. Where there is no file, magpie makes one with 0600 permissions, since it holds keys.

If you have a provider or a model of your own with the id `magpie`, or the file isn't settings Cowork reads, magpie says so and leaves the file alone. Cowork's start-up migrations only move models with no `providerId`, so magpie's entries are left alone.

## Picking it in Cowork

Which model a chat is on is Cowork's own pick in its model menu, kept per workspace by model id. magpie doesn't write that pick, so the first time you pick magpie's model in Cowork's menu. The model's id stays `magpie`, so a model you change in magpie later is the one that pick sends, with no new pick.

While Cowork is running, magpie reminds you to pick its model in the model menu, and to restart Tuanjie Cowork if it isn't there yet.

## Switching back

Switching back removes magpie's provider and model. If magpie made settings.json and nothing else is left in it, the file goes too. Your own models are picked in Cowork's model menu; magpie doesn't set them.

```
magpie tuanjie-cowork default
```

## FAQ

### How do I use DeepSeek, GLM or a ChatGPT subscription in Tuanjie Cowork?

Pick a via-magpie model for Tuanjie Cowork on magpie's Agents page. magpie adds a magpie provider and model to ~/.codely/settings.json. Then pick it once in Cowork's model menu.

### After changing the model in magpie, do I pick it again in Cowork?

No. magpie's model id is always magpie, so Cowork's pick stays on it and sends the model you picked in magpie.

### Are my own custom models changed?

No. magpie adds and removes only entries with the id magpie. If you have one of your own with that id, magpie says so and leaves the file alone.

### magpie's model isn't in the model menu. What now?

Restart Tuanjie Cowork. While it runs, magpie says so too.

More desktop apps on the same models: [OpenBot on any model](https://usemagpie.ai/docs/openbot), [miniQ on any model](https://usemagpie.ai/docs/miniq), [Cindy on any model](https://usemagpie.ai/docs/cindy) and [DS Bot on any model](https://usemagpie.ai/docs/ds-bot). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/ds-bot

# DS Bot on any model

DS Bot (once DeepSeek Bot) is an Electron desktop app built on DSH. It ships its own DSH and runs the profile `ds-bot` on a data folder of its own, and its models are that DSH's llm-pi-ai routes. magpie adds a route of its own there, so DS Bot runs on any model in magpie: GLM, Kimi, Qwen, Claude, GPT or a ChatGPT subscription, and DeepSeek too.

## Set up DS Bot

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick a model for DS Bot on the Agents page.** Pick a model via magpie; magpie writes its route and key into DS Bot's data folder.
3. **Make a new Bot in DS Bot.** New Bots start on that model, as below.

```
magpie ds-bot deepseek/deepseek-v4-pro
```

This is the DS Bot desktop app. DS Bot is also a DSH plugin: in DSH Desktop or `dsh web` it runs on `~/.dsh`, and its model follows magpie's DSH row.

## Where the data folder is

magpie looks for the data folder in DS Bot's own order:

1. **`DS_BOT_HOME`.** When it is set, as for a throwaway folder.
2. **`dataDir` in locations.json.** In Electron's userData: `DS_BOT_SHELL_DATA`, else `<config dir>/DS Bot`. The older `<config dir>/DeepSeek Bot` is used when it exists and DS Bot's folder has no locations.json.
3. **`~/.ds-bot`.** When there is no locations.json, the first run's default.

When locations.json can't be read, or has no `dataDir`, magpie counts the folder as unknown and touches none.

## What gets written

```
/
  .env                              ← magpie's key for DS Bot
  profiles/ds-bot/cordis.patch.yml  ← magpie's llm-pi-ai route
  (DSH's key store)                 ← the same key
  agent-default-model               ← the model you picked
```

As for DSH: magpie puts its route in the profile's patch list, `profiles/ds-bot/cordis.patch.yml`, the key in `.env` and DSH's key store, and sets agent-default-model. Your own routes stay as they are.

## New Bots and older ones

New Bots in DS Bot start on DSH's agent-default-model, so a Bot you make now is on the model you picked in magpie, unless a default model for Bots is set in DS Bot. A Bot made before keeps its own model until you pick another for it. magpie says so on the Agents page.

## Web search

DS Bot's web search goes through magpie too. When magpie has nothing to search with yet, it asks you to set up a provider that searches by itself (DeepSeek, Claude, Codex, …) or a search API under Settings › Models › Web search.

## Before DS Bot is opened

You can set it up before DS Bot is ever opened; magpie says it starts on this the first time it opens. DS Bot's first open writes the profile's files only where they are missing, so the patch list magpie made is kept.

## Switching back

Switching back takes magpie's route out. For a DS Bot that was never opened, magpie removes the files it made.

```
magpie ds-bot default
```

## FAQ

### Can DS Bot use models other than DeepSeek?

Yes. Pick a via-magpie model for DS Bot on magpie's Agents page. magpie adds a route to the DSH that DS Bot ships, so GLM, Kimi, Qwen, Claude, GPT or a ChatGPT subscription all work.

### Why are my existing Bots still on the old model?

A Bot made before keeps its own model. New Bots start on the default magpie sets; pick another model for an older Bot in DS Bot.

### I moved DS Bot's data folder. Does magpie find it?

Yes. magpie reads dataDir from DS Bot's locations.json. When it can't be read, magpie changes no folder.

### What about the DS Bot plugin in DSH Desktop?

The plugin runs on ~/.dsh, so its model follows magpie's DSH row: pick a model for DSH on the Agents page.

More desktop apps on the same models: [Tuanjie Cowork on any model](https://usemagpie.ai/docs/tuanjie-cowork), [OpenBot on any model](https://usemagpie.ai/docs/openbot), [miniQ on any model](https://usemagpie.ai/docs/miniq) and [OpenHanako on any model](https://usemagpie.ai/docs/openhanako). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/prime-agent

# Prime Agent on any model

Prime Agent is Prime Intellect's open-source coding agent in Rust, the `prime-agent` command. It keeps Pi's settings.json and models.json in a folder of its own and reads them with Pi's fields and types. magpie sets it up as it does [Pi](https://usemagpie.ai/docs/pi), so Prime Agent runs on any model in magpie: DeepSeek, GLM, Kimi, Qwen, Claude or a ChatGPT subscription.

## Set up Prime Agent

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick a model for Prime Agent on the Agents page.** Pick a model via magpie.
3. **Run prime-agent.** A new session starts on that model, with every model of magpie's in its list.

```
magpie prime-agent deepseek/deepseek-v4-pro
```

## What gets written

```
~/.prime/agent/            (or $PRIME_AGENT_CODING_AGENT_DIR)
  settings.json            defaultProvider: "magpie"
                           defaultModel:    "deepseek/deepseek-v4-pro"
                           defaultThinkingLevel
  models.json              providers.magpie: the gateway's /v1,
                           the key magpie-prime-agent, magpie's models
```

magpie adds a provider named `magpie` to models.json, at the gateway's `/v1` with magpie's models, and sets `defaultProvider`, `defaultModel` and `defaultThinkingLevel` in settings.json. Your own providers and settings stay as they are.

Prime Agent's requests carry no User-Agent, so the key magpie gives it names it, `magpie-prime-agent`: that is how the gateway counts its requests as Prime Agent's.

## PRIME_AGENT_CODING_AGENT_DIR

Prime Agent's folder is `~/.prime/agent`, or `$PRIME_AGENT_CODING_AGENT_DIR` when it is set, `~` in it standing for home. A relative path is its working directory's, which magpie can't know, so it isn't taken and magpie writes `~/.prime/agent`. A Prime Agent in WSL is set up too.

## Settings left to you

Only the global settings.json is written, as for Pi. These are yours, and magpie doesn't change them:

1. **A project's `.prime/agent/settings.json`.** Settings for that project.
2. **`allowedModels`.** Its daemon's allow-list; a model outside it fails loudly.
3. **`subagentDefaultModel`.** The model subagents start on.

So if you keep allowedModels, add magpie's model to it.

## Switching back

Pick one of your own models on Prime Agent's row, or run the command below. magpie copied both files before its first write: if nothing changed since, they go back byte for byte; otherwise only magpie's provider is removed.

```
magpie prime-agent default
```

## FAQ

### Can Prime Agent run on DeepSeek or GLM?

Yes. Pick a via-magpie model for Prime Agent on magpie's Agents page. magpie adds its provider to models.json, so DeepSeek, GLM, Kimi, Qwen and Claude all work.

### Which folder does magpie write to?

~/.prime/agent, or PRIME_AGENT_CODING_AGENT_DIR when it is set, with ~ expanded. A relative path isn't taken.

### magpie's model fails as not allowed. Why?

Your allowedModels doesn't list it. magpie leaves that list to you; add the model to it.

### How does magpie know Prime Agent's requests?

By the key magpie gives it, magpie-prime-agent, since its requests carry no User-Agent.

More agents on the same models: [Pi on any model](https://usemagpie.ai/docs/pi), [Kimi Code on any model](https://usemagpie.ai/docs/kimi-code), [DS Bot on any model](https://usemagpie.ai/docs/ds-bot) and [Muse Code on any model](https://usemagpie.ai/docs/muse-code). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/openhanako

# OpenHanako on any model

OpenHanako (HanaAgent) is a desktop personal agent that keeps what it knows in `~/.hanako`, or the folder `$HANA_HOME` names. magpie adds a provider, `magpie`, there and makes your pick the primary agent's chat model, so OpenHanako runs on any model in magpie: DeepSeek, GLM, Kimi, Qwen, Claude or a ChatGPT subscription.

## Set up OpenHanako

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Open OpenHanako once.** It makes its agent the first time. Until it has one, magpie asks you to open it.
3. **Pick a model for OpenHanako on the Agents page.** Pick a model via magpie; the primary agent chats on it.

```
magpie hanako deepseek/deepseek-v4-pro
```

## What gets written

```
~/.hanako/                       (or $HANA_HOME)
  provider-catalog.json          providers.magpie: the gateway's /v1,
                                 api openai-completions, magpie's key, models
  provider-plugins/magpie/...    the same provider, once OpenHanako moves it
  agents//config.yaml        models.chat: {id, provider: magpie}
```

magpie is one provider in OpenHanako, `magpie`, spoken to as Chat Completions (`openai-completions`) at the gateway's `/v1`, with magpie's catalog as its models: each with its context, max output, and whether it takes images and reasons. OpenHanako runs on Pi's SDK, so the effort goes as `reasoning_effort`.

The model set is the primary agent's `models.chat`: `primaryAgent` in `user/preferences.json`, else the first agent with a config, as OpenHanako picks at start-up.

## Changes while it runs

While OpenHanako runs, magpie adds its provider and changes the chat model through OpenHanako's local API, which saves them and reloads its models at once, with no restart. Otherwise magpie writes the files, which OpenHanako reads when it starts.

## The sealed catalog

Since 1.0 OpenHanako seals its provider catalog under a key kept in the system keychain: the file is then `HANA-SECRET-1.AES-256-GCM.…`, not JSON. magpie can't read it or write it, and never writes over it.

A provider's definition is in its plugin file under `provider-plugins/magpie`, out of the catalog, so magpie still keeps that up to date; its key stays sealed. Adding or removing magpie needs OpenHanako running, to do it through its API. When it isn't, magpie says to open OpenHanako and try again.

## Switching back

magpie stashes the primary agent's model when it first steps in and puts it back when it steps out. With none stashed, or one OpenHanako no longer has, the agent goes to the first of OpenHanako's own models, as since 1.0 its API takes no agent without a model. Then magpie's provider is removed.

```
magpie hanako default
```

## FAQ

### Can OpenHanako run on DeepSeek, GLM or Kimi?

Yes. Pick a via-magpie model for OpenHanako on magpie's Agents page. magpie adds the magpie provider and makes it the primary agent's chat model.

### magpie says OpenHanako keeps its providers encrypted. What now?

Since 1.0 OpenHanako seals its catalog, so magpie can change it only through its API while it runs. Open OpenHanako and try again.

### Do I restart OpenHanako for the change?

Not while it runs: magpie goes through its local API and the models reload at once. When it isn't running, the change is there the next time it opens.

### Does switching back give me my old model?

Yes. magpie stashed it and puts it back; if OpenHanako no longer has it, the agent goes to OpenHanako's first model of its own.

More desktop apps on the same models: [DS Bot on any model](https://usemagpie.ai/docs/ds-bot), [Tuanjie Cowork on any model](https://usemagpie.ai/docs/tuanjie-cowork), [OpenBot on any model](https://usemagpie.ai/docs/openbot) and [Kun on any model](https://usemagpie.ai/docs/kun). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/kun

# Kun on any model

Kun (KunAgent) is a local-first AI workbench: a desktop app (Code, Work, chats, agents) and a `kun` TUI, both clients of one runtime, `kun serve`. Its models come from the runtime's model connections. magpie adds a connection of its own and makes it the default, so Kun runs on any model in magpie: DeepSeek, GLM, Kimi, Qwen, Claude or a ChatGPT subscription, in the desktop app and the TUI alike.

## Set up Kun

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Open Kun.** magpie adds its connection through the running Kun, as below.
3. **Pick a model for Kun on the Agents page.** Pick a model via magpie; it becomes Kun's default.

```
magpie kun deepseek/deepseek-v4-pro
```

## Through Kun's own API

Kun keeps its connections in `model-connections.v2.json` in its data folder (`$KUN_DATA_DIR`, else `~/.kun/data`), and a connection's key in its protected credential store, so a connection can't be written into a file by hand. magpie adds and removes its connection as Kun's own Settings › Providers and its `kun provider` command do, through the runtime's admin API:

```
GET    /v1/model-connections              the connections, with a revision
POST   /v1/model-connections/connect      magpie's connection
PATCH  /v1/model-connections/magpie       its model list
POST   /v1/model-connections/select       Kun's default model
DELETE /v1/model-connections/magpie       switching back
```

The address and token come from `runtime.json` in the data folder. magpie's connection, `magpie`, is an HTTP one at the gateway's `/v1`, spoken to as Chat Completions with magpie's own key for Kun. magpie remembers its id, so one you renamed to magpie-2 in Kun is still magpie's.

## The model list

The connection's models are the ones you tick for Kun on magpie's Agents page, at most 500. A model picked or dropped there reaches the connection, and so does a gateway on a new port.

## Kun has to be running

Kun adds and changes model providers only while it runs. When it isn't running, magpie says to open Kun, then try again.

## Switching back

magpie stashes the default Kun had when it first steps in. Switching back picks that default again, then removes magpie's connection. With no provider of your own in Kun to go back to, magpie asks you to add one in Kun's Settings › Providers.

```
magpie kun default
```

## FAQ

### Can Kun run on DeepSeek, GLM or a ChatGPT subscription?

Yes. Open Kun and pick a via-magpie model for Kun on magpie's Agents page. magpie adds a magpie model connection and makes it the default.

### magpie says open Kun, then try again. Why?

Kun takes provider changes only while it runs. Open the Kun desktop app or kun serve, and try again.

### Does the kun TUI get the models too?

Yes. The desktop app and the kun TUI are both clients of kun serve and share its model connections.

### Does switching back restore my default model?

Yes. magpie stashed the default Kun had, picks it again, then removes its connection.

More desktop apps on the same models: [OpenHanako on any model](https://usemagpie.ai/docs/openhanako), [DS Bot on any model](https://usemagpie.ai/docs/ds-bot), [Tuanjie Cowork on any model](https://usemagpie.ai/docs/tuanjie-cowork) and [Alma on any model](https://usemagpie.ai/docs/alma). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/alma

# Alma on any model

Alma is a desktop AI chat app that keeps its providers and settings in the app, not in a file magpie can edit. magpie adds a provider named magpie through the local API Alma serves while it runs, and makes it the default model, so Alma runs on any model in magpie: DeepSeek, GLM, Kimi, Qwen, Claude or a ChatGPT subscription.

## Set up Alma

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Open Alma.** magpie can change Alma's settings only through a running Alma. When it isn't open, magpie says to open Alma and try again.
3. **Pick a model for Alma on the Agents page.** Pick a model via magpie; it becomes Alma's default model.

```
magpie alma deepseek/deepseek-v4-pro
```

## Through Alma's local API

While it runs, Alma serves a local API at `http://localhost:23001`, and that is what magpie uses:

```
GET  /api/providers              Alma's providers
POST /api/providers              magpie's provider
PUT  /api/providers/:id/models   its model list
GET  /api/settings, PUT it back  chat.defaultModel, imageGen.model
```

magpie's provider is of type openai at the gateway's `/v1`, with magpie's own key for Alma. Alma's requests carry only the AI SDK's User-Agent, so the key is how the gateway knows them for Alma's. The default model is `chat.defaultModel`, as `providerId:model`; Alma takes only the whole settings, so magpie puts the rest back as they were.

## Models and thinking levels

Alma works out a model's capabilities from models.dev by its id, and magpie's ids (codex/gpt-5.5) aren't models.dev's, so such a model would show no thinking. magpie tells Alma each model's capabilities: a model that reasons comes with the thinking levels Alma knows, and its window, output limit and images when magpie knows them. One you set yourself in Alma's model options (tool calling) stays as you set it. Models added or dropped in magpie reach Alma while it is open.

## Image generation

When magpie has an image model and Alma's image generation model is Auto, picking one of magpie's models for Alma makes magpie's image model Alma's too. An image model you picked is left as it is.

## Switching back

Switching back clears Alma's default model when it is magpie's, leaving it to Alma, puts an image generation model of magpie's back to Auto, and removes magpie's provider. If Alma has been uninstalled, magpie remembers, and takes its provider out once Alma is installed again and answers.

```
magpie alma default
```

## FAQ

### Can Alma run on DeepSeek, GLM or a ChatGPT subscription?

Yes. Open Alma and pick a via-magpie model for Alma on magpie's Agents page. magpie adds a magpie provider and makes it the default model.

### magpie says Alma isn't running. Why?

Alma's settings change only through the local API it serves while it runs. Open Alma and try again.

### Why do magpie's models have thinking levels in Alma?

magpie tells Alma each model's capabilities: whether it reasons, its thinking levels and its window.

### What happens when I switch back?

magpie's provider is removed, a default model of magpie's is cleared for Alma to pick, and the image generation model goes back to Auto.

More desktop apps on the same models: [Kun on any model](https://usemagpie.ai/docs/kun), [Every model in Cherry Studio, through magpie](https://usemagpie.ai/docs/cherry-studio), [OpenHanako on any model](https://usemagpie.ai/docs/openhanako) and [OpenPencil on any model](https://usemagpie.ai/docs/openpencil). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/openpencil

# OpenPencil on any model

OpenPencil (ZSeven-W/openpencil, the openpencil-desktop app) is a design canvas whose chat runs models through builtin agents of your own: an Anthropic or OpenAI-compatible endpoint, a key and a list of models, each listed in the chat's model picker. magpie adds an entry named magpie, so OpenPencil runs on any model in magpie: DeepSeek, GLM, Kimi, Qwen, Claude or a ChatGPT subscription.

## Set up OpenPencil

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Quit OpenPencil.** Why is below.
3. **Pick magpie for OpenPencil on the Agents page.** Then tick the models it should list.
4. **Open OpenPencil and pick a magpie model in its chat's model picker.** The model is picked in OpenPencil, not in a file.

```
magpie openpencil magpie
```

## The entry in settings.json

OpenPencil keeps its settings in one settings.json:

```
macOS    ~/Library/Application Support/openpencil/settings.json
Linux    ~/.config/openpencil/settings.json   ($XDG_CONFIG_HOME)
Windows  %APPDATA%\openpencil\settings.json
```

magpie writes one entry of `builtin_agents`, id `magpie`, of kind openai-compat, which posts to `/chat/completions` under the gateway's `/v1`. OpenPencil's User-Agent isn't known, so the gateway tells its requests apart by the key `magpie-openpencil`:

```
{"version": 1,
 "builtin_agents": [{"id": "magpie", "preset": "custom", "display_name": "magpie",
   "kind": "openai-compat", "api_key": "magpie-openpencil",
   "model": "", "models": ["", …],
   "base_url": "http://127.0.0.1:3425/v1", "enabled": true}]}
```

Your other entries and settings stay, and so do the name and the on/off you give magpie's entry in OpenPencil. `version` has to be 1: without it OpenPencil sets the file aside as corrupt and then refuses to save at all. So magpie writes version 1 in a file it makes, and leaves alone a file whose version it doesn't know.

## Quit OpenPencil first

OpenPencil reads settings.json once, when it starts, and writes all of it back from what it holds when a setting changes and when it quits. A change magpie makes while it runs is written over when it quits, so magpie refuses one then and says to quit OpenPencil and try again. On Windows, where magpie can't tell it is running, a notice asks you to quit it first.

## The model list

The entry's models are the ones you tick for OpenPencil on magpie's Agents page, each once, at most 64 (OpenPencil drops the rest when it next saves). The `models` list is written for two or more, with the first again as `model`; v0.8.4 knows only `model`, so it lists the first model alone. Changes in magpie are synced to it.

## Switching back

Switching back takes magpie's entry out of `builtin_agents`, and the file too when all that is left is the version and empty list magpie wrote. Quit OpenPencil first here too.

```
magpie openpencil default
```

open-pencil/open-pencil, the other app of the name, keeps its providers in its webview's localStorage, which magpie can't write. It reaches magpie through an agent magpie sets up (Pi, an ACP agent) or a base URL typed in.

## FAQ

### Can OpenPencil run on DeepSeek, GLM or a ChatGPT subscription?

Yes. Quit OpenPencil, pick magpie for it on magpie's Agents page, then open OpenPencil and pick a magpie model in its chat's model picker.

### Why quit OpenPencil first?

OpenPencil writes its whole settings back to settings.json when it quits, over what magpie wrote while it ran.

### Why does OpenPencil show only one magpie model?

OpenPencil v0.8.4 reads only the model field, so it lists the first model; later versions read the models list, up to 64.

### Are my other builtin agents kept when I switch back?

Yes. magpie removes only the entry with id magpie and leaves the rest as it was.

More desktop apps on the same models: [Alma on any model](https://usemagpie.ai/docs/alma), [Kun on any model](https://usemagpie.ai/docs/kun) and [Pi on any model](https://usemagpie.ai/docs/pi). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/muse-code

# Muse Code on any model

Muse Code is Meta's `muse` coding agent CLI. Where its requests go is `endpoint_transport` in its settings.json, and the model sessions start on is the top-level `model`. magpie points both at the gateway, so Muse Code runs on any model in magpie: DeepSeek, GLM, Kimi, Qwen, Claude or a ChatGPT subscription.

## Set up Muse Code

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick a model for Muse Code on the Agents page.** Pick a model via magpie.
3. **Restart open muse sessions.** Muse Code reads its settings at start-up.

```
magpie muse deepseek/deepseek-v4-pro
```

## settings.json

Muse Code keeps its settings in `${XDG_CONFIG_HOME:-~/.config}/muse/settings.json`, and refuses the file without `"schema_version": 1`. magpie writes:

```
{
  "schema_version": 1,
  "endpoint_transport": {
    "base_url": "http://127.0.0.1:3425/v1",
    "auth": "none"
  },
  "model": "deepseek/deepseek-v4-pro"
}
```

Muse Code streams to `/responses` under `base_url` (OpenAI's Responses API), where the gateway answers. The file's other keys are left as they are. With no file, magpie makes one with the schema version. Muse Code in a WSL distro is set up the same way, in `~/.config/muse` there.

## Why auth is none

With `auth` `bearer`, Muse Code sends the Meta sign-in's token (auth.json, or META_API_KEY); with `none` it sends no Authorization and asks for no sign-in. magpie uses none, so your Meta token is neither read by magpie nor sent to the gateway.

## The model list

Muse Code lists its models from `/muse-code/models` on `base_url`'s host, which the gateway serves, so magpie's models show in Muse Code's model choice.

## Switching back

When it first steps in, magpie stashes the `endpoint_transport` and `model` you had. Switching back puts them back, or takes magpie's out where you had none. A file magpie made goes again once only the schema version is left.

```
magpie muse default
```

## FAQ

### Can Muse Code run on DeepSeek, GLM or a ChatGPT subscription?

Yes. Pick a via-magpie model for Muse Code on magpie's Agents page, then restart open muse sessions.

### Does magpie read my Meta sign-in token?

No. magpie sets auth to none, so Muse Code sends no Authorization; the token is neither read nor sent to the gateway.

### Nothing changed in Muse Code. Why?

Muse Code reads settings.json at start-up. Restart open muse sessions.

### Does switching back restore my settings?

Yes. magpie stashed the endpoint_transport and model you had and puts them back; the file's other keys were never touched.

More agents on the same models: [Prime Agent on any model](https://usemagpie.ai/docs/prime-agent), [Pi on any model](https://usemagpie.ai/docs/pi), [Kimi Code on any model](https://usemagpie.ai/docs/kimi-code) and [Paimon on any model](https://usemagpie.ai/docs/paimon). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/paimon

# Paimon on any model

Paimon (aisk/paimon, installed with `uv tool install paimon`) is a coding agent in the terminal, built on pydantic-ai. Its settings are one JSON file: the model is `provider:name`, and each provider keeps its own address and key. magpie adds a provider at the gateway, so Paimon runs on any model in magpie: DeepSeek, GLM, Kimi, Qwen, Claude or a ChatGPT subscription.

## Set up Paimon

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick a model for Paimon on the Agents page.** Pick a model via magpie.
3. **Restart Paimon.** Paimon reads its settings when it starts, so a running one keeps its model until it starts again.

```
magpie paimon deepseek/deepseek-v4-pro
```

## config.json

The file is `$PAIMON_CONFIG_HOME/config.json`, else `~/.config/paimon/config.json` (on Windows too). magpie changes three things:

```
{
  "model": "litellm:deepseek/deepseek-v4-pro",
  "providers": {
    "litellm": {
      "api_base": "http://127.0.0.1:3425/v1",
      "api_key": ""
    }
  },
  "compaction": { "context_window": 1000000 }
}
```

A model is sent with its own provider's key only. The rest of the file is left alone; with no file, magpie makes one readable by you alone (it holds keys), as Paimon makes it. Paimon in a WSL distro is set up the same way.

## Why litellm

magpie uses pydantic-ai's litellm provider, an OpenAI-compatible proxy that profiles a `vendor/model` name by its vendor, as magpie's ids are spelled. Paimon's login doesn't offer it, so it is almost never one of your own. The gateway knows the provider for magpie's by magpie's own key for Paimon.

## Context window and compaction

For a name genai-prices doesn't know, which magpie's ids aren't, Paimon compacts against `compaction.context_window` only, and doesn't compact at all without it. So magpie writes the window it knows the model to take; for a model whose window it doesn't know, your own value, never the last model's.

## Switching back

When it first steps in, magpie stashes the model, providers.litellm and compaction.context_window you had. Switching back puts all three back, takes out the empty objects it left, and removes a file it made once nothing is left in it. A model you picked in Paimon since, on a provider of your own, counts as yours and is the one put back.

```
magpie paimon default
```

## FAQ

### Can Paimon run on DeepSeek, GLM or a ChatGPT subscription?

Yes. Pick a via-magpie model for Paimon on magpie's Agents page, then restart Paimon.

### Why does the model in config.json start with litellm:?

magpie goes through pydantic-ai's litellm provider, an OpenAI-compatible proxy that reads magpie's vendor/model ids.

### Does Paimon still compact its context?

Yes. magpie writes the model's context window, which Paimon compacts against; without it Paimon doesn't compact.

### Does switching back restore my settings?

Yes. magpie stashed the model, litellm provider and context window you had and puts them back; the rest of the file was never touched.

More agents on the same models: [Muse Code on any model](https://usemagpie.ai/docs/muse-code), [Prime Agent on any model](https://usemagpie.ai/docs/prime-agent), [Pi on any model](https://usemagpie.ai/docs/pi) and [PenguinHarness on any model](https://usemagpie.ai/docs/penguin). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/penguin

# PenguinHarness on any model

PenguinHarness (Prism-Shadow/penguin-harness, the `penguin` command, npm `@prismshadow/penguin-cli`, and a desktop app) keeps each Project's models in one TOML file. magpie adds a provider named magpie and its models there, so PenguinHarness runs on any model in magpie: DeepSeek, GLM, Kimi, Qwen, Claude or a ChatGPT subscription. The CLI and the desktop app read the same file.

## Set up PenguinHarness

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick a model for PenguinHarness on the Agents page.** Pick a model via magpie. A running PenguinHarness moves to it at once, with no restart.

```
magpie penguin deepseek/deepseek-v4-pro
```

## .project_config.toml

The file is under the data root: `$PENGUIN_HOME`, else `~/.penguin/data` on every system. The CLI works in the Project `$PENGUIN_PROJECT_ID`, else `default_project`, so the file is `~/.penguin/data/default_project/.project_config.toml`. What magpie writes:

```
default_model = { provider = "magpie", model_id = "deepseek/deepseek-v4-pro" }

[providers.magpie]
base_url = "http://127.0.0.1:3425/v1"
client_type = "openai-responses"
api_key = ""

[[models]]
provider = "magpie"
model_id = "deepseek/deepseek-v4-pro"
display_name = "…"
context_window = …
vision = …
max_tokens = …

[models.pricing]
unit = "usd_per_mtok"
cache_read = …
cache_write = …
output = …
```

A model is the pair of provider and model_id, and one without an address or key of its own takes its provider's. magpie uses the `openai-responses` client: requests go to base_url plus `/responses`, with the thinking level as reasoning.effort, which the openai-chat client leaves out. Your own providers and models stay as they are. With no file, magpie makes one readable by you alone (it holds keys), as PenguinHarness makes it. PenguinHarness in a WSL distro is set up the same way, in `~/.penguin/data` there.

## The model list

Each of magpie's models is one `[[models]]` entry, with what PenguinHarness's own Models page records for one: the display name, context window, cap on a reply, whether it reads images, and its price per million tokens. `vision` is always written, since PenguinHarness takes a model to read images unless told not. PenguinHarness refuses a default_model naming no entry, so magpie writes the entries before the default, and on the way back changes the default before taking them out.

## No restart

PenguinHarness's server reads the file again whenever its modification time moves, so a change needs no restart. Its own Models page and `penguin config model …` write the whole file back, and every key magpie writes is one it knows, so none is lost. A sync with nothing new leaves the file, and its time, alone.

## Switching back

When it first steps in, magpie stashes the default_model you had. Switching back picks it again if PenguinHarness still has it, takes out a vision_model picked among magpie's, then removes magpie's models and `[providers.magpie]`. A file magpie made is removed once nothing is left in it.

```
magpie penguin default
```

## FAQ

### Can PenguinHarness run on DeepSeek, GLM or a ChatGPT subscription?

Yes. Pick a via-magpie model for PenguinHarness on magpie's Agents page; the CLI and the desktop app both use it.

### Which file does magpie change?

The current Project's .project_config.toml under the data root ($PENGUIN_HOME, else ~/.penguin/data). The default Project is default_project.

### Do I need to restart PenguinHarness?

No. It reads its settings again whenever the file's modification time moves.

### Does switching back restore my model?

Yes. magpie stashed the default_model you had, picks it again if PenguinHarness still has it, and removes the provider and models it added.

More agents on the same models: [Paimon on any model](https://usemagpie.ai/docs/paimon), [Muse Code on any model](https://usemagpie.ai/docs/muse-code), [Prime Agent on any model](https://usemagpie.ai/docs/prime-agent) and [MothX on any model](https://usemagpie.ai/docs/mothx). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/mothx

# MothX on any model

MothX (OSCHINA's oschina/mothx, the `mothx` command, formerly vibecoding) is a coding agent in the terminal, written in Go. Its providers and the model it starts on are in one settings.json. magpie adds a provider named magpie and makes it the default, so MothX runs on any model in magpie: DeepSeek, GLM, Kimi, Qwen, Claude or a ChatGPT subscription.

## Set up MothX

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick a model for MothX on the Agents page.** Pick a model via magpie, and a thinking level if you want one.
3. **Restart MothX.** MothX reads its settings when it starts, so an open session keeps its model until it starts again.

```
magpie mothx deepseek/deepseek-v4-pro
```

## settings.json

The config folder is `$MOTHX_DIR`, else `%APPDATA%\mothx` on Windows and `~/.mothx` elsewhere. What magpie writes:

```
{
  "defaultProvider": "magpie",
  "defaultModel": "deepseek/deepseek-v4-pro",
  "defaultThinkingLevel": "high",
  "providers": {
    "magpie": {
      "baseUrl": "http://127.0.0.1:3425/v1",
      "api": "openai-chat",
      "apiKey": "",
      "thinkingFormat": "openai",
      "models": [
        { "id": "deepseek/deepseek-v4-pro", "name": "…", "reasoning": true,
          "input": ["text"], "contextWindow": …, "maxTokens": …,
          "cost": { "input": …, "output": …, "cacheRead": …, "cacheWrite": … } }
      ]
    }
  }
}
```

MothX asks the default provider for the default model on that provider's api: `openai-chat` is baseUrl plus `/chat/completions`, under Bearer apiKey. Each of magpie's models is one entry, with whether it reads images, its context window, its cap on a reply and its price per million tokens; without them MothX takes its own default window and cap, and can't count a turn's cost. Headers or an httpProxy you put in magpie's provider stay, and your own providers aren't touched. MothX in a WSL distro is set up the same way, in `~/.mothx` there.

## Thinking levels

`defaultThinkingLevel` is the level a session starts at: off, minimal, low, medium, high, xhigh or max, narrowed to the ones a model takes when magpie knows them. MothX sends a level only for a model whose entry says `reasoning` is true. magpie writes `thinkingFormat: "openai"`, so MothX asks every model as reasoning_effort, which the gateway carries to each vendor's own form. Without it MothX guesses the vendor from the model id and the address: a model named qwen… got Qwen's enable_thinking, a deepseek… one only thinking:{type:enabled}, whatever served it. A thinkingFormat you already set is left alone.

## Restart MothX

MothX reads settings.json at start-up, so a running MothX needs a restart; magpie tells you when a mothx or vibecoding process is running. MothX's own /model and /auth dialogs write the whole file back, and magpie's settings survive that. Its requests say `Vibecoding Client/<version>` as their User-Agent, and Usage counts them as MothX.

## Switching back

Switching back takes out defaultProvider, defaultModel and `providers.magpie`, and a providers object left empty. When the file then says the same as before magpie's first write, the original file is put back byte for byte.

```
magpie mothx default
```

## FAQ

### Can MothX run on DeepSeek, GLM or a ChatGPT subscription?

Yes. Pick a via-magpie model for MothX on magpie's Agents page, then restart MothX.

### Does this work for vibecoding too?

Yes. vibecoding is MothX's old name; magpie takes it for MothX, with the same settings.json.

### How does the thinking level reach the model?

magpie sets thinkingFormat to openai, so MothX sends reasoning_effort, which the gateway turns into each vendor's own form.

### Does switching back restore my settings?

Yes. magpie takes out the default and the provider it added; when the file says the same as before, the original is put back as it was.

More agents on the same models: [PenguinHarness on any model](https://usemagpie.ai/docs/penguin), [Paimon on any model](https://usemagpie.ai/docs/paimon), [Pi on any model](https://usemagpie.ai/docs/pi) and [Avibe on any model](https://usemagpie.ai/docs/avibe). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/avibe

# Avibe on any model

Avibe (avibe-bot/avibe, MIT, the `avibe-os` package and its `vibe` CLI) is a local agent OS. Its own agent, Vibey, and the Claude Code, Codex and OpenCode it runs all take their models from its Model Hub, a gateway of Avibe's own (CLIProxyAPI) in front of the model sources added on its Models page. magpie is added as one such source, so every agent in Avibe runs on any model in magpie: DeepSeek, GLM, Kimi, Qwen, Claude or a ChatGPT subscription.

## Set up Avibe

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Start Avibe.** Avibe adds and removes model sources only while it runs, so start it with `vibe start` first.
3. **Pick magpie for Avibe on the Agents page.** magpie shows up as a model source on Avibe's Models page, for Vibey and the agents it runs.

```
vibe start
magpie avibe magpie
```

## magpie as a model source

Avibe's home is `$AVIBE_HOME`, else `~/.avibe` (`~/.vibe_remote` before 3.0), and its sources are `model_hub.sources` in `config/config.json` there. A source can't be written into config.json by hand: each is checked whole, its key lives in the Model Hub's store, and Avibe adds it to its agents' route chains as it is added. So magpie adds and removes it as Avibe's Models page does, through Avibe's internal API: the socket `state/dispatch.sock` in its home on macOS and Linux, or on Windows the loopback port and bearer token `runtime/control-ipc/endpoint.json` gives. What magpie sends:

```
POST /internal/model-hub
{
  "operation": "create_source",
  "payload": {
    "source": {
      "kind": "api_key",
      "vendor": "custom",
      "display_name": "magpie",
      "base_url": "http://127.0.0.1:3425/v1",
      "key": "",
      "protocol": "openai_chat",
      "supply_channel": "hub",
      "billing": "metered",
      "save_unverified": true
    }
  }
}
```

magpie keeps the source's id, so one you rename in Avibe is still magpie's. A custom source at the gateway that you added by hand on the Models page counts as magpie's too. When the gateway moves to another port, a sync removes the old source and adds it again at the new address, since the key is sealed with the address; one pointed at another machine, a local proxy's path or the way a WSL distro reaches Windows stays where it is.

## Why chat completions

The source's protocol is `openai_chat`, not Responses. For a Responses source the Model Hub runs Codex's executor, which names itself codex-tui and would be taken for Codex itself; for chat it passes each backend's own headers on. A hub source serves every backend, the Model Hub translating Claude's and Codex's requests. It is saved without Avibe's protocol probe, which can't tell the gateway's protocols apart, as it serves them all.

## The model list

Avibe lists its models from the gateway's `/v1/models` itself, so what it offers is the models you picked for Avibe on magpie's Agents page. Avibe lists them again on its own only once the listing is half an hour old, so magpie has it refresh the source when you add or drop one.

## Removing it

Switching back has magpie delete the source through the same internal API and forget its id. When removing it would take a hop out of a route or interrupt work in progress, Avibe asks for that to be confirmed, as its Models page does; you asked for it in magpie, so magpie asks again with what Avibe listed.

```
magpie avibe default
```

## FAQ

### Do Claude Code and Codex inside Avibe get magpie's models too?

Yes. magpie is a Model Hub source, and a hub source serves Vibey and every backend Avibe runs: Claude Code, Codex and OpenCode.

### Why does magpie say to start Avibe first?

Avibe adds and removes model sources only through its internal API while it runs; config.json can't be edited for it. Run vibe start and try again.

### Which models does Avibe offer?

The ones you picked for Avibe on magpie's Agents page. Avibe reads them from the gateway's /v1/models, and magpie has it refresh when the list changes.

### How do I remove magpie?

Switch Avibe back to its default in magpie, or run magpie avibe default. magpie deletes the source it added.

More agents on the same models: [MothX on any model](https://usemagpie.ai/docs/mothx), [PenguinHarness on any model](https://usemagpie.ai/docs/penguin), [Paimon on any model](https://usemagpie.ai/docs/paimon) and [StepCode on any model](https://usemagpie.ai/docs/stepcode). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/stepcode

# StepCode on any model

StepCode is StepFun's coding agent in the terminal, the `step` command. Its default provider and model are in config.toml, and its providers in models.json, in Pi's provider format. magpie adds a provider named magpie to models.json and makes it the default in config.toml, so StepCode runs on any model in magpie: DeepSeek, GLM, Kimi, Qwen, Claude or a ChatGPT subscription.

## Set up StepCode

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick a model for StepCode on the Agents page.** Pick a model via magpie. On the command line, `magpie step` is the same agent.
3. **Start StepCode.** StepCode reads both files when it starts, so a new session is on the model you picked.

```
magpie stepcode deepseek/deepseek-v4-pro
```

## config.toml and models.json

The files are in `~/.stepcode`, or the folder above an absolute `STEP_CODING_AGENT_DIR`. A folder renamed with `STEPCODE_CONFIG_DIR` is followed on this computer. In config.toml magpie writes only these keys, and the rest of the file stays as it was:

```
# ~/.stepcode/config.toml
defaultProvider = "magpie"
defaultModel = "deepseek/deepseek-v4-pro"
enabledModels = ["…", "magpie/deepseek/deepseek-v4-pro"]
```

In models.json magpie writes only `providers.magpie`: the gateway's `/v1` as baseUrl, the `openai-completions` api, magpie's own key for StepCode, and magpie's models. models.json may have comments (JSONC). magpie checks it first: the root, providers and providers.magpie must be objects, or nothing is written, so a file it can't read safely isn't broken.

```
// ~/.stepcode/models.json
{
  "providers": {
    "magpie": {
      "name": "magpie",
      "baseUrl": "http://127.0.0.1:3425/v1",
      "api": "openai-completions",
      "apiKey": "",
      "models": [ { "id": "deepseek/deepseek-v4-pro", … } ]
    }
  }
}
```

## The enabledModels scope

`enabledModels` is a scope of patterns matched against models. At start-up StepCode uses the default model when a pattern in the scope takes it, and otherwise the scope's first entry, with any `:level` suffix taken off. So the default alone isn't enough: when you have a scope, magpie appends its pick to it and remembers that it did. Switching back takes out only those entries, never your own. A provider renamed takes its scope entries with it.

## Switching back

Before its first write magpie saves the original provider, model and scope, the original `providers.magpie` text, and whether config.toml, models.json and providers existed. Switching back puts all of these back, and removes files magpie made.

```
magpie stepcode default
```

## FAQ

### Can StepCode run on DeepSeek, GLM or a ChatGPT subscription?

Yes. Pick a via-magpie model for StepCode on magpie's Agents page, then start StepCode.

### Why did StepCode start on another model when defaultModel was set?

With enabledModels set, the default is used only when the scope takes it. magpie appends its pick to the scope and removes only that entry when switching back.

### Does a models.json with comments work?

Yes. magpie reads it as JSONC, and writes nothing when the root, providers or providers.magpie isn't an object.

### Does switching back restore my settings?

Yes. The original provider, model, scope and providers.magpie go back, and files magpie made are removed.

More agents on the same models: [Avibe on any model](https://usemagpie.ai/docs/avibe), [MothX on any model](https://usemagpie.ai/docs/mothx), [Pi on any model](https://usemagpie.ai/docs/pi) and [omp on any model](https://usemagpie.ai/docs/omp). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/omp

# omp on any model

omp (oh-my-pi, the `omp` command) is a fork of Pi, a coding agent in the terminal. It gives each kind of work a model role: default for the session, task for subagents, smol for small jobs, slow for review, plus plan, commit and more. magpie adds a provider named magpie to models.yml and points the roles you pick at it, so each of omp's roles runs on any model in magpie: DeepSeek, GLM, Kimi, Qwen, Claude or a ChatGPT subscription.

## Set up omp

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick models for omp on the Agents page.** Pick the default role's model first, then one for any other role and a thinking level if you want. On the command line, `magpie oh-my-pi` is the same agent.
3. **Start a new session.** A new omp session starts on the default role's model.

```
magpie omp deepseek/deepseek-v4-pro
```

## config.yml and models.yml

omp's settings are in `~/.omp/agent/config.yml`; `PI_CONFIG_DIR` renames `~/.omp`, and `PI_CODING_AGENT_DIR` moves the agent folder. Each role's model is under `modelRoles` as provider/model, so one of magpie's is `magpie/<provider>/<model>`, with an optional `:level` on the end.

```
# ~/.omp/agent/config.yml
modelRoles:
  default: magpie/deepseek/deepseek-v4-pro
  slow: magpie/…:high
enabledModels:
  - …
  - magpie/**
```

In models.yml beside it, magpie's provider takes no key on this computer (`auth: none`), and its models carry their context window, cap on a reply, whether they read images, the thinking levels each takes and the price per million tokens. With the price, omp counts what each call cost; without it a magpie model matches none of omp's bundled ones and every call costs 0. Your own providers and what else you keep in models.yml, such as modelOverrides, are left alone.

```
# ~/.omp/agent/models.yml
providers:
  magpie:
    baseUrl: http://127.0.0.1:3425/v1
    auth: none
    models:
      - id: deepseek/deepseek-v4-pro
        …
```

## A model per role

default is the model a session starts on. task is for subagents; scout and sonic run on smol and reviewer on slow. Unset, task takes the parent session's model, and smol and slow the default's. plan is plan mode's, vision handles images, advisor gives a second opinion (slow first when unset), commit writes commit messages, tiny names sessions, and memory follows tiny. Every role but default can have a thinking level of its own, say medium for sessions and high for slow. The levels are minimal, low, medium, high, xhigh and max; an omp before 16.4.0 doesn't take max, so it gets xhigh. Image models set in magpie's Settings › Models › Images show up for omp's image role in its own Roles view, from omp 18.7.0.

## enabledModels

While `enabledModels` lists models, a new session is held to it: a default model outside the list never starts, and omp picks another from the list. So when you have one, magpie adds `magpie/**` to it, which also keeps all of magpie's models in omp's picker and Ctrl+P. The list is yours: magpie keeps its entries, order and comments, never makes one where there is none, and leaves entries scoped to folders as they are. The other roles aren't held to it.

## Each model on its own API

As with Pi, each model is asked on its provider's native API, and the gateway relays it as it is: OpenAI's Responses, Anthropic's Messages, Gemini's `/v1beta`. Over Chat, a Claude lost its thinking's signatures between tool turns, since Chat has no place for them. magpie also has omp send its session id in a header, so Record gateway conversations keeps its turns. omp 18.1.6 and later name themselves (`omp/<version>`); for an older omp magpie adds the name as its User-Agent, so Usage counts it as omp either way. A User-Agent you set on magpie's provider yourself stays.

## Profiles and WSL

Each profile in `~/.omp/profiles/<name>/agent` is an omp of its own, shown on the Agents page as `omp#<name>` with its own config.yml and models.yml; the one `OMP_PROFILE` picks is the default row. omp in a WSL distro uses `~/.omp/agent` there; when it reaches Windows' address from behind NAT, the provider carries the key the gateway is shared on the network with.

## Switching back

Before magpie takes a role over it saves what the role had, and setting the role back puts that back as it was, a YAML list in the style it was written. magpie's provider stays in models.yml while any role, fallback chain or task agent is on one of its models, and goes once none is, with the `enabledModels` entry magpie added.

```
magpie omp default
```

## FAQ

### Can omp run on DeepSeek, GLM or a ChatGPT subscription?

Yes. Pick a via-magpie model for omp's default role on magpie's Agents page, then start a new session.

### Can smol, slow and commit each have their own model?

Yes. Each role can take its own magpie model, and every role but default its own thinking level.

### Why did omp start on another model when default was set?

While enabledModels lists models, the default model has to be in it. magpie adds magpie/** and removes it when switching back.

### Does switching back restore my settings?

Yes. Each role gets back what it had; once nothing is on magpie, its provider and its enabledModels entry go too.

More agents on the same models: [Pi on any model](https://usemagpie.ai/docs/pi), [StepCode on any model](https://usemagpie.ai/docs/stepcode), [MothX on any model](https://usemagpie.ai/docs/mothx) and [Ante on any model](https://usemagpie.ai/docs/ante). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/ante

# Ante on any model

Ante is antigma.ai's coding agent in the terminal, the `ante` command. It ships its own providers, and takes more of yours in catalog.json, merged on top. magpie adds a provider named magpie there and has Ante start on it in settings.json, so Ante runs on any model in magpie: DeepSeek, GLM, Kimi, Qwen, Claude or a ChatGPT subscription.

## Set up Ante

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick a model for Ante on the Agents page.** Pick a model via magpie.
3. **Restart Ante.** Ante reads catalog.json once per process, so a running one needs a restart.

```
magpie ante deepseek/deepseek-v4-pro
```

## catalog.json

The file is `~/.ante/catalog.json`, or `$ANTE_HOME/catalog.json` when `ANTE_HOME` is set. A key under providers is what `--provider` takes. magpie's entry points at the gateway's `/v1` on the OpenAiCompatible wire style, which is how Ante speaks Chat Completions, and the gateway takes every model on it. magpie's models are listed in `preferred_models`, Ante's model picker.

```
// ~/.ante/catalog.json
{
  "providers": {
    "magpie": {
      "display_name": "magpie",
      "base_url": "http://127.0.0.1:3425/v1",
      "wire_style": "OpenAiCompatible",
      "preferred_models": [
        { "id": "deepseek/deepseek-v4-pro", "display_name": "…",
          "context_limit": …, "max_tokens": …, "supported_efforts": […] }
      ]
    }
  }
}
```

The entry has no auth: the gateway listens on this computer and lets its requests in without a key, and Ante counts a provider with no auth block as signed in. A bearer env_key would mean putting a key into Ante's environment, which is yours to decide. An auth block, http_headers or extra_body you add inside magpie's entry stays, which is how a gateway shared on the network or reached from WSL gets its key. Your own providers and the models section are left alone. magpie doesn't write support_vision either: Ante takes a model as seeing images unless told otherwise, and false would have Ante drop your images before the gateway, which can describe them to a model that can't see. A routing group gets no thinking levels, since which member answers each turn, and what it takes, is the group's to decide.

## settings.json

Being in the catalog isn't enough. The provider a session starts on is `provider` and `model` in `~/.ante/settings.json`; with neither set, Ante takes the first signed-in provider in catalog order, and the ones it ships come first. So magpie sets those two as well, and saves what was there.

```
// ~/.ante/settings.json
{ "provider": "magpie", "model": "deepseek/deepseek-v4-pro" }
```

## Restart Ante

Ante reads the catalog once per process, so an edit needs a restart. It parses the file leniently: an entry it can't read is skipped with a notice and the rest still load, so a bad entry would cost you magpie's provider, not your own.

## Switching back

Switching back puts Ante's original provider and model back (or nothing, which leaves Ante to its own detection) and takes magpie's entry out of the catalog, with a providers map left empty and files magpie made. A provider you picked in Ante's own /providers while magpie was set up is your choice and stands.

```
magpie ante default
```

## FAQ

### Can Ante run on DeepSeek, GLM or a ChatGPT subscription?

Yes. Pick a via-magpie model for Ante on magpie's Agents page, then restart Ante.

### Why didn't Ante use magpie's provider when it was in the catalog?

Ante starts on provider and model in settings.json, else the first signed-in provider it ships. magpie sets those two as well.

### Why is there no API key in magpie's entry?

The gateway takes no key on this computer, and Ante counts a provider with no auth as signed in. An auth block you add stays.

### Does switching back restore my settings?

Yes. Your original provider and model go back and magpie's entry comes out; a choice you made in Ante since stands.

More agents on the same models: [omp on any model](https://usemagpie.ai/docs/omp), [StepCode on any model](https://usemagpie.ai/docs/stepcode), [Avibe on any model](https://usemagpie.ai/docs/avibe) and [Aside on any model](https://usemagpie.ai/docs/aside). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/aside

# Aside on any model

Aside (the `aside` command) keeps settings, a model list and sign-in for each account. magpie adds a provider named magpie to the account's models.json and has Aside itself make it the default, so Aside runs on any model in magpie: DeepSeek, GLM, Kimi, Qwen, Claude or a ChatGPT subscription, and draws with magpie's image models too.

## Set up Aside

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick a model for Aside on the Agents page.** Pick a default model via magpie, and a thinking level, categories and an image model if you want.
3. **Carry on in Aside.** magpie has Aside change its own settings, then reads them back to check they took.

```
magpie aside deepseek/deepseek-v4-pro
```

## models.json

Each Aside account has a folder, `~/.aside/u/<id>`, with settings.json, models.json and its sign-in. magpie writes `providers.magpie` in models.json in Pi's format: the gateway's `/v1` as baseUrl, magpie's own key for Aside, and magpie's models.

```
// ~/.aside/u//models.json
{
  "providers": {
    "magpie": {
      "baseUrl": "http://127.0.0.1:3425/v1",
      "api": "…",
      "apiKey": "",
      "models": [ { "id": "deepseek/deepseek-v4-pro", … } ]
    }
  }
}
```

magpie changes only its own entry. When the magpie entry there has no key or another key, magpie won't write over it; one pointing at another gateway changes only when you reconnect on purpose.

## Aside's own settings

magpie doesn't edit settings.json for the default model and the like. It has Aside set them, through `aside repl --account <id> --host local`, then reads them back. When the value read back differs, magpie says so instead of calling it done. The default model is a provider and a modelId, and magpie's are the ones whose provider is magpie. The thinking level goes with the default model, offering only the levels that model takes.

## Categories and the image model

Aside's `modelCategories` are fast, standard, deep and visual, and each can take its own model; unset, they follow the default. `imageGenerationModel` is the model Aside draws with, and can be one of magpie's image models. One unticked in its provider's editor isn't offered, but one already picked keeps drawing.

## More than one account

`currentAccountId` in `~/.aside/accounts.json` is the account Aside is on. magpie sets up the account picked in magpie, else the one Aside has active, else u0 when neither can be read. Each account's settings, and what magpie remembers of them, stay with that account. Picking another account changes only which one magpie sets up; nothing in Aside changes.

```
magpie aside account u1
```

## Switching back

Before each setting it changes, magpie saves what was there. Switching back restores only the settings magpie changed; the rest are left as they are.

```
magpie aside default
```

## FAQ

### Can Aside run on DeepSeek, GLM or a ChatGPT subscription?

Yes. Pick a via-magpie default model for Aside on magpie's Agents page; magpie has Aside apply it.

### Can fast, standard, deep and visual each have their own model?

Yes. Each category can take its own magpie model, and follows the default when unset.

### Which account does magpie set up when Aside has several?

The one Aside is on, unless you pick one in magpie, for example magpie aside account u1.

### Does switching back restore my settings?

Yes. magpie restores only the settings it changed, from the values it saved before.

More agents on the same models: [Ante on any model](https://usemagpie.ai/docs/ante), [omp on any model](https://usemagpie.ai/docs/omp), [Pi on any model](https://usemagpie.ai/docs/pi) and [fx on any model](https://usemagpie.ai/docs/fx). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/fx

# fx on any model

fx (fx.sh, from Vercel Labs, not the JSON viewer of the same name) keeps its settings in `~/.fx/settings.json`: `provider` is the provider it talks to (gateway, codex, grok or one of your own), `models` each provider's model, and `providers` the providers of your own. magpie adds itself there as the provider magpie, so fx runs on any model in magpie: DeepSeek, GLM, Kimi, Qwen, Claude or a ChatGPT subscription.

## Set up fx

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick a model for fx on the Agents page.** Pick one via magpie. magpie finds fx by its `~/.fx` folder, not the `fx` command, as the name is a common one.
3. **Restart fx.** fx reads its settings at start-up.

```
magpie fx deepseek/deepseek-v4-pro
```

## settings.json

With one of magpie's models picked, magpie sets `provider` to magpie and `models.magpie` to the model, such as `deepseek/deepseek-v4-pro`, and writes `providers.magpie`: the openai-chat-completions protocol, the gateway's `/v1` as base_url, and auth none, so no key. In fx the model reads `magpie/deepseek/deepseek-v4-pro`.

```
// ~/.fx/settings.json
{
  "provider": "magpie",
  "models": { "magpie": "deepseek/deepseek-v4-pro" },
  "providers": {
    "magpie": {
      "protocol": "openai-chat-completions",
      "base_url": "http://127.0.0.1:3425/v1",
      "auth": { "type": "none" },
      "tool_choice_mode": "send",
      "model_metadata": {
        "deepseek/deepseek-v4-pro": { "supports_tool_use": true, "supports_vision": …, "context_window": …, "max_output_tokens": … }
      }
    }
  }
}
```

fx sends no effort to a provider of your own, so there is no effort to pick. An fx in WSL is set up the same way, its base_url the gateway as that distro reaches it.

## The model list

fx's model picker lists `model_metadata`: magpie's catalog, each model marked as taking tools, with whether it takes images, its context window and its output limit. fx refuses an output limit that isn't below the context window, so magpie leaves such a limit out. fx takes at most 256 models and refuses the whole settings file past that, so magpie writes at most 256, the model in use first so it is never the one cut. When the catalog changes, magpie brings the list up to date while fx is connected.

## What you set yourself

A provider in fx can have a `reviewer_model`, the model its auto permission mode asks. magpie doesn't write one, and one you set stays. magpie writes `tool_choice_mode` send, and omit stays when you turn it to that. The protocol, address, auth and model_metadata are magpie's; auth is written whole, as fx refuses an env beside type none.

## Restarting fx

fx reads its settings at start-up. When fx is running as the model changes, magpie says to restart open fx sessions.

## Switching back

Picking one of fx's own models removes `providers.magpie` and `models.magpie`, and `provider` when it is magpie, so fx is back on the provider it talks to without magpie: Vercel's AI Gateway when none was set. The model goes into that provider's `models`; default removes it, leaving fx on its own default.

```
magpie fx default
```

## FAQ

### Which fx is this?

Vercel Labs' coding agent fx (fx.sh), with its settings in ~/.fx. The JSON viewer named fx is another program.

### Does fx need an API key for magpie?

No. magpie's provider in fx has auth none and talks to the gateway on this computer.

### Why does fx list at most 256 of magpie's models?

fx refuses the whole settings file when model_metadata holds more than 256, so magpie writes at most 256, the model in use first.

### Which provider does fx use after switching back?

The one it talks to without magpie; Vercel's AI Gateway when none was set.

More agents on the same models: [Aside on any model](https://usemagpie.ai/docs/aside), [Ante on any model](https://usemagpie.ai/docs/ante), [omp on any model](https://usemagpie.ai/docs/omp) and [Grok App on any model](https://usemagpie.ai/docs/grok-app). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/grok-app

# Grok App on any model

Grok App (RongleCat/grok-app) is a desktop front end for the grok CLI, which it starts over ACP. Its own model list is Grok Build's official catalog only; a model of your choosing is a provider channel in its settings. magpie adds itself as a custom provider named magpie, so Grok App's model picker offers any model in magpie: DeepSeek, GLM, Kimi, Qwen, Claude or a ChatGPT subscription.

## Set up Grok App

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick a model for Grok App on the Agents page.** Pick one via magpie, and magpie writes its custom provider.
3. **Press Use in Grok App.** Press Use on magpie in Grok App's Settings › Account; that is what moves the App onto magpie.

```
magpie grok-app deepseek/deepseek-v4-pro
```

## magpie's custom provider

magpie writes `[model.magpie]` in `agent-home/config.toml` under the App's data folder, the way the App writes a channel itself: the gateway's `/v1` as base_url, magpie's own key for Grok App, chat completions. `app_models` is a JSON list of magpie's models, each with its context window, whether it takes images and its effort levels, so the custom providers in Settings list magpie and the model picker can offer those models and their efforts.

```
# /agent-home/config.toml
[model.magpie]
model = "deepseek/deepseek-v4-pro"
base_url = "http://127.0.0.1:3425/v1"
name = "magpie"
api_key = ""
api_backend = "chat_completions"
app_provider_mode = "generic"
app_models = "[…]"
app_efforts = "[…]"
supports_reasoning_effort = …
context_window = …
```

The channel's context window, images and efforts follow the model picked. When the picked model is one magpie no longer has, the channel moves to the first in the list.

## The route is yours to switch

`[models] default` is the route the App starts on. magpie doesn't write it: making it magpie takes the App over, and the App then drops its own sign-in and the session no longer runs. So the route stays what the App had, and pressing Use in the App's settings is what switches it, the App's own choice. An older magpie set the route to magpie; this one puts the old route back once, on the next sync or connect, and a Use you press after that stays. A model you pick in the App's picker since is yours too, and stays through a sync.

On magpie, the App starts the CLI with GROK_HOME at agent-home, its independent mode; its default shared mode uses `~/.grok`, Grok Build's home.

## Models and efforts

Grok Build has no effort none for a channel, so the levels are the model's others. The one the picker starts on is the default you marked for that model on the App's Providers page, while the model still has it, else medium, or the middle level without it.

## The data folder

magpie finds Grok App's data folder at `$GROK_APP_HOME` when it is set, else by system, the first that is there.

```
macOS    ~/Library/Application Support/com.grokapp.grok-app
Windows  %APPDATA%\grokapp\grok-app\data
Linux    $XDG_DATA_HOME/grok-app (~/.local/share/grok-app)
         or ~/.grok-app; $GROK_APP_HOME when set
```

## Disconnecting

Disconnecting takes `[model.magpie]` out. The route is touched only when it still names magpie, a route that doesn't run: magpie puts back the one it remembered, or clears it. Any other route is the App's and stays. Picking one of the App's own routes in magpie, such as the official Grok, also takes magpie's channel out and makes that the route.

## FAQ

### Can Grok App run on DeepSeek, GLM or a ChatGPT subscription?

Yes. magpie adds itself as a custom provider in Grok App, so its model picker offers magpie's models; press Use on magpie in its settings to switch.

### Why is Grok App not on magpie after connecting?

magpie leaves the App's route alone, as taking it over makes the App drop its own sign-in. Press Use on magpie in Grok App's Settings › Account.

### Can I pick an effort in Grok App?

Yes. Each magpie model comes with its own effort levels, starting on the one you marked, else medium.

### Does disconnecting put Grok App's old route back?

Yes, when the route still names magpie; any other route is left alone.

More agents on the same models: [fx on any model](https://usemagpie.ai/docs/fx), [Aside on any model](https://usemagpie.ai/docs/aside), [Ante on any model](https://usemagpie.ai/docs/ante) and [Mister Morph on any model](https://usemagpie.ai/docs/mister-morph). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/mister-morph

# Mister Morph on any model

Mister Morph (the `morph` command) keeps its settings in `~/.morph/config.yaml`, or the file `MISTER_MORPH_CONFIG` names: the main model under `llm.model`, asked of the vendor `llm.inference_provider` names at `llm.endpoint` with `llm.api_key`. It has no list of providers to add one to, so magpie takes those llm keys over, and Mister Morph runs on any model in magpie: DeepSeek, GLM, Kimi, Qwen, Claude or a ChatGPT subscription.

## Set up Mister Morph

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick a model for Mister Morph on the Agents page.** Pick one via magpie, and an effort if you want. magpie finds it by its `~/.morph` folder, not the `morph` command, which other tools are named too; the folder is made by its first run, `morph install` or the desktop app's setup.
3. **Start a new task.** Mister Morph's Console uses the model for new tasks; restart open morph chats to use it there.

```
magpie morph deepseek/deepseek-v4-pro
```

## config.yaml

magpie writes these keys under llm: `inference_provider` openai_response_compatible, OpenAI's Responses API, Mister Morph's own default, which the gateway serves for every vendor; `endpoint` the gateway's `/v1` (Mister Morph adds no second /v1 to a base ending in one); `api_key` magpie's key; and `model` the catalog id. In Mister Morph the model reads `magpie/deepseek/deepseek-v4-pro`. magpie also sets a User-Agent of mistermorph in `llm.headers`, as its requests otherwise carry the OpenAI SDK's, which tells them from no one's.

```
# ~/.morph/config.yaml (or $MISTER_MORPH_CONFIG)
llm:
  inference_provider: openai_response_compatible
  endpoint: http://127.0.0.1:3425/v1
  api_key: 
  model: deepseek/deepseek-v4-pro
  context_window_tokens: …
  headers:
    User-Agent: mistermorph
  reasoning_effort: high
```

`llm.provider` is left as it is: Mister Morph derives it from inference_provider. A Mister Morph in WSL is set up the same way, at `~/.morph/config.yaml`, as MISTER_MORPH_CONFIG isn't read there.

## The context window

Mister Morph knows a model's context window only from a list of its own, by the id after its last slash. So magpie writes the window it knows in `llm.context_window_tokens`, and removes the key when it knows none.

## Effort

The effort goes in `llm.reasoning_effort`: none, minimal, low, medium, high, xhigh or max. Unset, Mister Morph sends none.

```
magpie morph effort high
```

## Profiles and routes

`llm.profiles` and `llm.routes` are yours, and magpie leaves them alone. A route that sends the main loop to another profile still does.

## Switching back

Before it first takes llm over, magpie saves what you had under those keys. Switching back puts them back, and removes the ones you didn't have; when the User-Agent was alone in llm.headers, headers goes too. Picking one of Mister Morph's own models restores them the same way, then sets `llm.model` to it.

```
magpie morph default
```

## FAQ

### Can Mister Morph run on DeepSeek, GLM or a ChatGPT subscription?

Yes. Pick a via-magpie model for Mister Morph on magpie's Agents page, and magpie sets the llm keys in config.yaml.

### Which API does Mister Morph use through magpie?

OpenAI's Responses API (openai_response_compatible), Mister Morph's default, which magpie's gateway serves for every vendor.

### Why does magpie write context_window_tokens?

Mister Morph looks a window up only in its own list, which doesn't have magpie's model ids, so magpie gives it the window it knows.

### Are my llm.profiles and llm.routes changed?

No. They are yours; magpie changes only its keys under llm and puts them back when you switch back.

More agents on the same models: [Grok App on any model](https://usemagpie.ai/docs/grok-app), [fx on any model](https://usemagpie.ai/docs/fx), [Aside on any model](https://usemagpie.ai/docs/aside) and [mu on any model](https://usemagpie.ai/docs/mu). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/mu

# mu on any model

mu (qybaihe/mu: npm's `mu-agent`, the `mu` command and the mu desktop app) is Pi with a judgment kernel added as an extension. It starts Pi, with Pi's `settings.json` and `models.json` in its own `~/.mu/agent` folder, and the desktop app uses the same folder. So magpie sets mu up as it does Pi, and mu runs on any model in magpie: DeepSeek, GLM, Kimi, Qwen, Claude or a ChatGPT subscription.

## Set up mu

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick a model for mu on the Agents page.** Pick one via magpie, and an effort if you want. The command and the desktop app both use it.
3. **Start a new session.** New mu sessions use the model.

```
magpie mu deepseek/deepseek-v4-pro
```

## settings.json and models.json

magpie writes `defaultProvider`, `defaultModel` and `defaultThinkingLevel` in `settings.json`, and adds itself to `models.json` as the provider `magpie`, as it does for Pi.

```
// ~/.mu/agent/settings.json
{
  "defaultProvider": "magpie",
  "defaultModel": "deepseek/deepseek-v4-pro",
  "defaultThinkingLevel": "…"
}
```

```
// ~/.mu/agent/models.json
{
  "providers": {
    "magpie": { "apiKey": "", … }
  }
}
```

On its first run mu asks for `mu setup` only while models.json has no provider and settings.json no defaultProvider. Once magpie has written them, mu counts as set up and doesn't ask.

## mu's own key

mu's requests say `pi/` and a version, as Pi's do. So magpie gives mu a key of its own (magpie-mu), and the gateway counts its requests as mu's, not Pi's.

## mu's folder

magpie finds mu's folder as mu does: the first of these variables that is set, with `~` in it standing for your home.

```
MU_AGENT_DIR
KYRN_AGENT_DIR
MU_CODING_AGENT_DIR
KYRN_CODING_AGENT_DIR
```

With none set it is `~/.mu/agent`, or `~/.kyrn/agent` when only `~/.kyrn`, its old name, exists and `~/.mu` doesn't. A mu in WSL is set up the same way, though magpie can't read the variables there.

`mu` is a common name: a mu on PATH that is maildir-utils' mu (djcb/mu) isn't taken for mu-agent. mu is also found by its alias `mu-agent`.

## The judge

mu's judgment kernel has settings of its own (`mu.json` and `MU_JUDGE`). They are mu's, and magpie leaves them alone.

## Switching back

Before its first write magpie saves settings.json and models.json as they were. Switching back puts them back byte for byte while they still say what magpie left.

```
magpie mu default
```

## FAQ

### Can mu run on DeepSeek, GLM or a ChatGPT subscription?

Yes. Pick a via-magpie model for mu on magpie's Agents page, and magpie writes settings.json and models.json in ~/.mu/agent.

### Do I still run mu setup?

No. mu asks for it only while models.json has no provider and settings.json no defaultProvider, and magpie writes both.

### Are mu's requests counted as Pi's?

No. Both say pi/ in their User-Agent, so magpie gives mu its own key (magpie-mu) and counts its requests as mu's.

### Is mu's judge changed?

No. mu.json and MU_JUDGE are mu's own settings, and magpie leaves them alone.

More agents on the same models: [Pi on any model](https://usemagpie.ai/docs/pi), [Mister Morph on any model](https://usemagpie.ai/docs/mister-morph), [Grok App on any model](https://usemagpie.ai/docs/grok-app) and [Claude Science on any model](https://usemagpie.ai/docs/claude-science). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/claude-science

# Claude Science on any model

Claude Science is Anthropic's research app: a daemon, `claude-science`, serves its UI on localhost, and a window (a Swift launcher on the Mac, Electron on Windows, a browser on Linux) attaches to the daemon running, or starts one. The daemon asks Anthropic's Messages API at the address its environment's `ANTHROPIC_BASE_URL` names, and the app has no setting for it. So magpie starts the daemon with ANTHROPIC_BASE_URL set to the gateway, and Claude Science runs on any model in magpie: DeepSeek, GLM, Kimi, Qwen or a ChatGPT subscription.

## Set up Claude Science

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Set Claude Science's provider to magpie on the Agents page.** magpie restarts its daemon; a session running in it is cut off.
3. **Open Claude Science again.** Reload its window if it is open, then pick one of magpie's models in its model menu.

## The daemon

magpie does one thing: `stop`, then `serve --detached --no-browser` on the port it was on, with ANTHROPIC_BASE_URL set. It sets no variable for you and writes none of Claude Science's files. Started by hand in a terminal, the same is:

```
claude-science stop; ANTHROPIC_BASE_URL=http://127.0.0.1:3425 claude-science serve --detached
```

Claude Science takes an https address, or http on a loopback address, so the local gateway's `http://127.0.0.1` works as it is. magpie finds claude-science in the Mac app's bundle, Windows' per-user Programs folder, the `~/.local/bin` its installers link it into (the only place on Linux), or on PATH.

## The Claude sign-in

Claude Science still needs you signed in with your Claude account; API keys are not supported, and with no sign-in it sends nothing. Signed in, it sends that sign-in as its request's bearer, which magpie's gateway never passes on to any provider. The gateway knows its requests by the `X-Anthropic-Surface: operon` header it sends on every one.

## The model menu

Claude Science's model menu lists only ids that start with `claude-`, so magpie lists each model to it by an alias, `claude-magpie-<number>`, named as the Agents page names it. Where no pick of yours is in play (its default before you pick, the haiku for its small tasks) it asks for Claude's own ids; one magpie doesn't serve goes to the model its last turn was on.

## Staying connected

The daemon runs until it is stopped or the computer restarts. While it is connected magpie starts it again when it isn't running. Claude Science's window starts its own, without the variable, when none runs, and the app may offer to run its own after an update. magpie puts its daemon back once no session runs in the other, but never in place of one a service manager such as launchd or systemd keeps, which would come back at once; the Agents page says so meanwhile. One you keep putting back within an hour is left running.

## WSL

With Claude Science in a WSL distro, magpie on Windows starts its daemon there through wsl.exe with ANTHROPIC_BASE_URL set, and keeps it connected while the distro runs; it never starts a stopped distro. In mirrored networking the distro's 127.0.0.1 is Windows', and the daemon is given the gateway's address. Under NAT magpie starts a socat relay in the distro on 127.0.0.1 at the gateway's port, leading to Windows' address on the WSL network.

## Switching back

Turn magpie off for Claude Science on the Agents page, and magpie restarts its daemon, when it runs, without the variable, back on Anthropic's API.

## FAQ

### Can Claude Science run on DeepSeek, GLM or a ChatGPT subscription?

Yes. Set Claude Science's provider to magpie on magpie's Agents page, then pick one of magpie's models in its model menu.

### Does magpie change Claude Science's files or my environment?

No. magpie only restarts its daemon with ANTHROPIC_BASE_URL set; it writes no file and sets no variable for you.

### Do I still sign in with a Claude account?

Yes. Claude Science doesn't take API keys and needs a Claude sign-in, which magpie never passes on to any provider.

### Why do its models read claude-magpie?

Claude Science lists only ids that start with claude-, so magpie lists each model as claude-magpie-, named as its Agents page names it.

More agents on the same models: [Claude Desktop on any model](https://usemagpie.ai/docs/claude-desktop), [mu on any model](https://usemagpie.ai/docs/mu), [Mister Morph on any model](https://usemagpie.ai/docs/mister-morph) and [VS Code on any model](https://usemagpie.ai/docs/vscode). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/vscode

# VS Code on any model

VS Code's own Chat (GitHub Copilot Chat) has a Custom Endpoint provider since VS Code Stable 1.122, which takes other vendors' models with no GitHub sign-in or Copilot plan. Its groups of models are in `chatLanguageModels.json` beside `settings.json`, a file VS Code watches and reads again when it changes. magpie adds a group of its own there, and VS Code's Chat runs on any model in magpie: DeepSeek, GLM, Kimi, Qwen, Claude or a ChatGPT subscription.

## Set up VS Code

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick a model for VS Code on the Agents page.** Pick one via magpie.
3. **Pick the model in VS Code's Chat.** magpie's models are in Chat's model picker, under magpie. If they don't show, run Developer: Reload Window in VS Code.

## chatLanguageModels.json

magpie writes a group `{"vendor": "customendpoint", "name": "magpie"}` listing magpie's catalog: each model at the gateway's `/v1/chat/completions`, with tool calling on, as agent mode lists only models that call tools.

```
// chatLanguageModels.json (beside settings.json)
[
  {
    "name": "magpie",
    "vendor": "customendpoint",
    "apiType": "chat-completions",
    "models": [
      {
        "id": "deepseek/deepseek-v4-pro",
        "name": "…",
        "url": "http://127.0.0.1:3425/v1/chat/completions",
        "toolCalling": true,
        "vision": …,
        "contextWindow": …,
        "maxOutputTokens": …,
        "requestHeaders": { "Authorization": "Bearer " }
      }
    ]
  }
]
```

A group's apiKey can't be written in the file: VS Code reads it from its secret storage alone. So each model sends magpie's token as the Authorization in `requestHeaders`, which a Custom Endpoint model takes in place of the key, and VS Code asks you for none. Groups of your own stay as they are.

## A new chat's model

The model a new chat starts on is the `chat.defaultModel` setting, which magpie sets to the catalog id. A model picked in Chat's model picker is kept in VS Code's storage, not there.

```
// settings.json
"chat.defaultModel": "deepseek/deepseek-v4-pro"
```

## Profiles and Insiders

The default profile's chatLanguageModels.json is in its User folder, and each other profile has its own. magpie writes its group in every profile, and in one made later too. VS Code Insiders has its own User folder and its own row, and is set up the same way. A portable VS Code keeps its files in its data folder, where magpie finds them.

## VSCodium

VSCodium has no Copilot Chat of its own; its users install the Marketplace's, whose last release (0.48.1) has no Custom Endpoint but an OpenAI Compatible provider (customoai). magpie writes for whichever the installed extension's package.json declares. The OpenAI Compatible one takes the same group in the same file, with magpie's token in `x-api-key`, as it drops an Authorization in requestHeaders. It shows its providers only while Copilot Chat is signed in to GitHub with a personal Copilot plan.

VSCodium's Chat features must also be on (`chat.disableAIFeatures=false`), and its product.json must have defaultChatAgent and trustedExtensionAuthAccess for GitHub.copilot-chat; then run Developer: Reload Window. The Agents page says so.

## Switching back

Picking one of VS Code's own models for it in magpie, such as Copilot's Auto, sets chat.defaultModel to it, puts the other profiles back on theirs, and leaves magpie's group in Chat's picker. Switching VS Code off in magpie puts back each profile's chat.defaultModel and takes the group out.

## FAQ

### Can VS Code's Chat use DeepSeek or GLM without a Copilot plan?

Yes. The Custom Endpoint provider, since VS Code 1.122, needs no GitHub sign-in or Copilot plan, and magpie writes its group in chatLanguageModels.json.

### Why don't magpie's models show in Chat?

It takes VS Code 1.122 or later. On that, run Developer: Reload Window in VS Code.

### Where does magpie's key go?

VS Code reads an apiKey only from its secret storage, so magpie puts its token in each model's requestHeaders, and VS Code asks you for no key.

### Does VSCodium work?

Yes, with the Marketplace's Copilot Chat, whose OpenAI Compatible provider shows only while it is signed in to GitHub with a personal Copilot plan.

More agents on the same models: [Claude Science on any model](https://usemagpie.ai/docs/claude-science), [Claude Desktop on any model](https://usemagpie.ai/docs/claude-desktop), [mu on any model](https://usemagpie.ai/docs/mu) and [WorkBuddy on any model](https://usemagpie.ai/docs/workbuddy). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/workbuddy

# WorkBuddy on any model

WorkBuddy is Tencent's CodeBuddy desktop app. It reads your own models from `~/.workbuddy/models.json` (or `$WORKBUDDY_CONFIG_DIR` when set), as OpenAI chat-completions models. magpie writes its models into that file, so WorkBuddy's model picker lists DeepSeek, GLM, Kimi, Qwen, Claude, a ChatGPT subscription or any other model in magpie.

## Set up WorkBuddy

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Set WorkBuddy's provider to magpie on the Agents page.** WorkBuddy's picker then lists the models magpie picked for it.
3. **Pick the model per task in WorkBuddy.** The model is picked for each task in WorkBuddy's window; magpie's show as custom-local:<id>. If they don't show, restart WorkBuddy; magpie's Agents page offers a restart.

Why a restart: WorkBuddy 5.6 watches models.json only when the file existed at start, and it watches the file itself, so a rewrite can go unseen until it restarts.

## models.json

The file is either a list of models or `{"models":[…],"availableModels":[…]}` as CodeBuddy Code's CLI writes it; magpie reads and writes both. WorkBuddy's own local models are entries in the same list (`local: true`), and magpie leaves them alone. Each of magpie's models points at the gateway's `/v1/chat/completions`, with tool calling on and magpie's key for WorkBuddy:

```
// ~/.workbuddy/models.json (one of magpie's entries)
{
  "id": "deepseek/deepseek-v4-pro",
  "name": "…",
  "vendor": "magpie",
  "apiKey": "",
  "url": "http://127.0.0.1:3425/v1/chat/completions",
  "maxInputTokens": …,
  "maxOutputTokens": …,
  "contextWindow": { "supportedLengths": [200000, …], "defaultLength": … },
  "supportsToolCall": true,
  "supportsImages": …,
  "supportsReasoning": true,
  "reasoning": { "supportedEfforts": […], "canDisableThinking": …, "defaultEffort": "…" }
}
```

WorkBuddy sends requests to url with reasoning_effort, under the apiKey as a Bearer token. Its requests say CLI/<version> WorkBuddy/<version>, so magpie tells them apart by their key. An entry you edited in WorkBuddy is saved under vendor Custom, and magpie still recognises it by its key.

## Context and reply length

WorkBuddy offers a choice of context in its model menu only when contextWindow lists two sizes or more. magpie adds a smaller 200K beside the whole window, and defaultLength is the whole window. Without maxOutputTokens WorkBuddy caps every reply at its own default, so magpie writes it.

## What stays yours

WorkBuddy rewrites models.json itself a few seconds after every start: it purges local models this computer can't run, and may encrypt the apiKey. magpie doesn't take that rewrite as a change. The other entries and keys stay as WorkBuddy wrote them:

- A model you turned off in WorkBuddy stays off.
- Models pointed at a magpie on another machine (a NAS) keep that address and key.
- A reply limit you typed stays.
- A default effort set in WorkBuddy's model settings, Auto included, stays while the model still offers it.

## WorkBuddy AI

WorkBuddy AI, the international build (www.workbuddy.ai, com.workbuddy.workbuddy-ai), is the same app with its data in `~/.workbuddy-ai`. magpie wires it as an agent of its own, under its own key. On a Mac magpie finds it by its app, not by that folder. WorkBuddy in WSL works too, with the gateway's address as the distro reaches it.

## Switching back

When you switch WorkBuddy off in magpie, magpie takes its models out of models.json and leaves every other entry as it was.

## FAQ

### Can WorkBuddy use DeepSeek or GLM?

Yes. magpie writes its models into ~/.workbuddy/models.json; pick one starting with custom-local in WorkBuddy's model picker.

### Why don't magpie's models show in WorkBuddy?

WorkBuddy may not have seen the rewrite. Restart it; magpie's Agents page offers a restart.

### Does magpie change my WorkBuddy settings?

No. Models you turned off, models pointed at a NAS, reply limits you typed and your default effort all stay.

### Does WorkBuddy AI, the international build, work?

Yes. Its data is in ~/.workbuddy-ai, and magpie wires it as an agent of its own.

More agents on the same models: [VS Code on any model](https://usemagpie.ai/docs/vscode), [CodeBuddy on any model](https://usemagpie.ai/docs/codebuddy), [Claude Science on any model](https://usemagpie.ai/docs/claude-science) and [Pencil on any model](https://usemagpie.ai/docs/pencil). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/pencil

# Pencil on any model

Pencil (pen.dev) is a design canvas whose agent runs models. It takes custom providers of your own in `~/.pencil/models.json`, in Pi's format. magpie adds a provider named magpie there, so Pencil's model picker lists DeepSeek, GLM, Kimi, Qwen, Claude, a ChatGPT subscription or any other model in magpie.

## Set up Pencil

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Set Pencil's provider to magpie on the Agents page.** Pencil's model picker then lists the models magpie picked for it.
3. **Restart Pencil and pick the model in its agent composer.** Pencil reads its custom models at start-up, so restart it once. The model is picked in Pencil's agent composer, not in a file magpie reads.

How magpie finds Pencil: the `~/.pencil` folder, there once the app or pen.dev's CLI has run; on a Mac, an app installed and never opened is found as Pencil.app or pen.dev.app.

## models.json

Pencil's settings offer a custom provider on OpenAI Completions, OpenAI Responses or Anthropic Messages, set for the provider as a whole. magpie's provider is on OpenAI Completions (Pi's openai-completions) at the gateway's `/v1`, which the gateway takes for every model:

```
// ~/.pencil/models.json
{
  "providers": {
    "magpie": {
      "name": "magpie",
      "baseUrl": "http://127.0.0.1:3425/v1",
      "api": "openai-completions",
      "apiKey": "",
      "models": [
        {
          "id": "deepseek/deepseek-v4-pro",
          "name": "…",
          "reasoning": …,
          "input": ["text", …],
          "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
          "contextWindow": …,
          "maxTokens": …,
          "compat": {}
        }
      ]
    }
  }
}
```

Pencil's requests carry magpie's key for Pencil, which is how magpie tells them apart, as Pencil's User-Agent isn't known.

## Model fields

Each model carries every field Pencil writes for one. Where magpie knows no better it uses Pi's defaults: a 128K window and 16K out. Every cost is 0, as magpie counts the spend itself. A model's own api and baseUrl are left out: Pi reads them, but Pencil's own editor never writes them.

## Your providers stay

The other providers you set up in Pencil stay as they are. A key in magpie's provider that magpie doesn't write, such as a setting another tool added, stays too. The model list is magpie's alone, so a model gone from the catalog leaves it.

## Switching back

When you switch Pencil off in magpie, magpie deletes the magpie provider from models.json and leaves your other providers as they were.

## FAQ

### Can Pencil use DeepSeek or GLM?

Yes. magpie adds a magpie provider to ~/.pencil/models.json; restart Pencil and pick the model in its agent composer.

### Why don't magpie's models show in Pencil?

Pencil reads its custom models at start-up. Restart Pencil.

### Which protocol does magpie's provider use?

OpenAI Completions, at the gateway's /v1, for every model.

### Does magpie change my other Pencil providers?

No. magpie writes only its own magpie provider.

More agents on the same models: [OpenPencil on any model](https://usemagpie.ai/docs/openpencil), [WorkBuddy on any model](https://usemagpie.ai/docs/workbuddy), [Pi on any model](https://usemagpie.ai/docs/pi) and [Mistral Vibe on any model](https://usemagpie.ai/docs/mistral-vibe). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/mistral-vibe

# Mistral Vibe on any model

Mistral Vibe is Mistral's open-source coding agent, the `vibe` CLI. It keeps its settings in `config.toml` in `$VIBE_HOME`, else `~/.vibe`. magpie adds a magpie provider there with one model per catalog model, so Vibe's /model picker lists DeepSeek, GLM, Kimi, Qwen, Claude, a ChatGPT subscription or any other model in magpie. For Mistral's own models in other agents, see [Mistral in Claude Code, Codex, Gemini CLI and OpenCode](https://usemagpie.ai/docs/mistral).

## Set up Mistral Vibe

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Pick a model for Mistral Vibe on the Agents page.** Pick one via magpie; magpie points Vibe's active_model at it.
3. **Restart open vibe sessions.** Vibe reads its settings at start-up. Afterwards you can switch to another magpie model in Vibe's /model too.

## config.toml

magpie writes a `[[providers]]` entry with the gateway's `/v1` as OpenAI chat completions, and one `[[models]]` entry per catalog model. A model's alias is `magpie/<provider>/<model>`, which is what /model shows and active_model holds:

```
# ~/.vibe/config.toml
active_model = "magpie/deepseek/deepseek-v4-pro"

[[providers]]
name = "magpie"
api_base = "http://127.0.0.1:3425/v1"
api_style = "openai"
backend = "generic"
extra_headers = { Authorization = "Bearer " }

[[models]]
name = "deepseek/deepseek-v4-pro"
provider = "magpie"
alias = "magpie/deepseek/deepseek-v4-pro"
thinking_levels = ["off", …]
supports_images = …
max_context_length = …
```

## Where the key goes

Vibe reads a provider's key only from the environment variable its api_key_env_var names, or the keyring, never from config.toml. A keyless provider sends its extra_headers as they are, so magpie's key for Vibe goes there as an Authorization header. Nothing of magpie's is put in your environment or in `~/.vibe/.env`. Vibe's requests say Mistral-Vibe/<version> as their User-Agent, which the gateway tells apart.

## Models and thinking

A model with effort levels offers them in thinking_levels beside off; one without offers off alone. A thinking level you chose in Vibe on one of magpie's models stays while the model still has it. A model whose context magpie doesn't know is given 128K, since without one Vibe takes a default window with a warning.

## What stays yours

Every other key and entry of the file is yours and stays as written. magpie rewrites its own entries only when its models changed. Avibe, whose command is also vibe, is not taken for Mistral Vibe. Vibe's skills and AGENTS.md, in `~/.vibe/skills` and `~/.vibe/AGENTS.md`, are kept by magpie's [Library](https://usemagpie.ai/docs/library).

## Switching back

magpie notes what active_model was when it first takes over. When you pick Vibe's own model in magpie, or switch Vibe off, magpie puts active_model back to that value (or the model you picked) and removes its provider and model entries.

## FAQ

### Can Mistral Vibe use DeepSeek or Claude?

Yes. magpie adds a magpie provider and its models to config.toml; pick a model starting with magpie/ in Vibe's /model.

### Where does magpie put its key?

Vibe doesn't read keys from config.toml, so magpie puts its key in extra_headers as an Authorization header, not in your environment.

### Why is Vibe still on its old model?

Vibe reads its settings at start-up. Restart open vibe sessions.

### Is my old model back when I switch back?

Yes. magpie noted what active_model was and puts it back.

More agents on the same models: [Avibe on any model](https://usemagpie.ai/docs/avibe), [Pencil on any model](https://usemagpie.ai/docs/pencil), [WorkBuddy on any model](https://usemagpie.ai/docs/workbuddy) and [OpenMausBot on any model](https://usemagpie.ai/docs/openmausbot). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/openmausbot

# OpenMausBot on any model

OpenMausBot is an open-source Electron chat app whose bots run the CLIs installed on the computer. It keeps its settings in `config.json` in its data folder: `$OMB_DATA_DIR`, else `~/.openmausbot` on every system. Each engine a bot can run on is an entry in that file's instances. magpie adds an engine of its own there, magpie, so bots can run on DeepSeek, GLM, Kimi, Qwen, Claude, a ChatGPT subscription or any other model in magpie.

## Set up OpenMausBot

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Quit OpenMausBot.** magpie refuses the change while OpenMausBot runs (on Windows magpie can't tell, so quit it first).
3. **Set OpenMausBot's provider to magpie on the Agents page.** magpie puts every magpie model in the magpie engine's model picker.
4. **Open OpenMausBot and pick magpie as a bot's engine.** Then pick the model in the engine's picker.

## The magpie engine

Why an engine of its own: OpenMausBot's Claude bots run Claude Code isolated, with only the sign-in keys of `~/.claude/settings.json` carried over, so a Claude Code wired to magpie reaches the gateway already but its picker lists Claude's own models alone. Its Codex bots run your `~/.codex` as it is, which magpie's Codex wiring already covers.

magpie writes the engine as OpenMausBot's own Claude endpoint writes one: a claudeAgent with access custom, a Claude home of its own, requireApiKey, the gateway's address and magpie's key as ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN and ANTHROPIC_API_KEY, and every magpie model in endpointModels. An engine with those keys owns its routing: neither your settings nor a provider switch in OpenMausBot reaches it. If you gave OpenMausBot a Claude Code of your own, the magpie engine uses it too.

```
// ~/.openmausbot/config.json
"instances": {
  "magpie": {
    "driver": "claudeAgent",
    "displayName": "magpie",
    "access": "custom",
    "config": {
      "configDir": "~/.openmausbot/providers/magpie",
      "requireApiKey": true,
      "endpointModels": […]
    },
    "environment": {
      "ANTHROPIC_BASE_URL": "http://127.0.0.1:3425",
      "ANTHROPIC_AUTH_TOKEN": "",
      "ANTHROPIC_API_KEY": "",
      "ANTHROPIC_MODEL": "…"
    }
  },
  …
}
```

A 1M model is marked `[1m]`. A model id OpenMausBot wouldn't take is left out, since one such id makes it refuse the whole engine.

## The default fleet stays

With no engines saved in config.json, OpenMausBot runs its default fleet. A saved instances map is the whole fleet, so one holding magpie's alone would take every other engine away. When the file has none, magpie writes the default fleet beside its own.

## Why quit it first

OpenMausBot reads the file when it starts, and writes its whole map of engines, as it holds it, back when you change one in its Settings. So magpie refuses a change while it runs. A sync writes anyway: what OpenMausBot writes over is written again by the next sync, or within half a minute. When OpenMausBot runs on an older list than the file's, magpie's Agents page offers a restart.

## What stays yours

The magpie engine's name, colour, icon, whether it is on or hidden, the keys magpie doesn't write and the environment besides the routing are yours. So is the model picked first, while magpie still lists it. The routing, the Claude home and the model list are magpie's.

## Switching back

When you switch OpenMausBot off in magpie, magpie takes its engine out, and the default fleet it wrote with it while that is still the default fleet, so OpenMausBot runs its defaults again as they are then.

## FAQ

### Can OpenMausBot's bots use DeepSeek or GLM?

Yes. magpie adds a magpie engine to config.json; pick it as a bot's engine, then pick the model.

### Why quit OpenMausBot first?

When you change an engine in it, it writes its whole map back over magpie's change, so magpie refuses while it runs.

### Will my other engines disappear?

No. When the file has no engines saved, magpie writes OpenMausBot's default fleet beside its own.

### How do Codex bots use magpie?

OpenMausBot's Codex bots run your ~/.codex as it is, which magpie's Codex wiring already covers.

More agents on the same models: [Mistral Vibe on any model](https://usemagpie.ai/docs/mistral-vibe), [Pencil on any model](https://usemagpie.ai/docs/pencil), [Claude Desktop on any model](https://usemagpie.ai/docs/claude-desktop) and [JetBrains Copilot on any model](https://usemagpie.ai/docs/copilot-jetbrains). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/copilot-jetbrains

# JetBrains Copilot on any model

The GitHub Copilot plugin in JetBrains IDEs (IntelliJ IDEA, PyCharm, GoLand and the rest) and Android Studio takes other vendors' models through Bring Your Own Key: Manage Models… in Copilot Chat's model picker, then Add Custom Endpoint Provider. magpie writes that custom endpoint for you, named magpie, so every model in magpie (DeepSeek, GLM, Kimi, Qwen, Claude, a ChatGPT subscription and the rest) is in Copilot Chat's picker. To use a Copilot subscription in other agents instead, see [GitHub Copilot in Claude Code, Codex, Gemini CLI and OpenCode](https://usemagpie.ai/docs/copilot).

## Set up JetBrains Copilot

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Set Copilot (JetBrains)'s provider to magpie on the Agents page.** magpie writes its endpoint into Copilot's byok.json.
3. **Restart the IDE.** The IDE lists the endpoints when Copilot signs in, so magpie's models show after a restart.
4. **Pick a model in Copilot Chat's model picker.** magpie's models are listed under magpie. The IDE keeps the one you pick in its project files.

magpie lists Copilot (JetBrains) on the Agents page when a JetBrains IDE or Android Studio has the github-copilot-intellij plugin in its plugins folder, or when byok.json already has magpie's endpoint.

## Which Copilot plan

Bring Your Own Key needs Copilot signed in to GitHub. The personal plans, Copilot Free, Pro and Pro+, have it; Business and Enterprise have it when the organisation's policy allows it. Its requests say `GithubCopilot/<server version>`, as every client of the Copilot language server does, so magpie tells them apart by their key.

## byok.json

The JetBrains plugin keeps none of this itself. It asks the Copilot language server it bundles (copilot-language-server), which keeps every custom endpoint in one JSON file and reads it again each time it is used:

- With `$XDG_CONFIG_HOME` set (and absolute): `$XDG_CONFIG_HOME/github-copilot/byok.json`
- Windows: `%USERPROFILE%\AppData\Local\github-copilot\byok.json`
- macOS and Linux: `~/.config/github-copilot/byok.json`

A custom endpoint is three keys there. magpie writes them as the language server itself saves them:

```
// ~/.config/github-copilot/byok.json
{
  "magpie-provider-config": { "groupName": "magpie", "apiType": "chatCompletions" },
  "magpie-api-key": "",
  "magpie-models-config": {
    "…": {
      "deploymentUrl": "http://127.0.0.1:3425/v1/chat/completions",
      "isRegistered": true,
      "isCustomModel": true,
      "modelCapabilities": {
        "name": "…", "maxInputTokens": …, "maxOutputTokens": …,
        "toolCalling": true, "vision": …
      }
    }
  },
  …
}
```

Each model points at the gateway's `/v1/chat/completions`, with the key sent as a Bearer token. The key is in this file in plain text, not in the IDE's password safe. Xcode's and Eclipse's Copilot run the same language server and read the same file, so they list magpie's models too.

## Agent mode and context

Tool calling is on for every model, as Copilot's agent mode lists only models that call tools. maxInputTokens is the window the server fills: the context length from magpie's catalog, or the server's own 128K default for a custom endpoint when that isn't known. maxOutputTokens stays within that window.

## What stays yours

Your other endpoints and keys in byok.json stay as they are. A magpie model you hid in the IDE's Manage Models stays hidden after a sync. When nothing changed, magpie doesn't write the file, so it stays as the language server last wrote it.

## Switching back

When you switch Copilot (JetBrains) off in magpie, magpie deletes its three keys from byok.json. Your own endpoints are left alone.

## FAQ

### Can Copilot in JetBrains use DeepSeek or GLM?

Yes. magpie writes a custom endpoint into Copilot's byok.json; restart the IDE and pick a model under magpie in Copilot Chat's picker.

### Does Copilot Business work?

Bring Your Own Key works on Business and Enterprise when the organisation's policy allows it, and on Free, Pro and Pro+.

### Can agent mode use magpie's models?

Yes. magpie turns tool calling on for every model, and Copilot's agent mode lists only models that call tools.

### Do Xcode's and Eclipse's Copilot get them too?

Yes. They run the same Copilot language server and read the same byok.json.

More agents on the same models: [VS Code on any model](https://usemagpie.ai/docs/vscode), [Copilot CLI on any model](https://usemagpie.ai/docs/copilot-cli), [OpenMausBot on any model](https://usemagpie.ai/docs/openmausbot) and [Kiro Crew on any model](https://usemagpie.ai/docs/kirocrew). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/kirocrew

# Kiro Crew on any model

Kiro Crew (kirodotdev/KiroCrew) is a persistent agent: the KiroCrew.app desktop app, the kirocrew CLI, its web dashboard and the Gateway they share. It runs each session on a harness, an agent it starts and talks to over ACP. Kiro Crew has no model provider of its own to point at magpie; its models are its harness's. So what magpie sets is which harness it runs: an agent already connected to magpie, whose own config sends its requests to the gateway, so DeepSeek, GLM, Kimi, Qwen, Claude, a ChatGPT subscription and every other model in magpie are there.

## Set up Kiro Crew

1. **Add a provider in magpie.** Add an API key on the Providers page, or sign in to a subscription.
2. **Set Kiro Crew's provider to magpie on the Agents page.** When Kiro Crew is set to a harness magpie wires, magpie keeps it, and connects that agent to magpie too if it isn't yet. On a harness magpie doesn't wire (KAS, kiro-cli, deepseek), magpie picks the first harness connected to magpie, one whose adapter is here first.
3. **Start a new session in Kiro Crew.** The Gateway reloads the file when it changes. New sessions take the new harness; sessions already open keep theirs.

To change the harness, pick another agent connected to magpie under harness on Kiro Crew's row. With none connected, magpie asks you to connect Codex, Claude Code, OpenCode, Pi or Goose to magpie first, then Kiro Crew.

## The harnesses

magpie offers the harnesses it wires itself, through the files each one reads under Kiro Crew too:

- Codex: through the codex-acp adapter (npm @agentclientprotocol/codex-acp), reading `~/.codex` or `$CODEX_HOME`
- Claude Code: through the claude-agent-acp adapter (npm @agentclientprotocol/claude-agent-acp), running your claude, which reads `~/.claude`
- OpenCode: `opencode acp`
- Pi: through the pi-acp adapter (npm pi-acp)
- Goose: `goose acp`

Not deepseek: Kiro Crew runs it as `dsh --profile acp`, a profile of its own that magpie's dsh wiring doesn't reach.

## config.json

Kiro Crew's settings are `config.json` in its home: `$KIROCREW_HOME` when set (made absolute; a root, `/usr`, `/System` or `/etc` is refused and the default used), else `~/.kiro/crew`, the desktop app's too. magpie writes two keys:

```
// ~/.kiro/crew/config.json
{
  "agent": {
    "acp_backend": "codex",
    "member_acp_backend": "codex"
  },
  …
}
```

`acp_backend` is the sessions' harness; empty, it is kiro-cli, the default. `member_acp_backend` is the crew members' harness, kas by default, written only for a harness that can dispatch members (Codex, Claude Code, OpenCode, Goose), not Pi. magpie keeps what both keys said before, and puts it back on switching off.

## ACP adapters

Codex, Claude Code and Pi run through an npm adapter Kiro Crew doesn't ship. magpie looks for it where Kiro Crew does: the path its variable names (CODEX_ACP_BIN, CLAUDE_AGENT_ACP_BIN, PI_ACP_BIN), the PATH, `~/.local/bin`, npm's, mise's, Volta's and Homebrew's folders, and every Node version mise, asdf, nvm and fnm keep. When it isn't there, the Agents page says to install the package with `npm i -g`, then start a new session. magpie installs nothing.

## config.local.json is yours

`config.local.json` beside it is merged over config.json key by key and wins. When it sets the harness (agent.acp_backend), magpie writes no key, and asks you to set it there to a harness connected to magpie, or take it out and connect again.

## Switching back

When you switch Kiro Crew off in magpie, magpie puts back what both keys said before; a key you changed since stays as you set it. When connecting Kiro Crew is what connected its harness agent to magpie, and you haven't disconnected that agent yourself since, magpie disconnects it again. Otherwise it stays connected.

## FAQ

### Can Kiro Crew use DeepSeek or GLM?

Yes. Kiro Crew's models are its harness's; magpie sets the harness to Codex, Claude Code, OpenCode, Pi or Goose connected to magpie, and the model is picked in that harness.

### Why didn't my open session change?

Sessions already open keep their harness; the new one is for new sessions.

### magpie says codex-acp isn't found. What now?

Codex, Claude Code and Pi run through an npm adapter. Install the package it names with npm i -g, then start a new session.

### Why didn't magpie change my harness?

Your config.local.json sets agent.acp_backend, which wins over config.json, so magpie leaves your setting alone.

More agents on the same models: [Goose on any model](https://usemagpie.ai/docs/goose), [Pi on any model](https://usemagpie.ai/docs/pi) and [JetBrains Copilot on any model](https://usemagpie.ai/docs/copilot-jetbrains). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/cherry-studio

# Every model in Cherry Studio, through magpie

Cherry Studio is a desktop chat client that takes any OpenAI-compatible provider. magpie adds itself there as one provider, named magpie, so every model you have in magpie shows up in Cherry Studio: providers with an API key and the Claude, ChatGPT or Copilot subscriptions you signed in to.

magpie runs a gateway on your computer at `http://127.0.0.1:3425`. It speaks the OpenAI Chat Completions API and translates each request for the provider behind the model, Anthropic’s, Google’s or a subscription’s, with streaming, tool calls and reasoning. Cherry Studio sees one OpenAI-compatible provider at `http://127.0.0.1:3425/v1`.

Cherry Studio keeps its providers in its own database, and magpie never writes to it. It adds itself through Cherry Studio’s add-provider link instead, and you confirm it in Cherry Studio. This works in Cherry Studio 1.x and 2.x.

## Add magpie to Cherry Studio

1. **Add providers in magpie.** In the Providers tab, add an API key (DeepSeek, Kimi, GLM, Qwen, OpenRouter…) or sign in to a subscription.
2. **Open the Agents tab.** magpie lists Cherry Studio once it has run on this computer, including a data folder you moved elsewhere.
3. **Click Add magpie.** On Cherry Studio’s row, press Add magpie. Cherry Studio opens its model provider settings with magpie filled in: name magpie, type OpenAI, the gateway’s address and a key.
4. **Confirm it in Cherry Studio.** Nothing is added until you do.

If nothing opens, no app on this computer handles Cherry Studio’s links yet: open Cherry Studio once, or install it again, then click Add magpie again.

## Pick the models

Cherry Studio lists a provider’s models from `/v1/models`, so the magpie provider offers every model magpie has, named `provider/model` (for example `deepseek/deepseek-v4-pro`). Add the ones you want to the magpie provider in Cherry Studio, and choose them in a chat like any other model.

The list has magpie’s image and video models too. Cherry Studio knows most of them by name (gpt-image-2, Gemini’s image models, Imagen, Seedream, Grok Imagine…) and offers them on its Paintings page, not in a chat. For one it doesn’t know, open the model’s settings in the magpie provider and tick image generation.

A provider you add in magpie later shows up the next time Cherry Studio fetches the list; there is nothing to change in Cherry Studio. Several accounts behind one model, rest periods after a 429 and failover work as they do for every agent.

## From a terminal

```
magpie cherrystudio add      # opens Cherry Studio to add magpie, confirm it there
```

`cherry-studio` works as the name too.

## How magpie knows it was added

Once Cherry Studio has a provider at the gateway’s address, the row shows magpie instead of the button. magpie reads Cherry Studio 2.x’s database for this, read-only. Cherry Studio 1.x keeps providers where magpie doesn’t read them, so there the button stays.

## Usage and keys

On a gateway that isn’t shared, the key in the link is Cherry Studio’s own, so its requests are counted as Cherry Studio’s in magpie’s Usage, apart from your coding agents. When the gateway is shared on your network with gateway keys, the link carries a key that works there.

## FAQ

### Do I need an API key to use Claude or ChatGPT in Cherry Studio?

No. Sign in to a Claude, ChatGPT or Copilot subscription in magpie, and its models appear in the magpie provider in Cherry Studio.

### Does magpie change Cherry Studio’s settings?

No. magpie opens Cherry Studio’s own add-provider dialog, and you confirm it. It only reads Cherry Studio’s database to show whether magpie was added.

### What address and type does the magpie provider use?

Type OpenAI, at http://127.0.0.1:3425/v1, or the gateway address you set in magpie.

### Why don’t I see a new model in Cherry Studio?

Cherry Studio shows models you added to the provider. Fetch the magpie provider’s model list again and add the new one.

### Cherry Studio isn’t in magpie’s Agents tab.

magpie lists it once Cherry Studio has run on this computer. Open Cherry Studio once, then look again.

Another desktop app on the same models: [AionUi on any model](https://usemagpie.ai/docs/aionui). Using a coding agent too? See [Subscriptions in any agent](https://usemagpie.ai/docs/subscriptions) and [Get started](https://usemagpie.ai/docs/start). Something fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/troubleshooting

# Fixing common errors: 401, 429, 502, 504 and more

An error from magpie’s gateway says what went wrong in its own words. This page lists the common ones, what causes them, and the fix.

Every request is listed on magpie’s Routing page, with which provider and account it went to and how each try ended. Copy Report on a request copies what you need to ask for help.

## 401 and 403: a key or sign-in refused

**From the vendor.** The provider turned down the key or sign-in magpie sent. magpie sets that key or account aside and tries the next one, so you see the error only when none is left. A sign-in that has run out says so, for example “the ChatGPT sign-in has expired — sign in again”.

- **Fix:.** sign in again from ＋ Add provider (or `magpie accounts add <provider>`), or give the provider a new key.

**From magpie itself.** magpie answers 403 on its own in a few cases, before anything is sent:

| Error | Cause | Fix |
| --- | --- | --- |
| model disabled | You turned the model off in magpie. | Turn it on again on its provider. |
| model not allowed for the gateway key | The gateway key is held to some models. | `magpie gateway-key models <id>` lists or changes them. |
| magpie doesn’t answer the web page … | A web page called the gateway from a browser. | List it in Settings › Network and sharing › Web pages, and send a gateway key. |

## 429 and rest periods

A 429 means the provider is out of quota, out of credit or rate limiting you. magpie rests the key or account that was refused and sends the request to the next account, the next member of a routing group, or the provider’s Fallback. The provider’s row shows Resting · {why} · back at {time}.

| Refused for | Rests |
| --- | --- |
| Quota, with a reset time | Until the reset |
| Rate limit, with Retry-After | Until then |
| Credit | 30 minutes, then 2 hours, 8 hours, a day, 3 days and a week if it is refused again |
| A ChatGPT account out of credits | Until the reset its refusal names, else until its full window renews, else 5 hours |
| Any other failure | A minute, doubling on repeats up to 10 minutes (30 for a rate limit) |

- **Ask it again now..** Try now ends the rest: the next request asks it again. Refused again, it rests again.
- **Cap the rest..** `magpie provider rest-cap <id> 4h` sets the longest rest for a provider; `off` stops it resting for failures that say nothing of why.
- **A relay whose limits pass in a moment..** Untick Set it aside when out of quota or rate limited in the provider editor’s Advanced: a 429 then rests nothing, and the next request goes to it as usual.
- **Never all at once..** Add a second account or a fallback model, so a spent one never stops the agent. `magpie accounts` shows how much of each account’s allowance is used.

Rests are kept across restarts, so quitting magpie doesn’t bring a resting account back early.

## 502: the provider didn’t answer

A 502 means magpie couldn’t get an API reply from the provider. What follows the provider’s name says which case it is:

- **“didn’t answer: …”.** The connection failed: a name that doesn’t resolve, a refused connection, a proxy that is down. When this computer has no network at all, magpie notices and rests nobody.
- **“… not an API reply”.** The provider answered, but with a web page (a sign-in page, a Cloudflare challenge), nothing at all, or something that isn’t JSON. The base URL usually points at a web site instead of the API: check it against the vendor’s docs, and whether it should end in `/v1`.
- **OpenCode: “… which is no error, not an API reply”..** OpenCode’s gateway sometimes answers a 400 holding only the model’s name. The same request is answered some seconds later, so magpie reads it as a 502, asks again within the request’s patience or tries a group’s next member, and rests nobody. It is tied to requests carrying very large tool lists.

A 502, 503, 504, 529 or Cloudflare’s 520 to 524 counts as busy: magpie asks again or moves to a routing group’s next member before the agent sees it.

## 504: no answer in time

- **“<provider>: no first token in Ns”..** A routing group gives each member a time to start answering (First token). The member was slower, so the next was asked. Raise it on the group for a slow model.
- **“no member of the group answered within its Ns budget”..** Every member of the group was tried within the group’s time and none answered.
- **“magpie held this request for … without routing it to any provider”..** The request waited inside magpie and was stopped rather than left waiting. Send it again; if it comes back, Copy Report on that request on the Routing page and share it.

## Model not found (404)

The error reads *magpie knows no model “…”*, often with *did you mean …?* and the list of your provider ids.

- **Name it as magpie does..** Use `provider/model`, as `magpie models` lists it, a routing group’s id or name, or a bare model id.
- **“… is switched off in Magpie, so … is not served”..** The provider or routing group is off. Switch it on again on the Providers or Routing page.
- **No providers yet..** The error says “add a provider in magpie first”.

## The agent doesn’t show the model

- **Restart the agent..** Most agents read their config only when they start. magpie says so on the agent’s row after a change, for example “Codex builds its model list at start-up”. Codex’s app also keeps an app-server running; restart it as the notice says.
- **Check magpie serves it..** `magpie models` lists every model you can pick. A model you turned off, or one whose provider is switched off, isn’t listed.
- **Claude Code..** `/model` lists magpie’s models marked “via magpie”. If `CLAUDE_CODE_USE_BEDROCK` or `CLAUDE_CODE_USE_VERTEX` is set in your shell, Claude Code goes to that cloud instead of magpie; remove it from your shell profile.

## Port 3425 is in use

The gateway listens on `127.0.0.1:3425`. To move it, open Settings › Network and sharing › Gateway address. Only the port is set there, 1024 to 65535, and the agents magpie connected move with it.

| magpie says | Fix |
| --- | --- |
| Port … is in use by another program: pick another one | Pick a free port. |
| Another magpie serves the gateway at …: set its port there, or quit it first | Two copies of magpie are running. Quit one. |
| Port … is taken by another program, magpie web perhaps: magpie tries again every few seconds | Find what holds the port, or move the gateway to another. |
| MAGPIE_ADDR=… sets the gateway’s whole address, host:port: unset it to set the port here | Unset `MAGPIE_ADDR`, or change it. |

## Agents in WSL

On Windows, magpie looks in running WSL distros for agents such as Claude Code, Codex, OpenCode, Kimi Code and Qwen Code. Each one it finds gets a row of its own on the Agents page, and magpie sets it up as it does on Windows. It never starts a stopped distro.

- **The agent isn’t listed..** Start the distro, and check Settings › General › Detect agents in WSL is on.
- **It can’t reach magpie..** Under WSL’s default NAT networking, magpie also serves the gateway at Windows’ address on the WSL network, with a key of its own, and writes that address into the agent’s config. With mirrored networking the agent uses `127.0.0.1` as on Windows. Windows’ firewall still decides: WSL’s network counts as Public, so allow magpie there if the connection is blocked.
- **A change doesn’t show..** An agent in WSL reads its config at start-up: restart it there.

An agent that magpie marks Apply again or How to fix: see [When an agent stops going through magpie](https://usemagpie.ai/docs/agent-drift).

## From another computer on the network

By default the gateway answers only this computer. To use it from another: Settings › Network and sharing › Share on local network. The other computer sends a gateway key from the Gateway page’s Gateway keys.

- **“magpie isn’t shared on the local network”..** Turn sharing on, on the computer that runs magpie.
- **401..** The key is missing, off or expired. Send an enabled gateway key as `Authorization: Bearer <key>` or `x-api-key`.
- **403 for a model..** The key is held to some models: `magpie gateway-key models <id>`.

Don’t open the port to the internet; use a VPN between your computers. The full setup, another magpie included, is in [Remote magpie](https://usemagpie.ai/docs/remote).

## A subscription moved to a plugin isn’t served

Command Code, Cursor, Devin, Factory, Grok, Kiro, Xiaomi MiMo, Qoder, WorkBuddy, ZCode and Zed are no longer built into magpie. Each is served by a community plugin that does the same job. Accounts added before still need to move to the plugin, and nothing serves them until they do.

- **Fix:.** a line over the Providers list says “… built-in subscription is retired, and its accounts haven’t moved to its plugin yet”. Press Move to the plugin: magpie installs the plugin and checks each account. Moving keeps your accounts, models and agents as they are. magpie also moves them by itself, and installing the plugin from the Plugins page does too.

An error after the move comes from the plugin, which does the sign-in, models and requests.

[Mirrors in China: faster magpie plugin, Bun and update downloads](https://usemagpie.ai/docs/mirrors)

## FAQ

### Why does magpie answer 502 when the provider is up?

The provider answered with something that isn’t an API reply, such as a web page or an empty body. The base URL usually points at the vendor’s web site instead of its API.

### Why does an account stay unused after a 429?

magpie rests it until the reset the vendor named, or for a while if none was named. The provider’s row says when it is back, and Try now ends the rest.

### What does “magpie knows no model” mean?

No provider serves a model by that name. Name it as provider/model, as magpie models lists it, or switch its provider on again.

### How do I change magpie’s port?

Settings › Network and sharing › Gateway address. The agents magpie connected move with it.

### Can an agent in WSL use magpie on Windows?

Yes. magpie finds agents in running WSL distros and sets each up with an address it can reach. Under NAT networking, Windows’ firewall must let WSL’s connection through.

### Can I use magpie from another computer?

Yes. Turn on Settings › Network and sharing › Share on local network, and send a gateway key from the other computer. Don’t open the port to the internet.

Still stuck? Copy the request’s report from the Routing page and ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/agent-drift

# When an agent stops going through magpie

When magpie connects an agent, it remembers what it set in the agent's config. From then on the Agents page keeps checking two things: whether the config still says what magpie set, and, when it does, whether the agent's latest requests actually reached magpie's gateway. When they don't, the agent's row is marked with the reason and a fix: usually Apply again (on the status line, Reconnect), or How to fix when an address doesn't answer or a proxy is in the way. Here are the five things magpie can say, one by one.

Two things are not a problem: moving from one magpie model to another in the agent's own model picker isn't flagged, and a provider named magpie that you wrote by hand is yours, so magpie neither flags nor overwrites it.

## “No longer goes through magpie — its config was changed”

The model is still magpie's, but the part of the config that sends requests to magpie (the gateway's address, for one) was changed: by a hand edit, an update of the agent that rewrote its config, or another tool.

1. **Press Apply again.** magpie writes what it set once more and renews its record. The mark goes away.
2. **Restart the agent.** Most agents read their config at start-up, so one that is open needs reopening.

## “Was switched off {model} outside magpie”

magpie set a magpie model, and the config now has the agent's own model there, one that doesn't go through magpie. The detail says what the field is now and what magpie set. You have two choices:

- **Apply again:.** magpie's model goes back, and so do the other fields magpie set with it, such as an effort.
- **Keep current settings:.** the change was yours on purpose. magpie forgets what it set, keeps your config as it is and stops flagging it. The row menu has this item only in this case.

## “Was used without going through magpie — restart it after applying”

The config is right, yet the agent was used after magpie set it up and none of its requests reached magpie. Most often the agent was already open before magpie changed its config and still runs on the old one; something outside the file, such as an environment variable, can also override it. The detail says which:

- Its last request went to another host, not magpie: it was started before magpie set it up and still runs on its old config.
- It couldn't reach magpie at a given time: magpie wasn't running then, so it has none of magpie's models.
- It was used at a given time, but none of its requests reached magpie.

The fix each time is to quit and reopen the agent. Press Apply again first if you like: it renews the record, so a use before then no longer counts.

## “Is set up, but nothing answers at the address it reaches magpie by”

The config is right, but the agent reaches magpie at an address other than this computer's loopback (127.0.0.1), nothing answers there, and magpie itself answers fine here. That is usually an agent in WSL, or a forward of your own. magpie tries the address from here in the background.

When an agent in WSL is pointed at the address magpie listens on for WSL and nothing answers, Windows' firewall is keeping WSL out. Allow magpie when Windows asks, or run this in PowerShell as administrator (`-Program` is magpie.exe's real path; the detail gives the whole command):

```
New-NetFirewallRule -DisplayName 'magpie (WSL)' -Direction Inbound -Action Allow -Profile Any -InterfaceAlias 'vEthernet (WSL*)' -Program '…\magpie.exe'
```

WSL's network counts as Public, so a rule for Private networks only doesn't do. On Windows 11 you can also turn on mirrored networking in .wslconfig, and WSL then reaches magpie at 127.0.0.1:

```
# %UserProfile%\.wslconfig
[wsl2]
networkingMode=mirrored
```

Under WSL's NAT networking, Windows as WSL sees it answers only while something listens there: magpie itself with Settings › Network and sharing › Share on local network on (it then listens on every address, and asks other computers for a gateway key), or a forward of your own (netsh interface portproxy, which may need setting up again after Windows restarts). If it answers here and WSL still can't connect, it is the firewall: allow the gateway's port (3425 by default) for the WSL network.

When the address a WSL distro reaches Windows at has moved, the detail names the new one and the button reads Use {url}: pressing it points the agent there. Outside WSL, whatever forwarded the address to magpie isn't listening any more: start it again, or point the agent at magpie's address on this computer.

## “Reaches magpie through a proxy that doesn't pass its requests on”

This one is Codex. Codex sends its requests for magpie through a proxy set in the environment or the system settings, and that proxy doesn't pass them back to magpie: every turn fails with 502 Bad Gateway, whichever model it is on. magpie asks which proxy Codex would use the way Codex does (a terminal's environment for Codex in a terminal, the login shell's for the ChatGPT app's Codex), and the detail names the proxy and where it is set. Any one of these fixes it:

- Have the proxy send 127.0.0.1 direct: a DIRECT rule for 127.0.0.0/8, or rule mode rather than global.
- When the proxy comes from a *_PROXY variable, add 127.0.0.1 to NO_PROXY where that variable is set.
- On Windows, add 127.0.0.1 to “Don't use the proxy server for addresses beginning with” in Windows' proxy settings (127.* there is not enough for Codex).
- On macOS and Linux, add NO_PROXY to your shell profile; Codex in a terminal and the ChatGPT app's Codex both read it:

```
# ~/.zshrc
export NO_PROXY=127.0.0.1
```

Then quit and reopen Codex.

## Disconnect from magpie

If you can't fix it now, or don't want the agent on magpie at all, pick Disconnect from magpie in the row menu: magpie puts the agent's config back as it was before and forgets what it set. To connect it again later, set it up on the Agents page.

## FAQ

### Why does magpie say the config was changed after I switched models in the agent?

The model you switched to doesn't go through magpie. Pick Keep current settings to keep it, or Apply again to go back to magpie. Moving from one magpie model to another in the agent isn't flagged.

### It still says the agent bypassed magpie after Apply again?

The agent was open before magpie set it up and still runs on its old config. Quit and reopen it; once a new request reaches magpie, the mark goes away.

### An agent in WSL can't reach magpie. What do I do?

Most often Windows' firewall keeps WSL out: allow magpie when Windows asks, or run the New-NetFirewallRule command the detail gives in PowerShell as administrator. On Windows 11, networkingMode=mirrored in .wslconfig also works.

### Codex fails every turn with 502 and magpie says a proxy doesn't pass its requests on?

A proxy takes Codex's requests for magpie. Have it send 127.0.0.1 direct, or add 127.0.0.1 to NO_PROXY, then reopen Codex.

Related: [Use DeepSeek, Kimi, GLM, Claude or any model in Codex](https://usemagpie.ai/docs/codex-models) and [Remote magpie](https://usemagpie.ai/docs/remote). Something else fails? See [Fixing common errors](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/web-search

# Web search for any model

Claude Code has WebSearch and Codex has web_search, but those tools only work when the model's provider can search the web itself. Many models' APIs can't: DeepSeek, GLM, Qwen and others. When you use them through magpie, magpie searches for them: the model is given magpie's web_search tool, and when it calls it, magpie searches and gives it the pages found, with the search and its sources sent back in the shape the agent knows. So web search keeps working in Claude Code or Codex whichever model you switch to.

## Set it up

Searches come from two kinds of source: providers that can search, and the Search APIs you add. Both are in Settings › Models › Web search.

1. **With a provider that can search, there is nothing to set.** magpie picks one by itself, such as a Google sign-in, a ChatGPT account (Codex's sign-in), or a Kimi Code, GLM Coding Plan or WorkBuddy plan.
2. **Or add a Search API.** Add a key for Tavily, Brave Search or another under Search APIs. With no provider that can search, these do the searching.
3. **Pick which kind goes first with Search first with.** The other is asked when it fails.

A search may use the service's quota or incur charges.

## Providers that search

A provider whose models search the web by themselves can search for a model that can't. Pick one under Searches for other models, or leave it to magpie:

- **One magpie picks:.** when it fails or finds nothing, magpie moves on to the next provider that can search, up to three in all.
- **One you pick:.** when it fails, only the providers you put after it under If it fails take over, in their order. Only when it can't search at all (out of quota or rate-limited) do other available sources try, then your Search APIs.
- When every source fails, the errors go back to the model as the tool's result, and the turn goes on.

Some providers search for their own models first: a Kimi Code plan through its own search service, a GLM Coding Plan through the plan's Web Search MCP server (with the same key, nothing to set up), a WorkBuddy plan through its search service, and a Google sign-in through Google Search. A ChatGPT account searches through the ChatGPT backend's own search, the request Codex's web.run sends.

To use Search APIs only, turn provider search off: every model then uses only the Search APIs you added, and with none, magpie adds no search tool. A provider's own web search is unchanged.

## Search APIs

The Search APIs you can add are Tavily, Brave Search, Exa, Firecrawl, You.com, DeepSeek, Doubao Search (Volcengine), Yuanbao Search (Tencent Cloud), TinyFish and SearXNG, and the ones a plugin gives. They are asked in the list's order: drag them to reorder, or switch one off (kept with its key, and never asked). The CLI does the same:

```
magpie search add tavily 
magpie search add you              # You.com: free with no key (100 searches a day)
magpie search add searxng url=
magpie search                      # the search APIs, in the order they are asked
magpie search move  
magpie search count 10             # results per search, 1 to 20, 6 by default
```

- One API can take several keys, separated by commas, which searches take in turn; with `pick=order` the first is used until it is refused.
- SearXNG needs its address. Any other API can take `url=` for an endpoint of your own that answers as that API does, and its key is sent only there.
- Results per search: the count when the client names none (Claude Code's WebSearch, Codex's web_search), 1 to 20, 6 by default. Each result carries up to 1500 bytes of its page, so more results give the model more to read.
- `magpie search mix <api>,<api>` asks several APIs at once and gives at most 12 pages, merged. It spends each mixed API's quota.

## Models that search by themselves

Models such as Grok's and Gemini's search the web by themselves, and a client's web search goes to them as sent. Models that search by themselves can be set to magpie's, so they use magpie's providers and Search APIs as every other model does; Their own leaves them as they are.

## As an MCP server

The same search is an MCP server too, for Cursor, Claude Desktop or any agent. It has a web_search tool, and a web_fetch tool that reads a page by its URL, for an agent with no fetch tool of its own. Its address is on the MCP server row of the Web search page; by default:

```
http://127.0.0.1:3425/mcp/magpie/web-search
```

It speaks Streamable HTTP only. A client that only speaks stdio mounts it through `mcp-remote`. From another computer (with magpie shared on the local network), send a gateway key as `Authorization: Bearer <key>`. web_fetch reads public addresses only, for at most 30 seconds and 5 MiB.

## Who searched

Every search magpie makes shows on the Routing page. When another source searched in place of the first, it says who searched instead.

[Image recognition and generation for any model](https://usemagpie.ai/docs/images): screenshots for models that can't see, and images and videos made from an agent.

## FAQ

### Can DeepSeek search the web?

DeepSeek's API doesn't search by itself. Through magpie, Claude Code's WebSearch or Codex's web_search is answered by magpie's search: a provider that can search, or a Search API you added.

### What if no provider I have can search?

Add a Search API under Settings › Models › Web search, such as Tavily or Brave Search. You.com works with no key, 100 searches a day, or give the address of your own SearXNG.

### Does a search cost anything?

It uses the chosen service's allowance: a provider that searches spends its quota or may charge, and a Search API bills at its own prices.

### Can Cursor use magpie's web search?

Yes. Add /mcp/magpie/web-search to Cursor as an MCP server (Streamable HTTP), and it gets the web_search and web_fetch tools.

Related: [DeepSeek in Claude Code, Codex, Gemini CLI and OpenCode](https://usemagpie.ai/docs/deepseek) and [When an agent stops going through magpie](https://usemagpie.ai/docs/agent-drift). Something fails? See [Fixing common errors: 401, 429, 502, 504 and more](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/routing-groups

# Round robin and failover across accounts, keys and providers

One Claude subscription isn't enough, one API key keeps getting rate limited, or you want another vendor to take over when DeepSeek is down? magpie routes requests at two levels: between a provider's accounts or keys, and between the providers and models in a routing group. When an upstream fails before any of the reply is sent to the agent, magpie moves to the next candidate, and the agent never knows.

## Several accounts or keys

Once a provider has a second account or key switched on, its editor gets Routing and Stays, which decide how requests go between them.

You can also choose what one rate limited (429) while it still has quota does: Keeps its place rests as long as the vendor asks, then takes its place again; Goes to the back goes behind every one not rate limited since, so the load goes round rather than back to the first each time.

## Routings

- **Quota first.** (default): the first takes requests while it has quota to spare; when it runs low, the one with the most left takes over. One out of credit sits out half an hour, one out of quota until it resets, one rate limited as long as the vendor asks, and one that fails a minute, longer each time it fails again.
- **In order.** : requests go to the first; the next takes over when the one before runs out of quota, hits a rate limit or fails.
- **In turn.** : each message you send goes to the next one, round the list; the agent’s tool calls for it stay on the same one. A move costs some prompt cache; with Stays on Session, a whole conversation stays on one instead.
- **Least used first.** : a subscription by the share of its allowance used, a key by the tokens it served in the last hours.
- **Weekly pace.** : the subscription with the most of its week left per hour until it renews, so less of each week is lost at its reset; one at 90% or more waits until the others can't answer.
- **By weight.** : by the weight beside each key; a key weighing 3 takes three requests for every one a key weighing 1 takes. Keys only, not accounts.
- **Free first.** : what costs nothing first, and only when those can't answer one that spends.

## Stays

Stays decides whether a conversation stays with the account or key that answered it:

- **Auto.** (default): while what the vendor cached of it is worth keeping; within a turn always.
- **Session.** : for the whole session, while it can answer.
- **Within a turn.** : stays put while the agent sends tool results back; routed afresh when you speak again.
- **Off.** : every request routed afresh.
- **Strict.** : never moved, even rate limited or out of quota; the error goes to the agent. New conversations are routed as usual.

## Routing groups

A routing group puts models from different providers together: Opus from a Claude subscription and from Copilot, say, or several free models. An agent picks `group/<id>` as its model, and magpie sends each request as the group's routing and rules say. Groups are under Routing groups on the Routing page; New group makes one.

1. **magpie finds groups by itself.** A model two or more of your providers serve becomes a group of them (auto-<model>), with nothing to set. Switch off Find groups on their own if you don't want them.
2. **What goes in.** Any model as provider/model, another group (up to 8 deep), or a pattern: `openrouter/*:free` takes in free models the vendor adds later too. `free:` before a pattern keeps only the models the last catalog marks free, as in `free:workbuddy/*`: the vendor's flag, not a promise of no charge.
3. **A group's routing.** Besides the ones above, a group can go By weight (each model's weight) or Manual (only the model you pick, with no failover).
4. **Rules.** Which model a turn goes to first, by its length, an image, the reasoning asked for or the agent.

A group can set reasoning too: a member can be fixed at `:high` and the like, or a classifier rates each turn as it begins and picks low to xhigh.

## CLI

```
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
magpie group set opus-anywhere stays=session models+=openrouter/anthropic/claude-opus-5.5
magpie group set opus-anywhere routing=weight weight=claude/claude-opus-5-5=3
magpie group add my-free-pool models='openrouter/*:free,opencode-zen/*-free' routing=order
magpie group pick opus-anywhere copilot/claude-opus-5.5
magpie claude group/opus-anywhere
```

Routings: smart, order, rotate, usage, pace, weight, manual. Stays: auto, session, turn, off, strict. `magpie group help` lists every field.

## Ready-made groups

`magpie group template` makes a group for a common need from your own models in one go:

- **smart.** : hard turns to the strongest model, easy ones to a cheap one, a classifier telling them apart.
- **thrifty.** : a cheap model first, the strongest for high reasoning or when the cheap ones fail.
- **steady.** : the strongest model of each of up to three providers, each behind the other.

```
magpie group template            # lists smart, thrifty, steady and the models each would take
magpie group template steady
```

To see what is left of each account before it runs out, see [Quota left on every subscription and key](https://usemagpie.ai/docs/quota).

## FAQ

### Can I use several Claude accounts in turn?

Yes. Add them to the same Claude subscription; once Routing shows in its editor, pick In turn or Least used first. When one runs out, requests go to the next.

### What happens when an API key is rate limited (429)?

It rests as long as the vendor asks and requests go to the provider's other keys; with Goes to the back it goes behind the others, so the load goes round.

### Can another model take over when DeepSeek is down?

Yes. Make a routing group with DeepSeek and a fallback in order, routing In order, and pick group/ in the agent. An upstream that fails before the reply starts gives way to the next.

### Does switching accounts lose the prompt cache?

Stays is Auto by default: a conversation stays with its account while the cache is worth keeping, and always within a turn, so rotating doesn't lose the cache on every request.

Related: [Use your Claude Pro/Max, ChatGPT Plus/Pro or GitHub Copilot subscription in any coding agent](https://usemagpie.ai/docs/subscriptions). Something fails? See [Fixing common errors: 401, 429, 502, 504 and more](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/quota

# Quota left on every subscription and key

How much of Claude's five hours is left? When does Codex's week reset? Is the DeepSeek balance enough? magpie asks the vendors and puts each window of every subscription and plan, its use and when it starts again, beside each key's balance. It is on the Usage page, and the CLI and a local API read it too.

## magpie quota

`magpie quota` lists what is left of every subscription, plan and key magpie has: each window's use and when it starts again, and each key's balance, asked of the vendors now (or less than a minute ago). Name providers to see only those.

```
magpie quota                       # every subscription, plan and key
magpie quota codex claude --json   # for scripts and agents
magpie quota refresh claude        # read one card again
magpie quota history --days 7 --json
```

- `--json` is for scripts and agents, each entry with `lastServedAt`, when it last answered through the gateway, and `last: true` on the latest.
- `magpie quota refresh` reads one card again, as its refresh button on the Usage page does. A card read less than 30 seconds ago isn't asked again.
- A Claude account's use is told by Claude Code as it answers or runs /usage; `refresh` reads it by running Claude Code's /usage in the account's own folder, which plain `magpie quota` never does.

## For scripts and agents

The gateway answers the same on a local API, on the port in Settings' Gateway address. Another machine reaches it only while magpie is shared on the local network, with its key as the API key (Authorization: Bearer or x-api-key).

```
curl http://127.0.0.1:3425/v1/magpie/quotas
curl 'http://127.0.0.1:3425/v1/magpie/quotas/history?days=7&provider=codex'
```

magpie's own skill `magpie-quota` lets an agent read `magpie quota --json` and wait with `magpie quota wait`. It is first in the Library's skills market.

## Alerts

Have the magpie app notify you when any window of a subscription or plan reaches a share used, once each time the window runs, or when a balance falls to an amount or under, in its own currency or credits, once until topped up past it. Both are off until set; `off` turns either off.

```
magpie quota alert 80              # notify at 80% used, once per window
magpie quota alert --balance 5     # notify when a balance falls to 5 or under
magpie quota alert                 # what is set
```

## Wait for allowance

`magpie quota wait codex` returns once any Codex account magpie has on has allowance again; an account's email or login, or `<provider>/<account>`, waits for that one alone. It reads the vendors itself, gateway running or not, again shortly after the soonest reset (every 1 to 10 minutes), and says on stderr what it waits for. A script can go on with work it stopped:

```
magpie quota wait codex --timeout 6h
until codex exec …; do magpie quota wait codex || break; done
```

Exit 0 once there is allowance, 1 when `--timeout` (30m, 6h) passes first, 2 for a name it doesn't know, 130 on Ctrl+C.

## History

`magpie quota history` is what magpie has read of each subscription's and plan's windows over time, kept 45 days (UTC times, a reading only when it changed, each window's runs apart by when they reset): the latest readings of each window, or with `--json` every one since `--days` days ago, as `/v1/magpie/quotas/history` answers.

## A Codex account's resets

A Codex account that holds rate-limit resets says how many.

```
magpie quota reset                 # spends one held reset; asks first
magpie quota auto-reset on
magpie quota credits off
```

- `magpie quota reset` spends one, starting the account's current windows again. It can't be undone, so it asks first; `--yes` doesn't.
- `magpie quota auto-reset on` lets the account spend one by itself when its weekly window is used up and no other account can take a request, one a week at most (the five hours running out never does), and spend the one about to expire about half an hour before it does, if the account's windows have been used. Off until turned on.
- `magpie quota credits off` keeps a Codex account from spending its credits once a window is used up: routing holds it as used up and the request goes to the other accounts, groups and fallbacks. On, the default, lets the task go on.

[Token usage and cost per agent](https://usemagpie.ai/docs/usage): what each agent, model, account and session spent, and a relay's real price.

## FAQ

### How do I see Claude Code's five hours and week left?

Run magpie quota, or open magpie's Usage page. A Claude account's use updates as Claude Code answers or runs /usage; magpie quota refresh claude runs /usage to read it again.

### Can a Codex job go on once its quota is back?

Yes. In a script, until codex exec …; do magpie quota wait codex || break; done: magpie quota wait returns once there is allowance, and the command runs again.

### Can I be told when use is nearly full?

magpie quota alert 80 has the magpie app notify when any window reaches 80% used; --balance 5 when a balance falls to 5 or under. Both are off until set.

### Can an agent read the quota itself?

Yes. magpie quota --json and GET http://127.0.0.1:3425/v1/magpie/quotas give the same; magpie's skill magpie-quota teaches an agent to read it and wait for allowance.

Related: [Round robin and failover across accounts, keys and providers](https://usemagpie.ai/docs/routing-groups) and [Use your Claude Pro/Max, ChatGPT Plus/Pro or GitHub Copilot subscription in any coding agent](https://usemagpie.ai/docs/subscriptions). Something fails? See [Fixing common errors: 401, 429, 502, 504 and more](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/images

# Image recognition and generation for any model

Many models can't see images: DeepSeek, GLM and others. Paste a screenshot in Claude Code or Codex, switch to such a model, and the request is usually turned away. Through magpie, a model that can see describes the image first, and the description goes in the image's place: in the current turn, older turns and tool results alike. So screenshots keep working whichever model you switch to. The other way round, agents can generate images and videos through the Magpie Image tool.

## Image recognition

Pick the model that describes images under Settings › Models › Image recognition:

- **Automatic:.** the default. magpie picks one of your models that can see, one with allowance left first.
- **A model you pick:.** always that one. If its provider is removed or turned off, the row says so and the automatic choice takes its place.
- **Off:.** images are no longer described, and a model that can't see turns away a request with one in its latest message.

Each image is described once and the description is cached, so an agent sending the same image again every turn doesn't pay again. A request's images are described at once, up to 4 in parallel. A chip beside the model picks how hard it thinks; unset, it uses the model's lowest level.

A model that can see still gets the image itself, not a description.

## Image recognition MCP server

Image recognition is also an MCP server (Streamable HTTP) with one analyze_image tool, which reads an image with the Image recognition model. The address is on the Image recognition MCP server row; by default:

```
http://127.0.0.1:3425/mcp/magpie/vision
```

1. **Add the address to an agent as an MCP server.** Cursor, Claude Desktop or any agent that speaks Streamable HTTP.
2. **Call analyze_image.** image is an http(s) URL, a data URL, or an absolute path to a file on this computer (`~/` and `file://` taken, up to 20 MB). An optional prompt asks a question about the image; without one, the image is described.

A file path works only for a caller on this computer. From another computer (with magpie shared on the local network), send a gateway key as `Authorization: Bearer <key>` and the image as a URL or data URL. With Image recognition off, or no model that sees, the tool answers with an error that says where to pick one.

## Generating images and videos

Magpie Image is magpie's own MCP tool (`magpie mcp image`, stdio). Give it to an agent from the Library, or with Give agents Magpie Image… under Settings › Models › Image generation. It has three tools:

- **generate_image:.** an image from a prompt, or an edit or combination of reference_images. Optional size (1024x1024 or 16:9, say), n (1 to 4), quality and background.
- **generate_video:.** a short video of 1 to 15 seconds from a prompt, optionally from an image as its first frame, or with reference images.
- **generation_result:.** waits for an image or video still being made, by the id it gave, and says where it was saved.

Images go in the project's `generated-images` folder and videos in `generated-videos` unless a path is given, and an existing file is never written over. Images are drawn with the model picked under Image generation (with Automatic, magpie picks it), videos with the first video model magpie has.

Many agents wait only 30 to 60 seconds on a tool call, and an image often takes a minute or more. So a call waits at most 20 seconds: if the job isn't done, it answers with an id, and the job goes on and saves what it makes.

## Image API

The gateway also serves OpenAI's image endpoints, translated to the picked model's own image API:

```
/v1/images/generations
/v1/images/edits
```

magpie handles the differences between OpenRouter's, Volcengine Ark's and other providers' endpoints. A ChatGPT account's GPT Image, a Grok subscription's Grok Imagine and a WorkBuddy plan's image models aren't held back by an account's own list of models. A name that points to a routing group tries its members in the group's order, moving on when one fails.

## Image generation timeout

Settings › Models › Image generation timeout: how long a provider is given to draw an image and send it, 1 to 60 minutes, 5 by default. A slow image endpoint may need longer.

## FAQ

### Can DeepSeek see images?

DeepSeek's models can't see images by themselves. Through magpie, the Image recognition model describes each image first and the description goes to DeepSeek in its place, so screenshots in Claude Code still work.

### Does image recognition cost extra?

Describing an image uses the Image recognition model's allowance or price. Each image is described once and the result is cached.

### How do I make Claude Code generate images?

Give Claude Code Magpie Image from the Library. It then has a generate_image tool that draws with the model under Settings › Models › Image generation and saves to the project's generated-images folder.

### Can Cursor use magpie's image recognition?

Yes. Add /mcp/magpie/vision to Cursor as an MCP server (Streamable HTTP) and it has the analyze_image tool.

Related: [Web search for any model](https://usemagpie.ai/docs/web-search), [DeepSeek in Claude Code, Codex, Gemini CLI and OpenCode](https://usemagpie.ai/docs/deepseek). Hit an error? See [Fixing common errors: 401, 429, 502, 504 and more](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/usage

# Token usage and cost per agent

Every request through magpie is recorded: the agent, the model asked for and the one that answered, the account, the tokens, an estimated cost, the time and the status. The Usage page sums them per agent, model and subscription account, and the Requests page lists each one. With Claude Code, Codex and the rest, you see where the money goes without another tracking tool.

## On the command line

The same numbers are on the command line, the last 30 days by default:

```
magpie usage                      # the last 30 days: tokens and cost per agent, model and account
magpie usage today                # or 7d, 30d, all
magpie usage --last 24h           # a window ending now (90m, 1.5 days…)
magpie usage --csv 7d             # every request as CSV
magpie usage --csv --account  30d
```

`--last` and `--days` count a window ending now, not from a midnight. Each CSV row is one request: the model asked for, sent and served, tokens, cost, time, status and account.

## What each session cost

The Sessions page and `magpie sessions` list the latest Claude Code, Codex, OpenCode, Pi and other agents' sessions with what each cost, filtered by model or project folder:

```
magpie sessions                   # the latest sessions, with what each cost
magpie sessions --days 7          # what every session spent, day by day
magpie sessions --model  --folder  --json
magpie sessions read              # which agents' history magpie may read
```

An agent's own session files are read only once you allow that agent; none are read until then. Once allowed, calls that didn't go through magpie (Claude Code signed in to claude.ai directly, say) reach Usage from those files too.

## Search what was said

The Sessions page's search, `magpie sessions search` and the Magpie Sessions MCP server (Library → MCP) find the sessions of every agent whose prompts or replies say the words, newest first, each with a snippet. `magpie sessions show` prints one as text, from where the words were said, so an agent can look up an earlier conversation, decision or fix by itself:

```
magpie sessions search login bug                 # every agent's sessions that said it
magpie sessions search "rate limit" --agent codex --days 7 --limit 5
magpie sessions search login --json
magpie sessions show claude:<id> --find login    # that session, from where it was said
magpie sessions show claude:<id> --from 40 --json
```

They read only the agents you allow magpie to read. The first search on a long history builds an index of what was said, kept for the next one.

## Where a price comes from

A call is counted at its effective price: what you set for that provider and model if you did, otherwise what the provider's own catalogue lists, otherwise what models.dev lists for the model's maker.

A relay that resells at a discount or a multiplier isn't charging the maker's price. Say what it actually charges, and Usage and the session totals use that:

```
magpie model price relay-a/gpt-5.5                        # what it is counted at, and where that came from
magpie model price relay-a/gpt-5.5 0.12,0.60,0.01,0.15   # input,output,cache read,cache write
magpie model price relay-a/gpt-5.5 --reset
magpie model prices                                       # every model you priced
```

- The four numbers are input, output, cache read and cache write, in USD per million tokens, and all four are needed. `0` is a model served at no cost, which is a price.
- Or set it in the provider's editor, under the model.
- A fifth number is a 1-hour cache write's price. For a Claude model it defaults to 2× input, Anthropic's rule.
- A call the vendor answered with another model is counted at the model that answered, the one the vendor billed for.

## Calls with no price

A call with no price is left out of a total's cost, never counted as free. The Usage page says how many calls it couldn't price beside the sum (3 unpriced, say), and `magpie usage` says so after its totals. magpie doesn't guess a variant's price from a similar name: `-auto`, `-max` and `-fast` can each cost differently, so give it one with `magpie model price`.

## Claude Code's status line

`magpie statusline` prints one line for Claude Code's status line: the model the session's latest turn went to, then each subscription account's windows, with `*` on the one that answered last. Turn it on from Claude Code's row on the Agents page, or:

```
magpie claude statusline on
# → claude/claude-opus-5-5 | claude a@example.com* 5h 62% 7d 41% | claude B 5h 8% 7d 30%
```

A status line of your own (claude-hud, a script) is never written over. It works however Claude Code signs in to the gateway.

## From other programs

The Usage page's summary and request list are served by the gateway too, read-only and without conversation text:

```
GET /v1/magpie/usage
GET /v1/magpie/usage/requests
```

From another computer they need a gateway key. A key held to a budget, models or accounts is refused the summary and gets only its own requests in the list.

## FAQ

### How do I see what Claude Code costs?

With Claude Code going through magpie, every request is recorded with its tokens and an estimated cost. See it per agent on the Usage page or with magpie usage, and per session on the Sessions page or with magpie sessions.

### My relay charges less than list price. How do I get the cost right?

Set what it charges with magpie model price / input,output,cache read,cache write (USD per million tokens), and Usage and the session totals use it.

### Can I export every request?

Yes. magpie usage --csv exports each request with its models, tokens, cost, time, status and account; --account limits it to one account.

### Why do some calls have no cost?

A call with no known price is left out of the total, and the Usage page says how many are unpriced. Give the model a price and they are counted.

Related: [Quota left on every subscription and key](https://usemagpie.ai/docs/quota), [Round robin and failover across accounts, keys and providers](https://usemagpie.ai/docs/routing-groups). Hit an error? See [Fixing common errors: 401, 429, 502, 504 and more](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/vertex

# Google Vertex AI in Claude Code, Codex and other agents

Google Vertex AI, which Google's documentation now calls Gemini Enterprise Agent Platform, serves Gemini from your own Google Cloud project, which is billed for it. It also serves partner and open models such as DeepSeek, GLM and gpt-oss, and Anthropic's Claude. magpie's `google-vertex` preset brings them to Claude Code, Codex, OpenCode and other agents with no API key: each request is signed with a token minted from your Google credentials.

## Add it

1. **Turn on the API..** Turn on the Agent Platform API (`aiplatform.googleapis.com`) in the project. Billing has to be on there.
2. **Sign in..** Run `gcloud auth application-default login`, or have a service account's key file.
3. **Add and test..** Give the project id, then test:

```
gcloud auth application-default login
magpie provider add google-vertex project=my-project
magpie provider test google-vertex
```

The app's editor asks the same in Project ID, Location, Credentials file and Service account. The TUI's `a` asks for the project alone, and the CLI sets the rest. Adding, listing and showing it ask Google nothing; the credentials are read when a request is signed. Then pick a model for an agent:

```
magpie claude google-vertex/claude-sonnet-5-5
magpie codex google-vertex/gemini-3.1-pro-preview
```

## Location, credentials, service account

```
magpie provider set google-vertex location=us-central1        # global (default), us, eu or a region
magpie provider set google-vertex credentials=~/keys/vertex.json
magpie provider set google-vertex impersonate=vertex@my-project.iam.gserviceaccount.com
magpie provider set google-vertex impersonate=                # empty clears it
```

- `location=` is `global` (the default, and what an empty value goes back to), `us`, `eu` or a region such as `us-central1`.
- `credentials=` names a credentials file to sign with in place of gcloud's sign-in, such as a service account's key. A relative path is made full from the folder the command runs in.
- `impersonate=` has requests made as that service account. The account signed in needs the Service Account Token Creator role on it.
- A key is refused, and so is an address (`url=` and the like): the project and location make the only address the token is sent to.

## Models per location

Each location serves models of its own, and Vertex AI has no list to ask which, so magpie gives each location the models it answered with:

- `global`: Gemini (`gemini-3.8-flash`, `gemini-3.1-pro-preview`, `gemini-2.5-pro` and more), three partner models, and Claude models such as `claude-opus-5-5`, `claude-sonnet-5-5` and `claude-haiku-5-5`.
- `us`, `eu`: the 3.8, 3.7, 3.6 and 3.5 Flash models, `gemini-3.5-flash-lite` and `gemini-3.1-flash-lite`.
- A region: `gemini-2.5-pro`, `gemini-2.5-flash` and `gemini-2.5-flash-lite`.

When a region serves one more, as asia-northeast1 serves `gemini-3.5-flash`, type it in with the rest you want. Moving location keeps the models picked, so pick again after a move.

## Partner models

A partner model names its publisher before a slash, as `deepseek-ai/deepseek-v4.1-flash-maas`, `zai-org/glm-5.2-maas` and `openai/gpt-oss-120b-maas` do. magpie asks it on Google's OpenAI-compatible chat completions in your project, with the same credentials and nothing to set. Type in another one (in preview, or listed later) under its full id:

```
magpie provider models google-vertex gemini-3.8-flash deepseek-ai/deepseek-v4.1-flash-maas google/gemma-4-26b-a4b-it-maas
magpie provider models google-vertex all     # back to the location's list
magpie provider test google-vertex zai-org/glm-5.2-maas
```

Turn each partner model on for the project in Model Garden first: until then Google refuses it. `magpie provider test google-vertex` tests Gemini; test a partner model on its own, by right-clicking it in the app or by naming it after the command.

## Claude on Vertex AI

A model whose id starts with `claude-` is asked on Anthropic's Messages API in your project (streamRawPredict), as Claude Code asks it with `CLAUDE_CODE_USE_VERTEX`, with nothing more to set. Every agent can use it, whatever API it speaks, Codex and OpenCode included.

- `global` lists the current models under the ids Claude Code gives them for Vertex AI.
- An older model goes under Vertex's id with its date, such as `claude-sonnet-4-5@20250929`, typed in.
- At another location (`us-east5`, `europe-west1`), type in the Claude models it serves.
- Turn each Claude model on in Model Garden first, as a partner model is, and test it on its own.

## Priority PayGo and Flex PayGo

Google's Priority PayGo and Flex PayGo are asked for with request headers. The editor's Headers offers both, `X-Vertex-AI-LLM-Request-Type` and `X-Vertex-AI-LLM-Shared-Request-Type`; their values are the ones Google's pages give. From the CLI:

```
magpie provider set google-vertex header.=
```

## Common errors

- `no Google credentials at <file>`: there is no credentials file there. If it is your `credentials=`, correct it or clear it with `credentials=` alone; otherwise run `gcloud auth application-default login`.
- `GOOGLE_APPLICATION_CREDENTIALS names <file>, which isn't there`, or `… not a full path`: the variable names no file magpie can read, and gcloud's own isn't read in its place. Give the whole path, unset it, or set `credentials=`.
- `the sign-in was refused`: the sign-in expired or was revoked. Run the command the advice names, such as `gcloud auth application-default login`. The next request reads the new file, with no restart.
- A 403 `PERMISSION_DENIED` naming `aiplatform.endpoints.predict`: the account that signs, or the service account it goes as, may not use Vertex AI in the project. Give it Agent Platform User (`roles/aiplatform.user`) on the project.
- `impersonating …: the sign-in was refused (403)`: the account signed in needs Service Account Token Creator (`roles/iam.serviceAccountTokenCreator`) on that service account.

## FAQ

### Does Vertex AI need an API key in magpie?

No. magpie signs each request with gcloud's Application Default Credentials, a service account's key file or an impersonated service account. A key is refused.

### Can Claude Code use Claude on Vertex AI through magpie?

Yes. claude- models are asked on Anthropic's Messages API, as with CLAUDE_CODE_USE_VERTEX, and Codex, OpenCode and other agents can use them too. Turn the model on in Model Garden first.

### Why did the models change when I moved location?

Each location serves models of its own: global has the most, us and eu the newer Flash models, and a region the 2.5 models. Type others in with magpie provider models google-vertex.

### What does a 403 PERMISSION_DENIED mean?

The account that signs needs Agent Platform User (roles/aiplatform.user) on the project; when it impersonates a service account, it also needs Service Account Token Creator on that account.

Related: [Gemini in Claude Code, Codex, Gemini CLI and OpenCode](https://usemagpie.ai/docs/gemini), [DeepSeek in Claude Code, Codex, Gemini CLI and OpenCode](https://usemagpie.ai/docs/deepseek). If something fails, see [Fixing common errors: 401, 429, 502, 504 and more](https://usemagpie.ai/docs/troubleshooting) or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/bedrock

# Amazon Bedrock in Claude Code, Codex and other agents

magpie has two Amazon Bedrock presets: `bedrock`, the Bedrock runtime, and `bedrock-mantle`, Bedrock's Mantle endpoint. Both take the same Bedrock API key, with no AWS access keys and no SigV4 signing. Once added, Claude Code, Codex, OpenCode and other agents can use Claude, OpenAI's GPT models, and gpt-oss, Qwen, DeepSeek, Kimi, GLM and MiniMax on Bedrock, billed to your AWS account.

## Add it

1. **Get a key..** Create a Bedrock API key on the Bedrock page of the AWS console.
2. **Add it and pick a region..** The default region is us-east-1. Change it in the app's editor under Region, or from the CLI:

```
magpie provider add bedrock 
magpie provider set bedrock region=eu-west-1
magpie provider test bedrock
```

The runtime preset's regions are us-east-1, us-east-2, us-west-2, eu-central-1, eu-west-1, eu-west-3, ap-northeast-1, ap-southeast-1, ap-southeast-2, ap-south-1. Each has its own Claude (Anthropic Messages), Chat Completions and Responses address, and a change of region moves all three.

## Models

The Bedrock runtime has no model list to ask, so magpie gives it one:

- Claude: `global.anthropic.claude-opus-5-5`, `global.anthropic.claude-sonnet-5-5`, `global.anthropic.claude-haiku-4-5-20251001-v1:0` and more, as global. inference profiles, which every commercial region routes.
- OpenAI GPT: `global.openai.gpt-6-astra`, `global.openai.gpt-6-sol`, `global.openai.gpt-6-luna`, global. profiles too.
- Other makers: in-region ids such as `openai.gpt-oss-120b-1:0`, `qwen.qwen3-coder-480b-a35b-v1:0`, `deepseek.v3.2`, `moonshotai.kimi-k2.5`, `zai.glm-5`, `minimax.minimax-m2.5`, which not every region serves (gpt-oss isn't in ap-southeast-1).

A profile kept in one geography (`us.`, `eu.`, `apac.`, `jp.`, `au.`) isn't in the list; type it in, as any model of your own is.

## Use it in an agent

magpie picks Bedrock's API per model: Claude on Anthropic Messages alone, OpenAI's GPT models (not gpt-oss) on Responses first, the rest on Chat Completions. Whatever API an agent speaks, magpie translates, so Codex can use Claude on Bedrock and Claude Code can use GPT there:

```
magpie claude bedrock/global.anthropic.claude-sonnet-5-5
magpie codex bedrock/global.openai.gpt-6-sol
```

## Bedrock Mantle

Mantle is Bedrock's other endpoint (`bedrock-mantle.<region>.api.aws`), with the same key:

```
magpie provider add bedrock-mantle  region=us-west-2
magpie provider test bedrock-mantle
```

- Unlike the runtime, Mantle lists its models, so the list is your account's own, models only Mantle serves among them.
- Model ids are in-region ones alone, such as `anthropic.claude-sonnet-5` and `openai.gpt-oss-120b`; there are no `global.` or `us.` profiles.
- Mantle serves its OpenAI APIs under two prefixes: OpenAI's closed GPT models and xAI's Grok at `/openai/v1`, the rest at `/v1`. magpie picks per model; when a maker it doesn't know yet is refused, it asks once more at the other prefix and remembers the one that worked.
- Mantle has 17 regions; the runtime's eu-west-3 has no Mantle.

## Claude Code's CLAUDE_CODE_USE_BEDROCK

With `CLAUDE_CODE_USE_BEDROCK` (or `_VERTEX`, `_MANTLE` and the like) on, Claude Code goes to that cloud's own endpoint and never reaches magpie. When magpie wires Claude Code in, it takes such a switch out of the settings it writes, keeps its value, and puts it back as written when it steps out, unless you set it again since. The cloud's own variables (`AWS_*`) stay. When the switch is somewhere magpie doesn't write (the managed settings, `~/.claude.json`'s env, or the login shell's environment), the Agents page's check names the variable and where it is.

## Notes

- When Claude Code sends an `anthropic-beta` Bedrock doesn't take, Bedrock answers 400 "Unexpected value(s) … for the anthropic-beta header". magpie asks again at once without those betas, and leaves them out for that provider from then on.
- The key goes in `x-api-key` alone on Claude's API, as Bedrock asks.
- A custom provider added at a runtime or Mantle address is recognised too, and gets the same rules.

## FAQ

### Does magpie need AWS access keys for Bedrock?

No. One Bedrock API key is enough, and magpie does no SigV4 signing. Create it on the Bedrock page of the AWS console.

### Can Claude Code use Claude on Bedrock through magpie?

Yes. Pick a model such as bedrock/global.anthropic.claude-sonnet-5-5. Leave CLAUDE_CODE_USE_BEDROCK off, or Claude Code goes around magpie; magpie takes it out of the settings it writes.

### Why can't I use some models in my region?

The global. Claude and GPT profiles are routed in every commercial region; other makers' in-region ids aren't in every region. Pick another region, or type in an id your region serves.

### Bedrock or Bedrock Mantle?

Both take the same key. The runtime has global. profiles and a given model list; Mantle lists your account's own models, Mantle-only ones included, under in-region ids alone.

Related: [Anthropic in Claude Code, Codex, Gemini CLI and OpenCode](https://usemagpie.ai/docs/anthropic), [Google Vertex AI in Claude Code, Codex and other agents](https://usemagpie.ai/docs/vertex). If something fails, see [Fixing common errors: 401, 429, 502, 504 and more](https://usemagpie.ai/docs/troubleshooting) or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/azure

# Azure OpenAI in Codex, Claude Code and other agents

Azure OpenAI serves OpenAI's models, and other makers' such as Kimi, DeepSeek and Grok, at your own Azure resource. magpie's `azure` preset brings that resource to Codex, Claude Code, OpenCode and other agents: the endpoint and key are your resource's, and the model ids are your deployments' names.

## Add it

1. **Find the endpoint and key..** Open the resource's Keys and Endpoint in the Azure portal, and copy the endpoint and a key.
2. **Add it..** Pick Azure OpenAI in the app and paste the address into Endpoint, or from the CLI:

```
magpie provider add azure  url=https://my-resource.openai.azure.com
magpie provider test azure
```

Paste the address any way: `https://<resource>.openai.azure.com`, `…/openai`, `…/openai/v1`, a classic deployment's URL with its api-version, or only the resource's name. magpie asks every one at the resource's v1 API (`/openai/v1`, generally available since August 2025), where chat completions, Responses and the model list sit at OpenAI's paths and no api-version is wanted. Hosts ending `.openai.azure.com`, `.cognitiveservices.azure.com` and `.services.ai.azure.com` are all known.

The key goes in `api-key`, never as a Bearer: a Bearer on Azure is an Entra ID token.

## Deployments are the models

Once added, magpie asks the resource for its deployments with the key, and their names are the model ids. Where the data plane won't list them, it takes the models the v1 API lists, which match only when each deployment is named after its model. When neither answers, the error says to type your deployments' names in:

```
magpie provider models azure my-gpt-5-5 my-gpt-6-sol
```

Azure hosts other makers' models too, which models.dev lists under it with no reasoning levels, so magpie doesn't take its list as a maker's word on theirs.

## Use it in an agent

Codex speaks Responses; Claude Code and other Anthropic agents are translated by magpie to Azure's API:

```
magpie codex azure/my-gpt-5-5
magpie claude azure/my-gpt-5-5
```

## API Management and headers

When an API Management gateway (or any address that isn't a resource's host) sits in front of the resource, magpie keeps the URLs you gave and doesn't move them to the v1 API. Add headers in the editor's Headers; `${sessionId}`, `${threadId}` and `${subagentId}` in a value become the conversation's ids, so a gateway can keep one conversation on one account:

```
magpie provider set azure 'header.X-Session=${sessionId}'
```

## Notes

- An Azure provider imported from another app becomes the `azure` preset's too, on the resource's v1 API.
- Azure's `content_filter` is read as the vendor's safety filter, not a broken request: another account or model in a routing group may still answer.
- Reasoning items Codex hands back are left out of a request relayed as is to Azure, unless `store` is true: Azure, like OpenAI, looks the id up among stored items and answers 400 "Item with id 'rs_…' not found".
- OpenAI's Decisions API (`/v1/decisions`) goes to Azure too, at `/openai/v1/decisions`, with your deployment's name as the model.

## FAQ

### Does magpie support Azure OpenAI?

Yes, with the azure preset. Give the resource's endpoint and key; magpie asks its v1 API under /openai/v1 with the key in the api-key header, and lists the resource's deployments as models.

### What goes in as the model id?

Your deployment's name, not the model's. magpie asks the resource for its deployments; when it can't, type them in with magpie provider models azure .

### Do I need an api-version?

No. magpie uses Azure's v1 API, and a classic /openai/deployments/…?api-version= address is moved onto it.

### What if an API Management gateway is in front of the resource?

Give the gateway's address; magpie leaves it as it is. Add the headers it needs under Headers, where ${sessionId} and the like become the conversation's ids.

Related: [OpenAI in Claude Code, Codex, Gemini CLI and OpenCode](https://usemagpie.ai/docs/openai), [Amazon Bedrock in Claude Code, Codex and other agents](https://usemagpie.ai/docs/bedrock). If something fails, see [Fixing common errors: 401, 429, 502, 504 and more](https://usemagpie.ai/docs/troubleshooting) or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/groq

# Groq in Claude Code, Codex and other agents

Groq runs open models on its own LPU chips and is known for speed. It serves OpenAI's gpt-oss and other makers' open models. magpie's `groq` preset brings it to Claude Code, Codex, OpenCode and other agents: one Groq key, with the model list Groq gives.

## Add it

1. **Get a key..** Create an API key at console.groq.com/keys.
2. **Add it..** Pick Groq in the app and paste the key into API key, or from the CLI:

```
magpie provider add groq 
magpie provider test groq
```

The preset points Chat Completions and Responses at `https://api.groq.com/openai/v1`, so there is no address to type. A Groq provider set up in OpenCode or another app becomes the `groq` preset when imported.

## Use it in an agent

Model ids are `groq/<Groq's model id>`:

```
magpie claude groq/openai/gpt-oss-120b
magpie codex groq/openai/gpt-oss-120b
```

Claude Code and other Anthropic agents have their requests translated by magpie to Chat Completions for Groq: Groq's Chat API reports its cache, so Usage shows what was read from it.

Most of Groq's models are other makers', and models.dev lists them under Groq, so magpie doesn't take Groq's list as a maker's word on theirs.

## Rate limits and context

- Groq's 429 names the model it limits (for model `…`). magpie rests that model on that key alone and asks the other models straight; a 429 that names no model rests the key whole.
- When Groq says "reduce the length of the messages", magpie reads it as an overflow and gives the agent the error it knows (OpenAI's `context_length_exceeded`, say), so the agent compacts instead of asking again.
- Groq turns away a field it doesn't take with a 400 saying "unsupported". For a field magpie adds, such as its cache key, magpie asks again without it and doesn't send it to Groq again.

## Speech to text and text to speech

The gateway's `/v1/audio/transcriptions` and `/v1/audio/speech` take Groq too: the form and the audio go to Groq as sent, with only the model set to Groq's own id, and the answer comes back in Groq's own format. Text to speech works the same way, with model `groq/playai-tts`.

```
curl http://127.0.0.1:3425/v1/audio/transcriptions \
  -H 'Authorization: Bearer magpie' \
  -F model=groq/whisper-large-v3 -F file=@meeting.m4a
```

## Notes

- Groq takes its turn in a routing group like any provider: when it fails, the group's next member answers.
- When one key isn't enough, add another as a second account of the same provider.

[Fireworks and Fireworks Nexus in Claude Code, Codex and other agents](https://usemagpie.ai/docs/fireworks)

## FAQ

### Does magpie support Groq?

Yes, with the groq preset. Give a Groq API key; Chat Completions and Responses are set, the models come from Groq's list, and a model id is groq/.

### Can Claude Code use Groq's models?

Yes. magpie translates Claude Code's Anthropic requests to Chat Completions for Groq, whose Chat API reports its cache, so Usage shows it.

### What happens when Groq rate-limits me?

When Groq's 429 names the model, magpie rests only that model on that key and the others go on; in a routing group with other providers, the request goes to the next one.

### Can I use Groq's Whisper?

Yes. Send an OpenAI-style form to magpie's /v1/audio/transcriptions with model groq/whisper-large-v3; text to speech goes to /v1/audio/speech.

Related: [Mistral in Claude Code, Codex, Gemini CLI and OpenCode](https://usemagpie.ai/docs/mistral), [OpenAI in Claude Code, Codex, Gemini CLI and OpenCode](https://usemagpie.ai/docs/openai). If something fails, see [Fixing common errors: 401, 429, 502, 504 and more](https://usemagpie.ai/docs/troubleshooting) or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/vercel

# Vercel AI Gateway in Claude Code, Codex and other agents

Vercel AI Gateway serves every maker's models with one key, as `maker/model` ids. magpie's `vercel` preset brings it to Claude Code, Codex, OpenCode and other agents, with all three APIs set and no address to type.

## Add it

1. **Get a key..** Create one under AI Gateway → API Keys in the Vercel dashboard.
2. **Add it..** Pick Vercel AI Gateway in the app and paste the key into API key, or from the CLI:

```
magpie provider add vercel 
magpie provider test vercel
```

The preset points Chat Completions and Responses at `https://ai-gateway.vercel.sh/v1` and Anthropic Messages at `https://ai-gateway.vercel.sh`. By Vercel's docs, each of them serves every model.

## Use it in an agent

Model ids are `vercel/<Vercel's model id>`, which already names the maker:

```
magpie claude vercel/anthropic/claude-sonnet-4.6
magpie codex vercel/openai/gpt-5.5
```

A Claude model goes to Vercel's Anthropic Messages whatever API the agent spoke: a relay serving both drops `cache_control` on Chat, so every turn was billed uncached, and thinking with it. Other models go on the agent's own API: Responses for Codex, Chat Completions for a Chat client.

## The model list

Vercel's `/v1/models` says each row's type, and magpie sorts by it:

- Chat models show in agents' model pickers, their window from Vercel's `context_window`.
- Image and video models serve magpie's image and video generation; embedding and reranking models go on `/v1/embeddings` and `/v1/rerank`; speech and transcription models on `/v1/audio`.
- Evaluation models (`typesafe-ai/jev`, say) and realtime voices answer no chat and are left out.
- A `-batch` id is for Vercel's batch API alone, which synchronous requests don't accept, and is left out too.

## Notes

- Vercel AI Gateway is a relay: put it in a routing group beside OpenRouter or a maker's own account, and when one fails the group's next member answers.
- Vercel's billing and credit are in the Vercel dashboard; magpie's Usage records each request's tokens.

## FAQ

### Does magpie support Vercel AI Gateway?

Yes, with the vercel preset. Give an AI Gateway key; Chat Completions, Responses and Anthropic Messages are set, and a model id is vercel//.

### Does Claude Code hit the cache with Claude on Vercel?

Yes. A Claude model always goes to Vercel's Anthropic Messages with cache_control as sent, so the cache isn't lost on Chat.

### Can Codex use Vercel AI Gateway?

Yes. Codex speaks Responses, which magpie sends to Vercel's /v1 Responses API; the model is vercel//.

### Why are some models missing from the list?

magpie sorts by Vercel's types: evaluation models, realtime voices and -batch ids answer no synchronous chat and stay out of agents' lists; image, video, embedding and speech models go to their own APIs.

Related: [OpenRouter in Claude Code, Codex, Gemini CLI and OpenCode](https://usemagpie.ai/docs/openrouter), [Round robin and failover across accounts, keys and providers](https://usemagpie.ai/docs/routing-groups). If something fails, see [Fixing common errors: 401, 429, 502, 504 and more](https://usemagpie.ai/docs/troubleshooting) or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/nvidia

# NVIDIA NIM in Claude Code, Codex and other agents

NVIDIA hosts NIM endpoints at build.nvidia.com: one `nvapi-` key reaches the many models it hosts. magpie's `nvidia` preset brings it to Claude Code, Codex, OpenCode and other agents.

## Add it

1. **Get a key..** Sign in at build.nvidia.com and make one under Settings → API Keys.
2. **Add it..** Pick NVIDIA NIM in the app and paste the key into API key, or from the CLI:

```
magpie provider add nvidia nvapi-…
magpie provider test nvidia
```

The preset sets Chat Completions alone, at `https://integrate.api.nvidia.com/v1`: NIM's `/v1/responses` answers for a few models and 404 for the rest, so magpie doesn't use it.

## Use it in an agent

Model ids are `nvidia/<NIM's model id>`, from NIM's own list:

```
magpie claude nvidia/
magpie codex nvidia/
```

Claude Code speaks Anthropic's API and Codex speaks Responses; magpie translates both to Chat Completions for NIM and the answers back to what the agent reads.

## Free models

A model NIM prices at 0 is marked free beside it in agents' model pickers. The price is NIM's alone: the same model on another provider costs what it costs there, and NIM's $0 isn't taken as the maker's price.

## Many keys

Importing from an app that keeps an entry per key, as CC Switch does, often brings hundreds of entries, "NVIDIA #001" to "NVIDIA #600". magpie folds entries alike in all but their key into one provider, each key an account of it; otherwise every model showed hundreds of times in every agent's picker. Each entry's old name becomes its key's name, and one that was off stays off.

## Notes

- An `nvidia` provider set up in OpenCode becomes this preset when imported.
- When NIM's free use runs out or is rate-limited, put it in a routing group with other providers: when one fails, the group's next member answers.
- magpie can't tell a free NIM key from a paid one, so it doesn't say how a key bills.

[Free models in Claude Code, Codex and other agents](https://usemagpie.ai/docs/free-models)

## FAQ

### Does magpie support NVIDIA NIM?

Yes, with the nvidia preset. Give a build.nvidia.com API key; magpie asks Chat Completions at integrate.api.nvidia.com/v1, and a model id is nvidia/.

### Can Claude Code and Codex use NIM's models?

Yes. NIM is asked on Chat Completions alone, and magpie translates Claude Code's Anthropic requests and Codex's Responses requests to Chat and the answers back.

### How do I tell which models are free?

A model NIM prices at 0 is marked free beside it in agents' model pickers. That is NIM's price only; the same model costs what it costs on other providers.

### I imported hundreds of NVIDIA entries. What now?

magpie folds entries alike in all but their key into one provider, each key an account of it, so models aren't repeated in the pickers.

Related: [ModelScope in Claude Code and Codex](https://usemagpie.ai/docs/modelscope), [Round robin and failover across accounts, keys and providers](https://usemagpie.ai/docs/routing-groups). If something fails, see [Fixing common errors: 401, 429, 502, 504 and more](https://usemagpie.ai/docs/troubleshooting) or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/relay

# API relays in Claude Code, Codex and other agents

A relay sells many vendors' models on one key, often at its own prices and under its own model names. magpie treats a relay as a provider: an agent asks for `relay/model`, and prices, names and windows can be set to what the relay really does.

## Add a relay

1. **A preset relay..** AiHubMix, PipeLLM, 302.AI, CherryIN, 鱼鱼连线 and AIGoCode are presets: give an API key. 鱼鱼连线 also takes an Auto, Global or China Mainland line.
2. **Any other relay..** Give its addresses: `url=` for an OpenAI-compatible base, `anthropic=` for an Anthropic-compatible one, both when it has both, and `responses=` when Responses has an address of its own.

```
magpie presets
magpie provider add aihubmix sk-…
magpie provider add "My Relay" url=https://relay.example.com/v1 anthropic=https://relay.example.com key=sk-…
magpie provider test "My Relay"
```

`magpie provider test` sends one tiny request per API, with latency.

## Caching for Claude models

When a relay has both an OpenAI and an Anthropic address, a Claude model goes to Anthropic's Messages whatever API the agent spoke: many relays drop `cache_control` on Chat, so every turn was billed uncached, and thinking went with it (#997). If the relay has an Anthropic address, give it.

## Count the relay's prices

Out of the box a call is counted at the model maker's list price, the wrong number for a relay that sells at a discount or a multiplier. Say what the relay charges, and the usage ledger and session totals use it:

```
magpie model price relay-a/gpt-5.5 0.12,0.60,0.01,0.15
magpie model price relay-a/gpt-5.5
magpie model prices
```

The four numbers are input, output, cache read and cache write, in USD per million tokens, and all four are asked for; `0` is a model served at no cost. A relay that sells `kimi-k3` as `moonshot-kimi-k3` answers as `kimi-k3`, so a renamed model with no price of its own is counted at `kimi-k3`'s price at the same relay.

## Model names and windows

Relays often add a prefix or a date to a model's id. `magpie model wire` sets the name the relay is asked for, `*` standing for the model; for a model models.dev doesn't list or lists at the wrong size, `magpie model context` and `magpie model output` set the window and the reply limit:

```
magpie model wire 'relay-b/*' 'vendor-c/*'
magpie model wire relay-b/model-2 --reset
magpie model context "relay-a/*" 200000
magpie model output relay-a/gpt-5.5 131072
```

Quote arguments with a `*` in zsh, or it answers `no matches found`. Windows and limits are looked for in this order: this model → this provider's `*` → the provider's own list → models.dev.

## The model list

Relays list new models fast. Have the gateway fetch the list on a schedule, and expose new models that match a pattern:

```
magpie provider refresh-every relay 6h
magpie provider auto-include relay 'gpt-*' 're:claude-.*'
```

## Notes

- Agents only ever reach magpie; they never hold the relay's key or its address.
- Several relays can share a routing group: when one fails, the group's next member answers.
- When a reply says another model answered, usage marks it and counts the model that answered.

## FAQ

### Can magpie use an API relay?

Yes. AiHubMix, PipeLLM, 302.AI, CherryIN, 鱼鱼连线 and AIGoCode are presets that take a key; any other relay is added with magpie provider add and its OpenAI- and Anthropic-compatible addresses.

### Why does caching miss for Claude models through a relay?

Many relays drop cache_control on Chat. Give the relay's Anthropic address, and magpie sends Claude models to Messages, keeping caching and thinking.

### The relay sells at a discount. How do I count the right cost?

Run magpie model price relay/model with the input, output, cache read and cache write prices in USD per million tokens; usage and session totals use them.

### The relay's model names have a prefix. What now?

magpie model wire sets the name the relay is asked for: 'relay-b/*' 'vendor-c/*' sends every model with a vendor-c/ prefix.

Related: [OpenRouter in Claude Code, Codex, Gemini CLI and OpenCode](https://usemagpie.ai/docs/openrouter), [Round robin and failover across accounts, keys and providers](https://usemagpie.ai/docs/routing-groups). If something fails, see [Fixing common errors: 401, 429, 502, 504 and more](https://usemagpie.ai/docs/troubleshooting) or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/fireworks

# Fireworks and Fireworks Nexus in Claude Code, Codex and other agents

Fireworks hosts open models, paid as you go; Fireworks Nexus is an account and plan of its own at nexus.fireworks.ai, where Nexus Auto picks the model. magpie has a preset for each: `fireworks` and `fireworks-nexus`.

## Fireworks, pay as you go

1. **Get a key..** Make one at app.fireworks.ai under Settings → Users → API Keys.
2. **Add it..** Pick Fireworks in the app and paste the key into API key, or from the CLI:

```
magpie provider add fireworks fw_…
magpie provider test fireworks
magpie claude fireworks/
```

The preset asks Chat Completions alone, at `https://api.fireworks.ai/inference/v1`, with models.dev's `fireworks-ai` for the list and prices. magpie translates Claude Code's Anthropic requests and Codex's Responses requests to Chat for Fireworks.

## Fireworks Nexus

A Nexus key is made at nexus.fireworks.ai, not on the Fireworks platform. Its `/inference` endpoints speak Chat Completions, Responses and Anthropic Messages alike, so Codex's and Claude Code's requests go on their own APIs.

```
magpie provider add fireworks-nexus fw_…
magpie codex fireworks-nexus/auto
magpie claude fireworks-nexus/auto
```

Pro and Team take only `auto`, Nexus Auto, and refuse an open model named directly with a 403, so `auto` is the preset's list. An Enterprise account's open models are typed in by id among the provider's models.

## Claude and GPT in Nexus

Nexus Auto reaches Claude and GPT with your own keys, in the `x-anthropic-api-key` and `x-openai-api-key` headers, or with Provider Keys set up on the Nexus account. In magpie's provider editor, Headers offers both names to add, with the values yours to fill in; from the CLI:

```
magpie provider set fireworks-nexus header.x-anthropic-api-key=sk-ant-…
magpie provider set fireworks-nexus header.x-openai-api-key=sk-…
```

A header of your own goes on every request. An empty value removes it.

## Notes

- Agents only reach magpie; they never hold the Fireworks key or its address.
- Fireworks can share a routing group with other providers of the same open models: when one fails, the group's next member answers.
- Nexus plans and limits are as Fireworks' own pages say; this page covers how magpie connects.

## FAQ

### Does magpie support Fireworks AI?

Yes. The fireworks preset takes a Fireworks API key and asks Chat Completions at api.fireworks.ai/inference/v1; a model id is fireworks/.

### How is Fireworks Nexus different from Fireworks?

Nexus is an account and plan of its own, with keys made at nexus.fireworks.ai. Its endpoints speak Chat, Responses and Messages, Nexus Auto picks the model, and Pro and Team take only auto.

### Why does Nexus list only auto?

Pro and Team refuse an open model named directly with a 403 and take only auto. An Enterprise account types its open models in by id.

### How do I use Claude and GPT in Nexus?

Put your own Anthropic and OpenAI keys in the x-anthropic-api-key and x-openai-api-key headers, or set up Provider Keys on the Nexus account.

Related: [Groq in Claude Code, Codex and other agents](https://usemagpie.ai/docs/groq), [API relays in Claude Code, Codex and other agents](https://usemagpie.ai/docs/relay). If something fails, see [Fixing common errors: 401, 429, 502, 504 and more](https://usemagpie.ai/docs/troubleshooting) or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/free-models

# Free models in Claude Code, Codex and other agents

Some providers serve models free, some with no key at all. magpie lists them in the same picker as every other model, an agent asks for `provider/model`, and free ones are marked.

## Free models with no key

1. **OpenCode Zen..** Its free models (ids ending in `-free`, and `big-pickle`) need no key. Zen serves its free tier to OpenCode alone, and magpie asks for them as OpenCode does.
2. **Kilo Gateway..** Its free models (marked free, ids ending in `:free`) need no key. With none, a caller counts as anonymous, by IP, at 200 requests an hour.

```
magpie provider add opencode-zen
magpie provider add kilo
magpie models
```

Once added, the free models are in every agent's picker:

```
magpie claude opencode-zen/big-pickle
magpie codex kilo/:free
```

For their paid models, add a key; the free ones keep working:

```
magpie provider key opencode-zen 
magpie provider key kilo 
```

## The free mark in pickers

A model a provider prices at 0 on all four counts (input, output, cache read, cache write) is marked free beside it in the pickers: OpenRouter's `:free` models, OpenCode Zen's `-free` ones, [NVIDIA NIM](https://usemagpie.ai/docs/nvidia)'s free models.

- It is that provider's price alone: the same model on another provider costs what it costs there.
- A model its maker gives away (Zhipu's `glm-4.7-flash`) isn't marked, since a provider reselling it may not.
- A plan's price list says what members pay per token, not what the model costs, so it doesn't count either.
- A price you set yourself wins: 0 is marked free, anything else isn't.

```
magpie model price relay-a/some-model 0,0,0,0
```

## Free models first, paid as fallback

Free models are often rate-limited. Put a free model and a paid one in a routing group, the free one first: when it is limited or fails, the group's next member answers. See [Round robin and failover across accounts, keys and providers](https://usemagpie.ai/docs/routing-groups).

## Notes

- When a provider answers that a model is deprecated or retired (Zen's 410 "Model exo-free has been deprecated."), the model leaves `magpie models`, `/v1/models` and every agent's list. It comes back once a request for it is answered, or after a week.
- Which models are free, and how far, is as each provider's own pages say, and changes.

## FAQ

### Are there free models I can use in Claude Code with no key?

Yes. OpenCode Zen's free models (ending in -free, and big-pickle) and Kilo Gateway's free models (ending in :free) need no key: add them with magpie provider add opencode-zen or magpie provider add kilo.

### What is the limit on Kilo Gateway with no key?

With no key, a caller counts as anonymous, by IP, at 200 requests an hour. A Kilo key reaches its paid models too.

### Where does the free mark in the pickers come from?

A provider pricing a model at 0 on all four counts. It is that provider's price alone; a model its maker gives away, or a plan's $0 price list, doesn't count.

### What if a free model is rate-limited?

Put it in a routing group with a paid model, the free one first. When it is limited or fails, the group's next member answers.

Related: [NVIDIA NIM in Claude Code, Codex and other agents](https://usemagpie.ai/docs/nvidia), [OpenRouter in Claude Code, Codex, Gemini CLI and OpenCode](https://usemagpie.ai/docs/openrouter). If something fails, see [Fixing common errors: 401, 429, 502, 504 and more](https://usemagpie.ai/docs/troubleshooting) or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/coding-plans

# OpenCode Go and ClinePass in Claude Code, Codex and other agents

OpenCode Go and ClinePass are monthly plans for open coding models: OpenCode Go at $10 a month, ClinePass at $9.99. magpie's `opencode-go` and `clinepass` presets bring them to Claude Code, Codex, OpenCode and other agents, not only their own clients.

## Add it

1. **Get a key..** OpenCode Go's at opencode.ai/auth, ClinePass's at app.cline.bot.
2. **Add it..** Pick OpenCode Go or ClinePass in the app and paste the key into API key, or from the CLI:

```
magpie provider add opencode-go 
magpie provider add clinepass 
magpie models
```

The presets have the addresses set. An OpenCode Go or ClinePass provider set up in OpenCode becomes its preset when imported.

## Use it in an agent

Model ids are `provider/model`; ClinePass's own ids start with `cline-pass/`.

```
magpie claude opencode-go/
magpie codex clinepass/cline-pass/glm-5.3
```

When Claude Code, Codex or Gemini CLI speaks another protocol than the plan's, magpie translates.

## OpenCode Go

- OpenCode Go serves each model on one protocol of three and turns it away on the other two ("Model does not support this protocol"). magpie sends each as OpenCode does: GPT, Grok and Muse Spark on Responses, Claude, MiniMax and some Qwen on Anthropic Messages, Gemini on Gemini's API, the rest on Chat Completions.
- Chat and Responses are at `https://opencode.ai/inference/go/openai/v1`, Messages at `https://opencode.ai/inference/go/anthropic` and Gemini at `https://opencode.ai/inference/go/google/v1beta`, as Go's docs give them. An OpenCode Go provider saved with the old addresses is moved to these.
- Quota shows the plan's three windows, 5 hours, 7 days and Month: how much is used and when each resets.

## ClinePass

- Chat Completions is at `https://api.cline.bot/api/v1`. Cline's API lists only its paid models, not the plan's, so magpie takes the models from the list Cline's own clients use: the plan's, plus Cline's free models; paid models are left out.
- Cline's free models (ids starting `cline-free/`) cost nothing and are apart from ClinePass's quota. They answer Cline's own clients alone, so magpie sends the headers Cline's desktop app sends.
- When that list can't be had, magpie asks the API's own list, with the free models as Cline's desktop app last listed them.

## Notes

- When a plan is limited or used up, put it in a routing group with other providers and the group's next member answers. See [Round robin and failover across accounts, keys and providers](https://usemagpie.ai/docs/routing-groups).
- Prices, quotas and models are as OpenCode's and Cline's own pages say, and change.

## FAQ

### Can Claude Code use OpenCode Go?

Yes. Add it with magpie provider add opencode-go and your key, and ask for opencode-go/. magpie sends each model on the protocol Go serves it on, translating when needed.

### OpenCode Go says Model does not support this protocol. What now?

The model went to the wrong protocol. magpie picks each model's protocol as OpenCode does: add it with the opencode-go preset, and a provider saved with the old addresses is moved to the new ones.

### Can I use ClinePass outside Cline?

Yes. Add it with magpie provider add clinepass and a Cline key; the plan's models and Cline's free ones are in every agent's picker.

### Where do I see what is left of OpenCode Go?

magpie's Quota page shows OpenCode Go's 5-hour, 7-day and monthly windows, with what is used and when each resets.

Related: [Use DeepSeek, Kimi, GLM or your Claude and ChatGPT subscription in OpenCode](https://usemagpie.ai/docs/opencode-models), [Cline on any model](https://usemagpie.ai/docs/cline), [Quota left on every subscription and key](https://usemagpie.ai/docs/quota). If something fails, see [Fixing common errors: 401, 429, 502, 504 and more](https://usemagpie.ai/docs/troubleshooting) or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/sync

# Keep magpie in sync across computers: WebDAV, S3 and GitHub

With a computer at work and one at home, or a new one, there is no need to set up providers, keys and every agent's model again. magpie keeps them as one encrypted file on your own WebDAV, S3 or private GitHub repo, and every computer follows it.

## What is synced

- Providers, with their keys, and the pictures picked for them.
- Settings, profiles and every agent's model.
- The library: instruction sets, MCP servers, skills and their files.
- Plugins added from npm or git, installed on the other computer; a plugin's sign-in is not carried.
- Gateway keys, sealed with the settings.

Subscriptions (Claude, ChatGPT and other accounts) are not in it: sign in to them on each computer. Their model picks and settings come along and show once signed in, and the sync status names the ones still to sign in to.

## Turn it on

1. **Turn on sync..** Pick a kind of storage in Settings → Sync and backup → WebDAV, S3 or GitHub sync, or from the CLI:

```
magpie webdav on https://dav.jianguoyun.com/dav/ user=me@example.com
magpie s3 on s3://my-bucket/magpie endpoint=https://.r2.cloudflarestorage.com access-key-id=…
magpie github on github://owner/private-backups/settings branch=main
magpie github                   # where it syncs to and how the last sync went
```

1. **Use one passphrase on every computer..** The file is sealed on your machine with it before it goes up, so the server holds only ciphertext.
2. **Let it sync..** Every 3 minutes while the gateway runs. Each computer writes only over the version it read, so changes from two computers are merged, not lost.

## Three kinds of storage

- **WebDAV**: a folder on a WebDAV server such as 坚果云 (Nutstore), Nextcloud or a Synology.
- **S3**: AWS S3, Cloudflare R2, Backblaze B2, MinIO, Garage, a NAS or any S3-compatible server. The bucket must exist; MinIO and most servers you run yourself need `path-style=yes`. A server without conditional writes works too (Aliyun OSS): when two computers write at once, the later one merges its change back in at its next sync.
- **GitHub**: an existing **private** repository, with a fine-grained token that has Contents read and write. A public one is refused, since its history would give anyone every sealed version. Each update is a commit, so the history is the encrypted backup's.

```
magpie s3 on s3://backups endpoint=http://nas.local:9000 path-style=yes access-key-id=…
```

Switching between the three keeps the others' settings and credentials for switching back; one syncs at a time.

## A computer keeping its own

A change to an agent's model on one computer reaches the others. When sync changes one on a computer and you set it back there, that computer keeps its own: the others' picks no longer change it, and its picks stay there, while everything else keeps syncing. Kept on this computer lists those fields, and Follow the others takes the synced value again.

## Pick what syncs, preview, undo

Under What syncs in the sync's form, untick what each computer should keep as its own: providers, settings, agents' models, the library or memory (profiles, usage and sign-ins are under Advanced). A part not ticked is neither sent nor taken: this computer keeps its own, and the server keeps the others'. Ticked again later, it is joined like a first sync, with this computer's copy kept in the sync folder first. Preview a sync lists what would come here and what would go to the server, item by item, before anything changes; Sync now there runs that sync only if nothing changed since. Undo the last sync puts back what the last sync brought in, on this computer only.

```
magpie webdav set providers=no settings=no agents=no   # only the library and memory sync
magpie webdav preview                                 # what syncing now would change
magpie webdav undo-sync                               # put back what the last sync brought in
```

## A one-off backup and restore

For a move to a new computer without sync, use an encrypted backup file:

```
magpie backup                               # writes magpie.magpie-backup, asks for a passphrase twice
magpie backup --no-keys ~/b.magpie-backup   # no API keys in it
magpie backup --no-usage                    # no usage history in it
magpie restore magpie.magpie-backup         # on the other machine
magpie restore --no-agents b.magpie-backup  # agents left as they are
```

It is encrypted on your machine with AES-256-GCM, the key derived from the passphrase with PBKDF2-SHA256; nothing in it can be read without the passphrase. Restoring replaces providers with the same id and adds the rest; agent models are set only for agents installed on that computer. The file also carries the usage history (--no-usage leaves it out); a restore adds the calls that computer hasn't got, so restoring twice counts nothing twice.

## FAQ

### Can magpie sync through Nutstore (坚果云)?

Yes. Pick WebDAV in Settings → Sync and backup with Nutstore's WebDAV address and account, or run magpie webdav on https://dav.jianguoyun.com/dav/ user=. Use one passphrase on every computer.

### Is syncing to a cloud safe?

The file is sealed on your machine with your passphrase before it goes up, so the server holds only ciphertext. GitHub sync takes only a private repository.

### Are Claude and ChatGPT subscriptions synced?

No, sign in to them on each computer. Their model picks and settings are synced and show once signed in.

### I only want to move to a new computer. What do I do?

Export an encrypted backup with magpie backup and restore it there with magpie restore. --no-keys leaves the API keys out.

Related: [Get started](https://usemagpie.ai/docs/start), [magpie in Docker](https://usemagpie.ai/docs/docker). Questions go to [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/mirrors

# Mirrors in China: faster magpie plugin, Bun and update downloads

From China, npm and GitHub are often slow or unreachable when installing plugins. magpie can have those downloads asked of a mirror in China first; the mirror's file is the very same, checked the same way.

## The Plugins page's Mirrors in China

1. **Open the Plugins page..**
2. **Turn on Mirrors in China..** The page's downloads then ask a mirror in China first and the official address after.

- **npm** (plugin packages, versions and search): `registry.npmmirror.com`.
- **Bun**: npmmirror's binary mirror.
- **The plugin list**: jsDelivr (`cdn.jsdelivr.net/gh/magpie-community/plugins`).

What the mirror hasn't copied yet is asked of the official address. npm's weekly download counts stay npmjs's own. `bun add` is pointed at npmmirror too, unless `BUN_CONFIG_REGISTRY` or `NPM_CONFIG_REGISTRY` names a registry already. The switch never sends anything through a proxy such as gh-proxy.

## Installs and updates through a mirror or proxy

Both the installer and `magpie update` take `--proxy` (http, https, socks5, socks5h; or `MAGPIE_PROXY`, `HTTPS_PROXY`, `ALL_PROXY`) and `--mirror`, a GitHub download mirror put before the release's github.com URL (or `MAGPIE_MIRROR`).

```
curl -fsSL https://usemagpie.ai/install.sh | sh -s -- --proxy http://127.0.0.1:7890
magpie update --mirror https://mirror.example/
magpie update mirror https://mirror.example/   # every update, the app's too
magpie update mirror off
```

In the app, Settings' Download source row has Use a mirror… for a Mirror address, and Remove mirror to go back. No mirror is used unless you give one. On a network that lets GitHub through and not usemagpie.ai, nothing needs setting: the update comes from GitHub, its signature checked.

## Download source and Update source in Settings

Two rows in the app's Settings decide where an update comes from. Neither needs changing on a network that reaches usemagpie.ai.

| Setting | Choice | What the update is downloaded from |
| --- | --- | --- |
| About › Download source | `usemagpie.ai` (the default) | usemagpie.ai, and github.com when that fails. |
|  | Use a mirror… | usemagpie.ai, and the mirror when that fails, in place of github.com. Remove mirror goes back. |
| About › Update source | Automatic (the default) | usemagpie.ai's release list and files, and GitHub's when the site can't be reached. |
|  | usemagpie.ai only | usemagpie.ai alone, never GitHub, so a mirror is never used. |
|  | GitHub only | github.com alone (through the mirror when one is set), never usemagpie.ai. |

### What a mirror's address is

A mirror here is a GitHub download proxy: a site that fetches any github.com link put after its own address, as in `https://mirror.example/https://github.com/yetone/magpie-releases/releases/download/…`. Type only the part before `https://github.com`, a full `https://` address such as `https://mirror.example/`. Public GitHub download proxies work this way; `gh-proxy.com`, the one `MAGPIE_MIRRORS` falls back to, is one of them. magpie names no mirror of its own and vouches for none: whichever you use, the file is checked against usemagpie.ai's checksum and the release's signature, and one that doesn't match is not installed.

### When to use one

- An update stalls or fails with a timeout or `EOF`, and both usemagpie.ai and github.com are slow or blocked where you are (often in mainland China): set a mirror.
- usemagpie.ai is slow and GitHub is fast: pick GitHub only, no mirror needed.
- You have a proxy: put it in Network and sharing › App updates instead; a mirror is for when you have none.
- A download that failed through the mirror says so, and offers to download from GitHub instead, which removes the mirror.

## MAGPIE_MIRRORS: a mirror after a failure

Another way is off by default. With `MAGPIE_MIRRORS=on`, the official source is tried first, and a mirror only after a network error, HTTP 429, HTTP 5xx or GitHub's rate-limit 403. The defaults are `registry.npmmirror.com` for npm and `gh-proxy.com` for GitHub; `MAGPIE_NPM_REGISTRY` and `MAGPIE_GITHUB_MIRROR` replace them:

```
MAGPIE_MIRRORS=on \
MAGPIE_NPM_REGISTRY=https://registry.example.com \
MAGPIE_GITHUB_MIRROR=https://gh.example magpie serve
```

The official source and the mirror share one request budget, so a hanging official source doesn't make the wait twice as long.

## Is a mirror safe

- magpie's own update files are checked against a SHA-256 from usemagpie.ai, never from the mirror; a file that doesn't match is not installed.
- Bun's zip is checked against Bun's SHA-256s, and a plugin package against the integrity npm gave.
- Requests that carry credentials (`Authorization`, a cookie, an API key, a token in the URL) never use a mirror; they go to the official source alone.
- Skill tarballs always use the official source.
- npm metadata, plugin READMEs and search results and version checks are not checksummed; a mirror can report a different version.

## FAQ

### Plugins install slowly in magpie. What helps?

Turn on Mirrors in China on the Plugins page. The plugin list comes from jsDelivr, npm packages and Bun from npmmirror, and the official address after.

### A magpie update fails to download. What do I do?

Run magpie update --mirror , or magpie update mirror to keep it for every update; --proxy goes through a proxy. The checksum always comes from usemagpie.ai.

### Can a mirror see my API keys?

No. Requests carrying Authorization, a cookie, an API key or a URL token never use a mirror; they go to the official source alone.

### How is MAGPIE_MIRRORS different from the Mirrors in China switch?

The switch has the Plugins page ask a mirror in China first. MAGPIE_MIRRORS=on asks the official source first and a mirror only after a network error, 429, 5xx or GitHub's rate limit.

Related: [Get started](https://usemagpie.ai/docs/start), [Fixing common errors: 401, 429, 502, 504 and more](https://usemagpie.ai/docs/troubleshooting). Questions go to [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/library

# Library

magpie’s Library keeps instructions, MCP servers, skills, hooks and subagents in one place, and writes each of them into every agent you tick for it, in that agent’s own files and format. The agents read those files as they always do. magpie adds no layer between an agent and what it is given: the agent itself decides when to use a skill, an MCP tool or a subagent.

The page has seven tabs: Instructions, MCP servers, Skills, Hooks, Subagents, RTK and billion-context. Each item has a row of agents; tick an agent to give it the item, untick it to take it away. An agent reads the change when it starts again.

## Where it is kept

- **The library.** is `library.json` in magpie’s config folder (`~/.config/magpie`, or `$XDG_CONFIG_HOME/magpie` when that is set). Instruction texts and skill folders are in `library/` next to it.
- **Every change.** saves the library and writes it into every agent at once. magpie records what it wrote, so it only ever takes away its own entries and leaves yours alone.
- **Backups..** Before a change, the files it replaces are copied to `backups/` in the same folder. The last 30 are kept. The Backups button at the top of each tab opens them.
- **Write it again..** After you install an agent, or edit its files by hand, `magpie library sync` writes the library into every agent again.

```
magpie library          # what the library gives each agent
magpie library sync     # write it into the agents again
```

## Instructions

Instructions are text every session of an agent starts with, such as house rules or a coding style. magpie writes its part between two marker lines in the agent’s instructions file:

```
<!-- magpie:begin · written by magpie from its Library -->
…the Library's instructions…
<!-- magpie:end -->
```

Everything outside the markers is yours and is never changed. You can keep several named sets and give each set to different agents, and a set can live in a file of your own.

| Agent | File |
| --- | --- |
| Claude Code | `~/.claude/CLAUDE.md` |
| Codex | `~/.codex/AGENTS.md` (or `AGENTS.override.md` when you use one) |
| Gemini CLI | `~/.gemini/GEMINI.md` |
| Antigravity | `~/.gemini/config/GEMINI.md` |
| OpenCode | `AGENTS.md` in its config folder |
| Copilot CLI | `~/.copilot/copilot-instructions.md` |
| Goose, Crush, Qwen Code, CodeBuddy | `.goosehints`, `CRUSH.md`, `QWEN.md`, `CODEBUDDY.md` |
| Droid, Grok, dsh, omp | `AGENTS.md` in the agent’s own folder |
| Pi, OmO | the first one there of `AGENTS.md` and `CLAUDE.md` |

Folders follow the agent’s own setting: a custom `CLAUDE_CONFIG_DIR` or `CODEX_HOME` is used in place of the default.

## MCP servers

An MCP server is either a command (a program the agent starts, such as `npx …`) or a URL (HTTP or SSE). magpie writes one entry per server into each ticked agent’s MCP config, in that agent’s format, and keeps any fields you added to the entry yourself.

| Agent | File |
| --- | --- |
| Claude Code | `~/.claude.json` |
| Codex | `~/.codex/config.toml` |
| Gemini CLI | `~/.gemini/settings.json` |
| Antigravity | `~/.gemini/config/mcp_config.json` |
| OpenCode | `opencode.json` |
| Cursor | `~/.cursor/mcp.json` |
| Copilot CLI | `~/.copilot/mcp-config.json` |
| Zed | `context_servers` in its `settings.json` |

- **Variables..** `${NAME}` in a header or an env value is written in each agent’s own syntax. An agent that has no such syntax is not given that server, and the page says why.
- **SSE..** Codex, Goose, dsh, Grok, Command Code and Zed can’t use an SSE server. Claude Desktop takes no remote servers at all.
- **Single tools off..** You can turn off tools one by one for Codex, Gemini CLI, Crush, Hermes Agent, Claude Code and OpenCode, each in its own setting. Every other agent gets the whole server.
- **Sign-in..** A server that needs OAuth is signed in to once, in magpie. Agents then reach it through magpie’s gateway at `/mcp/<name>`.
- **This computer only..** Turn off Sync to your other computers for a server that should stay here (`magpie library mcp local <name> on`).
- **Another command here..** For a synced server whose program sits elsewhere on this computer (a Mac and WSL), click Use another command on this computer under its command. Its name, agents and note still sync; your other computers keep running theirs (`magpie library mcp here <name> <command…>`).

With the [MCP router](https://usemagpie.ai/docs/mcp-router) on, each agent gets one server named `magpie` in place of these entries, and magpie runs each command server once for all of them. It is off by default.

## Skills

A skill is a folder with a `SKILL.md` in it. The agent reads each skill’s name and description and loads the rest when a task needs it. Add one from GitHub, any git repository, a folder on this computer, or the market on the Skills tab.

| Agent | Folder |
| --- | --- |
| Claude Code | `~/.claude/skills` |
| Codex | `~/.codex/skills` |
| Gemini CLI | `~/.gemini/skills` |
| OpenCode | `skills` in its config folder |
| Cursor | `~/.cursor/skills` |
| Copilot CLI | `~/.copilot/skills` |
| Goose | `~/.agents/skills` |

### Links or copies

Give skills as sets how a skill reaches an agent, for every agent or, under By agent, for one:

- **Links.** (the default). The agent’s folder links to the library’s copy, so an update reaches every agent at once. On Windows without the right to make links, a junction is used.
- **Copies..** Each agent gets a folder of its own, for tools that don’t follow links. A copy is made again when the library’s skill changes. If the agent, or you, edit a copy, the next sync takes the newest edit into the library and gives it to the other agents. An edit that loses to a newer one is kept with the backups.

A skill folder of your own with the same name is never written over: the page asks whether to use the library’s or keep yours.

### Editing and updates

- **Edit.** opens a skill’s files on the page; Save (or ⌘S) writes them. The command line has no editor.
- **Updates..** When you open the Skills tab, skills from GitHub are checked for updates if 12 hours have passed since the last check (`magpie library skill update` checks now). A skill you changed is never replaced without asking.
- **Put skills in..** Skills go to each ticked agent’s own folder (the default), or also into `~/.agents/skills`, which Codex, Gemini CLI, OpenCode, Crush, Droid, Kimi Code and other tools read.
- **Off here..** A skill can be turned off on this computer only; a sync from another computer doesn’t turn it back on.

## Subagents

A subagent is a helper the main agent can hand a task to. It has a name, a description and a prompt. magpie writes it as a file in each ticked agent’s subagent folder. The main agent reads every subagent’s **description** and decides itself when to call one, so the description should say plainly what it is for and when to use it.

- **Name:.** 2 to 50 lowercase letters, digits and `-`. A few names are reserved, such as `default` and `main`.
- **Description:.** required, up to 1,000 characters.
- **Prompt:.** required. It becomes the subagent’s instructions.
- **Model:.** optional. See Subagent models.

| Agent | File | Skills, MCP servers |
| --- | --- | --- |
| Claude Code | `~/.claude/agents/<name>.md` | the ones you pick |
| Codex | `~/.codex/agents/<name>.toml` | all the agent has |
| OpenCode | `agents/<name>.md` in its config folder | all the agent has |
| Gemini CLI | `~/.gemini/agents/<name>.md` | all the agent has |
| Qwen Code | `agents/<name>.md` in its folder | all the agent has |
| Droid | `~/.factory/droids/<name>.md` | MCP servers you pick; all skills |
| Grok | `agents/<name>.md` in its folder | all the agent has |
| Cursor | `~/.cursor/agents/<name>.md` | all the agent has |
| Copilot CLI | `~/.copilot/agents/<name>.agent.md` | all the agent has |

- Only Claude Code limits a subagent to the skills you pick, and only Claude Code and Droid to the MCP servers you pick. Elsewhere a subagent has everything its agent has.
- Cursor: only the Cursor app reads `~/.cursor/agents`. `cursor-agent` reads only a project’s `.cursor/agents`.
- Kimi Code, Goose, Crush, Qoder, CodeBuddy, iFlow and Kiro have no user-wide subagent folder, so they get none. Agents in WSL get none either.
- If you edit a file magpie wrote, it becomes yours and magpie stops changing it. A file of your own with the same name is never written over; the page shows a problem instead.

## Subagent models

A subagent’s Model field is written only for **Codex**. Every other agent runs its subagents on the model it picks itself, and the page says so. Left empty, the field reads Picked by the agent.

For Codex, the model goes into the subagent’s `.toml` file. Codex lays that file over the spawn, so requests carry that model and magpie’s gateway routes them like any other request. You can pick any model in Codex’s list, a magpie `provider/model`, or a routing group (`group/<id>`).

### Codex’s subagent model on the Agents page

Codex’s row on the Agents page has a subagent model of its own, for every subagent Codex starts:

- **Lead’s pick.** (the default). The main agent picks each subagent’s model, one of Codex’s own too. A subagent it names no model for runs on the main agent’s model. A resumed subagent stays on the model it started on.
- **Same as the lead..** Every subagent runs on the main agent’s model.
- **A model or a group..** Every subagent runs on it, even when the main agent names another.

> **The Agents page wins.** When that setting is anything but Lead’s pick, the gateway sends every Codex subagent request to it, over a Library subagent’s own model too. The Library editor then says so. Picking a model there also removes `default_subagent_model` from Codex’s config.

Codex’s own `[agents] default_subagent_model` in `config.toml` is a different thing: only the model a subagent starts on when the main agent names none. One exception to all of the above: a task the ChatGPT backend has sealed stays on the model it asked for, unless the setting is a ChatGPT account’s model.

Claude Code has its own order: the model the main agent names in its call, then the subagent file’s `model:`, then `CLAUDE_CODE_SUBAGENT_MODEL` (which Claude Code’s row on the Agents page can set), then the session’s model.

## Hooks

A hook is a command an agent runs at a point in its turn: a notification when it finishes, a formatter after it edits a file. Pick a portable event (turn end, after a tool, before a tool, on a prompt, at session start) and magpie writes it under each agent’s own name for that event. Only Claude Code, Codex, Gemini CLI, Cursor, Grok Build and Grok App take hooks. A hook entry you change becomes yours.

## RTK

The RTK tab turns on [RTK](https://www.rtk-ai.app/) per agent: the agent’s shell commands run through RTK, which shortens their output to save tokens. magpie can install RTK for you; turning it off works with RTK gone.

## billion-context

The billion-context tab turns on [billion-context](https://github.com/ranxianglei/billion-context)’s plugin per agent: it folds older turns of a long session into summaries the model can open again, so the session stays inside the model’s window. It is offered for Pi, omp, OpenCode, Claude Code, Hermes, DeepSeek Harness and Zed, whose requests still go through magpie with it on. magpie can install it for you (`npm install -g billion-context --prefix=~/.local`) and runs its own installer and remover; turning it off puts back what the install changed in the agent’s settings. An agent turned on here can’t also run billion-context-pi or opencode-acp.

For Claude Code, billion-context’s install turns Claude Code’s own auto-compaction off. magpie turns it back on, so a session billion-context doesn’t fold, such as one in the Claude desktop app’s Code tab, compacts instead of stopping at “Prompt is too long”. A `DISABLE_AUTO_COMPACT` you set yourself is left as it is.

Zed has no billion-context plugin, and Hermes’ and DeepSeek Harness’ plugins only catch HTTPS traffic, which magpie’s local address isn’t. Turned on, magpie runs `bili start` and points the agent’s magpie provider at `http://127.0.0.1:8787/bili/` followed by magpie’s address, the route billion-context documents for any client; for Hermes and DeepSeek Harness, in every profile that has magpie’s provider. Pick one of magpie’s models for the agent on the Agents page first, and restart it after turning it on or off.

The card shows how many tokens billion-context saved, in its own count: the net savings its dashboard shows, after the rebuilds a fold causes and the summaries’ cost, with how many folds and sessions, over every session it ran on this computer. magpie asks a running billion-context for it (`/__bili/overview`); when none runs, the card shows the last count it read and when. It shows nothing until billion-context has run for an agent.

## What magpie touches

- Only what it wrote: the text between its markers, entries it recorded, files it marked as its own.
- Never a file, entry or skill of yours with the same name. The page shows the clash and lets you choose.
- Anything it replaces goes to the backups first.

Projects can get skills and MCP servers too, in the project’s own folders (such as `.claude/skills`, `.agents/skills`, `.mcp.json` or `.codex/config.toml`). From a terminal, `magpie library project add .` adds the folder you are in, `magpie library project skill add . pdf docx` gives it skills, `magpie library project skill rm . pdf` takes one away, and `magpie library project skills .` lists them.

A project can have instructions of its own as well, so your shared instructions keep only what holds everywhere. On the Instructions page, open a project under the shared text and write what only it needs. magpie puts it between its two marker lines in the file each agent reads in that project: `CLAUDE.md` for Claude Code, `AGENTS.md` for Codex, Cursor and most others, `GEMINI.md` for Gemini CLI. The rest of the file stays yours. A file magpie makes is kept out of git, and turning an agent off takes its part out again. From a terminal: `magpie library project instructions . text "Use pnpm here."`, and `… agents claude,codex` or `… agents none`.

---

Source: https://usemagpie.ai/docs/mcp-router

# MCP router

The MCP servers you add in magpie’s Library are normally written into each agent’s own config, one entry per server. With the **MCP router** on, each agent is given a single server named `magpie` instead, and magpie passes each call on to the Library server behind it. It is **off by default**.

- **Set up once..** A server written once in the Library reaches every agent and app through one entry.
- **Run once..** A command server (one started as a program, such as `npx …`) runs once in magpie, not once in each agent. A server with no calls for 10 minutes is stopped and starts again on the next call.
- **One address for other apps..** Cursor, VS Code, Windsurf or an app on another computer can connect to magpie and use every Library server.

Tools appear in the agent as `server__tool`. Only tools are served (no resources or prompts), and a tool you turned off in the Library is neither listed nor run.

## Turn it on

1. **Open the page.** Go to Library → MCP.
2. **Switch it on.** Below the server list, turn on MCP router. Each agent that has Library servers ticked and can reach a server over HTTP (Streamable HTTP) gets one `magpie` entry at `/mcp/magpie/hub/<agent>` on magpie’s gateway, and those servers’ own entries are taken out of its config.
3. **Restart your agents.** An agent reads the change when it starts again.

Turning it off writes each server’s own entry back, removes only the `magpie` entry magpie wrote, and stops every server the router started. From the command line:

```
magpie library mcp router on
magpie library mcp router off
```

`magpie library` lists which agents are given the router and which keep their own entries, with why.

## Tools on demand

Every tool an agent is given goes out, with its whole parameter schema, on every request. So an agent given more than 10 tools through the router is given two in their place, and this is **on by default**:

- **`find_tools`.** takes the words of what the task needs and gives the tools that match: the best 5 with their description and parameters, then up to 15 more by name. Its own description names each server and its tools, so the model knows what there is to find.
- **`call_tool`.** runs a tool by name, with its arguments.

An agent that searches its MCP tools itself is given every tool, and its own search keeps them out of each request: Claude Code, Claude Desktop, Codex, Pi, Droid and omp. So is an agent given 10 tools or fewer, and an app at the Other apps address, since magpie can’t tell which app that is.

To give every agent every tool instead, turn off Tools on demand under MCP router in Library → MCP, then restart your agents.

## Other apps

With the router on, the Other apps row shows an address ending in `/mcp/magpie/hub`, which serves every server in the Library. Connect… opens a sheet with a ready entry to copy for Cursor, VS Code, Windsurf or any app that takes a JSON MCP config; in the app window, Cursor and VS Code also have Add, which opens the app to confirm. An app on another computer needs a gateway key, as every request from your network does (see [Remote magpie](https://usemagpie.ai/docs/remote)).

> **Command servers run on this computer.** Anyone holding a gateway key on your network can call them through the router, with your rights here. Only share keys with people you trust.

## Agents that keep their own entries

These agents keep each server’s own entry, and the Library page says which and why:

- **No remote servers..** The agent can’t reach an MCP server over HTTP, such as Claude Desktop.
- **A server named magpie..** One of your Library servers is itself called `magpie`, so the names would clash.
- **Its own magpie entry..** The agent already has an entry called `magpie` that magpie didn’t write; it is left as it is.

## When to use it

- **Turn it on.** when you use several agents with the same servers, when command servers start many copies of themselves, or when you want editors and other computers to use your Library.
- **Leave it off.** if you use one agent, if you want each agent to talk to its servers directly, or if you’d rather nothing else on your network can reach your command servers. Every call goes through magpie, so magpie needs to be running.

---

Source: https://usemagpie.ai/docs/remote

# Remote magpie

One magpie can serve several computers. Sign in and set up providers and routing groups once, on the computer that keeps them (your desktop, a server, a [NAS in Docker](https://usemagpie.ai/docs/docker)), and on every other computer add that magpie as a provider of its own: a **Remote magpie**.

|  | The shared magpie | Each other computer’s magpie |
| --- | --- | --- |
| Providers, subscriptions, keys | kept and signed in here | uses them through the Remote magpie |
| Routing groups | made here | picked as `office/group/…` |
| Agents | its own | still wired by this computer’s magpie |
| Usage and quotas | counted and read here | shown here, named with the remote |

The computer you sit at still runs magpie: it wires that computer’s agents, picks their models and keeps their sessions. Only the models come from the other one.

## 1. Share the main magpie

1. **Turn on sharing.** On the computer that keeps your providers: Settings → Network and sharing → Share on local network → On. magpie then listens on the local network and makes a gateway key named Magpie. The Address row below the switch shows where other computers reach it, such as `http://192.168.1.20:3425`.
2. **Make a key for each computer.** Gateway → Gateway keys, or `magpie gateway-key add "Laptop"`, which prints its `sk-magpie-key-…`. Each key can have its own daily, weekly or monthly limit and its own models, and its calls are counted under its name.

While sharing is off, a desktop magpie listens on its own computer only, and other computers can’t reach it. A magpie in Docker is reached through its published port instead, and asks every caller outside its container for a gateway key, shared or not; see [Docker](https://usemagpie.ai/docs/docker#share).

## 2. Add it on the other computer

You need the address and a key from step 1. Any of these does it:

- **The app:.** on the Providers tab press ＋ Add provider, pick Remote magpie under Another computer’s magpie (the last heading), then give its address and the key.
- **The TUI.** (`magpie tui`): on the Providers page press `a`, pick Remote magpie, then type its address and key. On its row, `w` changes the address and `m` fetches its list again.
- **The CLI:.**

```
magpie provider add remote-magpie sk-magpie-key-… url=http://192.168.1.20:3425 id=office
magpie models            # office/… are the shared magpie's
magpie provider refresh office   # fetch its list again
```

`id=` names the provider here, and so begins its models’ ids (`office/…`). The address can be typed as `192.168.1.20:3425` (plain `http://` is assumed), with `/v1` after it, or as the root: magpie puts every API on it either way. Add one Remote magpie for each computer you share from, with a different id.

## What you get

- **Its models.** , as its own agents are shown them: `office/relay-a/claude-sonnet-5`, labelled `Claude Sonnet 5 · Relay A · office`. The ids stay ids; only the labels carry the names. Pick them for an agent here like any other model.
- **Its routing groups.** , as `office/group/…`. The group decides on the shared magpie, with its accounts.
- **Every API..** A request goes on in the API the agent spoke (Anthropic Messages and token counting, Responses, Chat Completions). A model that the shared magpie’s provider serves on another API only is turned into that API once, never on both computers. Responses go over HTTP, SSE included, not WebSocket.
- **Images and video..** Its image and video models are found by themselves and served through its image generation and edit, and video, APIs.
- **System One..** Its decision models (Jev, Clef, and models with names of your own) are set up at its `/v1/systemone` and appear as decision models, not chat models. Refresh the provider’s list to find new ones. A bare `office` asks the first decision model listed.
- **Embeddings, rerank, speech to text and text to speech.** go to its matching APIs. They stay in agents’ lists as they are on the remote; being listed doesn’t make them able to hold a conversation.
- **Prices..** Each model costs here what the shared magpie counts it at (a price set there by hand, else its provider’s list price), so the two computers count the same. A price you set here comes first.

## Quotas and usage

The Usage page, the menu bar and `magpie quota` show the shared magpie’s subscription cards, named with it (`Codex · office`, id `office/codex`), as that magpie last read them: only the computer with the sign-ins asks the vendors. A card’s refresh here has it read that card once more, at most once every 30 seconds. A Codex reset or a WorkBuddy check-in is pressed on that computer, from its own app, TUI or CLI. A key that magpie holds to a budget, some models or some accounts is told none of its cards: only that key’s own card shows here, with its limit.

The shared magpie counts this computer’s requests under the name of the gateway key it sends, with the account that answered.

## Short-lived keys

A program that starts agents in sandboxes can give each one a gateway key of its own that stops working by itself. The key lives 1 minute to 30 days, and may be held to some models, some accounts, a number of tokens or a cost over its whole life, or to read-only use. Its secret is told once, in the answer.

```
curl -s -X POST http://127.0.0.1:3425/v1/magpie/keys \
  -d '{"name":"sandbox-1","ttl":"1h","models":["office/codex/gpt-5"],"tokens":200000}'
# {"id":"k…","name":"sandbox-1","key":"sk-magpie-…","expires":"…","models":[…],"limit":{…}}
curl -s http://127.0.0.1:3425/v1/magpie/keys              # the keys you issued, masked
curl -s -X DELETE http://127.0.0.1:3425/v1/magpie/keys/k…  # revoke one early
```

A program on this computer may call it with no key; a page in a browser may not. Another computer, a container or CI calls it with a gateway key you let issue keys, and every key it issues is held to that key: never a model or account it may not use, never past its own expiry, and what they spend counts against its limit. Turning it off or removing it stops its keys at once. The same from the command line, which prints the key alone:

```
magpie gateway-key issue --ttl 1h --name sandbox-1 --models office/codex/gpt-5 --tokens 200000
magpie gateway-key issuer <id> on    # let a key issue keys
magpie gateway-key issue --ttl 30m --from <id> --read-only --json
magpie gateway-key list               # until 10-31 14:00, expired, issued by …
```

An expired key is refused with `401` and why (“the gateway key "sandbox-1" expired at …: ask for a new one”) on every API, from this computer too. It is removed an hour later.

## Keys for GitHub Actions

A GitHub Actions job can get a short-lived key without a gateway key in the repository’s secrets: it trades the OIDC token GitHub gives it. Write a rule naming the repository (and, if you like, the branch, environment or any other claim, exact or with `*`), the gateway key its keys are issued under, and how long they live:

```
magpie gateway-key issuer <id> on
magpie gateway-key oidc add --key <id> --repo owner/app --ref refs/heads/main --ttl 1h
# prints the rule id and its audience, magpie-<rule id>
magpie gateway-key oidc list
magpie gateway-key oidc remove <rule id>
```

In the workflow, ask GitHub for a token with the rule’s audience and POST it to `/v1/magpie/keys/oidc`:

```
permissions:
  id-token: write
steps:
  - name: Get a magpie key
    run: |
      TOKEN=$(curl -s -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
        "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=magpie-<rule id>" | jq -r .value)
      KEY=$(curl -s -X POST https://<your magpie>/v1/magpie/keys/oidc \
        -H "Authorization: Bearer $TOKEN" -d '{"ttl":"30m"}' | jq -r .key)
      echo "::add-mask::$KEY"
      echo "MAGPIE_KEY=$KEY" >> "$GITHUB_ENV"
```

The key is issued under the rule’s gateway key and held to it like any other issued key, lives no longer than the rule says, and is named after the repository, branch and run. A token from another repository or branch, an expired one, or one already traded gets `401` and why. The route answers another computer only while magpie is shared, and refused tokens count against the failed sign-ins it allows. Without a rule nothing is traded.

## Management API

Providers, accounts, gateway keys, account groups and routing groups can be managed with no hand-edited file, by a key you allow to. Allow it from the key’s menu in the app, under Advanced, or from the command line (not through the API: a key can't give another more than it has):

```
magpie gateway-key add automation
magpie gateway-key admin <id> local   # this computer only
magpie gateway-key admin <id> any     # also from other computers
curl -s http://127.0.0.1:3425/v1/magpie/admin/providers -H "Authorization: Bearer $KEY"
curl -s -X POST http://127.0.0.1:3425/v1/magpie/admin/gateway-keys/add-key \
  -H "Authorization: Bearer $KEY" -d '{"name":"ci"}'
```

It answers the same as the app’s own pages do, under `/v1/magpie/admin/`: `GET providers`, `POST provider/{save,delete,on,off,name,…}`, `POST keys/…` (a provider’s keys), `GET`/`POST gateway-keys[/{add-key,rename-key,limit-key,models-key,remove-key,…}]`, `GET`/`POST account-groups[/…]`, `GET routing-groups[/{id}]` and `POST routing-groups/{create,update,delete,switch,…}` (the Routing page’s groups and combos, checked as the app checks them; `update` changes only the fields you send), and `POST signin` with `{"agent":…}`, which answers the vendor’s page and the code to type there, never a password; open it on a computer with a browser. A saved key and a gateway key’s secret are never told again, and what changes this computer’s apps is not served. Sign-ins are not exported: that would hand out every account’s secrets.

A key that is read-only, the extension’s, issued or short-lived, or the sharing key, can’t have it. A web page can’t call it, with a key or without (any request with `Origin` or `Sec-Fetch-*` is refused), and nor can a request under another name for this computer. Shared over the network, only a key set to `any` gets in.

## Memory from other computers

Magpie Memory answers the agents on this computer. To let an agent on another computer read and save it too, give that agent a gateway key of its own and allow it, from the key’s menu in the app under Advanced › Magpie Memory, or from the command line:

```
magpie gateway-key add remote-box
magpie gateway-key memory <id> on
```

While magpie is shared, that agent uses `http://<this computer>:3425/mcp/magpie/memory` with `Authorization: Bearer <key>`, or finds `magpie-memory` in the MCP router. What it saves goes into every agent’s instructions here, so no other key gets it: not the sharing key, a read-only, issued or short-lived key, nor a web page, with the key or without.

## Stats API

What the Usage page shows is also served as JSON, to this computer and, while magpie is shared, to a request with a gateway key. A key held to a budget, models or accounts is told only its own calls and limit, and the quotas of what it may use once its owner turns on Quotas for it (`magpie gateway-key quotas <id> on`).

- `/v1/magpie/usage?period=today|7d|30d|all`: totals, by model, agent, provider, account and gateway key.
- `/v1/magpie/usage/requests`: the request log, with `period`, `day`, `offset`, `limit`, and filters `model`, `agent`, `provider`, `account`, `callerKey`, `failed=1`, `retried=1` and `q`.
- `/v1/magpie/usage/requests?cursor=start`: the same requests as changes for a ledger of your own: `rows` to upsert by a stable `id` (with `original_ids`), `deleted` ids, `next_cursor` and `has_more`; `cursor=now` reads only what comes after, and a cursor magpie cannot resume from is refused with a `code`, never skipped.
- `/v1/magpie/quotas`: each subscription’s windows (`?kept=1` without asking the vendors); `/v1/magpie/quotas/history?days=`: what was left over time, 45 days at most.
- `/v1/magpie/limit`: the key’s own limits, its expiry, and its issuer’s limits; for a held key, what holds it (`heldTo`), its `models`, and whether it is told quotas (`quotas`, `quotaProviders`).
- `/v1/magpie/concurrency`: requests in flight, per account.

```
curl -s 'http://127.0.0.1:3425/v1/magpie/usage?period=7d'
curl -s 'http://127.0.0.1:3425/v1/magpie/usage/requests?period=today&callerKey=k…&failed=1&limit=50'
curl -s 'http://127.0.0.1:3425/v1/magpie/quotas?kept=1'
curl -s 'http://127.0.0.1:3425/v1/magpie/quotas/history?days=14'
curl -s http://127.0.0.1:3425/v1/magpie/limit -H 'Authorization: Bearer sk-magpie-…'
curl -s http://127.0.0.1:3425/v1/magpie/concurrency
```

## When it doesn’t work

| You see | What to do |
| --- | --- |
| “magpie isn’t shared on the local network”, or “remote magpie isn’t shared” | turn on Share on local network on that computer |
| “remote magpie didn’t take this key” (401) | use one of its enabled gateway keys: Gateway → Gateway keys there |
| 403 for a model | that key may use only some models: `magpie gateway-key models <id>` on that computer shows or changes them. A bare `office` asks System One’s first decision model, whatever the key allows; use the full `office/provider/model` id |
| “couldn’t reach the remote magpie” | check the address, that magpie is running there with sharing on, and that its firewall lets the port in |
| no System One models, or “doesn’t share its quotas” | update magpie on that computer, then refresh the list here |

> **Away from home**, reach the shared magpie over a VPN such as Tailscale or WireGuard, with its address there. Don’t open its port to the internet.

Questions or a setup worth sharing? Ask on [Discord](https://discord.gg/vGSnD3ZKQF). The [reference](https://github.com/yetone/magpie/blob/main/docs/reference.md) has the details.

---

Source: https://usemagpie.ai/docs/docker

# magpie in Docker

Run magpie on a server or a NAS that has no desktop: its gateway serves your models to agents on other computers, and you add providers and sign in to subscriptions from a page in your browser.

| **Image** | `ghcr.io/yetone/magpie`, for `linux/amd64` and `linux/arm64` |
| --- | --- |
| **Tags** | `latest` (the newest release), `daily` (the desktop app's Daily channel: once a day at 20:00 UTC, the newest release whose CI run passed, or an urgent one at once), `stable` (the desktop app's Stable channel: a release a week, out three days first, or an urgent one at once), `0.1.1150` (one release), `0.1`, `edge` (every change on `main`) |
| **Ports** | `3425` the gateway agents call; `3430` the browser UI, when the container runs `magpie web`; it answers the gateway’s `/v1` routes too, so a reverse proxy needs only this port |
| **Volume** | `/config`: providers, keys, sign-ins, plugins and usage |
| **User** | nonroot (uid 65532) |

The image holds magpie’s terminal-only build on Debian 13 slim, with bash for a terminal in the container and curl for the installers of the CLIs some subscriptions sign in with (Cursor, Devin, Grok Build). It runs `magpie serve` (the gateway alone) unless given another command. The container finds no agents to wire, so magpie in it is a gateway: the agents that use it run elsewhere.

## Run it

Run it with the browser UI, a key for that page you keep across restarts, and both ports on the host’s loopback only:

```
docker run -d --name magpie --restart unless-stopped \
  -p 127.0.0.1:3425:3425 -p 127.0.0.1:3430:3430 \
  -e MAGPIE_WEB_KEY=$(openssl rand -hex 16) \
  -v magpie-config:/config \
  ghcr.io/yetone/magpie:latest web --addr 0.0.0.0:3430 --no-open

docker logs magpie
```

The log names the page with its key:

```
● magpie web on http://127.0.0.1:3430/?k=0f3c9a1e…
  on the network http://172.17.0.2:3430/?k=0f3c9a1e…
  these are the container's own addresses: other machines use the host's, and MAGPIE_PUBLIC_URL=http://<host>:<port> puts it here
  other containers on this host http://172.17.0.1:3425
! anyone with the link can change magpie and see its keys, and the network carries it unencrypted
  the link carries MAGPIE_WEB_KEY · gateway http://127.0.0.1:3425 · Ctrl-C to stop
```

> **Agents outside the container need a gateway key.** In the container any key works. A request from the host or another machine is answered only with an enabled gateway key, and gets 401 without one: make one as in Gateway keys. `127.0.0.1:` in `-p` keeps a port on the host; leave it out, or name the host’s LAN or VPN address, for other machines to reach it.

Without `web --addr 0.0.0.0:3430 --no-open` the container runs the gateway alone, which you then set up from a terminal in it (`docker exec -it magpie magpie provider add …`). A folder bind-mounted at `/config` works in place of the named volume, if uid 65532 can write it: `sudo chown -R 65532:65532 /volume1/docker/magpie/config`.

## The browser UI

Open the link from the log. The key in it is traded for a cookie and taken out of the address; a page opened without it is turned away (401). With `MAGPIE_WEB_KEY` set (16 or more letters, digits or `- . _ ~`; `openssl rand -hex 16` makes one) the key stays the same across restarts and the browser stays signed in for 400 days. Without it, every start makes a new key and the cookie lasts the browser session.

The page is in **gateway mode**: Providers, Gateway, Routing, Usage, Sessions, Plugins and Settings, with no Agents, since there are no agents in the container. Library has its MCP servers, with the MCP router: other computers’ apps connect at the router’s address with a gateway key. Beside them are its Skills and Instructions: a magpie on another computer that adds this one as an Another computer’s magpie provider, with Use its skills and prompts on, takes them and gives them to its own agents, since a skill is a folder on the agent’s computer. Sessions lists only the sessions of agents on other computers that came through this gateway, never this machine’s agents’ files. Settings → General → Gateway mode turns it off.

On a NAS or a server you reach over SSH, open the page through a tunnel rather than publishing 3430: `ssh -L 3430:127.0.0.1:3430 you@nas`, then the log’s link on your own computer.

> **Anyone with the link can change magpie and see its keys.** Keep 3430 on loopback or a VPN. Across the network, serve it over HTTPS: give magpie a certificate with `MAGPIE_TLS_CERT` and `MAGPIE_TLS_KEY`, or put it behind a reverse proxy with TLS, such as Caddy.

## Sign in to subscriptions

Add API keys on Providers as on the desktop. A subscription’s sign-in (ChatGPT, Claude…) opens the vendor’s page in your browser, and when you are done the vendor sends that browser back to `localhost`, for ChatGPT `http://localhost:1455/auth/callback?code=…`. That is your own computer, not the container, so the page doesn’t load. Copy its whole address from the address bar and paste it into the sign-in’s Callback URL field.

The same from a terminal:

```
docker exec -it magpie magpie accounts add codex
```

Open the link it prints, sign in, then paste the address the browser ended on. The browser UI can also import sign-ins from a file.

A Claude subscription is signed in to and answered through Claude Code, which the image doesn’t have. Have magpie download Anthropic’s own build first: it says the version, where it comes from and where it goes, asks, and checks the download’s SHA-256 against Anthropic’s manifest. It is kept in `/config/cache`, on the volume, so a new image keeps it, and magpie keeps it at Claude Code’s newest release by itself: it looks a minute after it starts and every six hours, and downloads a newer one the same way. Nothing needs installing again after an update. To hold a version, set `-e DISABLE_AUTOUPDATER=1`. `magpie accounts add claude` offers it too when Claude Code is missing.

```
docker exec -it magpie magpie claude-code install
```

A Grok (SuperGrok) subscription signs in through xAI’s Grok Build CLI, which the image doesn’t have either. Its sign-in, in the browser UI or with `magpie plugin login grok`, installs it first, as xAI’s installer does: the stable version from `x.ai/cli`, kept in `/config/home/.grok`. To use a Grok Build binary you put on the volume yourself, set `GROK_BIN_DIR` to the folder holding it.

## MCP servers

The Library’s MCP servers run in the container, and the image has what they start with: `npx`, `node` and `npm` (Node 24), and `uvx`, `uv`, `python` and `python3`. A server started with `uvx` or `python` downloads its Python into the volume the first time, which takes a few seconds. A server started with `docker` doesn’t run: the container has no Docker of its own.

The image has no browser. Chrome DevTools’ and Playwright’s MCP servers start a Chrome of their own, so in the container their row in the Library says no Chrome here. Use Magpie Browser instead, which acts in your own browser, or point the server at a Chrome it can reach: `--browserUrl http://host:9222` for Chrome DevTools, `--cdp-endpoint` for Playwright.

## Your own browser

Magpie Browser lets agents act in your own browser, through its extension. The extension can’t be loaded from the container’s folders, so in the browser UI open Library → Magpie Browser and click Download the extension. The zip is pointed at the page’s own address, with a gateway key named **Magpie Browser** of its own. Unzip it, open `chrome://extensions`, turn on Developer mode and click Load unpacked on the unzipped folder. An extension already loaded takes the address (`http://localhost:3430`, or the gateway’s published port) and a gateway key in its popup.

The Magpie Browser key connects the extension and nothing else: it can’t use models, MCP servers or stats, so a copy of the zip left in Downloads spends nothing. The host’s browser reaches the container from Docker’s bridge, not from the container’s own computer, so it is that key’s alone and the container’s agents don’t use it yet ([#5529](https://github.com/yetone/magpie/issues/5529)). To use it from an agent on the host, give that agent a gateway key of its own with full access, connect the extension with the same key in its popup, and call `/mcp/magpie/browser` with it. A browser given another key is that key’s alone, and it is let go once its key is turned off, removed or rotated.

## What is kept

Everything magpie writes is under `/config`, so a restart, or a new container on the same volume, keeps your providers, keys, sign-ins and plugins.

| Path | Holds |
| --- | --- |
| `/config/magpie` | magpie’s own files: `settings.json`, providers, gateway keys, routing groups |
| `/config/home` | the container’s `HOME`: sign-ins kept where their agent keeps them (`~/.codex`, `~/.claude`…) |
| `/config/cache` | the model catalog, Bun, which plugins run on (downloaded the first time one is used), and the Claude Code `magpie claude-code install` downloaded |
| `/config/data`, `/config/state` | the rest of what magpie keeps |

A volume made by an older image keeps working: magpie adds the folders it lacks when it starts. Only sign-ins made with that older image, which lived outside the volume, have to be made again.

## Environment

| Variable | What it does |
| --- | --- |
| `MAGPIE_ADDR` | where the gateway listens. The image sets `0.0.0.0:3425`, so the published port reaches it. |
| `MAGPIE_PUBLIC_URL` | the address other machines reach the gateway at, such as `http://192.168.1.20:3425` (the host’s or the NAS’s, on the published port), or a reverse proxy’s base URL. In the container magpie sees only Docker’s own `172.17.x` address; with this set, the address it shows and prints is the one to use. |
| `MAGPIE_WEB_KEY` | the browser UI’s key, kept across restarts (16+ characters) |
| `MAGPIE_NAME` | what this magpie is called: the browser tab’s title reads `<name> · magpie`, to tell several deployments apart. A name set on the page, in Settings → Network and sharing → Advanced → Name, comes first. |
| `MAGPIE_TLS_CERT`, `MAGPIE_TLS_KEY` | a PEM certificate (its chain after it) and its key, mounted into the container: other machines then reach the gateway and the browser UI over `https://` only, and plain HTTP from them gets 400. The files are read again when they change, so a renewal needs no restart. One without the other, or files that don’t load, stop magpie from starting. Use `https://` in `MAGPIE_PUBLIC_URL` too. |
| `MAGPIE_ALLOW_IPS` | the only addresses other machines may reach the gateway and the browser UI from, as IPs and CIDR ranges: `203.0.113.7,10.0.0.0/8,2001:db8::/32`. Any other address gets 403, even with a gateway key. Unset lets every address in, each with a key. See Allowed addresses. |
| `MAGPIE_DRAIN` | how long a stop waits for the requests in flight, streams included: seconds (`300`) or a duration (`5m`); 20 seconds in Kubernetes and 7 elsewhere unless set (`docker stop` waits 10), `0` for 2. Past 10, give Docker as long: `docker stop -t`, Compose’s `stop_grace_period`. See Kubernetes. |
| `HOME`, `XDG_CONFIG_HOME`, `XDG_CACHE_HOME`, `XDG_DATA_HOME`, `XDG_STATE_HOME` | set by the image to the folders under `/config` above; leave them |

## Gateway keys and other machines

1. **Make a key for each client.** Gateway → Gateway keys, or in a terminal `docker exec magpie magpie gateway-key add "Laptop"`, which prints the new `sk-magpie-key-…`. Every request from outside the container, the host’s own included, must carry an enabled gateway key, and one without gets 401. A key can have its own daily, weekly, monthly, every-N-days or every-N-hours limit and its own list of models (`magpie gateway-key limit`, `magpie gateway-key models`).
2. **Publish the port.** Recreate the container with `-p 3425:3425`, or bound to the NAS’s LAN or VPN address (`-p 192.168.1.20:3425:3425`), and with `-e MAGPIE_PUBLIC_URL=http://192.168.1.20:3425`.

On each other computer, point the agent at the gateway with one of those keys as its API key: `http://192.168.1.20:3425/v1` for an OpenAI client, `http://192.168.1.20:3425` for an Anthropic or Gemini one. Model ids are `provider/model`, or a routing group’s; `GET /v1/models` lists them. If that computer runs magpie itself, add the container as a [Remote magpie](https://usemagpie.ai/docs/remote) instead, and magpie wires its agents for you.

**Other containers on the same host.** Another container on the NAS reaches magpie at the host, through the Docker bridge’s gateway and the published port: `http://172.17.0.1:3425` on Docker’s default bridge. The container’s own `172.17.x` address is no use to it, and the host’s LAN address may not be either, as a NAS’s firewall can keep containers from it. `host.docker.internal` is the same address on Docker Desktop, and on Linux only in a container given `extra_hosts: ["host.docker.internal:host-gateway"]`. A container on magpie’s own compose network, or one you made, can use its name, `http://magpie:3425`. Either way it sends a gateway key. The log and the browser UI list this address as Other containers on this host, after the host’s address the page was opened at.

Settings → Network and sharing → Share on local network isn’t needed in the container: turning it on also makes a gateway key named Magpie, and the gateway asks for a key from outside the container either way.

**Upgrading from an earlier image.** An agent outside the container that sends `magpie`, or any other key that isn’t an enabled gateway key, now gets 401 (“the API key sent is not an enabled magpie gateway key”). Make it a key as above and put that in the agent’s settings. Agents that already send a gateway key, and a Remote magpie set up with one, keep working.

**Allowed addresses.** On a public host, set `-e MAGPIE_ALLOW_IPS=203.0.113.7,10.0.0.0/8` to the addresses your clients come from. A request from any other address is refused 403 before its key is looked at, so a key that leaks is no use from elsewhere; the refusal names the address it came from, as does the container’s log. magpie judges the address of the connection itself, never an `X-Forwarded-For` header, and a mistyped entry lets nothing in rather than everything. Docker’s default bridge network passes a client’s own address into the container, but a request from the host itself arrives from the bridge’s gateway (`172.17.0.1`), and Docker Desktop and rootless Docker show every client as one address of their own: add that, or check what the 403 says. Behind a reverse proxy or tunnel, every request comes from the proxy’s address, so limit who reaches magpie at the proxy. On the desktop app the same list is Settings → Network and sharing → Allowed addresses.

> **Over the internet, prefer a VPN** such as Tailscale or WireGuard to opening 3425. A reverse proxy or tunnel in front of the container is the network too: its clients need a gateway key like any other machine’s.

**Claude Code’s status line, with Claude Code outside the container.** The status line square can’t reach another machine’s `~/.claude/settings.json`, and the command it writes names a binary in the container. The gateway answers the same line itself: on the machine Claude Code runs on, set `statusLine` in `~/.claude/settings.json` to `{"type": "command", "command": "curl -fsS -m 1 -H 'Authorization: Bearer sk-magpie-key-…' --data-binary @- http://<host>:3425/v1/magpie/statusline || true"}`, with the host or address that reaches the container and a gateway key (a read-only key is enough). A key held to a budget, models or accounts gets the line once its owner turns on Quotas for it, with only the accounts it may use. Add `?format=json` for the same as JSON (the line, the model, and each account’s windows with `used` and `resetsAt`), for a status line that draws its own. Claude Code runs it on every message and passes its session on stdin, which adds the model the session went to. The same command is shown in the browser UI under Settings → About.

## Docker Compose on a NAS

```
services:
  magpie:
    image: ghcr.io/yetone/magpie:latest
    restart: unless-stopped
    ports:
      # 127.0.0.1: the host alone; every caller outside the container needs a gateway key
      - "127.0.0.1:3425:3425"
      - "127.0.0.1:3430:3430"
    environment:
      MAGPIE_PUBLIC_URL: http://<nas-address>:3425
      MAGPIE_WEB_KEY: <random-key>
    volumes:
      - ./config:/config
    command: [web, --addr, 0.0.0.0:3430, --no-open]
```

Then: `sudo chown -R 65532:65532 ./config`, `docker compose up -d`, open `http://127.0.0.1:3430/?k=<random-key>` through an SSH tunnel, add your providers and make a gateway key for each machine. For other machines to reach the gateway, change its line to `"3425:3425"` (or the NAS’s LAN or VPN address) and run `docker compose up -d` again.

## Health, terminal, updates

- **Health..** The image has a `HEALTHCHECK`: `magpie healthcheck` exits 0 while the gateway answers, under `serve` and `web` alike, so `docker ps` shows the container as healthy and Compose can wait for it with `depends_on: condition: service_healthy`.
- **Terminal..** `docker exec -it magpie bash`, or a NAS panel’s terminal, opens a shell with `magpie` on its PATH: `magpie providers`, `magpie models`, `magpie usage`, `magpie quota` and the rest of the [CLI](https://github.com/yetone/magpie/blob/main/docs/reference.md).
- **Updates..** Pull the new image and recreate the container on the same volume: `docker pull ghcr.io/yetone/magpie:latest`, then `docker rm -f magpie` and the same `docker run`, or `docker compose pull && docker compose up -d`. magpie releases several times a day; for one update a day with Renovate or Watchtower, follow `daily` (with Renovate, pin its digest), or `stable` for one a week. When magpie finds an update, Settings › About names that version's own image (`docker pull ghcr.io/yetone/magpie:0.1.1150`): `latest` may hold a newer release than your update channel's; run the container from the tag you pulled.
- **Build it yourself..** `docker build -t magpie .` in a checkout of [the repository](https://github.com/yetone/magpie) makes the same image.

## Kubernetes

A restart cuts nothing in flight, with nothing to set. On `SIGTERM` (a rolling update, `kubectl delete pod`, `docker stop`), `magpie serve` and `magpie web` fail their readiness check at once, keep accepting for 5 seconds while the Service stops sending them requests, then stop accepting and let the requests in flight finish, streams included, for up to 20 seconds.

```
apiVersion: apps/v1
kind: Deployment
metadata:
  name: magpie
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1         # the new pod starts beside the old one
      maxUnavailable: 0   # the old one ends once the new one is ready
  selector:
    matchLabels: {app: magpie}
  template:
    metadata:
      labels: {app: magpie}
    spec:
      terminationGracePeriodSeconds: 30   # MAGPIE_DRAIN (20s) plus 10s to save
      securityContext:
        fsGroup: 65532
      affinity:
        podAffinity:   # the new pod on the old one's node, where the ReadWriteOnce volume is
          requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchLabels: {app: magpie}
              topologyKey: kubernetes.io/hostname
      containers:
        - name: magpie
          image: ghcr.io/yetone/magpie:stable
          ports:
            - containerPort: 3425
          readinessProbe:
            exec:
              command: [/magpie, healthcheck]
            periodSeconds: 5
          volumeMounts:
            - name: config
              mountPath: /config
      volumes:
        - name: config
          persistentVolumeClaim:
            claimName: magpie-config   # ReadWriteOnce
```

**Readiness.** Probe with `exec` and `magpie healthcheck`, as above: it asks from inside the container, so it needs no key. An `httpGet` probe comes from outside the container and would need a gateway key.

**Longer turns.** An agent’s turn can stream for minutes. Raise `MAGPIE_DRAIN` and `terminationGracePeriodSeconds` together, the second 10 seconds above the first: `MAGPIE_DRAIN: "300"` with `terminationGracePeriodSeconds: 310`.

**Rolling updates.** The new pod serves beside the old one on the same `/config`, and the Service sends it requests once it is ready; the old pod then drains as above, so no request is dropped. Each sign-in renewal and each saved file is locked across the pods. What only one magpie may do (renewing the saved sign-ins in the background, check-ins, plugin updates) the old pod keeps doing until it ends, and the new pod takes it over within a second. A ReadWriteOnce volume mounts on one node only, so the `podAffinity` above starts the new pod on the old one's node; with a ReadWriteMany volume, leave it out.

**Updating from a version before v0.1.4526.** The old pod doesn't take part in that handover, so the two would both renew sign-ins for the length of the update. Make that one update with `strategy: Recreate`, then switch to the rolling update above.

Questions or a setup worth sharing? Ask on [Discord](https://discord.gg/vGSnD3ZKQF). The [reference](https://github.com/yetone/magpie/blob/main/docs/reference.md#docker) has the details.

---

Source: https://usemagpie.ai/docs/import

# Add to magpie

Hand your users one link, and your models show up in every agent they run: Claude Code, Codex, OpenCode, Gemini CLI, Pi, Crush. No config files, no environment variables, no copy-pasting base URLs.

## Quick start

1. **Build a link.** Describe your endpoint as URL parameters: a name, a base URL per API you speak, and optionally the user’s key and the models to offer.
2. **Put it behind a button.** On your dashboard, next to the key you just minted: *Add to magpie*.
3. **The user confirms.** magpie opens, shows exactly where prompts and the key will go, and adds the provider when the user says yes. Every agent can use it right away.

```
https://usemagpie.ai/import#name=Acme%20Relay&chat=https://api.acme.example/v1&anthropic=https://api.acme.example&key=sk-…&models=gpt-5.5,claude-sonnet-5
```

## The link

magpie registers the `magpie://` scheme with the system. An import link is that scheme, the word `import`, and a query string:

On the web, link to the same parameters on `usemagpie.ai/import` instead, after a `#`:

### Why the https link

It works everywhere a link does: GitHub READMEs, chat apps and email clients drop or block custom schemes. It opens magpie, and offers the download when magpie isn’t installed yet.

### Why after the `#`

Browsers never send the fragment to a server. The key goes from your page to the user’s machine without passing through usemagpie.ai, not even its logs.

Every value is URL-encoded, as `URLSearchParams` or `urlencode` produce. Both `%20` and `+` work for spaces.

## Parameters

A link either names one of magpie’s presets, which already knows the vendor’s endpoints, or describes a provider from scratch with a name and at least one base URL.

| Parameter | Meaning |
| --- | --- |
| `name`or preset | What the provider is called in magpie, at most 80 characters. |
| `chat` | OpenAI Chat Completions base URL, ending in `/v1` (magpie appends `/chat/completions`). |
| `responses` | OpenAI Responses base URL, ending in `/v1`. Codex speaks only this API; magpie translates for it when you don’t. |
| `anthropic` | Anthropic Messages base URL: the root, without `/v1`. |
| `gemini` | Google Gemini API base URL, ending in `/v1beta`, as the app’s editor and the TUI take one. |
| `key` | The user’s API key. Leave it out and the user pastes one in the dialog. |
| `models` | Model ids to offer the agents, comma separated. Without it, magpie lists the models your `/v1/models` returns. |
| `id` | The id agents use in `id/model`. Defaults to the name, lowercased with dashes (`Acme Relay` → `acme-relay`). |
| `catalog` | A [models.dev](https://models.dev) provider id whose metadata applies, e.g. `openai` for a relay of OpenAI models: display names, context sizes (written into the agents that take them), reasoning levels and image input; the model list when the provider’s own `/models` can’t be read; and per-token prices, which the Usage page turns into a cost estimate in USD. Several ids may be given, comma-separated: their models are combined, and where two know the same model the first one’s entry is used. |
| `website` | Your site (https). Shown on the provider’s page. |
| `keys` | The page where users make keys (https). The dialog links to it when the link has no key. |
| `icon` | A picture of your own (https): PNG, JPEG, GIF, WebP, ICO or SVG, at most 1 MB. magpie downloads it once, after the user confirms the import, and keeps it beside the provider. Without one, magpie shows the `catalog` vendor’s logo or a plain mark. |
| `balance` | Where the key’s balance is read (https), on the host of one of your base URLs: magpie asks it with the key, as a chat request sends it. `{key}` in it stands for the key. Without it, magpie reads the vendors it knows, and asks a relay where new-api and sub2api tell a key its balance (`/api/usage/token`, `/v1/usage`); give one when yours answers elsewhere. |
| `balance_path` | Where the amount is in the JSON reply: a dotted path, list items by index (`data.balance`, `balance_infos.0.total_balance`), or a sum of them in your own units (`$ data.quota / 500000`). `$` or `¥` before it is the currency, `%` after it a percent of 1; several amounts go apart by `;`, each with a `label:` if wanted. Needs `balance`. |
| `balance_method` | `GET`, the default, or `POST` with no body. Needs `balance`. |
| `preset`or name | A preset id; its endpoints, catalog and pages are used, and `name` may rename it. |
| `region` | With a preset that has regions, which one. |

At least one of `chat`, `responses`, `anthropic` and `gemini` is required without a preset; give every API you speak, and each agent uses the one it speaks natively. Base URLs must be **https**, except plain http to `localhost`, loopback, private addresses and `*.local`, where model servers usually run without TLS. They can’t carry a query, a fragment or credentials.

A link sets no other header or token for the balance: an account-wide access token is worth more than one key, and a URL stays in browser history. A balance that needs one is set up in the provider’s editor.

### Presets

Vendors magpie already knows. `magpie presets` prints the current list.

A vendor with a preset only needs to add the key: `magpie://import?preset=deepseek&key=sk-…`. Want yours on the list? [Open an issue](https://github.com/yetone/magpie/issues).

## Link builder

Fill in your endpoint; the link, the button and the Markdown follow as you type. Everything stays in this page.

## The button

Two ready-made badges, one for light pages and one for dark. Link them to your import link, or draw your own button: the words *Add to magpie* and the bird are yours to use.

```
<a href="https://usemagpie.ai/import#preset=deepseek&key=sk-…">
  <img src="https://usemagpie.ai/img/add-to-magpie.svg" alt="Add to magpie" width="176" height="40">
</a>
```

```
[![Add to magpie](https://usemagpie.ai/img/add-to-magpie.svg)](https://usemagpie.ai/import#preset=deepseek)
```

For dark pages, use `add-to-magpie-light.svg`. A public page like a README should never carry a key; leave `key` out and the user pastes their own.

## From your backend

The natural place for the button is the page that shows a freshly minted key. Build the link where you have it:

```
const params = new URLSearchParams({
  name: "Acme Relay",
  chat: "https://api.acme.example/v1",
  anthropic: "https://api.acme.example",
  key: apiKey,
  models: ["gpt-5.5", "claude-sonnet-5"].join(","),
  icon: "https://acme.example/logo.svg",
});
const href = "https://usemagpie.ai/import#" + params;
```

```
from urllib.parse import urlencode

href = "https://usemagpie.ai/import#" + urlencode({
    "name": "Acme Relay",
    "chat": "https://api.acme.example/v1",
    "anthropic": "https://api.acme.example",
    "key": api_key,
    "models": "gpt-5.5,claude-sonnet-5",
    "icon": "https://acme.example/logo.svg",
})
```

```
magpie import 'magpie://import?preset=deepseek&key=sk-…'   # asks first; -y to skip
```

## Security

An import link is a suggestion. The user decides.

- **Always confirmed..** magpie shows the name, every host that prompts and the key will go to, and the models, and saves nothing until the user presses Add. The user can rename it, or replace the key, first.
- **No silent overwrites..** When the id is already taken, the dialog says so and the button reads *Replace*.
- **https only..** Plain http is refused except to this machine or the local network; `file:`, credentials in URLs and other schemes are refused outright.
- **Read once..** Inside the app, the link’s contents are handed to the window a single time; a reload doesn’t bring the dialog back.
- **Icons are fetched, not embedded..** An `icon=` URL is downloaded by magpie, only after the user confirms the import, only over https, and only into its own icons folder — at most 1 MB, and the type is checked. magpie asks for it through usemagpie.ai’s icon proxy, so your host sees Cloudflare’s address and never the user’s, and the fetch is made from Cloudflare, where nothing on the user’s own machine or network can be reached. A loopback or local-network name is refused before anything is asked. The page and the dialog never load a remote picture directly.
- **The balance stays on your hosts..** A `balance=` URL on any host but one of the link’s base URLs is refused, so the key goes nowhere its requests don’t already go. It is asked only after the user adds the provider.
- **Keys stay out of servers..** The web link keeps parameters in the fragment. The key ends up only in `~/.config/magpie/providers.json`, readable by the user alone.

## Platforms

| System | How `magpie://` gets registered |
| --- | --- |
| macOS | By the app itself, as soon as magpie.app is in Applications. |
| Windows | For the current user, the first time magpie runs. |
| Linux | By a desktop entry (`x-scheme-handler/magpie`), written by the installer and again on first run. |
| Terminal | `magpie import <link>` shows the same summary and asks before adding. |

Import links need magpie 0.1.8 or later. When magpie is already running, the link goes to that instance and its window comes forward.

---

Source: https://usemagpie.ai/docs/integrate

# Integrate your app

For developers of an AI app, agent or client who want it to work well with magpie. There are three levels, from no work on magpie’s side to a row of your own on the Agents page.

| You want | Route | Change to magpie |
| --- | --- | --- |
| Your app’s requests served by magpie, counted under its own name in Usage | Talk to the gateway | none |
| A row on the Agents page: detected, its model picked there, put back on disconnect | An agent adapter | a pull request |
| A new model source (a subscription, a vendor), or rewriting requests | A plugin | none |

## 1. Talk to the gateway

magpie runs a local LLM gateway. Every model the user has in magpie (subscriptions, API keys, local models, routing groups) is served there under one id each, so your app needs one provider entry, not one per vendor.

### Find it

The gateway listens on `127.0.0.1:3425`, or on the port in `port` of magpie’s `settings.json` (`~/.config/magpie/settings.json`, the same path under the user’s folder on Windows; `$XDG_CONFIG_HOME/magpie` when that is set). `GET /api/hello` answers `{"name":"magpie","version":"…"}` when it is magpie. Read that file, never write it. magpie must be running (the app or `magpie serve`); an app that finds nothing there offers its own providers as usual.

```
curl -s http://127.0.0.1:3425/api/hello
curl -s http://127.0.0.1:3425/v1/models -H "Authorization: Bearer magpie-acme"
```

### Endpoints

Requests go straight through when the vendor speaks your API, and are translated otherwise, streaming, tool calls, images and reasoning included. The base URL is `http://127.0.0.1:<port>/v1` for an OpenAI client and `http://127.0.0.1:<port>` for an Anthropic or Gemini one.

| Path | API |
| --- | --- |
| `/v1/chat/completions` | OpenAI Chat Completions |
| `/v1/responses` | OpenAI Responses |
| `/v1/messages`, `/v1/messages/count_tokens` | Anthropic Messages |
| `/v1beta/models/{model}:generateContent` (and `:streamGenerateContent`) | Google Gemini |
| `/v1/models` | the catalog |
| `/api/version`, `/api/tags`, `/api/show` | the catalog as an Ollama server lists it, for a client that takes only an Ollama endpoint (Copilot in Visual Studio and VS Code: enter `http://127.0.0.1:<port>` as the Ollama URL; it chats on `/v1/chat/completions`, and `/api/chat` isn’t served) |

### The key names your app

On this machine the gateway takes any key. Send `magpie-<your-app-id>` (`Authorization: Bearer magpie-acme`, or `x-api-key`) and every call is counted as `acme` in Usage, the Requests log and the routing rules that match on agents. Without it, magpie counts the call by the first word of your `User-Agent` (`Acme/1.4 (darwin)` is `Acme`); an SDK’s own User-Agent (`OpenAI/JS …`, `ai-sdk/…`) would count it as that SDK. From another computer (Settings → Share on local network) the key must be one of the user’s gateway keys, and the User-Agent names your app.

### Models

`GET /v1/models` lists what the user has turned on: `id` (`provider/model`, or a routing group’s name, sent as it is), `display_name`, `owned_by` (the provider), `reasoning` and `supported_reasoning_levels` (`[{"effort":"low"},…]`, and the same as plain names in `reasoning_levels`), `context_window` and `max_output_tokens` when known, and `modalities` when magpie knows whether it takes images. List them from there rather than shipping a list: the user adds and removes providers in magpie. Reasoning is asked in your API’s own field (`reasoning_effort`, `reasoning.effort`, Anthropic’s `thinking` or `output_config.effort`). `?format=text` gives the ids one a line. The list holds chat models alone: ask for image, video, embedding and rerank models with `?kind=image,video,embedding,rerank` (or `?kind=all`). Each is marked `"kind": "image"`, `"video"`, `"embedding"` or `"rerank"` and goes to `/v1/images/generations`, `/v1/videos`, `/v1/embeddings` or `/v1/rerank`, not a chat route. Cherry Studio, which can’t ask and tells an image or embedding model from a chat one by its id, is listed every kind.

A vendor’s own fields: `/v1/images/generations` and `/v1/videos` take OpenAI’s fields and pass the others on to a vendor that takes them, such as Volcengine Ark’s `content` (reference video and audio, `draft_task`), `ratio`, `resolution`, `duration: -1`, `tools`, `watermark` and `sequential_image_generation`, and a video’s answer carries Ark’s own fields (`content.last_frame_url`, `usage`). For the rest of a vendor’s API use `/v1/magpie/native/<provider>/<path>`: `GET`, `POST`, `PUT`, `PATCH` or `DELETE`, with `<path>` joined to the provider’s host (not its base URL), in the vendor’s own shape on the user’s key for that provider, a stream as it comes; Ark’s task list is `GET /v1/magpie/native/ark/api/v3/contents/generations/tasks`. It serves a provider added with an API key, not a subscription or sign-in, and Ark’s short paths (`images/generations`, `contents/generations/tasks`) still work under the key’s base. It takes the same gateway key as every route, and a key held to models, accounts or a budget is refused it.

### Optional

Send `X-Magpie-Session: <id>` with a conversation’s requests and `GET /v1/magpie/route?session=<id>` says which model a routing group picked for the turn and the fallbacks it tried, before the first token (long-poll with `after=<seq>&wait=<s>`). `GET /v1/magpie/quotas` lists the user’s subscription allowances, and `GET /v1/magpie/usage` and `/v1/magpie/usage/requests` the Usage page’s numbers and its requests (with `session`, and `subagent`/`parent_agent` for a Claude Code subagent’s call). They answer only this machine, or another with a gateway key; a key held to a budget, models or accounts sees its own calls and routes alone, and is refused the quotas unless its owner lets it see those of what it may use (`magpie gateway-key quotas <id> on`; its own limit is `GET /v1/magpie/limit`). Calls your app makes to its vendor itself can be reported with `POST /v1/magpie/usage/requests` (one record or up to 5000 a post, in `usage.jsonl`’s shape, each with a `rid`; past times are kept, so a history can be backfilled). They show on the Usage page as reported, and never count against a key’s limit. The [reference](https://github.com/yetone/magpie/blob/main/docs/reference.md#connecting-anything-else) has the details.

> **Keep the user’s providers.** Add magpie as one more provider (named Magpie) beside the ones the user set up in your app, rather than replacing them, so turning magpie off is picking another provider.

## 2. A row on the Agents page

The agents magpie lists (Claude Code, Codex, OpenCode, dsh, Alma, Cindy…) are adapters in [`internal/agent`](https://github.com/yetone/magpie/tree/main/internal/agent), one file each. A row gets your app’s name and icon, shows when your app is installed, lets the user pick its model (and reasoning) from magpie’s catalog, follows the catalog as providers change, and on disconnect puts back what your app had before. There is no runtime registration: a row is added by a pull request to magpie, and ships in the next release.

An adapter is an [`Agent`](https://github.com/yetone/magpie/blob/main/internal/agent/agent.go) value. What your app offers decides its shape:

- **magpie edits your config file.** (most adapters; [`fx.go`](https://github.com/yetone/magpie/blob/main/internal/agent/fx.go), [`empryo.go`](https://github.com/yetone/magpie/blob/main/internal/agent/empryo.go)). `Dir`, `Path` and `Bin` find the app; each `Field` (`model`, `effort`…) has `Get`, `Set` and `Options`. Connecting adds a `magpie` provider at the gateway, keyed `magpie-<id>`, and sets your model to one of magpie’s; the agent’s default or `Unwire` takes magpie’s entries out and restores what was there. Only the keys magpie sets are touched. `Notice` says when your app must be restarted; `Sync` rewrites a model list your app keeps in a file.
- **Your app takes a provider only through its own import link, confirmed in your app.** ([`cindy.go`](https://github.com/yetone/magpie/blob/main/internal/agent/cindy.go)). `Import` returns the link (`yourapp://provider/import?…` with the gateway’s URL, the key `magpie-<id>` and the endpoints), the row’s button opens it, and the user says yes once, in your app. `Added` reads, read-only, whether your app has magpie already. magpie writes nothing of yours. This suits an app that keeps its providers in a database or encrypted.
- **Your app has a local API while it runs.** (Alma, Shelley): magpie adds itself as a provider and sets the default model through it.

A pull request needs the adapter and its entry in `agents.go`, `UA` (what your User-Agent begins with, lower-case) so Usage knows your calls, an icon in `internal/gui/assets/icons`, tests that run under a temporary `HOME` (connect, switch, disconnect restoring the original file), and a row in the reference’s Agents table. What helps most is a stable, documented config format or import link, and where your app keeps it on each system.

## 3. Plugins

A plugin is an npm package magpie runs; the user installs it from Settings → Plugins or with `magpie plugin add <package>`. **Provider plugins** (OpenCode’s `auth` hook, or a pi package) add a source of models, such as a subscription magpie doesn’t sign in to itself. **Gateway middleware** rewrites requests and replies as they pass. See the [plugin guide](https://usemagpie.ai/docs/plugins). A plugin can’t add a row to the Agents page or write another app’s config, so it is not how an app registers itself.

## What isn’t there

- No API or link lets another app register itself as an agent, or install a plugin, without the user: plugins are installed in magpie by the user, and agent rows come from adapters in magpie’s source.
- `magpie://import` links add a *provider* (a source of models, with its key), not an agent or an app: see [Add to magpie](https://usemagpie.ai/docs/import).

Questions, or an adapter you’d like to discuss first: open an [issue](https://github.com/yetone/magpie/issues) or ask on [Discord](https://discord.gg/vGSnD3ZKQF).

---

Source: https://usemagpie.ai/docs/plugins

# Writing a plugin

A plugin signs in to a service and makes its requests. magpie turns it into a provider that every agent can use, with several accounts, failover, usage and the rest. magpie runs [OpenCode’s provider plugins](https://opencode.ai/docs/plugins/), so a plugin written for OpenCode works here unchanged, and it runs [pi](https://github.com/earendil-works/pi)’s packages that register a provider too (see pi packages). This page covers what a plugin author needs: the hooks magpie calls, what it does with their answers, and how to test, publish and list a plugin.

> **In one paragraph.** A plugin is an npm package, a git repository or a folder. Its module exports an async function in OpenCode’s v1 plugin shape. magpie loads every plugin into one [Bun](https://bun.sh) process, the *plugin host*. The function returns hooks: `config` declares the provider and its default models. `auth` gives the sign-in methods, plus a `loader` whose `fetch` makes each request. `provider.models` lists the models one account has. `auth.usage` says how much of the plan is used. It is magpie’s own hook, and OpenCode ignores it. `auth.refresh` renews an account’s token before it runs out, once at a time. It is magpie’s own hook too. `auth.checkin` presses the vendor’s daily check-in for an account. It is magpie’s own hook too. An agent can send in any API. The gateway translates the request into the API the model speaks (chat completions, Responses, Anthropic Messages or Gemini), hands it to the plugin’s `fetch`, and streams the answer back.

## A plugin in five minutes

This example signs in to Acme, a made-up coding plan. Acme takes an API key, has an OpenAI-compatible endpoint, and reports each account’s models and usage. A real plugin differs mainly in how it signs in and signs its requests. This whole example was run against magpie v0.1.676 and a local stand-in for Acme’s API.

```
{
  "name": "opencode-acme-auth",
  "version": "0.1.0",
  "description": "OpenCode provider plugin: Acme Coding Plan",
  "type": "module",
  "main": "./index.mjs",
  "files": ["index.mjs", "README.md"],
  "keywords": ["opencode", "opencode-plugin", "acme"],
  "license": "MIT",
  "magpie": { "maxConcurrency": 4 }
}
```

```
const PROVIDER = "acme"
const BASE = "https://api.acme.example/v1"

export const AcmeAuthPlugin = async ({ client }) => ({
  // the provider and the models it has before anyone signs in
  config: async (cfg) => {
    cfg.provider ??= {}
    cfg.provider[PROVIDER] ??= {
      name: "Acme",
      npm: "@ai-sdk/openai-compatible", // chat completions
      api: BASE,
      models: {
        "acme-coder": { name: "Acme Coder", limit: { context: 200000, output: 32000 }, tool_call: true },
      },
    }
  },

  auth: {
    provider: PROVIDER,
    methods: [{ type: "api", label: "Acme API key", placeholder: "acme-…" }],
    // what every request of this account is sent with
    async loader(getAuth) {
      const auth = await getAuth()
      if (auth?.type !== "api") return {}
      return {
        baseURL: BASE,
        async fetch(input, init) {
          const headers = new Headers(init?.headers)
          headers.set("authorization", `Bearer ${auth.key}`)
          headers.set("x-acme-client", "opencode-acme-auth/0.1.0")
          return fetch(input, { ...init, headers })
        },
      }
    },
    // magpie's own hook: how much of the plan is used
    async usage(getAuth) {
      const auth = await getAuth()
      const res = await fetch(`${BASE}/usage`, { headers: { authorization: `Bearer ${auth.key}` } })
      if (!res.ok) return { error: `Acme answered ${res.status}`, windows: [] }
      const u = await res.json()
      return {
        plan: u.plan,
        windows: [{ name: "5 hours", used: u.percent, resetsAt: u.resets_at, span: 5 * 3600 }],
      }
    },
  },

  // the models this account has, asked of Acme
  provider: {
    id: PROVIDER,
    async models(provider, { auth } = {}) {
      if (auth?.type !== "api") return provider.models
      const res = await fetch(`${BASE}/models`, { headers: { authorization: `Bearer ${auth.key}` } })
      if (!res.ok) return provider.models // magpie keeps the list it had
      const { data } = await res.json()
      const base = provider.models["acme-coder"]
      return Object.fromEntries(data.map((m) => [m.id, { ...base, id: m.id, name: m.name ?? m.id }]))
    },
  },
})
```

Add the folder to magpie, sign in, and try it:

```
magpie plugin add ./opencode-acme-auth   # a folder is loaded where it is; nothing is installed
magpie plugin login acme                 # asks for the key
magpie plugin                            # acme (Acme, 2 models)  signed in
magpie provider test acme                # ✓ chat  7 ms · acme-coder
magpie quota                             # acme · Pro · 5h 37% ↻59m
```

Agents now reach its models as `acme/acme-coder`, the same way as any other provider’s. In the app, open Plugins, click Add a plugin and give it the folder. Then sign in from the provider’s row.

> **Try it in a sandbox.** A plugin you are writing should never touch your real magpie. Run magpie with a `HOME` of its own, as Testing shows.

## How magpie runs plugins

- **Bun..** magpie downloads Bun the first time a plugin is added, and runs every plugin on it. Bun runs TypeScript as is, so an entry can be `index.ts`.
- **One host process..** Every plugin that is on loads into one Bun process, started the first time one is needed. magpie and the host talk over stdin and stdout, one JSON message a line. Anything a plugin prints, `console.log` and `process.stdout` included, is sent to stderr. magpie logs it as `plugin: …`.
- **Installing..** An npm package is installed with `bun add`, with its install scripts left unrun, as OpenCode installs plugins. A dependency that needs a `postinstall` build won’t work.
- Packages come from the npm registry you already use: the `registry=` in your `~/.npmrc`, `install.registry` in `~/.bunfig.toml`, or `NPM_CONFIG_REGISTRY` / `BUN_CONFIG_REGISTRY` in your shell, before the Mirrors in China switch. A token your `.npmrc` keeps for that registry is sent to it alone. To use another, change npm registry on Plugins → Discover, or run `magpie plugin registry <url>` (`default` goes back).
- A git repository is fetched by Bun: `github:owner/repo[#ref]`, `git+https://…` or `owner/repo`.
- A path to a folder or file is loaded where it is.

- The community’s packages (`@magpie-community/*`) update by themselves a little after magpie starts, then every hour.
- Any other package with a newer version shows a dot on Plugins, and in the sidebar Installed reads “1 update”. Plugins then opens on Installed, which names the plugins with a newer version at the top beside Update all; the user updates them with a click or `magpie plugin update`.
- A spec pinned to a version (`name@1.2.3`) stays on it until the user updates it: Update to …, Update all and `magpie plugin update` install the newest version and unpin it.
- A git repository has no version to compare. It shows an update when its branch or tag (the default branch without `#ref`) is at another commit than the one Bun installed: GitHub is asked through its API, any other host with `git ls-remote`, at most every ten minutes, and the hourly check asks again. A spec pinned to a commit never has one. The row shows the commit installed.

What magpie keeps, in its config folder (`~/.config/magpie`, or `$XDG_CONFIG_HOME/magpie`):

| File | What it holds |
| --- | --- |
| `plugins.json` | The plugins added: `{"plugins": [{"spec", "off"?, "options"?}], "config"?}`. `options` is the plugin’s second argument, as OpenCode’s `["name", {…}]` gives it. `config` is the OpenCode config the plugins are handed. |
| `plugins/` | The installed npm and git packages, a Bun project of their own. |
| `plugin-auth.json` | The sign-ins (mode 600), in the same shape as OpenCode’s `auth.json`, so a sign-in can be moved between the two. |
| `plugin-providers.json` | The providers and models the plugins listed last, so magpie can start without asking them. |

## The package

### Where magpie loads it from

magpie looks for the server side of a plugin in the same places OpenCode does, and loads the first file that exports a plugin:

1. `exports["./server"]`, then `main`, then `exports["."]` (or `exports` when it is a string), in `package.json`.
2. Otherwise `index.ts`, `index.tsx`, `index.js`, `index.mjs` or `index.cjs`.

A path to a single file loads that file.

### What the module exports

- `export default { id, server }` (OpenCode v1): `server` is the plugin.
- Otherwise, **every function the module exports** is called as a plugin, as is every exported `{ server }` object.

So don’t export helper functions from the entry file. Put what your tests need on an object instead, as the community plugins do with `export const _internal = { … }`.

### The function

```
async (input, options) => hooks
// input:   { client, project, directory, worktree, serverUrl, $, experimental_workspace }
// options: the entry's "options" in plugins.json, else undefined
// hooks:   { config?, auth?, provider?, "chat.headers"? }
```

A plugin may return more than one provider by exporting more than one function. Each one’s hooks are separate. When two plugins have an `auth` hook for the same provider, the one loaded last wins, as in OpenCode.

### magpie’s fields in package.json

OpenCode ignores the `magpie` object, so these are safe to add to an OpenCode plugin.

| Field | Meaning |
| --- | --- |
| `magpie.icon` | The plugin’s picture, on its card in Discover (read from npm, or from the repository for one on GitHub) and its row in Installed, and the picture of each of its providers that doesn’t give its own: an `https://` URL or a `data:image/…` URI, at most 1 MB. SVG, PNG and the like. |
| `magpie.name` | The plugin’s name on its row in Installed, and on its sidebar tab when its page gives no title, for a plugin the community’s list doesn’t name (the list’s name wins). The package’s npm name has to be ASCII, so a name like 华为云 HUAWEI goes here. One line, at most 80 bytes; anything else is ignored. It is never shown as reviewed, and never used to find a plugin by name. A repository tagged `magpie-plugin` shows it on its card under Discover → Unofficial, on GitHub too, in place of the repository’s name. |
| `magpie.summary` | Its card’s line under Discover → Unofficial, on GitHub, by language: `{ "en": "…", "zh": "…" }`, in the window’s language (zh-TW reads `zh`), else English, else GitHub’s description. One line of at most 300 bytes a language; anything else is ignored. A card showing a name or summary of the package’s own says “Its own words”: nobody reviewed them. |
| `magpie.maxConcurrency` | How many requests each account takes at once, a whole number from 1 to 1000. A limit the user sets on the provider wins over it. |

The same fields can be set on the `auth` hook (`auth.icon`, `auth.maxConcurrency`), where they win over `package.json`. A plugin that signs in to several providers can give each its own `auth.icon` and keep `magpie.icon` for the plugin itself.

## Provider and models

### Declaring the provider

The provider’s id is `auth.provider`. If [models.dev](https://models.dev) lists that id, magpie starts from its entry, as OpenCode does. Otherwise, declare the provider in a `config` hook. Use `??=`, so a provider the user configured in `plugins.json` isn’t written over:

```
config: async (cfg) => {
  cfg.provider ??= {}
  cfg.provider["acme"] ??= {
    name: "Acme",
    npm: "@ai-sdk/anthropic",          // the API its models speak (table below)
    api: "https://api.acme.example/v1", // where requests go, unless the loader says otherwise
    models: {
      "acme-large": {
        name: "Acme Large",
        id: "acme-large-2026-09",          // the id the API takes, when it isn't the key
        limit: { context: 400000, output: 64000 },
        reasoning: true,
        tool_call: true,
        modalities: { input: ["text", "image"] },
        cost: { input: 3, output: 15, cache_read: 0.3 }, // US$ per million tokens; leave out for a plan
        variants: { low: {}, medium: {}, high: {} },        // reasoning levels
      },
    },
  }
}
```

A model can also say `provider: { npm, api }` to use another API or address than the provider’s, `headers`, `options`, and `disabled: true` to hide it.

### In front of a vendor magpie knows

When the provider’s `api` is the API of a vendor magpie has a preset for (`https://api.mistral.ai/v1`, `https://api.deepseek.com/v1`, `https://openrouter.ai/api/v1`, …), magpie shapes requests to your provider as it does for that vendor before they reach your `fetch`: Mistral’s thinking parts in place of `reasoning_content`, DeepSeek’s and xAI’s schema rules, OpenRouter’s free pool, and the rest. There is nothing to add; the base URL you already give is what it reads, even when your loader’s `baseURL` sends elsewhere. A base on no preset’s host, on `localhost` or on your network gets no vendor’s handling.

### An upstream that searches the web

When your plugin sits in front of Anthropic’s or OpenAI’s own API, which runs the hosted web search tool itself, set `searches: true` on the provider in the `config` hook. A client’s web search (Claude Code’s WebSearch, Codex’s `web_search`) then reaches your `fetch` as it was sent, on the provider’s Anthropic or Responses models, rather than going through magpie’s own search. Its Chat models are unaffected. magpie doesn’t search with it for other models by itself, but it can be named as the searcher in Settings.

### A decision API (System One)

A plugin can serve TypeSafe’s System One API for its provider, so its models can be a [routing group’s classifier](https://usemagpie.ai/docs/intent). Set `decide: true` on the provider in the `config` hook, and `decides: true` on each model that answers questions rather than a conversation, in the `config` hook or on the `models` hook’s list. magpie then posts each question as `POST {baseURL}/systemone` through your loader’s `fetch`, with the account’s sign-in, as it sends any other request. The body is `{"model", "questions", "state"}`; answer `{"model", "answers": {"<question>": {"choice", "score", "confidence"}}}`.

A marked model, and one named `jev-*`, is offered as a classifier and kept from agents: a chat request to it is refused. Without `decide: true` on the provider, `decides` is ignored and every model stays one to chat with.

### The API a model speaks

The AI SDK package named by `npm`, on the model or on the provider, decides the API. That decides the shape of the request your `fetch` receives. Whatever the agent sent, magpie’s gateway has already translated it:

| npm | API | Path after the base |
| --- | --- | --- |
| `@ai-sdk/anthropic`, `@ai-sdk/google-vertex/anthropic` | Anthropic Messages | `/messages` |
| `@ai-sdk/openai`, `@ai-sdk/azure` | OpenAI Responses | `/responses` |
| `@ai-sdk/google` | Gemini | `/models/<id>:streamGenerateContent?alt=sse` |
| `@ai-sdk/github-copilot` | Responses for GPT-5 and later (not gpt-5-mini), chat completions for the rest | `/responses` or `/chat/completions` |
| anything else (`@ai-sdk/openai-compatible`, `xai`, `groq`, `deepseek`, …) | Chat completions | `/chat/completions` |

The base is chosen in this order:

1. the loader’s `baseURL`;
2. the model’s `provider.api`;
3. the provider’s `api`;
4. the AI SDK package’s own default (`https://api.anthropic.com/v1`, `https://api.openai.com/v1`, …).

The body’s `model` is the model’s API id: its `id`, else its key.

### Each account’s models

When the models depend on the account, add a `provider` hook:

```
provider: {
  id: "acme",
  async models(provider, { auth }) {
    // provider.models: what models.dev and the config hook give, keyed by id
    // auth: this account's sign-in, as plugin-auth.json keeps it
    return { "acme-large": { ...provider.models["acme-large"], name: "Acme Large" } }
  },
}
```

- magpie calls it once for each account, in that account’s scope and through its proxy. Each account serves only the models listed for it, so an account on a smaller plan isn’t sent a model it doesn’t have.
- A model is OpenCode’s `Model`: `id`, `name`;
- `api: {id, url, npm}`;
- `limit: {context, input?, output}`;
- `capabilities: {reasoning, toolcall, attachment, input: {text, image, …}}`;
- `cost: {input, output, cache: {read, write}}`;
- `variants`, `release_date`, `status`.

- `free: true`: the plan serves it at no cost to its allowance. Only this flag makes a model free, and magpie never reads it from `rate`: set it from the vendor’s own word (its list marks the model free, or prices it at $0), not from a rate you worked out.
- `rate`: the credits a request costs, as a multiple, given as a number (`0.5`) or as the vendor writes it (`"x0.5"`). `0` reads as no rate given, not as free.
- `rateWas`: the rate before a discount that is running now.

### When the vendor can’t be reached

magpie keeps the list it already had, as it does for a built-in subscription whose list couldn’t be fetched, when the hook does any of these:

- returns `provider.models` unchanged after a fetch that failed;
- throws;
- returns a list of its own with `list[Symbol.for("magpie.fellBack")] = true`.

If what failed was the sign-in, throw an error with `signIn: "expired"` on it. The account is then marked as needing a new sign-in (see Sign-in state).

## Signing in

The `auth` hook is `{ provider, methods, loader, usage?, refresh?, refreshLead?, checkin?, icon?, maxConcurrency? }`. Each method is a way to sign in that the user can pick. In the app the methods are buttons; in a terminal, `magpie plugin login <id> [<method>]` asks which one.

### An API key

```
{ type: "api", label: "Acme API key", placeholder: "acme-…" }
```

- `label` titles the key’s field. A label that only says “API key” is shown as “Acme API key”.
- `placeholder` is magpie’s own field, a hint inside the field.
- Without an `authorize` function, the key is saved as is: `{type: "api", key, metadata?}`. Answers to `prompts` go in `metadata`.
- With `authorize(inputs)`, the plugin checks or exchanges the key itself. It returns `{type: "success", key, metadata?}` or `{type: "failed", error?}`.

### A browser or device sign-in

```
{
  type: "oauth",
  label: "Sign in with Acme",
  async authorize(inputs) {
    const d = await startDeviceCode()
    return {
      url: d.verification_uri,                    // magpie opens it
      instructions: `Enter the code ${d.user_code}`, // and shows this
      method: "auto",                              // "auto": callback() resolves on its own
      async callback() {                           // "code": callback(code), the code the user pastes
        const t = await pollForToken(d)
        if (!t) return { type: "failed", error: "The code expired" }
        return { type: "success", refresh: t.refresh_token, access: t.access_token,
                 expires: Date.now() + t.expires_in * 1000, accountId: t.email }
      },
    }
  },
}
```

- A success with `refresh` is saved as `{type: "oauth", refresh, access, expires, …}`, with every other field you return kept beside them (`accountId`, `enterpriseUrl`, your own).
- A success with `key` is saved as an API key.
- `provider: "other-id"` on the result saves the sign-in to another provider the plugin signs in to.
- `error` on a failure is magpie’s own field: the user sees why (up to 500 characters). Without it, they see only that the sign-in failed.
- When `authorize` can’t start the sign-in, throw, or return `{type: "failed", error}` with no `callback`: the user sees that reason.
- A sign-in the user cancels, or that times out, is over: whatever `callback` returns after it is dropped, and the fetches it makes for it fail. magpie also passes the sign-in’s `AbortSignal` as `callback(code, { signal })` (and `authorize(inputs, { signal })`), so a callback that waits a long time can stop when it aborts.
- `inputs` is passed only to a method with `prompts`. A method without prompts gets `undefined`, as OpenCode’s TUI calls it. An empty object is how OpenCode’s CLI calls, and some plugins then ask on the terminal.

### Questions before signing in

A method’s `prompts` are asked in order before `authorize`, each only when its condition holds:

```
prompts: [
  { type: "select", key: "region", message: "Region",
    options: [{ label: "Global", value: "global" }, { label: "China", value: "cn", hint: "acme.cn" }] },
  { type: "text", key: "team", message: "Team id", placeholder: "t-…",
    when: { key: "region", op: "eq", value: "global" },        // or condition: (inputs) => boolean
    validate: (v) => (/^t-/.test(v) ? undefined : "Starts with t-") },
]
```

A `type: "password"` question is a `text` one typed unseen: a masked field in the app, and no echo in `magpie plugin login` on a terminal. Use it for a token or a personal access token. It is magpie’s own type: OpenCode’s are `text` and `select`.

### Accounts

- **Where they are kept..** A provider can be signed in to more than once. The first account is kept under the provider’s id, as OpenCode keeps it. Others are kept under `id#xxxxxx`.
- **How the user tells them apart..** magpie names an account by `accountId`, else `metadata.email`, else `email`. Save one of them, an email where you have one.
- **Signing in again..** A new sign-in replaces an existing account when both have the same `accountId`. Where both also have a `uid` (the vendor’s own id, for vendors whose names can repeat), it must match too. Without an id, the same secret matches. Otherwise the sign-in becomes a new account.
- **Scope..** Every call magpie makes for an account runs in that account’s scope: `getAuth()` returns that account.
- `client.auth.set({ path: { id: "acme" }, body })` saves to that account.

### Renewing a sign-in

From magpie 0.1.684, a plugin can leave renewing its tokens to magpie with `auth.refresh`, magpie’s own hook (OpenCode ignores it):

```
auth: {
  provider: "acme",
  methods: [ … ],
  // optional: how long before expires to renew (ms), 5 minutes by default
  refreshLead: 5 * 60 * 1000,
  async refresh(auth, provider) {  // auth is the account's saved sign-in
    const t = await exchange(auth.refresh)
    if (t.error === "invalid_grant")
      throw Object.assign(new Error("Acme refused the sign-in"), { signIn: "expired" })
    return { access: t.access_token, refresh: t.refresh_token ?? auth.refresh,
             expires: Date.now() + t.expires_in * 1000 }
  },
  loader: async (getAuth) => ({ … }),  // getAuth() already gives the renewed token
}
```

- **When it runs..** For an OAuth account whose `expires` is less than `refreshLead` away, before the account’s loader, `provider.models`, `auth.usage` or a request. An account with `expires` 0 or none is never renewed.
- **Once at a time..** Requests that find the token due wait for one renewal, so a vendor that spends a refresh token once never sees it twice. They wait up to 15 seconds; a renewal that takes longer is still saved when it ends.
- **What is saved..** The fields you return are kept over the account’s old ones (merged, unlike `client.auth.set`), and the account’s mark is cleared. Return nothing when there is nothing to renew.
- **When it fails..** The account is left as it was and the request goes on with the old token, for the vendor’s answer to tell. An error with `signIn: "expired"` marks the account (see Sign-in state), and magpie doesn’t try again until it is signed in again. Any other error is tried again after 30 seconds.
- **OpenCode and older magpie..** They ignore the hook. Keep the check in your `fetch` too if the plugin runs there: under magpie it finds the token fresh and does nothing.

## Requests

`loader(getAuth, provider)` runs once per account and is run again after its sign-in changes. It returns what OpenCode would give the AI SDK:

| Field | What magpie does with it |
| --- | --- |
| `baseURL` | Where requests go, ahead of the model’s and provider’s `api`. |
| `apiKey` | Sent as the AI SDK package sends it: `x-api-key` for Anthropic, `x-goog-api-key` for Google, `Authorization: Bearer` otherwise. For an API-key sign-in, it defaults to the saved key. |
| `headers` | Added to every request. |
| `fetch` | Makes the request. Without it, magpie’s host uses the standard `fetch`. |

The request your `fetch(input, init)` receives:

- `input` is the full URL: the base plus the path for the model’s API.
- `init.method` is usually `POST`.
- `init.headers` are set in this order, each overriding the one before: the key header from `apiKey`;
- the loader’s `headers`;
- the gateway’s request headers;
- what `chat.headers` hooks add.
- `init.body` is the JSON string in that API’s shape (bytes when it isn’t UTF-8 text). `model` in it is the API id, and `stream` is whatever the agent asked for.
- `init.signal` aborts when the agent gives up on the request.

Return a `Response`. Its status, headers and body go back as they come, streamed chunk by chunk. If you rewrite a streaming body, drop `content-length` and `content-encoding` from the headers.

### Failures and failover

- A non-2xx response is the vendor’s answer. The gateway handles it as it would any provider’s: a rate limit or a server error moves the request to the next account or model, and a 401 marks the account (see Sign-in state). Answer a model the account may not use with 403 or 404 and the vendor’s words, not 401: the gateway reads that as the model refused, not the sign-in.
- A thrown error fails the request, and failover moves on.
- Answer in the API’s own error shape where you can, so the agent shows the vendor’s message.

### chat.headers

OpenCode’s `chat.headers` hook runs for every request. Its `input.sessionID` is magpie’s conversation id, which stays the same across a conversation’s turns. Use it for a vendor’s session or cache header:

```
"chat.headers": async (input, output) => {
  if (input.model.providerID === "acme") output.headers["x-acme-session"] = input.sessionID
}
```

## Sign-in state

magpie marks an account whose sign-in the vendor refused. It shows the mark to the user and stops sending to the account until it works again. By default a 401 marks the account and a success clears the mark. A plugin can say more precisely what an answer means with the `X-Magpie-Sign-In` response header, which magpie removes before the answer goes on:

| Value | Meaning |
| --- | --- |
| `expired` | The sign-in was refused, whatever the status (a vendor that answers 403 or 502 for it). |
| `kept` | Leave the account as it is (a 401 that is about something else). |
| `renewed` | The sign-in renewed: clear the mark, whatever the request then met. |

A 401 without the header whose body says only that the model isn’t served (“model … not available”, `model_not_found`, “模型不支持”) and nothing of a token, key, session or sign-in is read as `kept`. Before, it marked every account the request failed over to as needing a new sign-in. A 401 that names the model and also says the token is invalid still marks the account.

From `fetch` or `provider.models`, throw an error with `signIn: "expired"` on it for the same effect:

```
throw Object.assign(new Error("Acme refused the sign-in; sign in again"), { signIn: "expired" })
```

## Usage

`auth.usage(getAuth, provider)` is magpie’s own hook. It says how much of an account’s allowance is used. It runs in the account’s scope, so a token it refreshes is saved to that account. magpie shows its answer on the account in Providers, in `magpie quota` and at `GET /v1/magpie/quotas` on the gateway. Every field is optional:

```
{
  plan: "Pro",
  user: "ada@example.com",     // the account as the vendor names it
  until: "2026-11-01T00:00:00Z", // the plan's end
  renew: "auto",                // or "off"
  balance: "$12.40",
  error: "",                    // shown in place of the windows
  windows: [{
    name: "5 hours",
    used: 37,                   // percent; past 100 when overspent
    resetsAt: "2026-10-03T18:00:00Z", // or resetSecs: 3600
    span: 18000,                // seconds the window runs
    display: "370 / 1000 credits",
    amount: 370, limit: 1000, unit: "credits", // its own count, when it counts amounts
    model: "opus",              // counts only models whose ids hold this word
    models: [], notModels: [],  // or exactly these ids, or all but these
    family: "Gemini", pool: "Gemini", // a model's family, and the group sharing its allowance: the card shows a pool's own windows (no model, no family) in place of its models'
    aside: false,               // true: using it up doesn't stop the account
    runsOutAt: "2026-10-05T00:00:00Z", runsOut: 120, // when the soonest credits left are lost, and how many
    balance: 6291,              // a prepaid wallet: what is left, in unit; no used or limit
  }],
  resets: { count: 2, until: "…", byWindow: false, fiveHour: 1, weekly: 1 }, // resets the account may spend
  signIn: "kept",               // as X-Magpie-Sign-In
}
```

Times are ISO strings or epoch numbers, in seconds or in milliseconds. Without `signIn`, an `error` that says to sign in again marks the account, and a clean read clears the mark.

Leave `used` out when the vendor doesn’t tell it, never send 0 for “not known”. Left out with `amount` and `limit`, the share is theirs (370 of 1000 is 37 used). Left out with no count, the window is its `display` alone: routing doesn’t read it, and an account whose windows all say nothing is weighed as one never read, not as the one with the most left. A window with `aside: true` is shown on the account’s card, with its share and count, and in `GET /v1/magpie/quotas`, but routing never reads it: using it up doesn’t stop the account or weigh it against the others, whatever `amount` and `limit` say. Leave `aside` off a window the account really stops at.

## Check-in

A vendor that gives credits for a daily check-in can have the plugin press it with `auth.checkin`, magpie’s own hook (OpenCode ignores it). magpie runs it for each signed-in account once a Beijing day while the user has check-in on for the provider, and shows what came of it on the account’s Usage card and in Settings.

```
auth: {
  provider: "acme",
  async checkin(getAuth, provider) {
    const auth = await getAuth()
    const r = await claim(auth.access)
    if (r.already) return { outcome: "done" }
    return { outcome: "claimed", credit: r.points, streak: r.days, message: r.text }
  },
}
```

It answers `{ outcome, credit?, streak?, message? }`:

| `outcome` | Meaning |
| --- | --- |
| `claimed` | Checked in now. `credit` is what it gave. |
| `done` | Checked in already today. A vendor that answers 2xx with nothing left to claim is `done`, not `failed`. |
| `ineligible` | The account can’t take part. |
| `inactive` | No check-in is running. |
| `captcha` | The vendor asks for a captcha. Never solve it: the user checks in in the vendor’s own app. |
| `failed` | It didn’t work. magpie asks again later that day. |

`streak` is the days in a row, and `message` is shown as it is. A hook that throws, or answers no outcome above, is `failed`. It runs in the account’s scope, so a token it renews with `client.auth.set` is saved to that account.

## Model load

A vendor that queues requests to a busy model can have the plugin say how busy each model is, with `input.magpie.load(provider, loads)`, magpie’s own (OpenCode has none). `loads` maps a model id to a percent from 0 up, or to `null` to say it isn’t known any more. The plugin calls it whenever it likes, from its own timer: magpie doesn’t ask for it.

```
export default async (input) => {
  const report = async () => {
    const r = await fetch(`${BASE}/load`).then((r) => r.json()).catch(() => null)
    if (r) input.magpie?.load?.("acme", { "acme-large": r.large, "acme-small": r.small })
  }
  report()
  setInterval(report, 60_000)  // within five minutes, or the load is unknown again
  return { auth: { /* … */ } }
}
```

- **Values..** 100 is as busy as the vendor serves at once; a vendor that queues reports past it (200 is twice that). A number below 0 counts as 0, and one past 10000 as 10000, a sanity cap. Anything else (a string, `NaN`) is dropped. Model ids match whatever their case, and `model@256k` has its model’s load unless reported itself. One call takes up to 1000 models and returns how many it took. A provider that isn’t a string, or a `loads` that isn’t an object, throws a `TypeError`.
- **Freshness..** Each model’s load counts for five minutes from the call that reported it. After that it is unknown, never 0: a plugin that stops calling leaves its models where they were. A model a call doesn’t name keeps its last load until its own five minutes run out.
- **Where it shows..** The provider editor shows it by the model, a small grey number.
- **Routing..** With Settings › Models › Routing › Busy models last set (Off by default; over 50, 70, 80 or 90%, or Custom… for any number from 1 to 9999, such as 150 for a vendor that queues), a model reported busier than that goes behind every other candidate a request could go to, ahead of those resting after a failure. A conversation it answered moves to the one that leads at its next turn; within a turn it stays. A model with no load known keeps its place. The Routing trace says `busy` with the load.

A plugin written for older hosts checks `input.magpie?.load` first, as above.

## What a plugin is given

magpie hands a plugin what OpenCode’s `PluginInput` has, as far as it has meaning without an OpenCode server:

| Field | In magpie |
| --- | --- |
| `client.auth.set` / `.remove` | Saves or forgets the sign-in of the account in scope. |
| `client.app.log` | Writes to magpie’s log as `plugin [level]: [service] message`. |
| `client.tui.showToast` | Written to magpie’s log. |
| `client.config.get` | The config after every plugin’s `config` hook. |
| any other `client.*` | Answers `{ data: undefined }`. |
| `directory`, `worktree` | magpie’s config folder, a place to keep files. |
| `project` | `{ id: "magpie", worktree }`. |
| `$` | Bun’s shell. |
| `serverUrl` | A placeholder; no OpenCode server is behind it. |
| `magpie.option`, `.options`, `.load` | magpie’s own: the plugin’s options as the user set them, and its models’ load. |

The hooks magpie calls are `config`, `auth` (its methods, `loader`, `usage`, `refresh` and `checkin`), `provider.models` and `chat.headers`. A plugin’s other hooks (`tool`, `event`, `chat.params`, …) are not called. The agent runs its own tools.

## Provider ids

- Agents name a plugin’s model as `<id>/<model>`, where the id is the plugin’s `auth.provider`.
- When the id is taken in magpie, by a built-in subscription, a preset (`google`, `openai`, `anthropic`, …) or `magpie` itself, the plugin’s provider is named `<id>-plugin`. Pick an id that is only yours.
- The community’s plugins for magpie’s deprecated built-in subscriptions are the exception. They use the built-in’s id (`cursor`, `zed`, …) and take it over once the user moves onto the plugin, so agents keep working unchanged.
- When two installed plugins sign in to the same id, such as a published plugin and your own copy of it, one of them serves it: the one picked for it, otherwise the one added last. Both stay in Plugins → Installed, and each row says which one serves the provider. Use for … on the other row, or `magpie plugin use <name> <id>`, makes the pick.

## Testing

Run magpie in a sandbox, so your own magpie, its agents and sign-ins are never touched:

```
sb=$(mktemp -d)
m() { env HOME=$sb XDG_CONFIG_HOME=$sb/.config XDG_CACHE_HOME=$sb/.cache MAGPIE_ADDR=127.0.0.1:3499 magpie "$@"; }
m plugin add ./opencode-acme-auth </dev/null
m plugin --json                     # what the plugin lists: methods, accounts, models, load errors
m plugin login acme                 # each method, each prompt
m provider test acme                # one tiny request per API
m provider test acme acme-coder     # or to the models named
m quota                             # the usage hook
m plugin logout acme
```

- A plugin that fails to load says why in `magpie plugin`.
- Hook errors and everything a plugin prints are in the output, as `plugin: …` lines.
- For unit tests, run `bun test` against the functions you put on `_internal`.
- The [community repository](https://github.com/magpie-community/plugins) has a few scripts: `bun scripts/check.mjs` loads each package as magpie does and checks its hooks.
- `scripts/try.sh <name>` runs it in a sandbox like the one above.

## Publishing and listing

- **npm..** Publish the package as usual. Users add it by name (`magpie plugin add opencode-acme-auth`), by a version (`…@0.2.0`), from git, or from a folder.
- **Search..** The search on Plugins asks npm for `<query> opencode`. It shows a package whose name or keywords hold `opencode` and one of `auth`, `plugin` or `provider`. Keywords like `["opencode", "opencode-plugin", "<vendor>"]` do it. It also asks for `keywords:pi-package <query>` and shows a pi package whose name or keywords mention `auth` or `provider`.
- **README..** A plugin’s page in magpie shows its npm README. Say what it signs in to, how, where the sign-in is kept, and which models it has.
- **The list..** Plugins suggests the plugins in [`registry.json`](https://github.com/magpie-community/plugins/blob/main/registry.json) of the community repository. magpie fetches it at most every six hours and builds in a copy for when it can’t. To be listed, open a pull request adding an entry: { "package": "opencode-acme-auth", "name": "Acme", "icon": "https://acme.example/icon.svg", "providers": ["acme"], "summary": { "en": "Your Acme Coding Plan.", "zh": "使用你的 Acme Coding Plan。" } } A middleware’s entry has `"kind": "middleware"` and no `providers`; it is listed under Gateway middleware. The other kinds are listed the same way: `"kind": "tools"` under Tools for agents, `"kind": "page"` under Pages and `"kind": "agent"` under Agents. Those sections hold the community’s own packages, whose entries have `"community": true`. A package published from your own repository leaves that out: it isn’t in the sections, the search on Plugins finds it by its name, summary or publisher, and its card shows its npm publisher, not the magpie community badge. `MAGPIE_PLUGIN_MARKET=<url>` points magpie at another list, which is useful to check yours, and `off` keeps to the built-in copy.
- **A GitHub topic..** A repository tagged `magpie-plugin` on GitHub is shown under Plugins → Discover → Unofficial, on GitHub, the most starred first, marked as reviewed by no one. Keep `package.json` at the repository’s root. Published to npm with `repository` naming the repository, it is installed from npm; otherwise from the repository as it stands, so the file it loads must be committed: one whose `dist` is built only to publish is left out. Forks, archived repositories and magpie-community’s own are left out too. magpie asks GitHub at most every ten minutes, so a repository shows within minutes of being tagged. Its card shows the icon `"magpie": { "icon": "…" }` in its `package.json` gives, else a puzzle piece. Its licence is the one GitHub reads from the repository’s `LICENSE` file; when GitHub can’t match the file to a licence (it says `NOASSERTION`, as for MIT’s text with a line added) or there is none, the card shows `package.json`’s `license`. A plugin installed from npm shows `package.json`’s.
- **The community packages..** To contribute one to [magpie-community/plugins](https://github.com/magpie-community/plugins): Put it under `packages/<name>`, named `@magpie-community/opencode-<name>-auth` (a provider) , `@magpie-community/middleware-<name>` (middleware or a routing strategy), `@magpie-community/tools-<name>` (tools), `@magpie-community/page-<name>` (a page) or `@magpie-community/agent-<name>` (an agent), with no runtime dependencies unless one is really needed.
- Pushing a version bump to `main` publishes it.
- These packages update by themselves in every magpie.

## Async gateway request hooks

A plugin can await I/O before an agent request is routed, for example to recall project context. Declare `"magpie": { "hooks": "./hooks.js" }` in package.json, or add a `*.hooks.js` / `.mjs` / `.ts` / `.mts` file (Bun runs TypeScript without a build step). Export a named async `onRequest(body, ctx)`. A gateway-only package needs no OpenCode main/exports.

Optional async `onResponse(reply, ctx)` receives a best-effort completion notification after output finishes. It cannot change the reply and never holds the live stream. Client tool declarations and tool loops stay with the client.

Optional async `onSignIn(event, ctx)` hears of a subscription account that has to be signed in again: `event` is `{provider, providerName, account, state, endsAt?}`, `state` `signed-out`, or `ending` for a Claude sign-in within three days of its end. It is told once until the account works again, and carries no token. A hooks file may export only `onSignIn`.

It runs in Bun once per agent request, before the JS gateway middleware, for every provider, Codex's own ChatGPT sign-in included. body is the agent API object. ctx contains `protocol`, `model`, `stream`, `path`, `agent`, `session`, `cwd`, `query`, `options` and `signal`. The query is the latest user text, excluding tool results and images. Missing identity fields are empty; authorization headers are never included.

Return an object to replace the request, or undefined to keep it. A hook that changes the model, streaming, the client's tools or its tool choice is rolled back, as a failure, and gets no `onResponse` for that request. Each hook receives a clone; mutations from failed or undefined hooks are discarded. Successful changes follow enabled plugin order. Each hook defaults to one second; `gatewayTimeoutMs` accepts integers from 100 to 30000 milliseconds; a value outside that range is clamped to the nearer bound. The chain sums budgets, clamped to 2–10 seconds, or takes the longest hook's own timeout when that is longer; host startup is bounded to 11 seconds, and startup plus RPC to the chain budget plus one second (at least 11 seconds). Settings → Plugins offers JSON options and call, latency, failure and outcome diagnostics. `ctx.report(code, bytes)` accepts ready/empty/unbound/unauthorized/unavailable/invalid/skipped and byte counts only. Statistics reset on reload and retain no private text. Use `ctx.signal` with fetch. Errors, invalid returns, timeouts and a host busy starting keep the request. Bun plugins have host privileges; install trusted code.

Install with `magpie plugin add ./my-plugin`; save options with `magpie plugin options my-plugin '&lbrace;"serverUrl":"http://127.0.0.1:8000"&rbrace;'`. On/off and options changes reload the host; source-only edits need a configuration reload. Internal title/classifier requests skip the hook.

## Gateway middleware

A plugin can also be *gateway middleware*: code that magpie’s gateway runs on every request an agent sends it, before the request is routed, and on the reply on its way back. It can give a model another name, add to the system prompt, turn a request away, change or hide what the model says, or keep its own count of what goes through. It works with every provider, a plugin’s or not.

```
// alias.middleware.js
export const events = ["message_start"]

export function onRequest(body, ctx) {
  ctx.state.asked = body.model
  if (body.model === "fast") body.model = "deepseek/deepseek-chat"
  if ((ctx.options.blocked ?? []).includes(body.model)) return ctx.reject(403, "not this model")
  return body
}

export function onEvent(ev, ctx) {
  ev.message.model = ctx.state.asked  // the agent sees the name it asked for
  return ev
}
```

```
magpie plugin add ./alias.middleware.js   # or a package whose package.json has "magpie": { "middleware": "./mw.js" }
```

### Ready-made middleware

The community repository has middleware ready to add, most of it what [New API](https://github.com/QuantumNous/new-api) does for its channels, taking the same JSON. They are under Plugins → Discover → Gateway middleware, and every card there says whether it is a provider or middleware.

| Package | What it does |
| --- | --- |
| [`param-override`](https://github.com/magpie-community/plugins/tree/main/packages/param-override) | New API’s `param_override`: set, delete, move, copy or rewrite fields of the request, for some models or under conditions, or turn a request away. A `param_override` copied from New API works unchanged. |
| [`model-map`](https://github.com/magpie-community/plugins/tree/main/packages/model-map) | New API’s `model_mapping`: send a model under another name, by name or `/pattern/`. Replies name the model the agent asked for. |
| [`system-prompt`](https://github.com/magpie-community/plugins/tree/main/packages/system-prompt) | A system prompt of yours on every request, or only some agents’ or models’, in each API’s own place. A request with its own keeps it unless `override` is on. |
| [`word-guard`](https://github.com/magpie-community/plugins/tree/main/packages/word-guard) | New API’s sensitive-word filter: turn away or mask words and patterns in what users send, and in replies if you like. |
| [`think-tags`](https://github.com/magpie-community/plugins/tree/main/packages/think-tags) | Take a `<think>…</think>` block out of the start of a reply’s text, or put a Chat reply’s `reasoning_content` into it (New API’s `thinking_to_content`). |
| [`antigravity-cloak`](https://github.com/magpie-community/plugins/tree/main/packages/antigravity-cloak) | Breaks up the words Antigravity turns Claude Code’s and the Agent SDK’s system prompts away for, in what it sends Antigravity only. Other providers are sent the prompt as it was. |

```
magpie plugin add @magpie-community/middleware-model-map
magpie plugin options model-map '{"mapping": {"fast": "deepseek/deepseek-chat"}}'
```

### Options

A middleware reads its settings from `ctx.options`, which are its entry’s `options` in `plugins.json`. Set them in Plugins → Installed with the middleware’s Options button, which edits them as JSON in its row, or with `magpie plugin options <name> '<json>'` (`off` clears them). The name can be the package’s, its spec, or its short name: `model-map` for `@magpie-community/middleware-model-map`. They apply from the next request on. A package can suggest options with `"magpie": { "options": { … } }` in its `package.json`: the editor starts from those when none are set, but a middleware runs with no options until you save some. A key that a provider plugin declares as a switch (its editor’s Plugin options, such as Cursor’s `wire_trace`) is saved as that switch: `magpie plugin options cursor '&lbrace;"wire_trace": true&rbrace;'` turns it on, and `off` puts every switch back to the plugin’s default.

### How it runs

Middleware isn’t run on Bun. It runs inside the gateway’s own process, in [moejs](https://github.com/MoeForge/moejs), a JavaScript engine written in Go, because a reply streams thousands of events and each one waits for it. A hook on one event costs about a microsecond; a round trip to Bun would cost tens. Each middleware is compiled once, and each request gets a runtime of its own, so requests run in parallel and a request’s hooks share `ctx.state`.

- **Declaring it..** `"magpie": { "middleware": "./mw.js" }` in `package.json`, or a single file named `*.middleware.js` (or `.mjs`). A package with no `main` and no `exports` is only middleware, and the plugin host leaves it alone; one with both is a provider plugin and middleware at once.
- **Imports..** Only files inside the plugin, by relative path. There is no `node_modules` here: bundle what you import into the file.
- **What it has..** Standard JavaScript and `console.log` (into magpie’s log, at most 60 lines a minute). There are no timers, no `fetch` and no Node APIs. A hook may be `async`, but there is nothing for it to wait on.
- **Changes..** magpie looks at the files and `plugins.json` once a second, and loads a middleware again when they changed.

### The hooks

Each is a named export or a member of `export default { … }`. Bodies and events are in the agent’s own API (`ctx.protocol`), not the provider’s. Return the object to send on, or nothing to send it on as it was.

| Hook | Is given | Returns |
| --- | --- | --- |
| `onRequest(body, ctx)` | The request body, before routing: a new `model` routes it elsewhere. | The body, or nothing. `ctx.reject(status, message)` turns the request away with that error, in the agent’s API (403 when no status is given). |
| `onAccount(account, ctx)` | The subscription account a try is about to go to, before anything is sent: `account` has `ref`, `provider`, `name`, `kind` (such as `codex` or `claude`) and `model`. `ref` stands for the account without naming it: 32 hex characters, the same on every request and after magpie restarts, and different for each middleware, so a middleware can remember an account without ever being told its email or id. A new plan gives the account a new `ref`. Not called for an API key. `ctx.account` is the same object in the hooks after it for that try. | `{skip: true}` passes the account over for this request: the next account or key is tried, and the account isn’t rested or held against. When every one is passed over, the agent gets the usual error that none is ready, and nothing is sent. Anything else, or nothing, uses the account. |
| `onProvider(body, ctx)` | The request body as it is about to go to one provider; `ctx.provider` has its `id`, `name`, `account` (the subscription’s kind, such as `claude` or `antigravity`; absent for an API key) and `model`. It is called again for each provider a request is tried on, each time with the body `onRequest` left, so a change for one provider reaches no other. | The body, or nothing. The request is routed by now: it can’t be turned away or sent elsewhere. |
| `onEvent(event, ctx)` | Each event of a streamed reply: its `data:` JSON. | The event, nothing, or `null` to leave the event out. |
| `onResponse(body, ctx)` | A reply that isn’t streamed, whole; `ctx.status` is its status. | The body, or nothing. |

`export const events = ["content_block_delta"]` calls `onEvent` only for events of those names (Anthropic Messages and Responses name theirs). Chat Completions and Gemini events have no name, so leave `events` out for them. An event holds a piece of the reply, so a word can be split over two events. A `data: [DONE]` line and comments pass by unseen. A compressed reply passes as it is.

`ctx` has `protocol` (`anthropic`, `chat`, `responses` or `gemini`), `model` and `stream` as the agent asked, `path`, `agent` when magpie knows it, `options` (the plugin’s options) and `state`, an object of the request’s own.

### When a hook fails

A hook has 250 ms for a request, a provider’s try or a whole reply and 50 ms for an event; loading has a second. A hook that throws, runs out of time or returns something else goes on as if it weren’t there: the request or the event is sent as it was. Settings → Plugins shows each middleware’s hooks, how many calls it had, the average time each took and how many failed, with the last error. The hooks see what the agent sent and gets back, before magpie’s redaction on the way out and after it on the way back. magpie’s own requests (thread titles, the router’s classifier, the web searches and image descriptions it makes for an agent’s request) don’t go through middleware.

### Routings and usage rows

The same module can also export `strategies` and `onUsage`. Such a file can be named `*.gateway.js`, and a package can say `"magpie": { "gateway": "./gw.js" }`.

- **Routings..** Each `strategies[name]` is a routing named `<plugin>/<name>` (the package’s short name, or the file’s name without `.gateway.js`), offered in every routing picker of a provider, a pool and a group while the plugin is on. It is a function `(pool, seats, options)`, or an object with `order`, and returns the order to try the seats in, as indexes. Each seat has `key`, `account`, `known`, `learns`, `used`, `soon` (when its windows renew, in ms), `pace`, `weight`, `resting` and `tokens` (what it was sent lately). It has 20 ms; if it throws, takes longer or returns something else, the seats are tried in their listed order. Off, a provider or group routed by it is too.
- **Usage..** `onUsage(row, options)` gets each request’s usage row after it ends: provider, account and key, model, tokens, `ms`, `ttftMs`, status, error type and cost, never a body, prompt or error text. It runs on its own, so a request never waits for it; rows that come while it is busy past a queue are dropped and counted. It has 250 ms.

```
// spread.gateway.js
export const strategies = {
  "fewest-tokens": (pool, seats) =>
    seats.map((_, i) => i).sort((a, b) =>
      (seats[a].resting - seats[b].resting) || (seats[a].tokens - seats[b].tokens)),
}

let slow = 0

export function onUsage(row, options) {
  if (row.ms > (options.slowMs ?? 30000)) {
    slow++
    console.log(`slow: ${row.provider} ${row.model} ${row.ms} ms (${slow} so far)`)
  }
}
```

```
magpie plugin add ./spread.gateway.js
magpie group set fast routing=spread/fewest-tokens
```

## Tools for every agent

A plugin can give tools, with OpenCode’s `tool` hook, and magpie offers them to every agent, not only OpenCode: they are an MCP server of magpie’s own at `/mcp/magpie/tools` (Streamable HTTP). Add that address to any agent that takes an MCP server, and its model can call every tool your plugins that are on give. Each is named `<plugin>_<tool>`, the plugin’s short name first: `weather-tools_now` below.

```
import { tool } from "@opencode-ai/plugin"

export const WeatherTools = async () => ({
  tool: {
    now: tool({
      description: "The weather now in a city.",
      args: { city: tool.schema.string().describe("A city, e.g. Berlin") },
      async execute({ city }, ctx) {
        const r = await fetch(`https://wttr.in/${encodeURIComponent(city)}?format=3`, { signal: ctx.abort })
        return await r.text()  // text; an object is sent as its JSON
      },
    }),
  },
})
```

```
magpie plugin add ./weather-tools
claude mcp add --transport http magpie-tools http://127.0.0.1:3425/mcp/magpie/tools   # Claude Code; other agents take the same address
```

Settings → Plugins lists each plugin’s tools by these names and copies the server’s address. `args` is a zod shape (`tool.schema` is zod), a zod object or a JSON Schema object. The agent is shown it, and magpie checks a call’s arguments against it before `execute` runs; a wrong argument is answered as an error naming it. `ctx` is OpenCode’s, with `agent` the agent that called. A tool has 55 seconds, and `ctx.abort` fires when they are up.

The built-in plugin Plugin tools serves the server. It stays on while a plugin that is on gives a tool; off, no tool is listed and a call says so. A call made with a gateway key counts against that key’s limits. A tool runs in the plugin host with your rights, as a provider plugin does, and its answer goes only to the agent that called it.

Each plugin that gives tools is also a server of its own in the Library’s MCP tab, named by the plugin’s short name (`search1api`), so you don’t have to add the address by hand. With the [MCP router](mcp-router.html) on, its tools are in the router of every agent the router is given, as `search1api__search`; switch it on or off per agent, or turn single tools off, as with any Library server. Removed, it comes back only when you remove the plugin and add it again.

To keep a plugin for its providers but give its tools to no agent, press Hide from agents on its tools line under Plugins › Installed. Its server is then given to no agent, nor to an app at the router’s address, through updates, the plugin off and on, and restarts. Give to agents gives it back to the agents it had.

## Agent plugins

A plugin can also add an *agent*: one magpie has no setup of its own for. It says where the agent keeps its model and what else to write there for the agent to use magpie’s gateway. The agent is then on the Agents page like magpie’s own: pick one of magpie’s models in its row and magpie writes it into the agent’s config, with the gateway’s address and a key of the agent’s own; switch it off and everything goes back to how the user had it. The example below adds [Aider](https://aider.chat).

```
// agent.js, named by "magpie": { "agent": "./agent.js" } in package.json
export const agent = {
  id: "aider", name: "Aider", bin: "aider",
  config: "~/.aider.conf.yml",  // the file magpie edits
  model: "model",                 // the key of the model in it
  prefix: "openai/",              // written before magpie's model id
  ua: ["aider", "litellm"],
  notice: "Aider reads its settings when it starts: restart it to use the new model.",
}

export function connect({ gateway, model }) {
  return {
    "openai-api-base": gateway.v1,
    "openai-api-key": gateway.key,
    "show-model-warnings": false,
  }
}
```

```
magpie plugin add ./agent-aider   # or a single *.agent.js file
```

### The agent export

| Field | What it says |
| --- | --- |
| `id` | Its id, as the Agents page, usage and the CLI name it: lower-case letters, digits, `.`, `_` and `-`. One of magpie’s own agents’ ids (`codex`, `claude`, …) is refused: a plugin adds an agent, it doesn’t replace one. |
| `name` | What the page calls it. The id when left out. |
| `config` | The file magpie edits. `~` and `$VAR` are expanded. It is made when it isn’t there. |
| `format` | `json`, `yaml` or `env`, when the file’s name doesn’t say it (`.json`/`.jsonc`, `.yaml`/`.yml`, `.env`). TOML isn’t supported yet. |
| `model` | The key of the model in the file, as a dotted path for JSON and YAML (`llm.model`). Leave it out for an agent whose model is picked in the agent itself, among the models `connect` writes (Raycast): the row is then a switch with no model picker, and `connect`, which such a plugin must have, is called without `model`. |
| `startup` | For an agent that keeps the model a session starts on in another file than the one `connect` writes, in place of `model`: `config` and `format` of that file, `model` the key of the model in it, and `keys` written beside the model as they are. PiG keeps its providers in `models.json` and its default in `settings.json`: `startup: { config: "~/.pig/agent/settings.json", model: "defaultModel", keys: { defaultProvider: "magpie" } }`. The row then picks the model, and each file is put back as it was. A magpie older than v0.1.3008 reads such a plugin as one with no `model`. |
| `prefix` | Written before magpie’s model id: `openai/` for an agent that reaches OpenAI-compatible endpoints through LiteLLM. The id itself is `<provider>/<model>`, as the gateway takes it. |
| `bin`, `dir` | The command on `PATH` and the folder that say the agent is installed. |
| `ua` | Words of the agent’s User-Agent, to name its requests in Usage when they come without its key. |
| `icon` | A picture for its row: an icon name, an `https://` or `data:` URL. The plugin’s own icon, else a generic one, when left out. |
| `notice` | Said after its model is changed, as for magpie’s own agents. |
| `library` | Where the agent reads what the Library gives: `instructions` (a Markdown file it reads before every conversation), `mcp` (its MCP servers file) with `mcpFormat`, the agent whose file it is shaped like (`alma`, `antigravity`, `claude`, `cline`, `codex`, `commandcode`, `copilot`, `crush`, `cursor`, `devin`, `gemini`, `goose`, `grok`, `hermes`, `kimi`, `omp`, `opencode`, `zed`; `claude` is `{"mcpServers": {…}}`), and `skills` (a folder of `SKILL.md` folders). Each is optional, with `~` and `$VAR` expanded: `library: { instructions: "~/.toy/AGENTS.md", mcp: "~/.toy/mcp.json", mcpFormat: "claude", skills: "~/.toy/skills" }`. Without it the agent is given nothing from the Library, and giving it an item is refused, naming the key its plugin would set. |
| `launch` | For an agent that takes the gateway only from how it is started: `env`, the variables it is started with, each `{key}`, `{url}` or `{v1}` with a path after the address at most, and `model`, the flag that names the model. While it is on one of magpie’s models, magpie puts a function named after its `bin` in the user’s shells (zsh, bash, fish, PowerShell), which runs `magpie <id> run` to start it on the gateway: `launch: { env: { GEMINI_API_KEY: "{key}", GOOGLE_GEMINI_BASE_URL: "{url}" }, model: "--model" }`. Its own model takes the function out. `args` are flags put before the user’s arguments, each `{config}`, the config’s path: `args: { "--settings": "{config}" }`. `plain` are arguments, a subcommand or a flag, that start the agent as it is, never on the gateway: `plain: ["remote-control"]`. |
| `base` | For an agent handed its `config` by `launch.args`, so that the config is magpie’s own file: the agent’s own settings file. `connect` and `own` get it parsed as `base`, the user’s own model is written there, and stepping out takes the config away whole: `base: "~/.gemini/antigravity-cli/settings.json"`. |
| `merge` | For a json `config`: key paths whose object `connect` returns magpie’s members of, written beside the user’s own and taken out alone: `merge: ["customModelsConfig.customModels"]`. |
| `effort`, `wsl`, `aliases` | `effort: true` gives the agent the Effort field; `wsl: true` lists it in WSL distros too; `aliases` are other names `magpie <name>` takes. |

### connect

`connect(input)` returns the other keys to write beside the model, by key path, each with its value; it may be `async`. It is given `gateway` (`url`, `v1` — the URL ending in `/v1` — and `key`, the agent’s own key, which counts its requests under its id), `model` (`id`, `name`, `context`, `output`, `images`, `efforts`, and as `/v1/models` names them `native_endpoints`, the gateway paths a request for it goes on untranslated such as `["/v1/chat/completions"]`, and `pricing`, USD a token as decimal strings: `prompt`, `completion`, `input_cache_read`, `input_cache_write`; each left out when not known, never empty or 0), `models` (every model magpie offers the agent, the same way), `decisionModels` (magpie’s decision models — Jev, Clef, a model a plugin marks `decides` — and the routing groups of them, kept out of `models` and `/v1/models`, each `id`, `name`, `provider` or `group: true`, and `endpoints`, the paths it is asked on: `["/v1/systemone", "/v1/decisions"]`; `[]` for none) and `agent` (`id`, `config`). A plugin without `connect` writes only the model. It is called again when magpie’s models change, so a list it writes stays current.

`own({ config, base, model })`, when exported, gives the agent’s own models for the row’s picker: it gets the config file parsed (`{}` for none), `base` too when the agent has one, and the model the agent is on, and returns a list of `{ value, model, direct }`, `value` what is written as the model, `model` its name at the vendor and `direct` the vendor it goes to (`Google`, `OpenAI`, `Anthropic`). Without it the picker lists the model the agent is on.

### What magpie does with it

- **Writing..** Each key is set in place, the user’s comments and other keys kept. Before the first write, what each key held is kept aside, typed (a number stays a number).
- **The way back..** Picking the agent’s own model again, or switching it off, puts every key back as it was and takes out the keys that weren’t there. The file is never written over whole.
- **Connected or not..** The row says connected while the key that holds magpie’s key still holds it. A key changed by hand afterwards is said in the row, as for magpie’s own agents.
- **How it runs..** As middleware does: in moejs, in magpie’s own process, with imports inside the plugin only, no Node APIs and `console.log` into magpie’s log. Loading and `connect` each have a second. A plugin whose module doesn’t load, or whose `connect` throws, says why in its row on the Plugins page and writes nothing.
- **The Library..** With `library`, the agent is one of the Library’s agents: its instructions go between magpie’s marker lines in the file, its MCP servers into the file beside the user’s own (whose other fields are kept), and its skills linked or copied into the folder. Taking one off takes away only what magpie wrote there, and what a file held before is kept in magpie’s backups. An `mcpFormat` that isn’t one of the list, or an `mcp` without one, keeps the plugin from loading.
- **Declaring it..** `"magpie": { "agent": "./agent.js" }` in `package.json`, or a single file named `*.agent.js` (or `.mjs`). A package can be a provider, middleware and an agent at once. In the plugin market an agent’s entry has `"kind": "agent"` and is listed under Agents; a community one is named `@magpie-community/agent-<name>`.
- **An agent that needs a runtime..** The agent file stays a moejs module, with no timers and nothing imported from outside the plugin. When the agent needs more (a timer, a file watched, a value carried over into the app’s own config), the package can also have a Bun module as its `main`, run as a provider plugin’s is. It is still an agent plugin: a package that declares `magpie.agent` is listed under Agents, on GitHub too, with a `main` or without, and its row in Installed wears the Agent chip, and the Provider chip only when its module serves a provider.

## Pages in the window

A plugin can add a page of its own to magpie’s window. Once it is on, the page has a tab in the sidebar’s Plugins group, after magpie’s own pages. The page is plain HTML, CSS and JavaScript in the plugin’s folder, and needs no Bun and no build step. The example below shows today’s usage.

```
{
  "name": "magpie-usage-glance",
  "version": "0.1.0",
  "magpie": {
    "page": {
      "title": "Usage glance", "file": "page/index.html", "icon": "page/icon.svg",
      "titles": { "zh": "用量速览", "ja": "使用量の概要" }
    },
    "permissions": ["usage:summary"]
  }
}
```

```
<!doctype html>
<link rel="stylesheet" href="style.css">
<script src="_magpie/bridge.js"></script>   <!-- served beside every page -->
<script src="app.js" defer></script>
<p id="calls">…</p>
```

```
await magpie.ready                                  // the window's theme, painted
const s = await magpie.read("usage:summary", { period: "today" })
document.getElementById("calls").textContent = `${s.calls} calls`
const opts = await magpie.options.get()            // this plugin's own options
await magpie.options.set({ ...opts, hideCost: true })
```

The Plugins page shows the page, and what it may read, on the plugin’s row before it is turned on. `page.file` and `page.icon` are paths inside the plugin. The page’s files are what sits in `file`’s folder; a path out of it, or a link that leads out, isn’t served. A package can be a page and a provider, middleware or an agent too. A plugin that is only a page doesn’t start the plugin host. `page.titles` (and a panel’s `titles`) names the tab in other languages, by language code (`zh`, `zh-TW`, `ja`, `de`); `title` is used for any other.

What the page leaves unstyled already looks like magpie: the bridge adds a stylesheet for the font, colours, headings, buttons, fields and tables, with no weight (`:where()`), so any rule of the page’s own wins. Use the `--magpie-*` variables to match the window in your own styles.

### What the page can ask

| Field / call | What it gives |
| --- | --- |
| `magpie.ready` | A promise of the window’s theme. It resolves once the window has answered. Until then the page has said nothing to magpie, and a page that doesn’t say it in 10 seconds is shown as not answering. |
| `magpie.theme, magpie.onTheme(fn)` | `{ dark, lang, tokens }`. The bridge also sets `data-theme`, `lang`, `color-scheme` and `--magpie-bg`, `--magpie-fg`, `--magpie-accent` and so on on `<html>`, and again on each change. |
| `magpie.options.get(), .set(o)` | The plugin’s own options in plugins.json, never another plugin’s. `set` takes an object and answers with the options saved. It can be called at most once a second. |
| `magpie.read(name, params)` | A read that `magpie.permissions` declares. Anything else is refused, by the window and again by magpie. `usage:summary` (`period`: `today`, `7d` or `30d`) gives calls, errors, tokens and cost, with the top 20 models. `providers:list` gives each provider’s id and name. No read gives keys, accounts, sign-ins or request bodies. |

### What the page can’t do

- The page runs in a frame sandboxed to scripts alone (`sandbox="allow-scripts"`, and the same in its `Content-Security-Policy`), in an origin of its own. It can’t reach the window, magpie’s cookie or the window’s storage.
- Its policy allows its own files and nothing else: `connect-src 'none'`, so no `fetch`, WebSocket or beacon, and no forms or frames. Scripts must be files (`<script src>`), not inline. Inline styles and `data:` pictures are fine.
- In a sandboxed frame, WebKit (Safari on iPhone and Mac, the Mac and Linux window) may match `'self'`, or a source without a scheme, to nothing: a `fetch` under `connect-src 'self'` is refused. A page your plugin’s service serves, which runs sandboxed too, should name whole sources (`https://…`) in its own policy. magpie adds the service’s address next to each `'self'` in a `Content-Security-Policy` header the service sends through `magpie web`, but not in a `<meta>` tag.
- magpie’s API refuses any request a frame like this one can make (`Origin: null`, a frame or another site’s request), so it is closed to the page even without the policy. Its files are served at `/_magpie/plugin/<token>/`, a token that changes each time magpie starts.
- A page can still send itself to another site, which then holds its frame. That is why reads give nothing secret. Treat what a page can read as public.
- An error the page doesn’t catch shows This page stopped working in its place, with Try again. Its own scripts’ errors reach it as “Script error.”, so look in the window’s console for the rest.

### Panels in magpie’s own pages

A plugin can also put panels into the pages magpie draws itself. Each one is a small page of its own in the plugin’s folder, with the same bridge, reads, options and sandbox as a page. It sits in a card under a heading with its title, as tall as it draws.

```
{
  "name": "magpie-provider-notes",
  "version": "0.1.0",
  "magpie": {
    "panels": [
      { "slot": "provider", "file": "ui/notes.html", "title": "Notes" },
      { "slot": "usage", "file": "ui/spend.html", "title": "Top models today" }
    ],
    "permissions": ["usage:summary"]
  }
}
```

| `slot` | Where the panel goes | `magpie.context` |
| --- | --- | --- |
| `agents` | The end of the Agents page | `{}` |
| `usage` | The end of Usage’s Overview | `{}` |
| `settings` | A Plugins tab in Settings, there only while a plugin has a panel in it | `{}` |
| `provider` | Each saved provider’s editor | `{ provider: { id, name } }` |

A plugin has at most 8 panels. A panel’s height follows its `<html>` (up to 2400px), so let the page size itself and don’t give `html` or `body` a fixed height. A panel that throws, or doesn’t answer in 10 seconds, shows {name} stopped working with Try again in its own place; the page around it and the panels beside it go on.

### Taking a built-in page’s place

A page can take the place of one of magpie’s own: add `"replaces"` to `magpie.page`, one of `sessions`, `library`, `routing` or `usage`. Its tab then stands where the built-in’s was, and links to that page open the plugin’s. When two plugins ask for the same page, the first in the Plugins list takes it and the other is a page of its own. Turn the plugin off and the built-in page is back as it was.

```
"page": { "title": "My library", "file": "page/index.html", "replaces": "library" }
```

### Items in magpie’s menus

A plugin with a page can add items to the menus of magpie’s rows: a provider’s (right-click it) and an agent’s (its handle, or right-click). They come after magpie’s own, named in the window’s language like a page’s title. Picking one opens the plugin’s page and tells it which item, and the row’s id and name, nothing else of it. The page handles it with `magpie.onAction`; an item picked before the page gave its handler waits for it.

```
"page": { "title": "Balance", "file": "page/index.html" },
"actions": [
  { "id": "check", "menu": "provider", "title": "Check balance", "titles": { "zh": "查余额" } }
]
```

```
magpie.onAction(({ id, provider }) => {
  // id: "check"; provider: { id, name }
});
```

`menu` is `provider` or `agent`. An `id` is lower-case letters, digits and dashes, up to 40. A plugin has at most 8 items, and an item with no `title` takes its page’s. A plugin without a page adds no items. The Plugins page says which menus a plugin adds to.

## pi packages

magpie also runs [pi](https://github.com/earendil-works/pi)’s packages. A pi extension that registers a provider with `pi.registerProvider` works in magpie as it does in pi, with nothing to change, and is added like any plugin (`magpie plugin add pi-antigravity`).

- **What makes a package pi’s..** Its `package.json` has a `pi` manifest (`"pi": { "extensions": [...] }`), the `pi-package` keyword, or `@earendil-works/pi-coding-agent` (or the older `@mariozechner/pi-coding-agent`) among its `dependencies` or `peerDependencies`. A single file counts when it imports pi.
- **Loading..** magpie installs pi beside the package and loads it with pi’s own loader, in the same plugin host. The providers it registers become magpie providers, with the models pi lists for them (an account’s own list when pi can fetch one). Its commands, tools, renderers and event handlers are left alone.
- **Signing in..** An OAuth login runs as pi runs it: its questions (`onPrompt`) are asked in magpie’s sign-in, its page (`onAuth`) opens in the browser, and `refreshToken` renews it. The dialogs a package shows with `ctx.ui` (`select`, `confirm`, `input`, `editor`) and the terminal components it gives `ctx.ui.custom` are asked as magpie’s questions too. A provider that takes an API key gets a key field. Each sign-in is an account, so a pi provider can have several.
- **pi’s files..** pi’s settings, its `auth.json` (each provider’s first account, as pi keeps it) and the files a package writes are in `pi/` under magpie’s config directory, not the user’s `~/.pi`, unless `PI_CODING_AGENT_DIR` is set. magpie keeps the accounts in `plugin-auth.json`, like any plugin’s.
- **Requests..** A pi provider’s models take Anthropic Messages: the gateway translates what the agent sends, magpie streams it through pi, and the answer keeps its thinking, signatures and tool calls. A vendor error is passed on with its status, so failover works as with any plugin.
- **Ids..** A pi provider’s id follows the same rule as any plugin’s; see Provider ids.

## The host protocol

Writing a plugin doesn’t need this section. It is for people working on magpie itself, or debugging the host. magpie writes `{id, method, params}` to the host’s stdin, one per line. The host answers `{id, result}` or `{id, error: {message}}`.

| Method | Does |
| --- | --- |
| `init` | Loads the plugins; runs their `config` hooks. Every other call waits for it. |
| `providers` | Each provider, its methods, accounts and each account’s models. |
| `prompt`, `validate` | A method’s next question; an answer checked. |
| `authorize`, `callback`, `apiKey` | Signing in. |
| `load` | The loader’s options for an account. |
| `fetch` | One request. It streams `{id, event: "head", status, headers}`, then `{id, event: "chunk", data}` (base64), then `{id, result: null}`. `{method: "abort", params: {id}}` cancels it. |
| `usage`, `check` | An account’s usage; an account tried as a request would. |
| `import`, `take`, `signOut`, `reload` | Accounts moved in and out, forgotten, their loaders run again. |

The host also sends events of its own: `log`, `toast`, `auth` (a sign-in saved or refreshed) and `signIn` (an account’s sign-in state, as above). The source is [`internal/plugin/host.js`](https://github.com/yetone/magpie/blob/main/internal/plugin/host.js).

## FAQ

### Does my OpenCode plugin work in magpie unchanged?

Yes, as long as it signs in and makes requests through `auth`, `config`, `provider` and `chat.headers`. What magpie adds (`auth.usage`, `auth.refresh`, `magpie.icon`, `maxConcurrency`, `free`, `rate`, `X-Magpie-Sign-In`) is ignored by OpenCode, so one package serves both.

### Does my pi package work in magpie?

Yes, if it signs in and serves models through `pi.registerProvider`. magpie uses only the providers it registers; see pi packages. Give it the `pi-package` keyword so the search finds it.

### Why is my provider called `…-plugin`?

Its id is one magpie already has. See Provider ids.

### Some of my helper functions run as plugins.

Every function the entry module exports is called as a plugin. Export only the plugin function, or `export default { id, server }`.

### Can I use npm dependencies?

Yes. They are installed with the plugin, but their install scripts aren’t run. Bun’s `fetch`, `crypto`, `fs` and `$` cover most needs.

### Can my plugin run the vendor’s CLI?

Yes, with Bun’s `$` or `child_process`. Several community plugins sign in through the vendor’s own CLI. Expect it to be missing on some machines, and say how to install it in the error.

### What does a plugin see of the user’s work?

Everything in the requests it makes: the conversation, the tools and their results. Send it only where the user asked it to go, and don’t log it.

### How do I make magpie see my edits?

A `magpie` command in a terminal loads the folder as it is now. In the app, turn the plugin off and on in Plugins.

Questions, or a plugin to share? Ask on [Discord](https://discord.gg/vGSnD3ZKQF), or open an issue in [magpie-community/plugins](https://github.com/magpie-community/plugins).

---

Source: https://usemagpie.ai/docs/privacy

# Privacy

Your prompts, replies, keys and accounts go only to the providers you use; magpie has no server of its own in that path. This page lists everything magpie sends by itself, beside those requests, and every switch that stops it. It is written from the code, which is linked in each section.

| What | Where to | Off by default? | How to stop it |
| --- | --- | --- | --- |
| The daily count | PostHog (`us.i.posthog.com`) | On in releases; never in builds from source | Settings → Privacy, `DO_NOT_TRACK=1` |
| Update checks, release notes, the partner list, icons | `usemagpie.ai` | On | `noAutoUpdate` for update checks; the rest are needed by the app |
| Model catalog and exchange rate | `models.dev`, `open.er-api.com` | On | Not switchable; nothing of yours is sent |
| OTLP export | A collector you name | Off | Leave it off |

## The daily count

Once a day (UTC), a running release of magpie (the app, or `magpie serve`) sends one batch to PostHog, so we know how many people use it and which agents, providers and models to look after first. It is sent at start and then looked at every hour; a day already sent is skipped. Builds from source never send it.

The batch has one `magpie active` event with:

- a random id made up on your computer (32 hex characters, tied to nothing about you or the machine), sent as `distinct_id`;
- magpie’s version, `kind` (`app` or `serve`), your system (`$os`) and architecture;
- how many agents, providers and models it is used with, and how many routing groups (left out when you turn off sharing what you use).

Unless you turn that part off, one `magpie uses` event follows for each agent, provider and model, by magpie’s own ids only (at most 50 of each):

- **agents.** connected to magpie: `claude`, `codex`. A WSL distro or an omp profile name is cut off (`omp`).
- **providers.** that are on: a preset’s id (`deepseek`), a subscription’s (`codex`, `copilot`), a known community plugin’s (`plugin:kiro`). A provider you added yourself is only `custom`; any other plugin only `plugin`.
- **models.** the connected agents are set to, as provider id and vendor model id (`deepseek/deepseek-v4`). On a key’s provider, a model id that [models.dev](https://models.dev) doesn’t list (a local model, a fine-tune) is only `<provider>/other`; a model on your own provider is `custom`; a routing group is `group`.

With them go `magpie partner` events: for each partner listed first in the add sheet, by its id, how many times on a day that has ended the sheet showed it, its row was opened, its key page was opened, and a provider was added from it (`what`: `shown`, `opened`, `keys`, `added`; at most 20 a day each, 5 adds). Counts only, never a provider of your own.

With that part on, magpie also tells `usemagpie.ai`, on the same day, which of the plugins Discover lists are installed and on, so Discover can say how many use each one: `POST /api/plugins/report` with the same random id and the plugins’ npm names, or `github:owner/repo` for a repository tagged `magpie-plugin` (at most 50). A plugin from a folder, a private repository or a package Discover doesn’t list is never named. The same report names the MCP servers in your Library that an agent is given and that the Library’s market lists from what ships with magpie, by their market ids only (`context7`, `io.github.owner/name`; at most 50), so the market can put the most used first; a server of your own, or one found only by a search, is never named, nor its address, command or keys. A like on a plugin’s page goes as `POST /api/plugins/like` with the id, the plugin and whether it is on, and only for a plugin installed here; the plugins you liked are kept in `plugin-likes.json`. The site counts the ids that reported a plugin in the last 7 days, drops a report after 30 days, and keeps your address only hashed, for an hour, to limit how often it is asked. Discover reads the counts from `GET /api/plugins/stats`, which carries no id. The code is [internal/stats/plugins.go](https://github.com/yetone/magpie/blob/main/internal/stats/plugins.go) and [site/pluginstats.js](https://github.com/yetone/magpie/blob/main/site/pluginstats.js).

Every event carries `$process_person_profile: false`, so PostHog keeps no person profile for the id. No names, base URLs, accounts, keys, prompts, replies or usage are sent. A whole batch looks like this:

```
{
  "api_key": "phc_nyDyYyrUTRGvNq5U7FBesCyM2j4GdKeqGp8ko7DBerTC",
  "batch": [
    {
      "event": "magpie active",
      "distinct_id": "3f9c…(32 hex)",
      "timestamp": "2026-10-13T08:00:00Z",
      "properties": {
        "version": "0.1.1190", "kind": "app", "$os": "Mac OS X", "arch": "arm64",
        "agents": 2, "providers": 3, "models": 2, "groups": 1,
        "$process_person_profile": false, "distinct_id": "3f9c…"
      }
    },
    { "event": "magpie uses", "distinct_id": "3f9c…", "timestamp": "2026-10-13T08:00:00Z",
      "properties": { "kind": "agent", "id": "claude", "$process_person_profile": false, "distinct_id": "3f9c…" } },
    { "event": "magpie uses", "properties": { "kind": "provider", "id": "custom", … } },
    { "event": "magpie uses", "properties": { "kind": "model", "id": "deepseek/deepseek-v4", … } },
    { "event": "magpie partner", "timestamp": "2026-10-12T12:00:00Z",
      "properties": { "id": "<partner id>", "what": "shown", "count": 3, "day": "2026-10-12", … } }
  ]
}
```

The `api_key` is the project’s PostHog key; it can only send events, not read them. The code is [internal/stats](https://github.com/yetone/magpie/blob/main/internal/stats/stats.go) and [partner_events.go](https://github.com/yetone/magpie/blob/main/internal/provider/partner_events.go).

## Turning it off

Each of these switches stops part or all of it:

- Settings → Privacy → Count me as a user off, or `"noStats": true` in `settings.json` stops the whole daily count.
- `DO_NOT_TRACK=1` or `MAGPIE_NO_STATS=1` in magpie’s environment (any value but empty, `0` or `false`) stops the whole daily count, whatever the settings say.
- Settings → Privacy → Share the agents, providers, models and plugins I use off, or `"noUsageStats": true` leaves out the `magpie uses` and `magpie partner` events, the counts in `magpie active` and the plugin report; the id, version and system are still sent. Partner counts stop being kept too.
- Settings → About → Automatic updates off, or `"noAutoUpdate": true` stops magpie asking `usemagpie.ai` for a newer version by itself (it asks every 6 hours otherwise). This is not part of the count.

A change in Settings takes effect at the next hourly look; no restart is needed. `settings.json` sits in magpie’s folder (see below):

```
{
  "noStats": true,
  "noUsageStats": true,
  "noAutoUpdate": true
}
```

`MAGPIE_STATS_HOST` sends the count to another host instead (it is for testing, and also makes a build from source send).

## Files on your computer

| File | What it is |
| --- | --- |
| `install-id` | The random id, made the first time the count is sent |
| `stats-sent` | The last day (UTC) the count went, so a day is sent once |
| `plugin-likes.json` | The plugins you liked in Discover |
| `partner-counts.json` (in the cache folder) | Partner counts not yet sent, at most 14 days |

`install-id` and `stats-sent` are in magpie’s folder: `~/.config/magpie` on macOS and Linux, `%USERPROFILE%\.config\magpie` on Windows, `$XDG_CONFIG_HOME/magpie` when that is set, and the data folder of a portable magpie. `partner-counts.json` is in `~/.cache/magpie` (`$XDG_CACHE_HOME/magpie`, or `cache` in a portable magpie’s data folder). You can delete any of them: a deleted `install-id` is replaced by a new random one at the next send, so you are counted as a new user; with the count off, none of them is written again.

The request archive (the Request archive switch on the Usage page, above the list of requests) is **off by default**. Turned on while sync has no S3 bucket, it keeps each gateway call’s headers and bodies, secrets masked as for the S3 archive, in `request-archive` in magpie’s folder, one file per call, readable by your user only. It grows to 1 GiB (`requestArchiveLocalMB` in settings.json) and the oldest calls are removed past that. The switch is this computer’s own: sync never turns it on at another computer. With an S3 bucket the calls go to the bucket instead, kept to 1 GiB there too (`requestArchiveMB`), the oldest removed past it, and nothing is written here. Delete the folder whenever you like.

The app writes a log of what it did, `app.log`, in `~/Library/Logs/magpie` on macOS, `%LOCALAPPDATA%\magpie\logs` on Windows and `~/.local/state/magpie` on Linux (see [Where is magpie’s log?](https://usemagpie.ai/docs/start#log)), readable by your user only. It names what magpie did and the errors it met, never keys, prompts or replies, and stays on your computer unless you send it. It is kept to 5 MiB, with one older file, `app.old.log`. Delete them whenever you like.

## What usemagpie.ai sees

magpie asks its own site for a few things, whatever the privacy settings say, as any app asks its update server. None of these requests carries the install id or an account.

- `/api/latest`: the update feed, every 6 hours unless `noAutoUpdate` is on, with `?lang=` for the notes in your language, and `?channel=stable` or `?channel=daily` when Settings → About → Update channel is Stable or Daily; a fresh install asks `?channel=stable` once too, to stay on Stable when it is Stable’s version. Neither says who you are. `/api/notes` gives What’s new after an update.
- `/files/<version>/<file>`: the release files an update and the installer download, served from Cloudflare R2. A file the site doesn’t hold is sent on to github.com. Nothing is counted.
- `/api/partners`: the add sheet’s partner list, every 6 hours. One fetch in ten is counted as a `magpie partners fetch` event, with the country Cloudflare gives, while a partner is listed.
- `/go/<partner>/site` and `/go/<partner>/keys`: a partner’s website and key-page links, opened in your browser, are counted (the partner, which link, a region, a country) as `magpie partner go` before you are sent on.
- `/api/plugins/stats`: Discover’s counts of how many use and like each plugin, and the Library market’s of how many use each MCP server, at most once an hour. It carries no id; the plugin report and likes do, and go only with sharing what you use on.
- `/api/icon?url=…`: icons named by a plugin, an import link or the library are fetched through it, so their hosts see Cloudflare’s address, not yours. The worker passes the picture on and counts and keeps nothing.

The site’s own pages (these docs, the home page) carry Cloudflare Web Analytics and PostHog Web Analytics (`us.i.posthog.com`), without cookies. PostHog keeps a random visitor id in your browser’s local storage for this site, so a return visit counts as the same visitor. It gets each page’s address, the page that sent you, what you click on the page (not what you type), how fast the page and its requests loaded, errors the page hit, your browser, system and screen size, the country and city your address is in, and a recording of the visit (what the page showed, mouse moves, clicks and scrolls, its console messages) with every input box masked; nothing at all when your browser sends Do Not Track or Global Privacy Control. PostHog’s requests go through this site, under `usemagpie.ai/r/`, which passes them and your address on to PostHog and keeps the site’s cookies. Following a `/download` link, or fetching `install.sh`, sends PostHog a count of its own: which file, your country, and whether a browser or a command asked; no id and no address. The app doesn’t load either. The code is [site/worker.js](https://github.com/yetone/magpie/blob/main/site/worker.js).

## Public lists magpie fetches

To price and name models magpie fetches the [models.dev](https://models.dev) catalog (`models.dev/api.json`), and for prices in your currency the USD exchange rate from `open.er-api.com` (kept 12 hours). Plugins and their updates come from the npm registry, and the library’s items from GitHub. These are plain downloads of public data: nothing about you, your providers or your usage is sent, though, as with any request, those hosts see your IP address (or your proxy’s). magpie also asks each of your providers for your allowance and model list, with your own key or sign-in; Settings → Allowances → Allowance reads → When I ask limits those to when you ask.

## OTLP export

magpie can export each gateway request to an OpenTelemetry collector of yours (Langfuse, for example). It is **off by default**, and goes only to the endpoint you set, never to us. When on, it sends per-request spans: agent, provider, model, the name you gave the gateway key it came with (never the key itself), token counts, status, timing and estimated cost. Optional switches add metrics, local agent conversations, and the request and reply bodies (secrets masked). Turn it on in Settings → Observability, or for `magpie serve` with `MAGPIE_OTEL_ENABLED`, `MAGPIE_OTEL_ENDPOINT`, `MAGPIE_OTEL_HEADERS`, `MAGPIE_OTEL_METRICS`, `MAGPIE_OTEL_SESSIONS`, `MAGPIE_OTEL_BODIES` and `MAGPIE_OTEL_BODIES_WHOLE`. An endpoint alone doesn’t turn it on. For Langfuse, pick Langfuse there and give its host and your project’s two keys; magpie makes the endpoint and sign-in from them. Each export’s resource is `service.name=magpie`, plus only what you set yourself in `OTEL_RESOURCE_ATTRIBUTES` and `OTEL_SERVICE_NAME` (a server name, for example); nothing about your machine is looked up. The [reference](https://github.com/yetone/magpie/blob/main/docs/reference.md#otlp-export) has the details.

## Masking what goes to providers

The sections above are what magpie sends by itself. What your agents send goes to the providers you chose, and **privacy masking** keeps the secrets in it on this computer. It is **off by default**; turn it on in Settings → Privacy.

- Before a request leaves this computer, API keys, private keys, tokens, emails, and card and ID numbers whose checksum adds up become placeholders such as `{{API_KEY_k3v9x2mq}}`. Find with a local model adds the names, addresses and passwords no rule can find, with a model that runs on this computer (a 1.6 GB download, on the CPU).
- Every placeholder in the reply, streamed text and tool-call arguments included, turns back into its value, so your agent and your files keep the real values.
- A value gets the same placeholder every time, so the conversation and the prompt cache stay valid.
- Values are held in memory only; the record on disk keeps each value’s kind, length and first characters. If masking is on and can’t run, the request gets a 503 and nothing is sent.
- The model sees the placeholder, not the value. A value a task needs as it is (a team address, a test key) goes under Never mask.

How to turn it on, what each switch masks, an example and how to check it: [Privacy masking](https://usemagpie.ai/docs/masking).

## Why the count is on

magpie works with dozens of agents and providers, and is maintained by a small team. The daily count is how we know which of them people actually use, so they are kept working first. It is on in releases because counts from those who turn it on would be too few to tell that. In exchange it is kept small: a random id, built-in ids, numbers; one switch or `DO_NOT_TRACK=1` turns it off, builds from source never send it, and this page lists everything that goes.
