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:

+ +

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.

+ +

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
+ +

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.

+ + +

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.

+ + +

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.

+ +

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

+ + +

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 サインインを使います。

+ +

エディタと 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 ですべて表示できます。

+ +

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
+ +

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 と違えば変換します。ストリーミングとツール呼び出しもそのままです。

+ + +

Copilot Auto

+

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

+ + +

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

+

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

+ +

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

+ +

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

+ + +

トラブルシューティング

+
+ + + + + + + + + + +
表示意味
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 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
+ +

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

+ +

推論

+ + +

キャッシュ・費用・残高

+ + +

複数のキーと無料モデル

+

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

うまくいかないとき

+ + +

よくある質問

+

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

+ +
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
+ +

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

+ + +

Cache, cost and credits

+ + +

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.

+ +
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

+ + +

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 登录:

+ +

编辑器和 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 会全部列出来。

+ +

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
+ +

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 Auto

+

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

+ + +

高级请求、用量与费用

+

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

+ +

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

+ +

多账号与自动切换

+ + +

常见报错

+
+ + + + + + + + + + +
看到的提示意思
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 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
+ +

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

+ +

推理

+ + +

缓存、费用与余额

+ + +

多个 Key 与免费模型

+

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

+ +
终端
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
+ +

常见报错

+ + +

常见问题

+

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