From 795cab91ff011d7ac899679ee470d3416ebae94b Mon Sep 17 00:00:00 2001 From: yetone Date: Tue, 10 Nov 2026 04:01:05 +0800 Subject: [PATCH] site: OpenRouter and GitHub Copilot pages in en, zh and ja Two provider guides beside DeepSeek, Kimi, GLM, Qwen and MiniMax, at /docs/{,zh/,ja/}{openrouter,copilot}, linked from each agent guide's "By provider" line, from each other, the sitemap and llms.txt (llms-full.txt rebuilt). Facts come from source. OpenRouter: the preset's Chat and Anthropic bases in presets.go, the relay path that sends Claude Code's requests as they are, Messages for Claude models (MessagesFirst) so cache_control survives, skipOpenRouterAnthropic for the model list, readOpenRouter's credits, MaxRPM on free models and openRouterSharedPool, creditRest. Copilot: device sign-in and the three read-only login sources (copilot_accounts.go, copilot_cli.go), GHE.com hosts, /models and copilot_refused.go, copilot_auto.go's pick and fallback, the plan names (copilot_accounts.go: Free, Pro, Pro+, Max, Education, Business, Enterprise), copilotSubscriptionUsage's windows, cacheWritesAlike. Header names, GitHub's terms and env variables are left out. Run: mote-run sh -c 'cd site && node --test worker.test.mjs install.test.mjs': 71 pass, 0 fail. JSON-LD of the six pages parses. Deployed (1a513b7d); the six pages answer with their titles. Not tried: a real OpenRouter key or Copilot seat through the pages' commands. --- site/public/docs/claude-code-models.html | 2 +- site/public/docs/codex-models.html | 2 +- site/public/docs/copilot.html | 352 ++++++++++++++++++++ site/public/docs/gemini-cli-models.html | 2 +- site/public/docs/ja/claude-code-models.html | 2 +- site/public/docs/ja/codex-models.html | 2 +- site/public/docs/ja/copilot.html | 352 ++++++++++++++++++++ site/public/docs/ja/gemini-cli-models.html | 2 +- site/public/docs/ja/opencode-models.html | 2 +- site/public/docs/ja/openrouter.html | 343 +++++++++++++++++++ site/public/docs/opencode-models.html | 2 +- site/public/docs/openrouter.html | 343 +++++++++++++++++++ site/public/docs/zh/claude-code-models.html | 2 +- site/public/docs/zh/codex-models.html | 2 +- site/public/docs/zh/copilot.html | 352 ++++++++++++++++++++ site/public/docs/zh/gemini-cli-models.html | 2 +- site/public/docs/zh/opencode-models.html | 2 +- site/public/docs/zh/openrouter.html | 343 +++++++++++++++++++ site/public/llms-full.txt | 299 ++++++++++++++++- site/public/llms.txt | 2 + site/public/sitemap.xml | 6 + 21 files changed, 2399 insertions(+), 17 deletions(-) create mode 100644 site/public/docs/copilot.html create mode 100644 site/public/docs/ja/copilot.html create mode 100644 site/public/docs/ja/openrouter.html create mode 100644 site/public/docs/openrouter.html create mode 100644 site/public/docs/zh/copilot.html create mode 100644 site/public/docs/zh/openrouter.html diff --git a/site/public/docs/claude-code-models.html b/site/public/docs/claude-code-models.html index d0fe2eb37..c4723af55 100644 --- a/site/public/docs/claude-code-models.html +++ b/site/public/docs/claude-code-models.html @@ -251,7 +251,7 @@ magpie claude codex/gpt-5.5

The routing modes are in Get started.

-

By provider: DeepSeek · Kimi and Kimi Code · GLM Coding Plan · Qwen · MiniMax

+

By provider: DeepSeek · Kimi and Kimi Code · GLM Coding Plan · Qwen · MiniMax · OpenRouter · GitHub Copilot

FAQ

Do I set ANTHROPIC_BASE_URL myself?

diff --git a/site/public/docs/codex-models.html b/site/public/docs/codex-models.html index c632c5cde..0bb96c7ea 100644 --- a/site/public/docs/codex-models.html +++ b/site/public/docs/codex-models.html @@ -251,7 +251,7 @@ magpie codex claude/…

The routing modes are in Get started.

-

By provider: DeepSeek · Kimi and Kimi Code · GLM Coding Plan · Qwen · MiniMax

+

By provider: DeepSeek · Kimi and Kimi Code · GLM Coding Plan · Qwen · MiniMax · OpenRouter · GitHub Copilot

FAQ

Do I write [model_providers] myself?

diff --git a/site/public/docs/copilot.html b/site/public/docs/copilot.html new file mode 100644 index 000000000..09fb7bb81 --- /dev/null +++ b/site/public/docs/copilot.html @@ -0,0 +1,352 @@ + + + + + +GitHub Copilot in Claude Code, Codex, Gemini CLI and OpenCode · magpie + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

Docs · Provider

+

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 providerIn magpie’s Providers tab, press + Add provider and click the Copilot tile.
  2. +
  3. Enter the code on GitHubmagpie 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.
  4. +
  5. Pick a model for an agentIn the Agents tab, click the model on the agent’s row and choose a copilot/… model.
  6. +
+
Terminal
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.

+
Terminal
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.
  • +
  • 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.
  • +
  • Gemini CLI speaks Gemini’s API. magpie points it at its gateway and translates. Models in Gemini CLI.
  • +
  • OpenCode gets the model in opencode.json, with its reasoning variants. Models in OpenCode.
  • +
+

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.
  • +
  • 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 seeWhat it means
GitHub refused this Copilot sign-in; sign in againGitHub 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 refusedThe 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 subscriptionThe 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 planCopilot 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 GitHubThe 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 magpieSettings → 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 · Kimi and Kimi Code · GLM Coding Plan · Qwen · MiniMax · OpenRouter · Claude, ChatGPT and other subscriptions

+

Every agent: Models in Claude Code, Models in Codex, Models in Gemini CLI, Models in OpenCode. Ask on Discord if you get stuck.

+
+
+ + + + + + + diff --git a/site/public/docs/gemini-cli-models.html b/site/public/docs/gemini-cli-models.html index 8d81234d4..4c50ab8c6 100644 --- a/site/public/docs/gemini-cli-models.html +++ b/site/public/docs/gemini-cli-models.html @@ -235,7 +235,7 @@ magpie gemini model codex/gpt-5.5

The routing modes and rules are in Get started.

-

By provider: DeepSeek · Kimi and Kimi Code · GLM Coding Plan · Qwen · MiniMax

+

By provider: DeepSeek · Kimi and Kimi Code · GLM Coding Plan · Qwen · MiniMax · OpenRouter · GitHub Copilot

FAQ

Can Gemini CLI use models that aren’t Gemini?

diff --git a/site/public/docs/ja/claude-code-models.html b/site/public/docs/ja/claude-code-models.html index ccd77a9cc..f72ed846a 100644 --- a/site/public/docs/ja/claude-code-models.html +++ b/site/public/docs/ja/claude-code-models.html @@ -251,7 +251,7 @@ magpie claude codex/gpt-5.5

ルーティングモードははじめにで説明しています。

-

プロバイダ別:DeepSeek · Kimi と Kimi Code · GLM Coding Plan · Qwen · MiniMax

+

プロバイダ別:DeepSeek · Kimi と Kimi Code · GLM Coding Plan · Qwen · MiniMax · OpenRouter · GitHub Copilot

よくある質問

ANTHROPIC_BASE_URL は自分で設定しますか?

diff --git a/site/public/docs/ja/codex-models.html b/site/public/docs/ja/codex-models.html index 1488f1f01..711083878 100644 --- a/site/public/docs/ja/codex-models.html +++ b/site/public/docs/ja/codex-models.html @@ -251,7 +251,7 @@ magpie codex claude/…

ルーティングモードははじめにで説明しています。

-

プロバイダ別:DeepSeek · Kimi と Kimi Code · GLM Coding Plan · Qwen · MiniMax

+

プロバイダ別:DeepSeek · Kimi と Kimi Code · GLM Coding Plan · Qwen · MiniMax · OpenRouter · GitHub Copilot

よくある質問

[model_providers] は自分で書きますか?

diff --git a/site/public/docs/ja/copilot.html b/site/public/docs/ja/copilot.html new file mode 100644 index 000000000..e0917256b --- /dev/null +++ b/site/public/docs/ja/copilot.html @@ -0,0 +1,352 @@ + + + + + +GitHub Copilot を Claude Code・Codex・Gemini CLI・OpenCode で使う · magpie + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

ドキュメント · プロバイダ

+

GitHub Copilot を Claude Code・Codex・Gemini CLI・OpenCode で使う

+

Copilot のシートには Claude、GPT、Gemini などのモデルが含まれています。magpie で一度 Copilot にサインインすれば、Claude Code・Codex・Gemini CLI・OpenCode などつないだすべてのツールが、magpie のゲートウェイ 127.0.0.1:3425 経由でプランのモデルを使えます。API キーは要りません。

+ +

Copilot にサインインする

+
    +
  1. プロバイダを追加を開くmagpie の プロバイダ で + プロバイダを追加 を押し、Copilot のタイルをクリックします。
  2. +
  3. GitHub でコードを入力magpie がコードを表示し、GitHub のデバイスページ github.com/login/device を開きます。コードを入力して承認すると、magpie が GitHub にどのアカウントか、どのプランかを確かめ、アカウントが Copilot の下に表示されます。
  4. +
  5. ツールで選ぶエージェント タブで、ツールの行のモデルをクリックし、copilot/… のモデルを選びます。
  6. +
+
ターミナル
magpie accounts add copilot                        # github.com
+magpie accounts add copilot --host acme.ghe.com    # GHE.com の GitHub Enterprise
+magpie accounts copilot                            # 各アカウントと使用量
+

magpie は次の 3 か所の Copilot サインインを使います。

+
    +
  • Copilot のエディタプラグイン。~/.config/github-copilot(apps.json か hosts.json)にあるサインイン。
  • +
  • Copilot CLI。~/.copilot/config.json にあるサインインで、トークンはシステムのキーチェーンか、このファイルに平文で入っています。Windows の magpie は、起動中の WSL ディストリビューションにある Copilot CLI のサインインも config.json からだけ読みます。
  • +
  • magpie 自身のもの。magpie でコードを使ってサインインした各アカウント。トークンは magpie 自身の logins.json に保存されます。
  • +
+

エディタと CLI のサインインは読むだけで、magpie が書き換えることはありません。両方あるときは、エディタの github.com のサインイン、CLI のサインイン、エディタの GHE.com のサインインの順に使います。GitHub がエディタのトークンを拒否したときは、CLI にある同じアカウントのサインインに切り替え、別人のアカウントに替わることはありません。

+
GHE.com の GitHub Enterprise。データレジデンシーを使うエンタープライズは自社の <name>.ghe.com でサインインするので、アカウントは --host を付けて追加します(サインイン画面の「GHE.com のアカウント?」に答えても同じです)。magpie が受け付けるのは github.com か <name>.ghe.com のアドレスだけなので、GitHub のトークンが任意のホストに送られることはありません。このアカウントはエンタープライズの copilot-api.<name>.ghe.com で提供されます。同じログイン名でも github.com と GHE.com では別のアカウント(you と you@acme.ghe.com)になります。
+ +

シートで使えるモデル

+

magpie はアカウントごとに Copilot の /models に問い合わせ、返ってきたモデルを並べます。決まった表ではなく、プランに合わせた一覧になります。モデル名は copilot/ に Copilot 自身の ID を付けたもので、たとえば copilot/claude-opus-5.5、copilot/gpt-5.4、copilot/gpt-5.3-codex です。magpie models ですべて表示できます。

+
    +
  • チャットモデルだけ。Copilot の内部用モデル、どのモデルピッカーにも出ないモデル、そのアカウントで有効にできないモデルは除きます。
  • +
  • 規約の同意が要るモデル。規約に未同意のモデルも一覧に出ます。最初のリクエストで magpie が同意し、Copilot のエディタで有効にしたのと同じ状態になります。
  • +
  • 推論レベルは Copilot がモデルごとに示すものを使い、各ツールのピッカーに表示されます。
  • +
  • Auto は必ず一覧にあります。Copilot Auto を参照してください。
  • +
  • 画像モデル(GPT Image 2.5 Flare など)は画像生成用として並び(設定 → モデル → 画像)、チャットモデルとしては出ません。
  • +
  • 古いモデル。学生プランの GPT-4.1 や GPT-4o のように Copilot が API を示さないモデルは、Chat Completions だけで問い合わせます。
  • +
+

Claude Code はバージョンにドットを含む Claude の名前を古いモデルとして読むので、magpie は Copilot の Claude モデルをハイフン表記(claude-opus-5-5)で渡し、Copilot に届く前に元の名前に戻します。他のツールには Copilot の表記のまま見えます。

+ +

ツールごとの使い方

+

エージェント タブで各ツールの行のモデルをクリックして選ぶか、ターミナルで選びます。各ガイドに、magpie がそのツールの設定に何を書くか、どう元に戻すかがあります。

+
ターミナル
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 は Anthropic Messages を話します。Copilot の Claude モデルも Messages で提供されているので、リクエストはそのまま渡ります。GPT や Gemini のモデルには magpie が変換して渡します。Claude Code で他のモデル。
  • +
  • Codex が話すのは OpenAI Responses だけで、magpie も Copilot の OpenAI モデルには Responses で問い合わせるので、リクエストはそのまま渡ります。これらのモデルでは Codex の Web 検索を Copilot 側が実行し、Codex のネイティブなコンパクションも使えます。Copilot の Claude モデルではネイティブなコンパクションは使えません。Codex で他のモデル。
  • +
  • Gemini CLI は Gemini の API を話します。magpie がゲートウェイに向けて変換します。Gemini CLI で他のモデル。
  • +
  • OpenCode には、magpie が opencode.json にモデルを推論バリアントつきで書きます。OpenCode で他のモデル。
  • +
+

Copilot CLI も magpie がつなぐエージェントの一つです。その行では auto(Copilot が選ぶ)と Copilot 自身のモデルに加えて、magpie に追加した他のどのモデルも選べます。それらは Copilot CLI の providers.json を通じて届きます。

+ +

リクエストが Copilot に届くまで

+

Copilot はすべてのモデルをすべての API で提供しているわけではありません。最新の OpenAI モデルは Responses だけ、Claude モデルは Chat Completions と Anthropic Messages、Gemini モデルと古いモデルは Chat Completions だけです。magpie はリクエストをそのモデルが使える API に送り、ツールの API と違えば変換します。ストリーミングとツール呼び出しもそのままです。

+
    +
  • API が違うとき。Copilot がそのモデルはこの API では提供していないと答えたら、magpie はリクエストを次の API 向けに組み直して送り、どれが通ったかを覚えます。
  • +
  • 自分で固定する。magpie model api copilot/<model> chat(または responses、anthropic)で、そのモデルをその API だけで問い合わせます。auto で magpie の選択に戻ります。
  • +
  • Gemini のツール定義。Copilot の Gemini モデルは、Codex のツール定義の一部を 400「invalid request body」で断っていました。magpie は安全に書き換えられると確かめられたものを書き換え、それらのツールが届くようにします。
  • +
+ +

Copilot Auto

+

copilot/auto は、Copilot があなたのアカウント向けに選ぶモデルです。Copilot の /models には出ないので、magpie が必ず追加します。学生プランで選べるのはこれだけです。

+
    +
  • magpie はそのターンのプロンプトを付けて、Copilot Chat の既定の設定で Copilot に選択を求めます。選ばれたモデルは最長 1 時間使い回します。
  • +
  • Copilot がそのアカウントに Auto を提供していないか、アカウントが断られたモデルを選んだときは、アカウントが手動で選べるモデルが 10 分間代わりを務めます。順番は Copilot のベースモデル、その既定モデル、gpt-4.1、プレミアムでないモデル、残りのモデルです。
  • +
  • Auto が選んだモデルをその後 Copilot が断ったら、magpie は別のモデルを選んでリクエストを送り直します。
  • +
  • Auto が選んだモデルはリクエストのルートに記録されるので、どのモデルが答えたかがわかります。
  • +
+ +

プレミアムリクエスト、使用量、費用

+

Copilot の各アカウントには、GitHub が報告する 3 つの利用枠を示すカードがあります。プレミアムリクエスト、チャットリクエスト、補完 で、それぞれ「使用量 / 利用枠」の形です。magpie accounts copilot も同じ内容を表示します。

+
    +
  • 毎月。利用枠は毎月、GitHub が示す日に更新されます。
  • +
  • 無制限の枠は 無制限 と表示されます。GitHub が数字を示さない枠はカードに出さず、無制限とはみなしません。
  • +
  • 1 ターン 1 リクエスト。入力した 1 ターンは 1 リクエストとして課金され、そのターンを続けるツールの結果は数えられません。
  • +
  • Business と Enterprise。利用枠を使い切ったシートは一時停止されるので、magpie はそのアカウントを使い切ったものとして次のアカウントに移ります。組織で共有するプレミアム利用枠も、使い切ると使い切りと表示されます。
  • +
  • その他のプラン。プレミアム利用枠を超えて支払えるプランなら、使い切ってもアカウントは止まりません。補完も数えますが、magpie を通るリクエストは補完を使いません。
  • +
  • 利用枠を使わないモデル。Copilot のベースモデル gpt-4.1 は、どのプランでも利用枠に計上されません。
  • +
+

使用量 タブは、magpie を通った各ツールとモデルのトークン、キャッシュヒット、費用を数えます。サブスクリプションの費用はモデル提供元の定価による見積もりで、モデルに価格を設定していればその価格を使います。Anthropic 自身の価格と違う点が一つあります。Copilot はキャッシュ書き込みを保持時間にかかわらず同じ価格で課金するので、magpie は 1 時間のキャッシュ書き込みを 5 分の価格で計算します。claude-opus-5.5 なら 100 万トークンあたり 5 ドルで、Anthropic の入力 2 倍なら 8 ドルになるところです。

+ +

複数アカウントとフォールバック

+
    +
  • アカウントを追加する。Copilot のタイルをもう一度クリックするか、magpie accounts add copilot をもう一度実行します。使用中のアカウントが先頭に、残りは追加した順に並びます。
  • +
  • どれを先に使うか決める。magpie accounts switch copilot <login> で切り替え、magpie accounts forget copilot <login> で削除します。同じログイン名が github.com と GHE.com の両方にあるときは、フルネーム(you@acme.ghe.com)で指定するか --host を付けます。
  • +
  • リクエストを分散する。Copilot の行で使うアカウントにチェックを入れます。ルーティング で分散方法を決め、既定は スマート です。プロバイダの フォールバック には、すべてのアカウントがクォータ切れ、レート制限、障害のときに使うモデルを並べます。サブスクを任意のエージェントでを参照してください。
  • +
  • 2 つのサブスクリプションで同じモデル。Claude サブスクリプションの Claude Opus と Copilot の Claude Opus は、自動で 1 つのグループ auto/<model> になります。順番を自分で決めるなら magpie group add "Opus anywhere" models=claude/claude-opus-5-5,copilot/claude-opus-5.5 routing=order です。
  • +
  • エディタのサインインが切れたとき。Copilot のエディタが持つトークンを GitHub が拒否しても、同じログイン名で magpie にサインインしたアカウントは残り、そのまま使われます。
  • +
+ +

トラブルシューティング

+
+ + + + + + + + + + +
表示意味
GitHub がこの Copilot のサインインを拒否しました。再度サインインしてくださいGitHub がアカウントのトークンを受け付けなくなりました。その行からサインインし直すと、アカウントはその場で更新され、設定は残ります。ネットワークエラーや GitHub の 5xx で印が付くことはなく、リクエストが一度通れば印は消えます。
the GitHub token Copilot’s editors keep in … was refusedエディタのサインインが切れています。エディタか magpie で Copilot にサインインし直すか、そのファイルを別の場所に移してください。
<login> has no Copilot subscription承認した GitHub アカウントに Copilot のプランがありません。シートのあるアカウントでサインインしてください。
Copilot doesn’t serve this model on Anthropic’s Messages API; it isn’t about your planCopilot はそのモデルを他の API でだけ提供しています。プランの問題ではありません。magpie model api copilot/<model> chat で Chat Completions に送れます。
The requested model is not supported.Copilot が今このアカウントにそのモデルを提供していません。magpie はアカウントのモデル一覧と各ツールの選択肢から 6 時間外し、その後もう一度試します。Auto なら別のモデルを選んで送り直します。
Copilot doesn’t offer Auto to this account …Copilot が選択を返さず、アカウントにも手動で選べるモデルがありません。github.com/settings/copilot でプランを確認してください。
the code expired; start again · the sign-in was declined on GitHub入力前にコードの期限が切れたか、GitHub のページで拒否されました。サインインをやり直してください。
Copilot signs in on github.com or an enterprise’s <name>.ghe.com, not …--host に github.com でも GHE.com でもないアドレスが指定されました。
subscription accounts are off in magpie設定 → プライバシー → サブスクリプションアカウント がオフ(または magpie accounts discovery off を実行済み)なので、magpie はどのサインインも読まず、Copilot を含めどのサブスクリプションも提供しません。オンにするか、magpie accounts discovery on を実行してください。
+ +

よくある質問

+

Claude Code で Copilot のサブスクリプションを使うには?

+

magpie で Copilot にサインインし(プロバイダ → プロバイダを追加 → Copilot。GitHub で入力するコードが表示されます)、Claude Code の行で copilot/claude-opus-5.5 などの copilot/… モデルを選ぶか、magpie claude copilot/claude-opus-5.5 を実行します。magpie が Claude Code の settings.json を書きます。Copilot の Claude モデルには Claude Code の Anthropic リクエストがそのまま届き、GPT と Gemini のモデルには magpie が変換して渡します。

+

Codex で Copilot のモデルを使えますか?

+

使えます。Codex は OpenAI Responses を話し、magpie も Copilot の OpenAI モデルには Responses で問い合わせるので、リクエストはそのまま渡り、Web 検索も使えます。Copilot の Claude と Gemini のモデルは magpie が変換します。Codex の行で選ぶか magpie codex copilot/gpt-5.4 を実行すると、Codex の /model に並びます。

+

Gemini CLI や OpenCode でも Copilot を使えますか?

+

使えます。magpie gemini model copilot/gpt-5.4-mini か magpie opencode copilot/claude-opus-5.5 を実行するか、そのツールの行でモデルを選びます。magpie が Gemini CLI のリクエストを変換し、OpenCode の opencode.json にモデルを書きます。

+

VS Code などのエディタで Copilot にサインインしておく必要はありますか?

+

ありません。magpie はデバイスコードで自分で GitHub にサインインします。このコンピュータで Copilot のエディタプラグインや Copilot CLI がすでにサインインしていれば、そのサインインも読みますが、書き換えることはありません。

+

プレミアムリクエストを消費しますか?

+

リクエストはあなたのアカウントで Copilot に送られるので、Copilot の数え方でプランに計上されます。入力した 1 ターンは 1 リクエストとして課金され、そのターンを続けるツールの結果は数えられません。magpie は各アカウントのプレミアムリクエスト、チャットリクエスト、補完の使用量を表示します。

+

Copilot Business・Enterprise・GHE.com でも使えますか?

+

使えます。magpie は GitHub からプラン(Free、Pro、Pro+、Max、Education、Business、Enterprise)を読みます。GHE.com のエンタープライズは magpie accounts add copilot --host <name>.ghe.com でサインインします。Business や Enterprise のシートは利用枠を使い切ると一時停止されるので、magpie は更新までそのアカウントを使い切ったものとして扱います。

+

Copilot のモデルが一覧にないのはなぜですか?

+

magpie が並べるのは、Copilot の /models がそのアカウントに返すモデルです。チャットモデルだけで、どのモデルピッカーにも出ないものと、そのアカウントで有効にできないものは除きます。Copilot が「The requested model is not supported.」で断ったモデルは 6 時間外し、プランが変わった場合に備えてその後もう一度試します。

+ +

プロバイダ別:DeepSeek · Kimi と Kimi Code · GLM Coding Plan · Qwen · MiniMax · OpenRouter · Claude・ChatGPT などのサブスク

+

ツールごとのガイド:Claude Code で他のモデル、Codex で他のモデル、Gemini CLI で他のモデル、OpenCode で他のモデル。困ったときは Discord で質問してください。

+
+
+ + + + + + + diff --git a/site/public/docs/ja/gemini-cli-models.html b/site/public/docs/ja/gemini-cli-models.html index 61f9daf32..704917205 100644 --- a/site/public/docs/ja/gemini-cli-models.html +++ b/site/public/docs/ja/gemini-cli-models.html @@ -235,7 +235,7 @@ magpie gemini model codex/gpt-5.5

ルーティングモードとルールははじめにで説明しています。

-

プロバイダ別:DeepSeek · Kimi と Kimi Code · GLM Coding Plan · Qwen · MiniMax

+

プロバイダ別:DeepSeek · Kimi と Kimi Code · GLM Coding Plan · Qwen · MiniMax · OpenRouter · GitHub Copilot

よくある質問

Gemini CLI で Gemini 以外のモデルを使えますか?

diff --git a/site/public/docs/ja/opencode-models.html b/site/public/docs/ja/opencode-models.html index c69f344d4..aaf325d27 100644 --- a/site/public/docs/ja/opencode-models.html +++ b/site/public/docs/ja/opencode-models.html @@ -239,7 +239,7 @@ magpie visible opencode all # すべてに戻す
ターミナル
magpie opencode default

magpie を使う前の model と small_model が戻り、magpie プロバイダがファイルから取り除かれます。

-

プロバイダ別:DeepSeek · Kimi と Kimi Code · GLM Coding Plan · Qwen · MiniMax

+

プロバイダ別:DeepSeek · Kimi と Kimi Code · GLM Coding Plan · Qwen · MiniMax · OpenRouter · GitHub Copilot

よくある質問

OpenCode で DeepSeek を使うには?

diff --git a/site/public/docs/ja/openrouter.html b/site/public/docs/ja/openrouter.html new file mode 100644 index 000000000..3a5148ebe --- /dev/null +++ b/site/public/docs/ja/openrouter.html @@ -0,0 +1,343 @@ + + + + + +OpenRouter を Claude Code・Codex・Gemini CLI・OpenCode で使う · magpie + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

ドキュメント · プロバイダ

+

OpenRouter を Claude Code・Codex・Gemini CLI・OpenCode で使う

+

OpenRouter は多くのベンダーのモデルを一つのキーで提供していて、OpenAI Chat Completions と Anthropic Messages を話します。キーを magpie に一度追加すれば、Claude Code・Codex・Gemini CLI・OpenCode などつないだすべてのツールが、magpie のゲートウェイ 127.0.0.1:3425 経由で OpenRouter のどのモデルでも使えます。ツールごとに別のモデルを選べます。

+ +

OpenRouter を追加する

+
    +
  1. キーを取得openrouter.ai/keys で作ります。
  2. +
  3. プロバイダを追加magpie の プロバイダ で + プロバイダを追加 を押し、OpenRouter を選んでキーを貼り付け、保存します。magpie が OpenRouter に提供モデルを問い合わせます。
  4. +
  5. ツールで選ぶエージェント タブで、ツールの行の anthropic/claude-opus-5.5 などの OpenRouter モデルを選びます。
  6. +
+
ターミナル
magpie provider add openrouter sk-…
+magpie provider test openrouter
+

magpie のモデル ID は プロバイダ/モデル の形なので、OpenRouter のモデルは openrouter/anthropic/claude-opus-5.5 のようになります。前がプロバイダ、後ろが OpenRouter 自身の ID です。キーは magpie の設定に保存され、magpie がシェルから読むことはありません。

+

OpenRouter のドキュメントには、ランキングにアプリ名を載せるための任意のヘッダー HTTP-Referer と X-OpenRouter-Title があります。magpie は送りません。リクエストをアプリとして記録させたいときは、プロバイダ編集画面の ヘッダー に候補として出るので、そこで追加します。

+ +

エンドポイント

+
+ + + + +
APIベース URL用途
Chat Completionshttps://openrouter.ai/api/v1モデル一覧、Claude 以外のモデルへのリクエスト、画像モデル
Anthropic Messageshttps://openrouter.ai/apiClaude Code のリクエストと、どのツールからでも Claude のモデル
Decisionshttps://openrouter.ai/api/v1インテントルーティング用の判定モデル
+

magpie は OpenRouter の Responses API を使いません。Codex のように Responses を話すツールは、上の二つのどちらかに変換されます。

+ +

モデル一覧

+
    +
  • 一覧の出どころ。magpie は https://openrouter.ai/api/v1/models から一覧を取ります。各モデルのコンテキスト長もここから読みます。モデル名・推論レベル・価格は models.dev の openrouter カタログから来ます。
  • +
  • ツールに見えるモデル。OpenRouter のモデルは何百もあります。自分で選ばない限り、magpie は OpenRouter の一覧の先頭 24 個(新しい順)をツールに見せます。残りはプロバイダのモデル一覧で選ぶか、系列の最新のみ をオンにして各系列の最新だけに絞ります。
  • +
  • 新しいモデル。auto-include のルールに合うモデルはすぐに加わり、あとで一覧に初めて載ったものも加わります。refresh-every を設定すると、magpie が一覧を自分で取り直します。
  • +
  • 画像モデル。OpenRouter の /models にはテキストモデルしか載らないので、FLUX・Seedream・Riverflow・Recraft・GPT Image などの画像モデルは /api/v1/images/models から読みます。設定 → モデル → 画像 で選びます。
  • +
  • 判定モデル。OpenRouter の判定モデル(liquid/d1、cloudflare/clef、~typesafe/jev-latest など)も一覧に入るので、ルーティンググループは同じキーで各ターンを分類できます。
  • +
+
ターミナル
magpie provider models openrouter +anthropic/claude-opus-5.5   # 一つ追加で見せる
+magpie provider models openrouter best                          # 各系列の最新のみ
+magpie provider auto-include openrouter '*:free'               # 無料モデルを今後の分も含めてすべて
+magpie provider refresh-every openrouter 1d
+ +

ツールごとの使い方

+

エージェント タブでツールの行のモデルを選ぶか、ターミナルで切り替えます。各ガイドに、magpie がそのツールの設定に何を書くか、どう戻すかがあります。

+
ターミナル
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 は Anthropic Messages を話し、OpenRouter も https://openrouter.ai/api で同じものを話すので、リクエストはそのまま渡されます。Claude Code で他のモデル。
  • +
  • Codex が話すのは OpenAI Responses だけです。magpie がリクエストと返答を変換し、ストリーミングとツール呼び出しもそのまま使えます。Claude のモデルは OpenRouter の Anthropic エンドポイントへ、それ以外は Chat Completions へ送ります。Codex で他のモデル。
  • +
  • Gemini CLI は Gemini の API を話します。magpie が Codex と同じように変換します。Gemini CLI で他のモデル。
  • +
  • OpenCode は Chat Completions を話すので、リクエストはそのまま OpenRouter に渡ります。ただし Claude のモデルは、プロンプトキャッシュのために magpie が Anthropic エンドポイントへ送ります(下を参照)。OpenCode で他のモデル。
  • +
+

magpie が選んだエンドポイントでそのモデルは提供していないと OpenRouter が答えた場合、magpie はもう一方のエンドポイント向けにリクエストを作り直し、そのモデルについて覚えておきます。

+ +

推論

+
    +
  • 推論を切れないモデル。OpenRouter には推論をオフにできないモデルがあります(“reasoning is mandatory for this endpoint and cannot be disabled”)。ツールがオフを求めると、magpie はその指定を外し、レベルをモデルに任せてもう一度問い合わせます。Chat Completions でも Messages でも同じです。
  • +
  • 会話途中の推論の強さ。Claude Code はターンごとの推論の強さを会話の中で送ります。OpenRouter の Anthropic エンドポイントは DeepSeek や GLM などのモデルでこれを拒否します。magpie はすぐにそれを外して問い合わせ直し、magpie を再起動するまで OpenRouter には送りません。
  • +
  • 前の思考。OpenRouter の Anthropic エンドポイントは署名のない思考ブロックを受け付けないので、magpie は必ず署名を付けて送ります。Chat Completions では、ツールが送り返す OpenRouter の reasoning や reasoning_details を、モデルの前の思考として読みます。
  • +
+ +

キャッシュ・費用・残高

+
    +
  • Claude のプロンプトキャッシュ。両方の API を提供する中継サービスは Chat Completions で cache_control を落とすため、毎ターンがキャッシュなしで課金されます。そこで magpie は、どのツールからでも Claude のモデルは OpenRouter の Messages エンドポイントに、変換時に加えるキャッシュのブレークポイント付きで送ります。
  • +
  • キャッシュのトークン。magpie は返答ごとにキャッシュの読み出しと OpenRouter の cache_write_tokens を読み、使用量 タブでキャッシュのヒットと書き込みを分けて数えます。
  • +
  • 費用。使用量タブは、models.dev にある OpenRouter の価格で呼び出しごとの費用を出します。カタログにない場合はモデルのメーカーの定価を使います。:free で終わるモデルなど 0 ドルのモデルには、magpie のモデル選択で 無料 と表示されます。
  • +
  • どこが答えたか。OpenRouter は返答ごとに、それを処理したプロバイダを示します。magpie はそれを記録し、使用量タブの呼び出しの詳細に 上流プロバイダー として表示します。
  • +
  • 残高。OpenRouter の行に、アカウントの残りがドルで表示されます。/api/v1/credits から読んだ、チャージ総額から使用総額を引いた額です。アカウント全体の数字なので、同じアカウントのキーはどれも同じ額になります。
  • +
+ +

複数のキーと無料モデル

+

一つの OpenRouter プロバイダに複数のキーを入れられます。その下の 別のキーを追加 を押すか、まとめて貼り付けます。リクエストはオンになっている最初のキーに行き、そのキーが尽きるかレート制限にかかると次のキーが引き継ぎます。プロバイダのルーティングを、順番に回す・重みで分ける・一つを使い切ってから次へ、に変えることもできます。プリセットをもう一度追加すると OpenRouter プロバイダが二つになります。複数のキーにリクエストを分けたいときは、すべて同じプロバイダに入れてください。

+
    +
  • 支出上限。spend-cap で、キーごとに 1 日・1 か月・累計のドル上限を決められます。金額は使用量タブの計算で数え、上限に達するとルーティングはほかのキーとフォールバックに移ります。
  • +
  • フォールバック。fallback で、OpenRouter の枠が尽きたときや落ちたときの行き先を決めます。別のプロバイダのモデルか、ルーティンググループです。
  • +
  • 無料モデル。OpenRouter の無料モデルは 1 分あたり 20 リクエストまでです。rpm でキーごとの速さを抑えられます。超えた分は空きを待ち、2 分待っても空かなければ Retry-After 付きの 429 になります。
  • +
  • 無料モデルの 429。無料モデルを提供しているプロバイダの共有プールに断られた場合、magpie はそのモデルだけを休ませ、ほかの無料モデルは使い続けます。無料モデルのそれ以外の 429 は OpenRouter のアカウント全体の無料枠によるもので、キーが休みます。
  • +
  • 無料モデルのプール。ルーティンググループに openrouter/*:free というパターンを入れると、OpenRouter が載せている無料モデルがすべて入ります。あとから載ったものも加わります。
  • +
+
ターミナル
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
+ +

うまくいかないとき

+
    +
  • モデル一覧が anthropic/ で始まる ID ばかり、または取得できない。https://openrouter.ai/api だけを持つプロバイダには、OpenRouter が anthropic/ の下に並べたカタログが返りますが、その ID では提供していません。Chat Completions のベース URL https://openrouter.ai/api/v1 を足すか、両方を持つ OpenRouter プリセットを使ってください。
  • +
  • “Mid-conversation reasoning effort (configuration_update) is not supported”。DeepSeek や GLM などのモデルで、Claude Code のターンごとの推論の強さを OpenRouter が拒否したときのエラーです。magpie はすぐにそれを外して問い合わせ直すのでツールには返答が届き、magpie を再起動するまで OpenRouter には送りません。
  • +
  • 402 で “can only afford” や “fewer max_tokens”。OpenRouter が断ったのはリクエストの大きさか処理中のリクエストの予算で、残高切れではありません。magpie はそのキーを 30 分休ませてから試します。残高切れのキーと違い、断られるたびに休みが長くなることはありません。
  • +
  • Web 検索で選んでいないモデルが使われる?使われません。magpie の Web 検索に OpenRouter が答えるときは、選んである OpenRouter のモデルだけを使います。OpenRouter は地域によってほかのモデルを断ることがあるからです。その検索では OpenRouter 自身の web プラグインをオンにし、これはどのモデルでも使えます。
  • +
  • キーの確認。magpie provider test openrouter は各エンドポイントに、または指定した各モデルに小さなリクエストを送ります。--as codex や --as claude-code を付けると、そのツールと同じ形で送ります。
  • +
+ +

よくある質問

+

Claude Code で OpenRouter を使うには?

+

magpie に OpenRouter のキーを追加し(プロバイダ、プロバイダを追加、OpenRouter)、Claude Code の行で anthropic/claude-opus-5.5 などのモデルを選ぶか、magpie claude openrouter/anthropic/claude-opus-5.5 を実行します。magpie が Claude Code の settings.json を書き、リクエストはそのまま OpenRouter の Anthropic エンドポイントに渡されます。

+

Codex で OpenRouter のモデルは使えますか?

+

使えます。Codex が話すのは Responses API だけで、magpie は OpenRouter の Responses API を使いません。そこで magpie が Codex のリクエストを一つずつ変換します。Claude のモデルは OpenRouter の Anthropic エンドポイントへ、それ以外は Chat Completions へ送り、返答は Responses に戻して Codex に渡します。

+

Gemini CLI と OpenCode で OpenRouter は使えますか?

+

使えます。Gemini CLI のリクエストは Codex と同じように変換されます。OpenCode は Chat Completions を話すので、リクエストはそのまま OpenRouter に渡ります。ただし Claude のモデルだけは、プロンプトキャッシュが効くように magpie が Anthropic エンドポイントへ送ります。

+

OpenRouter の無料モデルだけを使うには?

+

openrouter/*:free というパターンでルーティンググループを作ります。たとえば magpie group add my-free-pool models='openrouter/*:free' routing=order。OpenRouter が載せている無料モデルがすべて入り、あとから載ったものも加わります。0 ドルのモデルには magpie のモデル選択で 無料 と表示されます。

+

OpenRouter の無料モデルが 429 を返すのはなぜ?

+

OpenRouter の無料モデルは 1 分あたり 20 リクエストまでです。magpie provider rpm openrouter 20 を実行すると、magpie がリクエストをその速さに抑えます。429 が無料モデルを提供しているプロバイダの共有プールから来た場合、magpie はそのモデルだけを休ませ、ほかの無料モデルは使い続けます。

+

magpie で OpenRouter の残高は見られますか?

+

見られます。magpie は OpenRouter の credits エンドポイントを読み、残りをドルで表示します。チャージ総額から使用総額を引いた額です。アカウント全体の数字なので、同じアカウントのキーはどれも同じ額になります。

+

magpie が OpenRouter のモデル一覧を /api/v1 から取るのはなぜ?

+

Anthropic のベース URL で一覧を求めると、OpenRouter は anthropic/ の下に並べたカタログを返しますが、その ID では提供していません。magpie は Chat Completions のベース URL https://openrouter.ai/api/v1 から一覧を取り、OpenRouter の Anthropic のベース URL しかないプロバイダには、この Chat の URL を足すよう案内します。

+ +

プロバイダ別:DeepSeek · Kimi と Kimi Code · GLM Coding Plan · Qwen · MiniMax · GitHub Copilot

+

ツールごとのガイド:Claude Code で他のモデル、Codex で他のモデル、Gemini CLI で他のモデル、OpenCode で他のモデル。困ったときは Discord で質問してください。

+
+
+ + + + + + + diff --git a/site/public/docs/opencode-models.html b/site/public/docs/opencode-models.html index f95a1b76a..32641e8d7 100644 --- a/site/public/docs/opencode-models.html +++ b/site/public/docs/opencode-models.html @@ -239,7 +239,7 @@ magpie visible opencode all # every model again
Terminal
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 · Kimi and Kimi Code · GLM Coding Plan · Qwen · MiniMax

+

By provider: DeepSeek · Kimi and Kimi Code · GLM Coding Plan · Qwen · MiniMax · OpenRouter · GitHub Copilot

FAQ

How do I use DeepSeek in OpenCode?

diff --git a/site/public/docs/openrouter.html b/site/public/docs/openrouter.html new file mode 100644 index 000000000..88613a74f --- /dev/null +++ b/site/public/docs/openrouter.html @@ -0,0 +1,343 @@ + + + + + +OpenRouter in Claude Code, Codex, Gemini CLI and OpenCode · magpie + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

Docs · Provider

+

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 keyMake one on openrouter.ai/keys.
  2. +
  3. Add the providerIn magpie’s Providers tab, press + Add provider, pick OpenRouter, paste the key and save. magpie asks OpenRouter which models it serves.
  4. +
  5. Pick it for an agentIn the Agents tab, click the model on the agent’s row and choose an OpenRouter model such as anthropic/claude-opus-5.5.
  6. +
+
Terminal
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

+
+ + + + +
APIBase URLUsed for
Chat Completionshttps://openrouter.ai/api/v1the model list, requests to non-Claude models, image models
Anthropic Messageshttps://openrouter.ai/apiClaude Code’s requests, and Claude models from any agent
Decisionshttps://openrouter.ai/api/v1decision models for intent routing
+

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 from /api/v1/images/models. 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.
  • +
+
Terminal
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.

+
Terminal
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.
  • +
  • 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.
  • +
  • Gemini CLI speaks Gemini’s API. magpie translates it the same way as Codex’s requests. Models in Gemini CLI.
  • +
  • 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.
  • +
+

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.
  • +
+
Terminal
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.
  • +
+ +

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 · Kimi and Kimi Code · GLM Coding Plan · Qwen · MiniMax · GitHub Copilot

+

Every agent: Models in Claude Code, Models in Codex, Models in Gemini CLI, Models in OpenCode. Ask on Discord if you get stuck.

+
+
+ + + + + + + diff --git a/site/public/docs/zh/claude-code-models.html b/site/public/docs/zh/claude-code-models.html index 7b2cc03b5..dcc48b747 100644 --- a/site/public/docs/zh/claude-code-models.html +++ b/site/public/docs/zh/claude-code-models.html @@ -251,7 +251,7 @@ magpie claude codex/gpt-5.5

各种路由方式见 快速上手。

-

按供应商:DeepSeek · Kimi 与 Kimi Code · GLM 编程套餐 · 通义千问 · MiniMax

+

按供应商:DeepSeek · Kimi 与 Kimi Code · GLM 编程套餐 · 通义千问 · MiniMax · OpenRouter · GitHub Copilot

常见问题

需要自己设置 ANTHROPIC_BASE_URL 吗?

diff --git a/site/public/docs/zh/codex-models.html b/site/public/docs/zh/codex-models.html index 364c11b89..128424765 100644 --- a/site/public/docs/zh/codex-models.html +++ b/site/public/docs/zh/codex-models.html @@ -251,7 +251,7 @@ magpie codex claude/…

各种路由方式见 快速上手。

-

按供应商:DeepSeek · Kimi 与 Kimi Code · GLM 编程套餐 · 通义千问 · MiniMax

+

按供应商:DeepSeek · Kimi 与 Kimi Code · GLM 编程套餐 · 通义千问 · MiniMax · OpenRouter · GitHub Copilot

常见问题

需要自己写 [model_providers] 吗?

diff --git a/site/public/docs/zh/copilot.html b/site/public/docs/zh/copilot.html new file mode 100644 index 000000000..d8874edf9 --- /dev/null +++ b/site/public/docs/zh/copilot.html @@ -0,0 +1,352 @@ + + + + + +GitHub Copilot 接入 Claude Code、Codex、Gemini CLI 和 OpenCode · magpie + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

文档 · 供应商

+

GitHub Copilot 接入 Claude Code、Codex、Gemini CLI 和 OpenCode

+

Copilot 的席位里有 Claude、GPT、Gemini 等模型。在 magpie 里登录一次 Copilot,Claude Code、Codex、Gemini CLI、OpenCode 以及你接入的其他工具,都能通过 magpie 的本地网关 127.0.0.1:3425 用上你套餐里的模型,不需要 API Key。

+ +

登录 Copilot

+
    +
  1. 打开添加供应商在 magpie 的 供应商 页点 + 添加供应商,再点 Copilot 卡片。
  2. +
  3. 在 GitHub 上输入验证码magpie 会显示一个验证码,并打开 GitHub 的设备登录页 github.com/login/device。输入验证码并授权后,magpie 会向 GitHub 确认这是谁的账号、是什么套餐,账号随即出现在 Copilot 下面。
  4. +
  5. 给工具选上在 Agent 页点工具那一行的模型,选一个 copilot/… 模型。
  6. +
+
终端
magpie accounts add copilot                        # github.com
+magpie accounts add copilot --host acme.ghe.com    # GHE.com 上的 GitHub Enterprise
+magpie accounts copilot                            # 每个账号及其用量
+

magpie 会从三个地方拿到 Copilot 登录:

+
    +
  • Copilot 的编辑器插件。它们存在 ~/.config/github-copilot 里的登录(apps.json 或 hosts.json)。
  • +
  • Copilot CLI。它在 ~/.copilot/config.json 里的登录,令牌在系统钥匙串里,或以明文存在这个文件里。Windows 上的 magpie 还会读取正在运行的 WSL 发行版里的 Copilot CLI 登录,只读 config.json。
  • +
  • magpie 自己登录的。你在 magpie 里用验证码登录的每个账号,令牌保存在 magpie 自己的 logins.json 里。
  • +
+

编辑器和 CLI 的登录 magpie 只读不写。两者都有时,先用编辑器的 github.com 登录,再用 CLI 的,最后是编辑器的 GHE.com 登录。如果 GitHub 拒绝了编辑器的令牌,magpie 会改用 CLI 里同一个账号的登录,绝不会换成别人的账号。

+
GHE.com 上的 GitHub Enterprise。使用数据驻留的企业要在自己的 <name>.ghe.com 登录,所以添加账号时加上 --host(或者在登录面板里回答“账号在 GHE.com 上?”)。magpie 只接受 github.com 或 <name>.ghe.com 地址,GitHub 令牌不会被发到你随手填的其他主机。这类账号走企业自己的 copilot-api.<name>.ghe.com。同一个用户名在 github.com 和 GHE.com 上算两个账号:you 和 you@acme.ghe.com。
+ +

你的席位能用哪些模型

+

magpie 会为每个账号请求 Copilot 的 /models,列出返回的模型,所以列表跟着你的套餐走,而不是一张写死的表。模型名是 copilot/ 加上 Copilot 自己的 ID,比如 copilot/claude-opus-5.5、copilot/gpt-5.4、copilot/gpt-5.3-codex。magpie models 会全部列出来。

+
    +
  • 只列对话模型。Copilot 的内部模型、任何模型选择器都不提供的模型,以及这个账号无权开启的模型,都不会列出。
  • +
  • 需要同意条款的模型。条款还没同意的模型照样列出,第一次请求它时 magpie 会替你同意,效果和在 Copilot 编辑器里开启它一样。
  • +
  • 推理强度取自 Copilot 给每个模型列出的档位,会显示在各个工具的模型选择里。
  • +
  • Auto 总在列表里,见 Copilot Auto。
  • +
  • 图像模型比如 GPT Image 2.5 Flare,只用来画图(设置 → 模型 → 图像),不会作为对话模型出现。
  • +
  • 较老的模型。Copilot 没有标明接口的模型,比如学生套餐里的 GPT-4.1 和 GPT-4o,只走 Chat Completions。
  • +
+

Claude Code 会把带小数点的 Claude 版本号当成更老的模型,所以 magpie 给它的 Copilot Claude 模型用短横线写法(claude-opus-5-5),请求到 Copilot 之前再换回原名。其他工具看到的是 Copilot 原本的写法。

+ +

在各个工具里用

+

在 Agent 页里点某个工具那一行的模型来选,或者在终端里选。每篇指南都写了 magpie 在那个工具的配置里改了什么、怎么换回去。

+
终端
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 说的是 Anthropic Messages。Copilot 的 Claude 模型也提供 Messages 接口,所以请求原样转过去;选 GPT 或 Gemini 模型时由 magpie 转换。Claude Code 接入其他模型。
  • +
  • Codex 只说 OpenAI Responses,magpie 也用 Responses 去问 Copilot 的 OpenAI 模型,所以请求直接转过去。这些模型上,Codex 的联网搜索由 Copilot 那边执行,Codex 的原生上下文压缩也能用;Copilot 的 Claude 模型则不支持原生压缩。Codex 接入其他模型。
  • +
  • Gemini CLI 说 Gemini 的 API。magpie 把它指向本地网关并做转换。Gemini CLI 接入其他模型。
  • +
  • OpenCode:magpie 把模型写进 opencode.json,带上推理档位。OpenCode 接入其他模型。
  • +
+

Copilot CLI 本身也是 magpie 支持的工具。它那一行可以选 auto(让 Copilot 挑)和 Copilot 自己的模型,也可以选你在 magpie 里添加的任何其他模型,这些模型通过 Copilot CLI 的 providers.json 接进去。

+ +

请求怎么到 Copilot

+

Copilot 并不是每个模型都开放所有接口:最新的 OpenAI 模型只走 Responses,Claude 模型走 Chat Completions 和 Anthropic Messages,Gemini 模型和较老的模型只走 Chat Completions。magpie 会把每个请求发到这个模型可用的接口上,和工具的接口不一致时做转换,流式输出和工具调用都保留。

+
    +
  • 接口不对。Copilot 回复说这个模型不在当前接口上时,magpie 会把请求改写成下一个接口的格式重发,并记住哪个能用。
  • +
  • 自己指定。magpie model api copilot/<model> chat(或 responses、anthropic)让这个模型只走该接口;auto 交还给 magpie 来选。
  • +
  • Gemini 的工具定义。Copilot 的 Gemini 模型曾用 400 “invalid request body” 拒绝 Codex 的部分工具定义。magpie 会改写其中能确定安全改写的部分,让这些工具能用。
  • +
+ +

Copilot Auto

+

copilot/auto 是 Copilot 替你的账号挑的模型。它不在 Copilot 的 /models 里,所以 magpie 总会补上。学生套餐只能选它。

+
    +
  • magpie 带着这一轮的提示词,按 Copilot Chat 的默认档位向 Copilot 要一个选择,同一个选择最多沿用一小时。
  • +
  • 如果 Copilot 不给这个账号提供 Auto,或者挑了这个账号被拒的模型,就用账号可以手动选的模型顶替 10 分钟,顺序是:Copilot 的基础模型、它的默认模型、gpt-4.1、非高级模型,然后是其余的。
  • +
  • 如果 Copilot 随后拒绝了 Auto 挑的模型,magpie 会另挑一个,把请求重发。
  • +
  • Auto 最终用了哪个模型会记在请求的路由里,能看到是谁回答的。
  • +
+ +

高级请求、用量与费用

+

每个 Copilot 账号都有一张卡片,按 GitHub 给出的数据显示三项额度:高级请求、聊天请求 和 代码补全,格式是“已用 / 额度”。magpie accounts copilot 输出的也是这些。

+
    +
  • 按月。额度每月在 GitHub 给出的日期重置。
  • +
  • 不限量的显示为 无限。GitHub 没给出数字的那一项不显示,绝不当成无限。
  • +
  • 一轮算一次。你输入的一轮按一次请求计费,接着这一轮的工具结果不另算。
  • +
  • Business 和 Enterprise。席位额度用完会被暂停,所以 magpie 把这个账号当作已用完,转去用下一个。组织共享的高级请求额度用光后,也显示为已用完。
  • +
  • 其他套餐。套餐允许超出高级请求额度后付费时,额度用完不会让账号停用。代码补全也会统计,但经过 magpie 的请求不会用到它。
  • +
  • 不占额度。Copilot 的基础模型 gpt-4.1 在任何套餐上都不计入额度。
  • +
+

用量 页会统计经过 magpie 的每个工具和模型的 token、缓存命中和费用。订阅的费用是按模型厂商的公开价估算的,你给模型设了价格就按你的价格算。和 Anthropic 官方计价有一处不同:Copilot 的缓存写入不论保留多久都是同一个价,所以 magpie 把 1 小时缓存写入按 5 分钟的价格算。以 claude-opus-5.5 为例,是每百万 token 5 美元,而按 Anthropic 的 2 倍输入价是 8 美元。

+ +

多账号与自动切换

+
    +
  • 再加一个账号。再点一次 Copilot 卡片,或再运行一次 magpie accounts add copilot。正在用的账号排第一,其余按添加顺序排列。
  • +
  • 指定先用哪个。magpie accounts switch copilot <login>;magpie accounts forget copilot <login> 删除一个。同一个用户名在 github.com 和 GHE.com 上都有时,写全名(you@acme.ghe.com)或加上 --host。
  • +
  • 把请求分给多个账号。在 Copilot 那一行勾选要用的账号。路由 决定请求怎么分,默认是 智能;供应商的 备用 列出所有账号额度用完、被限流或不可用时改用的模型。详见 订阅用于任意 Agent。
  • +
  • 两个订阅里的同一个模型。Claude 订阅和 Copilot 里的 Claude Opus 会自动合成一个组 auto/<model>。想自己定顺序:magpie group add "Opus anywhere" models=claude/claude-opus-5-5,copilot/claude-opus-5.5 routing=order。
  • +
  • 编辑器登录失效。GitHub 拒绝了 Copilot 编辑器保存的令牌时,你在 magpie 里用同一个用户名登录的账号会保留下来继续用。
  • +
+ +

常见报错

+
+ + + + + + + + + + +
看到的提示意思
GitHub 拒绝了这个 Copilot 登录,请重新登录GitHub 不再接受这个账号的令牌。在它那一行重新登录即可,账号原地更新,设置都保留。网络错误或 GitHub 的 5xx 不会让账号被标记,请求成功一次标记就会消失。
the GitHub token Copilot’s editors keep in … was refused编辑器里的登录失效了。在编辑器或 magpie 里重新登录 Copilot,或者把那个文件挪走。
<login> has no Copilot subscription你授权的 GitHub 账号没有 Copilot 套餐。换有席位的账号登录。
Copilot doesn’t serve this model on Anthropic’s Messages API; it isn’t about your planCopilot 只在其他接口上提供这个模型,和套餐无关。magpie model api copilot/<model> chat 让它走 Chat Completions。
The requested model is not supported.Copilot 目前不给这个账号用这个模型。magpie 会在账号的模型列表和各工具的选择里把它隐藏 6 小时,然后再试。用 Auto 时会另挑一个模型重发。
Copilot doesn’t offer Auto to this account …Copilot 没有给出选择,账号也没有可以手动选的模型。到 github.com/settings/copilot 看看套餐。
the code expired; start again · the sign-in was declined on GitHub验证码在输入前过期了,或者在 GitHub 页面上点了拒绝。重新登录一次。
Copilot signs in on github.com or an enterprise’s <name>.ghe.com, not …--host 填的既不是 github.com 也不是 GHE.com 地址。
subscription accounts are off in magpie设置 → 隐私 → 订阅账号 是关着的(或运行过 magpie accounts discovery off),magpie 不读取任何登录,也不提供任何订阅,Copilot 也一样。打开它,或运行 magpie accounts discovery on。
+ +

常见问题

+

Claude Code 怎么用 Copilot 订阅?

+

先在 magpie 里登录 Copilot(供应商 → 添加供应商 → Copilot,GitHub 会给你一个验证码去输入),然后在 Claude Code 那一行选一个 copilot/… 模型,比如 copilot/claude-opus-5.5,或者运行 magpie claude copilot/claude-opus-5.5。magpie 会写好 Claude Code 的 settings.json。Copilot 的 Claude 模型直接接收 Claude Code 的 Anthropic 请求,GPT 和 Gemini 模型则由 magpie 转换协议。

+

Codex 能用 Copilot 的模型吗?

+

能。Codex 说的是 OpenAI Responses,magpie 也用 Responses 去问 Copilot 的 OpenAI 模型,所以请求直接转过去,联网搜索也能用。Copilot 的 Claude 和 Gemini 模型由 magpie 转换。在 Codex 那一行选模型,或运行 magpie codex copilot/gpt-5.4,模型会出现在 Codex 的 /model 里。

+

Gemini CLI 和 OpenCode 能用 Copilot 吗?

+

能。运行 magpie gemini model copilot/gpt-5.4-mini 或 magpie opencode copilot/claude-opus-5.5,或者在对应那一行选模型。magpie 会转换 Gemini CLI 的请求,并把模型写进 OpenCode 的 opencode.json。

+

一定要在 VS Code 之类的编辑器里登录 Copilot 吗?

+

不用。magpie 自己用设备验证码登录 GitHub。如果这台电脑上 Copilot 的编辑器插件或 Copilot CLI 已经登录,magpie 也会读取那个登录,但从不改动它。

+

会消耗我的高级请求吗?

+

请求是用你的账号发给 Copilot 的,所以按 Copilot 的方式计入你的套餐。你输入的一轮按一次请求计费,接着这一轮的工具结果不另算。magpie 会显示每个账号的高级请求、聊天请求和代码补全用了多少。

+

Copilot Business、Enterprise 和 GHE.com 能用吗?

+

能。magpie 从 GitHub 读出套餐:Free、Pro、Pro+、Max、Education、Business 或 Enterprise。GHE.com 上的企业用 magpie accounts add copilot --host <name>.ghe.com 登录。Business 或 Enterprise 席位的额度用完后会被暂停,magpie 会把这个账号当作已用完,直到额度重置。

+

为什么我的列表里少了某个 Copilot 模型?

+

magpie 列出的是 Copilot 的 /models 给这个账号的模型:只有对话模型,不含任何模型选择器都不提供的,也不含这个账号无法开启的。被 Copilot 用“The requested model is not supported.”拒绝的模型会被隐藏 6 小时,之后再试,以防你的套餐已经变了。

+ +

按供应商:DeepSeek · Kimi 与 Kimi Code · GLM 编程套餐 · 通义千问 · MiniMax · OpenRouter · Claude、ChatGPT 等订阅

+

各个工具的指南:Claude Code 接入其他模型、Codex 接入其他模型、Gemini CLI 接入其他模型、OpenCode 接入其他模型。遇到问题可以在 Discord 提问。

+
+
+ + + + + + + diff --git a/site/public/docs/zh/gemini-cli-models.html b/site/public/docs/zh/gemini-cli-models.html index b2b3de051..0399a48e8 100644 --- a/site/public/docs/zh/gemini-cli-models.html +++ b/site/public/docs/zh/gemini-cli-models.html @@ -235,7 +235,7 @@ magpie gemini model codex/gpt-5.5

路由方式和规则详见 快速上手。

-

按供应商:DeepSeek · Kimi 与 Kimi Code · GLM 编程套餐 · 通义千问 · MiniMax

+

按供应商:DeepSeek · Kimi 与 Kimi Code · GLM 编程套餐 · 通义千问 · MiniMax · OpenRouter · GitHub Copilot

常见问题

Gemini CLI 能用 Gemini 以外的模型吗?

diff --git a/site/public/docs/zh/opencode-models.html b/site/public/docs/zh/opencode-models.html index 65144574f..717617be2 100644 --- a/site/public/docs/zh/opencode-models.html +++ b/site/public/docs/zh/opencode-models.html @@ -239,7 +239,7 @@ magpie visible opencode all # 恢复显示全部
终端
magpie opencode default

它会恢复接入 magpie 之前的 model 和 small_model,并把 magpie 供应商从文件里删掉。

-

按供应商:DeepSeek · Kimi 与 Kimi Code · GLM 编程套餐 · 通义千问 · MiniMax

+

按供应商:DeepSeek · Kimi 与 Kimi Code · GLM 编程套餐 · 通义千问 · MiniMax · OpenRouter · GitHub Copilot

常见问题

OpenCode 怎么用 DeepSeek?

diff --git a/site/public/docs/zh/openrouter.html b/site/public/docs/zh/openrouter.html new file mode 100644 index 000000000..9e9e2c7ba --- /dev/null +++ b/site/public/docs/zh/openrouter.html @@ -0,0 +1,343 @@ + + + + + +OpenRouter 接入 Claude Code、Codex、Gemini CLI 和 OpenCode · magpie + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

文档 · 供应商

+

OpenRouter 接入 Claude Code、Codex、Gemini CLI 和 OpenCode

+

OpenRouter 用一个 Key 卖许多厂商的模型,提供 OpenAI Chat Completions 和 Anthropic Messages 两种接口。把 Key 添加到 magpie 一次,Claude Code、Codex、Gemini CLI、OpenCode 以及你接入的其他工具,都能通过 magpie 的本地网关 127.0.0.1:3425 使用任意 OpenRouter 模型,每个工具各用各的模型。

+ +

添加 OpenRouter

+
    +
  1. 拿到 Key在 openrouter.ai/keys 创建。
  2. +
  3. 添加供应商在 magpie 的 供应商 页点 + 添加供应商,选 OpenRouter,粘贴 Key 并保存。magpie 会向 OpenRouter 查询它提供哪些模型。
  4. +
  5. 给工具选上在 Agent 页点工具那一行的模型,选一个 OpenRouter 模型,比如 anthropic/claude-opus-5.5。
  6. +
+
终端
magpie provider add openrouter sk-…
+magpie provider test openrouter
+

magpie 里的模型 id 是 供应商/模型,所以 OpenRouter 的模型写作 openrouter/anthropic/claude-opus-5.5:前面是供应商,后面是 OpenRouter 自己的 id。Key 保存在 magpie 的设置里,magpie 不会从 shell 里读取它。

+

OpenRouter 文档里有两个可选请求头,HTTP-Referer 和 X-OpenRouter-Title,用来在它的排行榜里署上应用的名字。magpie 默认不发送;想让请求计入某个应用,可以在供应商编辑页的 请求头 里加上。

+ +

接口地址

+
+ + + + +
接口Base URL用途
Chat Completionshttps://openrouter.ai/api/v1模型列表、非 Claude 模型的请求、图像模型
Anthropic Messageshttps://openrouter.ai/apiClaude Code 的请求,以及任何工具发给 Claude 模型的请求
决策(decisions)https://openrouter.ai/api/v1给意图路由用的决策模型
+

magpie 不使用 OpenRouter 的 Responses 接口。Codex 这类说 Responses 的工具,会被转换成上面两种之一。

+ +

模型列表

+
    +
  • 列表从哪来。magpie 从 https://openrouter.ai/api/v1/models 拉取列表,里面有每个模型的上下文长度。模型名、推理档位和价格来自 models.dev 上的 openrouter 目录。
  • +
  • 工具能看到哪些模型。OpenRouter 列出的模型有几百个。你没挑选时,magpie 给工具展示 OpenRouter 列表里的前 24 个(它按从新到旧排)。其余的可以在供应商的模型列表里勾选,也可以打开 每系最新,每个系列只留最新的一个。
  • +
  • 新模型。auto-include 规则会立刻加入匹配的模型,以后拉取列表时新出现的匹配模型也会自动加入;refresh-every 让 magpie 定期自己重新拉取列表。
  • +
  • 图像模型。OpenRouter 的 /models 只列文本模型,所以 magpie 从 /api/v1/images/models 读取 FLUX、Seedream、Riverflow、Recraft、GPT Image 等图像模型。在 设置 → 模型 → 图像 里选用。
  • +
  • 决策模型。OpenRouter 的决策模型(liquid/d1、cloudflare/clef、~typesafe/jev-latest……)也会列出来,路由分组可以用同一个 Key 给每一轮做分类。
  • +
+
终端
magpie provider models openrouter +anthropic/claude-opus-5.5   # 多展示一个
+magpie provider models openrouter best                          # 每个系列只留最新
+magpie provider auto-include openrouter '*:free'               # 所有免费模型,包括以后新上的
+magpie provider refresh-every openrouter 1d
+ +

在各个工具里用

+

在 Agent 页点工具那一行选模型,或者在终端里切换。每篇指南都写了 magpie 会改工具配置里的哪些内容,以及怎么切回去。

+
终端
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 说的是 Anthropic Messages,OpenRouter 在 https://openrouter.ai/api 也说这种协议,所以请求原样转过去。Claude Code 接入其他模型。
  • +
  • Codex 只说 OpenAI Responses。magpie 会转换请求和回复,流式输出和工具调用都保留:Claude 模型发到 OpenRouter 的 Anthropic 接口,其他模型发到 Chat Completions。Codex 接入其他模型。
  • +
  • Gemini CLI 说 Gemini 的 API,magpie 按和 Codex 一样的方式转换。Gemini CLI 接入其他模型。
  • +
  • OpenCode 说 Chat Completions,请求原样发给 OpenRouter;Claude 模型例外,magpie 会改发到 Anthropic 接口,为的是提示缓存(见下文)。OpenCode 接入其他模型。
  • +
+

如果 OpenRouter 说某个模型在 magpie 选的接口上不提供,magpie 会按另一个接口重新构造请求,并记住这个模型该走哪边。

+ +

推理

+
    +
  • 必须推理的模型。OpenRouter 上有些模型不允许关闭推理(“reasoning is mandatory for this endpoint and cannot be disabled”)。工具要求关闭时,magpie 会去掉这个设置再问一次,推理档位交给模型自己决定。Chat Completions 和 Messages 都是这样处理。
  • +
  • 对话中途的推理强度。Claude Code 会在对话里带上每一轮的推理强度。OpenRouter 的 Anthropic 接口在 DeepSeek、GLM 等模型上会拒绝它。magpie 会立刻去掉它再问一次,并且在 magpie 重启前不再把它发给 OpenRouter。
  • +
  • 之前的思考内容。OpenRouter 的 Anthropic 接口会拒绝没有签名的思考块,所以 magpie 总会带上签名。在 Chat Completions 上,工具传回的 OpenRouter reasoning 或 reasoning_details 字段会被当作模型之前的思考来读。
  • +
+ +

缓存、费用与余额

+
    +
  • Claude 的提示缓存。同时提供两种接口的中转,在 Chat Completions 上会丢掉 cache_control,每一轮都按未缓存计费。所以不管哪个工具,magpie 都把 Claude 模型的请求发到 OpenRouter 的 Messages 接口,带上转换时加的缓存断点。
  • +
  • 缓存 token。magpie 从每个回复里读取缓存读取量和 OpenRouter 的 cache_write_tokens,用量 页会把缓存命中和缓存写入单独统计。
  • +
  • 费用。用量页按 models.dev 上 OpenRouter 的价格给每次调用计价;目录里没有的,按模型厂商的官方价格算。标价为 0 美元的模型,比如以 :free 结尾的,在 magpie 的模型选择器里会标上 免费。
  • +
  • 是哪家回答的。OpenRouter 会说明每个回复由哪家服务商提供。magpie 会记下来,用量页里调用详情的 上游 就是它。
  • +
  • 余额。OpenRouter 那一行会以美元显示账号的剩余额度,即总充值减去总用量,读自 /api/v1/credits。这是整个账号的数字,同一账号下的每个 Key 显示的都一样。
  • +
+ +

多个 Key 与免费模型

+

一个 OpenRouter 供应商可以放多个 Key:在它下面点 添加另一个密钥,也可以一次粘贴好几个。请求先走第一个开着的 Key,它用完或被限流时由下一个接替。也可以把供应商的路由方式改成轮流、按权重或用完一个再换下一个。再次添加这个预设会多出一个 OpenRouter 供应商;想把请求分摊到多个 Key,就把它们都放进同一个供应商里。

+
    +
  • 花费上限。spend-cap 给某个 Key 设一个每天、每月或总计的美元上限,按用量页的计价算;到了上限,路由就转去其他 Key 和备用模型。
  • +
  • 备用模型。fallback 指定 OpenRouter 额度用完或挂掉时请求去哪:另一个供应商的模型,或一个路由分组。
  • +
  • 免费模型。OpenRouter 的免费模型每分钟只接受 20 个请求。rpm 给每个 Key 限速:超出的请求排队等空位,最多等 2 分钟,再等不到就返回带 Retry-After 的 429。
  • +
  • 免费模型的 429。如果免费模型是被背后服务商的共享池拒绝的,magpie 只让这一个模型暂停,其他免费模型照常使用。免费模型的其他 429 是 OpenRouter 整个账号的免费额度到了,这时 Key 会暂停。
  • +
  • 免费模型池。路由分组可以用 openrouter/*:free 这个模式包含 OpenRouter 列出的所有免费模型,现在的和以后新上的都算。
  • +
+
终端
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
+ +

常见报错

+
    +
  • 模型列表里全是 anthropic/ 开头的 id,或者拉不下来。只填了 https://openrouter.ai/api 的供应商,拿到的是 OpenRouter 挂在 anthropic/ 下的目录,那些 id 它并不提供。给它加上 Chat Completions 地址 https://openrouter.ai/api/v1,或者直接用 OpenRouter 预设,两个地址都有。
  • +
  • “Mid-conversation reasoning effort (configuration_update) is not supported”。这是 OpenRouter 在 DeepSeek、GLM 等模型上拒绝 Claude Code 每轮推理强度时的报错。magpie 会立刻去掉推理强度再问一次,工具照样拿到回复,并且在 magpie 重启前不再把它发给 OpenRouter。
  • +
  • 402,提示 “can only afford” 或 “fewer max_tokens”。OpenRouter 拒绝的是这次请求的大小或进行中请求的预算,不是余额用完了。magpie 让这个 Key 暂停半小时后再试;和真正没余额的 Key 不同,它的暂停时间不会越拒越长。
  • +
  • 联网搜索会不会用到没选的模型?不会。由 OpenRouter 回答 magpie 的联网搜索时,magpie 只用你选过的 OpenRouter 模型,因为 OpenRouter 可能因为地区拒绝别的模型。搜索时 magpie 会打开 OpenRouter 自己的 web 插件,它的任何模型都能用。
  • +
  • 检查 Key。magpie provider test openrouter 会向每个接口发一个很小的请求,或者发给你指定的每个模型。加上 --as codex 或 --as claude-code,就按那个工具的方式发送。
  • +
+ +

常见问题

+

Claude Code 怎么用 OpenRouter?

+

在 magpie 里添加 OpenRouter 的 Key(供应商页,添加供应商,选 OpenRouter),然后在 Claude Code 那一行选一个模型,比如 anthropic/claude-opus-5.5,或者运行 magpie claude openrouter/anthropic/claude-opus-5.5。magpie 会写好 Claude Code 的 settings.json,请求原样转给 OpenRouter 的 Anthropic 接口。

+

Codex 能用 OpenRouter 的模型吗?

+

能。Codex 只说 Responses API,而 magpie 不走 OpenRouter 的 Responses 接口,所以会转换每个请求:Claude 模型发到 OpenRouter 的 Anthropic 接口,其他模型发到 Chat Completions,回复再转回 Responses 交给 Codex。

+

Gemini CLI 和 OpenCode 能用 OpenRouter 吗?

+

能。Gemini CLI 的请求和 Codex 一样做转换。OpenCode 说 Chat Completions,请求原样发给 OpenRouter;只有 Claude 模型例外,magpie 会改发到 Anthropic 接口,好让提示缓存生效。

+

怎么只用 OpenRouter 的免费模型?

+

用 openrouter/*:free 这个模式建一个路由分组,比如 magpie group add my-free-pool models='openrouter/*:free' routing=order。它会包含 OpenRouter 列出的所有免费模型,以后新上的也算。标价为 0 美元的模型在 magpie 的模型选择器里会标上 免费。

+

OpenRouter 的免费模型为什么返回 429?

+

OpenRouter 的免费模型每分钟只接受 20 个请求。运行 magpie provider rpm openrouter 20,magpie 就会把请求压在这个速度以内。如果 429 来自某个免费模型背后服务商的共享池,magpie 只让这个模型暂停,其他免费模型照常使用。

+

magpie 能显示 OpenRouter 的余额吗?

+

能。magpie 读取 OpenRouter 的 credits 接口,以美元显示剩余额度,也就是总充值减去总用量。这是整个账号的数字,同一账号下的每个 Key 显示的都一样。

+

为什么 magpie 从 /api/v1 拉取 OpenRouter 的模型列表?

+

在 Anthropic 地址上拉列表,OpenRouter 返回的是挂在 anthropic/ 前缀下的目录,里面的 id 它并不提供服务。magpie 从 Chat Completions 地址 https://openrouter.ai/api/v1 拉列表;只填了 OpenRouter Anthropic 地址的供应商,会提示你补上这个 Chat 地址。

+ +

按供应商:DeepSeek · Kimi 与 Kimi Code · GLM 编程套餐 · 通义千问 · MiniMax · GitHub Copilot

+

各个工具的指南:Claude Code 接入其他模型、Codex 接入其他模型、Gemini CLI 接入其他模型、OpenCode 接入其他模型。遇到问题可以在 Discord 提问。

+
+
+ + + + + + + diff --git a/site/public/llms-full.txt b/site/public/llms-full.txt index 72dd1d565..9e6e2d1ec 100644 --- a/site/public/llms-full.txt +++ b/site/public/llms-full.txt @@ -413,7 +413,7 @@ With several keys or accounts, magpie can spread Claude Code’s requests over t 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) · [Qwen](https://usemagpie.ai/docs/qwen) · [MiniMax](https://usemagpie.ai/docs/minimax) +**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) · [OpenRouter](https://usemagpie.ai/docs/openrouter) · [GitHub Copilot](https://usemagpie.ai/docs/copilot) ## FAQ @@ -545,7 +545,7 @@ Requests on a Claude subscription run through the Claude Code installed on your 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) · [Qwen](https://usemagpie.ai/docs/qwen) · [MiniMax](https://usemagpie.ai/docs/minimax) +**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) · [OpenRouter](https://usemagpie.ai/docs/openrouter) · [GitHub Copilot](https://usemagpie.ai/docs/copilot) ## FAQ @@ -662,7 +662,7 @@ Gemini CLI still speaks the Gemini API; magpie translates each request for the m 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) · [Qwen](https://usemagpie.ai/docs/qwen) · [MiniMax](https://usemagpie.ai/docs/minimax) +**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) · [OpenRouter](https://usemagpie.ai/docs/openrouter) · [GitHub Copilot](https://usemagpie.ai/docs/copilot) ## FAQ @@ -995,7 +995,7 @@ 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) · [Qwen](https://usemagpie.ai/docs/qwen) · [MiniMax](https://usemagpie.ai/docs/minimax) +**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) · [OpenRouter](https://usemagpie.ai/docs/openrouter) · [GitHub Copilot](https://usemagpie.ai/docs/copilot) ## FAQ @@ -1533,6 +1533,293 @@ Every agent: [Models in Claude Code](https://usemagpie.ai/docs/claude-code-model --- +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 from `/api/v1/images/models`. 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 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. + +## 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) · [Qwen](https://usemagpie.ai/docs/qwen) · [MiniMax](https://usemagpie.ai/docs/minimax) · [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/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 `.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 `.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..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/ 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 `; `magpie accounts forget copilot ` 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/`. 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. | +| 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/ 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 .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 .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) · [OpenRouter](https://usemagpie.ai/docs/openrouter) · [Claude, ChatGPT and other subscriptions](https://usemagpie.ai/docs/subscriptions) + +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 @@ -3095,7 +3382,7 @@ export default async (input) => { - **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 › Network and sharing › 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. +- **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. @@ -3164,6 +3451,8 @@ A plugin can await I/O before an agent request is routed, for example to recall 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 10000 milliseconds. The chain sums budgets, clamped to 2–10 seconds; startup plus RPC is bounded to 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. diff --git a/site/public/llms.txt b/site/public/llms.txt index fd62159a8..b31fbbd94 100644 --- a/site/public/llms.txt +++ b/site/public/llms.txt @@ -49,6 +49,8 @@ DeepSeek, Kimi (Moonshot), GLM (Zhipu), Qwen, MiniMax, Anthropic (Claude), OpenA - [GLM Coding Plan in every agent](https://usemagpie.ai/docs/glm): Zhipu GLM and Z.ai, pay as you go or Coding Plan, each plan's endpoints, the 1113 "insufficient balance" fix, thinking and plan windows. - [Qwen in every agent](https://usemagpie.ai/docs/qwen): Alibaba Cloud Model Studio (DashScope), Bailian, the Qwen and Bailian Token Plans and Qwen Cloud in Claude Code, Codex, Gemini CLI and OpenCode; which endpoint each key works on, thinking and images. - [MiniMax and the Coding Plan in every agent](https://usemagpie.ai/docs/minimax): MiniMax M3 and M2.7, pay as you go or Coding Plan keys, global and China endpoints, interleaved thinking, effort and the plan's usage windows. +- [OpenRouter in every agent](https://usemagpie.ai/docs/openrouter): one OpenRouter key for Claude Code, Codex, Gemini CLI and OpenCode; which endpoint each agent's requests use, the model list, reasoning, Claude's prompt cache, cost and credits, several keys and free models. +- [GitHub Copilot in every agent](https://usemagpie.ai/docs/copilot): a Copilot seat's models in Claude Code, Codex, Gemini CLI and OpenCode; signing in (editors, Copilot CLI, GHE.com), Copilot Auto, premium requests, several accounts and errors. - [Intent routing](https://usemagpie.ai/docs/intent): how a turn is routed by what the user asks for. - [Privacy masking](https://usemagpie.ai/docs/masking): what is masked before a request leaves the computer and how values come back. - [Library](https://usemagpie.ai/docs/library): instructions, MCP servers, skills, hooks and subagents for each agent. diff --git a/site/public/sitemap.xml b/site/public/sitemap.xml index 31dee4449..f1bc8df99 100644 --- a/site/public/sitemap.xml +++ b/site/public/sitemap.xml @@ -28,6 +28,8 @@ https://usemagpie.ai/docs/glm https://usemagpie.ai/docs/qwen https://usemagpie.ai/docs/minimax +https://usemagpie.ai/docs/openrouter +https://usemagpie.ai/docs/copilot https://usemagpie.ai/docs/zh/claude-code-models https://usemagpie.ai/docs/zh/codex-models https://usemagpie.ai/docs/zh/contributors @@ -52,6 +54,8 @@ https://usemagpie.ai/docs/zh/glm https://usemagpie.ai/docs/zh/qwen https://usemagpie.ai/docs/zh/minimax +https://usemagpie.ai/docs/zh/openrouter +https://usemagpie.ai/docs/zh/copilot https://usemagpie.ai/docs/ja/claude-code-models https://usemagpie.ai/docs/ja/codex-models https://usemagpie.ai/docs/ja/contributors @@ -75,4 +79,6 @@ https://usemagpie.ai/docs/ja/glm https://usemagpie.ai/docs/ja/qwen https://usemagpie.ai/docs/ja/minimax +https://usemagpie.ai/docs/ja/openrouter +https://usemagpie.ai/docs/ja/copilot