# magpie

> One local gateway and menu bar app that picks any model for any coding agent

- Category: Evaluation & Production Ops / Gateways & Routing
- Language: Go
- Licence: MIT
- Repository: https://github.com/yetone/magpie
- Website: https://usemagpie.ai
- Canonical page: https://ai-tldr.dev/tools/magpie/

## In short

magpie is a desktop app, CLI and local gateway that lets you choose the model behind each of your AI coding agents from one list. It sits in the Gateways & Routing category of the Evaluation & Production Ops tools and is open-source, written in Go and licensed MIT. To get started: install.

## Overview

magpie is a desktop app, CLI and local gateway that lets you choose the model behind each of your AI coding agents from one list. Every agent keeps its model in its own config file, in its own format, with its own keys and base URLs; magpie edits the one key that matters in each agent's config (atomically, keeping comments, order and formatting) so you can run Claude Code on Kimi, Codex on DeepSeek or Gemini CLI on GLM, and switch any of them from the menu bar. The README lists more than 60 supported agents, from Claude Code, Codex, Gemini CLI and OpenCode to Zed, Cursor CLI, Goose, Cline and Copilot CLI, and magpie shows only the ones installed on your machine.

Underneath sits one gateway at `127.0.0.1:3425` that speaks OpenAI Chat, OpenAI Responses, Anthropic Messages and Gemini and translates between them, including streaming, tool calls and reasoning. Behind it you add providers from presets (Anthropic, OpenAI, DeepSeek, Kimi, Zhipu GLM, OpenRouter, Ollama, LM Studio and many more, or any OpenAI- or Anthropic-compatible URL) or reuse the subscriptions your agents are already signed in to, such as a Claude, ChatGPT, Copilot, Gemini or Grok plan. Any other tool that accepts a base URL can point at the same gateway.

Routing groups bundle several models an agent picks as one name, such as `group/daily-coding`; when a quota runs out the gateway moves to the next account or model and the agent never sees the error. Around that core, magpie tracks tokens, cache hits, cost and quota windows, runs plugins and JavaScript middleware on Bun, and can share its gateway on the local network, with a remote magpie, or from a Docker image. It is written mostly in Go, MIT-licensed, and runs on macOS, Windows, Linux, Docker and Termux; the repository does not accept outside pull requests, and feedback goes through the project's Discord.

## What it does

- Per-agent model picker across every provider you add, written into each agent's own config file, with profiles that save and restore every agent's setup at once
- Local gateway at 127.0.0.1:3425 that translates between OpenAI Chat, OpenAI Responses, Anthropic Messages and Gemini, with streaming, tool calls and reasoning
- Signed-in subscriptions (Claude, Codex/ChatGPT, GitHub Copilot, Gemini Code Assist, Grok and more) offered as providers to every other agent, with several accounts per subscription
- Routing groups with smart, order, rotate, usage and pace modes, nested groups, sticky conversations for prompt caching, and optional intent routing by a small model
- Plugins and gateway middleware (onRequest, onEvent, onResponse hooks) installed from npm, including OpenCode auth plugins and pi packages
- Usage, cost, quota and session tracking, plus a shared library of instructions, MCP servers, skills and subagents written into each agent's files

## Getting started

Install the app, add a provider, then point each agent at a model. Everything in the app also works from the terminal.

1. Install

   Download the app from usemagpie.ai or use the install script. The README also lists `go install github.com/yetone/magpie@latest` and a Docker image (`ghcr.io/yetone/magpie`); behind a firewall, the script takes `--proxy` or `--mirror`.

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

2. Add a provider

   In the app, go to Providers → Add provider and pick a preset or sign in with a subscription. From the terminal, a preset needs only the key.

```bash
magpie provider add deepseek sk-…
```

3. Pick a model for each agent

   Choose a model on the Agents page, or set it from the CLI as `provider/model`. Start a new agent session and it runs on the new model.

```bash
magpie claude deepseek/deepseek-v4-pro   # Claude Code on DeepSeek
magpie codex moonshot/kimi-k2.5          # Codex on Kimi
```

4. Create a routing group

   A group lets an agent fail over between models and subscriptions. Profiles save the whole setup under a name, and `magpie quota` shows what is left on every plan.

```bash
magpie group add "Opus anywhere" models=claude/claude-opus-5-5,copilot/claude-opus-5.5 routing=smart
magpie claude group/opus-anywhere
magpie save work && magpie use work
magpie quota
magpie tui
```

5. Point any other tool at the gateway

   Anything that takes a base URL can use the same gateway.

```bash
export OPENAI_BASE_URL=http://127.0.0.1:3425/v1     OPENAI_API_KEY=magpie
export ANTHROPIC_BASE_URL=http://127.0.0.1:3425     ANTHROPIC_API_KEY=magpie
export GOOGLE_GEMINI_BASE_URL=http://127.0.0.1:3425 GEMINI_API_KEY=magpie
```

## When to use it

- Run several coding agents (Claude Code, Codex, Gemini CLI, OpenCode) on models from other vendors without hand-editing each agent's config
- Use a subscription you already pay for, such as a ChatGPT or Claude plan, inside agents other than the vendor's own
- Keep an agent working when one account's quota runs out by failing over across accounts and models in a routing group
- Track token spend, cache hit rate and remaining quota across every key, plan and account in one place
