From 625f3db114d4b3d53d775017178e4e1fd1fd3c15 Mon Sep 17 00:00:00 2001 From: yetone Date: Fri, 13 Nov 2026 01:42:34 +0800 Subject: [PATCH] site: a routing groups page in en, zh and ja /docs/routing-groups covers both levels of magpie's routing: several accounts or keys on one provider (the editor's Routing and Stays, shown once a second one is on, and what one rate limited with quota left does: Keeps its place or Goes to the back), and routing groups across providers (auto-found groups, members, nested groups, patterns, By weight and Manual, rules, reasoning per member or by a classifier). Each routing and Stays choice is worded from app.js's ROUTINGS and STAYS and routing/client.js's options, with their zh and ja from i18n.js and plugins/routing/i18n.js; the CLI lines and templates are from groupUsage in internal/cli/groups_cli.go. Linked from each language's subscriptions page; in the sitemap, llms.txt and llms-full.txt. Run: the three pages' JSON-LD parsed with node; llms-full.mjs rebuilt; node --test site/*.test.mjs on the WSL box (magpie-desktop, wsl-run): 116 pass, 0 fail. Not tried: making a group or rotating real accounts for this page; it names only what magpie's source says. --- site/public/docs/ja/routing-groups.html | 277 ++++++++++++++++++++++++ site/public/docs/ja/subscriptions.html | 2 + site/public/docs/routing-groups.html | 277 ++++++++++++++++++++++++ site/public/docs/subscriptions.html | 2 + site/public/docs/zh/routing-groups.html | 277 ++++++++++++++++++++++++ site/public/docs/zh/subscriptions.html | 2 + site/public/llms-full.txt | 94 ++++++++ site/public/llms.txt | 1 + site/public/sitemap.xml | 3 + 9 files changed, 935 insertions(+) create mode 100644 site/public/docs/ja/routing-groups.html create mode 100644 site/public/docs/routing-groups.html create mode 100644 site/public/docs/zh/routing-groups.html diff --git a/site/public/docs/ja/routing-groups.html b/site/public/docs/ja/routing-groups.html new file mode 100644 index 000000000..0133db6ba --- /dev/null +++ b/site/public/docs/ja/routing-groups.html @@ -0,0 +1,277 @@ + + + + + +複数のアカウント・API キー・プロバイダーのローテーションとフェイルオーバー:Claude Code と Codex の負荷分散 · magpie ルーティンググループ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

ドキュメント · ガイド

+

アカウント・キー・プロバイダーのローテーションとフェイルオーバー

+

Claude のサブスクリプション一つでは足りない、API キーがすぐレート制限される、DeepSeek が落ちたら別のベンダーに切り替えたい。magpie はリクエストを二段でルーティングします。一つのプロバイダーのアカウントやキーの間と、ルーティンググループのプロバイダーやモデルの間です。返信がエージェントに届き始める前に上流が失敗すると、magpie は次の候補に移り、エージェントは気づきません。

+

複数のアカウントやキー

+

プロバイダーに二つ目のアカウントやキーを追加してオンにすると、編集画面に ルーティング と 維持 が現れ、リクエストをどう分けるかを決めます。

+

枠が残っているのにレート制限(429)されたものの扱いも選べます。位置を維持 はベンダーの指定どおり休んでから元の位置に戻り、最後尾へ はレート制限されていないものの後ろに回り、毎回先頭に戻らず負荷が回ります。

+

ルーティング

+
  • スマート(既定):枠に余裕のある間は最初のものが受け、少なくなると残りが最も多いものが引き継ぎます。クレジット切れは 30 分、枠切れはリセットまで、レート制限はベンダーの指定どおり、エラーは 1 分(繰り返すと長く)休みます。
  • 順番:最初のものに送り、枠切れ・レート制限・エラーで次が引き継ぎます。
  • 交互:会話のターンごとに次へ回して負荷を分けます。ターン内のリクエストは始まった場所に残り、プロンプトキャッシュが保たれます。
  • 使用量が最少のものを優先:サブスクリプションは使った枠の割合、キーは直近数時間のトークン数で決めます。
  • 週ペース:更新までの 1 時間あたりの残りが最も多いサブスクリプションへ送り、週のリセットで失う分を減らします。90% 以上使ったものはほかが答えられないときまで待ちます。
  • 重み付け:各キーの重みで分けます。重み 3 のキーは重み 1 のキーの 3 倍を受けます。キーのみで、アカウントには使えません。
  • 無料優先:費用のかからないものを先に使い、それが答えられないときだけ費用のかかるものへ。
+

維持

+

維持 は、会話を答えたアカウントやキーに留めるかを決めます。

+
  • 自動(既定):ベンダーのキャッシュに保つ価値がある間は留まり、ターン内では常に留まります。
  • セッション:答えられる限りセッション全体で留まります。
  • ターン内:エージェントがツール結果を返す間は動かず、次に話しかけると改めてルーティングします。
  • オフ:リクエストごとに改めてルーティングします。
  • 厳格:レート制限や枠切れでも移らず、エラーがエージェントに届きます。新しい会話は通常どおりです。
+

ルーティンググループ

+

ルーティンググループは異なるプロバイダーのモデルをまとめます。たとえば Claude サブスクリプションの Opus と Copilot の Opus、あるいは複数の無料モデルです。エージェントはモデルとして group/<id> を選び、magpie はグループのルーティングとルールに従って各リクエストを送ります。グループは ルーティング ページの ルーティンググループ にあり、新しいグループ で作ります。

+
    +
  1. magpie が自分でグループを見つける二つ以上のプロバイダーが提供するモデルは自動でグループ(auto-<モデル>)になり、設定は不要です。不要なら グループを自動で作成 をオフにします。
  2. +
  3. 入れられるものprovider/model で書いた任意のモデル、別のグループ(8 段まで)、パターン。openrouter/*:free なら後から増える無料モデルも入ります。
  4. +
  5. グループのルーティング上のものに加えて、重み付け(モデルごとの重み)と 手動(選んだモデルだけ、切り替えなし)があります。
  6. +
  7. ルールターンの長さ、画像の有無、求められた推論の強さ、エージェントで、ターンを最初にどのモデルへ送るかを決めます。
  8. +
+

推論の強さも決められます。メンバーを :high などに固定するか、分類モデルが各ターンの始めに難しさを判断して low から xhigh を選びます。

+

CLI

+
ターミナル
magpie groups                       # yours, then those magpie found
+magpie group add "Opus anywhere" models=claude/claude-opus-5-5,copilot/claude-opus-5.5 routing=order
+magpie group set opus-anywhere stays=session models+=openrouter/anthropic/claude-opus-5.5
+magpie group set opus-anywhere routing=weight weight=claude/claude-opus-5-5=3
+magpie group add my-free-pool models='openrouter/*:free,opencode-zen/*-free' routing=order
+magpie group pick opus-anywhere copilot/claude-opus-5.5
+magpie claude group/opus-anywhere
+

ルーティング:smart、order、rotate、usage、pace、weight、manual。維持:auto、session、turn、off、strict。magpie group help ですべての項目が出ます。

+

既成のグループ

+

magpie group template は、よくある用途のグループを自分のモデルで一度に作ります。

+
  • smart:難しいターンは最も強いモデル、簡単なものは安いモデルへ。分類モデルが見分けます。
  • thrifty:まず安いモデル、高い推論や安いものが失敗したときに最も強いモデル。
  • steady:最大三つのプロバイダーそれぞれの最も強いモデルを、順に後ろで控えさせます。
+
ターミナル
magpie group template            # lists smart, thrifty, steady and the models each would take
+magpie group template steady
+ +

よくある質問

+

複数の Claude アカウントを交互に使えますか?

+

使えます。同じ Claude サブスクリプションに追加し、編集画面に ルーティング が出たら 交互 か 使用量が最少のものを優先 を選びます。一つが枠切れになると次へ回ります。

+

API キーがレート制限(429)されたら?

+

ベンダーの指定どおり休み、同じプロバイダーのほかのキーへ回ります。最後尾へ を選ぶと後ろに回り、負荷が回ります。

+

DeepSeek が落ちたら別のモデルに切り替えられますか?

+

できます。DeepSeek と代わりのモデルを順に入れたルーティンググループを作り、ルーティングを 順番 にして、エージェントで group/ を選びます。返信が始まる前の失敗なら次へ移ります。

+

アカウントを切り替えるとプロンプトキャッシュは失われますか?

+

維持 は既定で 自動 です。キャッシュに価値がある間は同じアカウントに留まり、ターン内では常に留まるので、ローテーションでリクエストごとにキャッシュを失うことはありません。

+ +

関連ページ:Claude Pro/Max・ChatGPT Plus/Pro・GitHub Copilot のサブスクを任意のコーディングエージェントで使う。エラーが出るときは よくあるエラーの直し方:401・429・502・504 など、または Discord で質問してください。

+
+
+ + + + + + + diff --git a/site/public/docs/ja/subscriptions.html b/site/public/docs/ja/subscriptions.html index 854ed0278..8ace896d1 100644 --- a/site/public/docs/ja/subscriptions.html +++ b/site/public/docs/ja/subscriptions.html @@ -257,6 +257,8 @@

その他のツール

ベース URL を設定できるツールなら、ゲートウェイ経由でサブスクリプションを使えます。Gateway タブの Connect セクションに、コピーできるアドレスとキーがあります。ベース URL は、OpenAI クライアントなら http://127.0.0.1:3425/v1、Anthropic や Gemini のクライアントなら http://127.0.0.1:3425 です。アプリ連携(英語)を参照してください。

+

複数のアカウントやキーで負荷を分け、互いに引き継げます。アカウント・キー・プロバイダーのローテーションとフェイルオーバー を参照してください。

+

よくある質問

ChatGPT Plus や Pro のサブスクリプションを Claude Code で使えますか?

はい。magpie で ChatGPT にサインインし、Claude Code の行で codex/… のモデルを選ぶか、magpie claude codex/gpt-5.5 を実行します。magpie が Claude Code の Anthropic リクエストを GPT モデル向けに変換し、応答を戻します。ツール呼び出しも含みます。ティアや推論レベルを含む設定の全体は Claude Code で ChatGPT にあります。

diff --git a/site/public/docs/routing-groups.html b/site/public/docs/routing-groups.html new file mode 100644 index 000000000..6c82b83a2 --- /dev/null +++ b/site/public/docs/routing-groups.html @@ -0,0 +1,277 @@ + + + + + +Round robin and failover across accounts, API keys and providers: load balancing for Claude Code and Codex · magpie routing groups + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

Docs · Guide

+

Round robin and failover across accounts, keys and providers

+

One Claude subscription isn't enough, one API key keeps getting rate limited, or you want another vendor to take over when DeepSeek is down? magpie routes requests at two levels: between a provider's accounts or keys, and between the providers and models in a routing group. When an upstream fails before any of the reply is sent to the agent, magpie moves to the next candidate, and the agent never knows.

+

Several accounts or keys

+

Once a provider has a second account or key switched on, its editor gets Routing and Stays, which decide how requests go between them.

+

You can also choose what one rate limited (429) while it still has quota does: Keeps its place rests as long as the vendor asks, then takes its place again; Goes to the back goes behind every one not rate limited since, so the load goes round rather than back to the first each time.

+

Routings

+
  • Smart (default): the first takes requests while it has quota to spare; when it runs low, the one with the most left takes over. One out of credit sits out half an hour, one out of quota until it resets, one rate limited as long as the vendor asks, and one that fails a minute, longer each time it fails again.
  • In order: requests go to the first; the next takes over when the one before runs out of quota, hits a rate limit or fails.
  • In turn: each turn of a conversation goes to the next one, spreading the load; the requests within a turn stay where it began, so the prompt cache holds.
  • Least used first: a subscription by the share of its allowance used, a key by the tokens it served in the last hours.
  • Weekly pace: the subscription with the most of its week left per hour until it renews, so less of each week is lost at its reset; one at 90% or more waits until the others can't answer.
  • By weight: by the weight beside each key; a key weighing 3 takes three requests for every one a key weighing 1 takes. Keys only, not accounts.
  • Free first: what costs nothing first, and only when those can't answer one that spends.
+

Stays

+

Stays decides whether a conversation stays with the account or key that answered it:

+
  • Auto (default): while what the vendor cached of it is worth keeping; within a turn always.
  • Session: for the whole session, while it can answer.
  • Within a turn: stays put while the agent sends tool results back; routed afresh when you speak again.
  • Off: every request routed afresh.
  • Strict: never moved, even rate limited or out of quota; the error goes to the agent. New conversations are routed as usual.
+

Routing groups

+

A routing group puts models from different providers together: Opus from a Claude subscription and from Copilot, say, or several free models. An agent picks group/<id> as its model, and magpie sends each request as the group's routing and rules say. Groups are under Routing groups on the Routing page; New group makes one.

+
    +
  1. magpie finds groups by itselfA model two or more of your providers serve becomes a group of them (auto-<model>), with nothing to set. Switch off Find groups on their own if you don't want them.
  2. +
  3. What goes inAny model as provider/model, another group (up to 8 deep), or a pattern: openrouter/*:free takes in free models the vendor adds later too.
  4. +
  5. A group's routingBesides the ones above, a group can go By weight (each model's weight) or Manual (only the model you pick, with no failover).
  6. +
  7. RulesWhich model a turn goes to first, by its length, an image, the reasoning asked for or the agent.
  8. +
+

A group can set reasoning too: a member can be fixed at :high and the like, or a classifier rates each turn as it begins and picks low to xhigh.

+

CLI

+
Terminal
magpie groups                       # yours, then those magpie found
+magpie group add "Opus anywhere" models=claude/claude-opus-5-5,copilot/claude-opus-5.5 routing=order
+magpie group set opus-anywhere stays=session models+=openrouter/anthropic/claude-opus-5.5
+magpie group set opus-anywhere routing=weight weight=claude/claude-opus-5-5=3
+magpie group add my-free-pool models='openrouter/*:free,opencode-zen/*-free' routing=order
+magpie group pick opus-anywhere copilot/claude-opus-5.5
+magpie claude group/opus-anywhere
+

Routings: smart, order, rotate, usage, pace, weight, manual. Stays: auto, session, turn, off, strict. magpie group help lists every field.

+

Ready-made groups

+

magpie group template makes a group for a common need from your own models in one go:

+
  • smart: hard turns to the strongest model, easy ones to a cheap one, a classifier telling them apart.
  • thrifty: a cheap model first, the strongest for high reasoning or when the cheap ones fail.
  • steady: the strongest model of each of up to three providers, each behind the other.
+
Terminal
magpie group template            # lists smart, thrifty, steady and the models each would take
+magpie group template steady
+ +

FAQ

+

Can I use several Claude accounts in turn?

+

Yes. Add them to the same Claude subscription; once Routing shows in its editor, pick In turn or Least used first. When one runs out, requests go to the next.

+

What happens when an API key is rate limited (429)?

+

It rests as long as the vendor asks and requests go to the provider's other keys; with Goes to the back it goes behind the others, so the load goes round.

+

Can another model take over when DeepSeek is down?

+

Yes. Make a routing group with DeepSeek and a fallback in order, routing In order, and pick group/ in the agent. An upstream that fails before the reply starts gives way to the next.

+

Does switching accounts lose the prompt cache?

+

Stays is Auto by default: a conversation stays with its account while the cache is worth keeping, and always within a turn, so rotating doesn't lose the cache on every request.

+ +

Related: Use your Claude Pro/Max, ChatGPT Plus/Pro or GitHub Copilot subscription in any coding agent. Something fails? See Fixing common errors: 401, 429, 502, 504 and more, or ask on Discord.

+
+
+ + + + + + + diff --git a/site/public/docs/subscriptions.html b/site/public/docs/subscriptions.html index 9290be678..7618f38ec 100644 --- a/site/public/docs/subscriptions.html +++ b/site/public/docs/subscriptions.html @@ -257,6 +257,8 @@

Other tools

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

+

Several accounts or keys can share the load and stand in for each other. See Round robin and failover across accounts, keys and providers.

+

FAQ

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

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

diff --git a/site/public/docs/zh/routing-groups.html b/site/public/docs/zh/routing-groups.html new file mode 100644 index 000000000..4d39713d7 --- /dev/null +++ b/site/public/docs/zh/routing-groups.html @@ -0,0 +1,277 @@ + + + + + +多个账号、API Key 和供应商轮询与故障切换:Claude Code、Codex 的负载均衡 · magpie 路由组 + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

文档 · 指南

+

多个账号、Key 和供应商轮询与故障切换

+

一个 Claude 订阅不够用、一个 API Key 老被限流,或者想让 DeepSeek 挂了时自动换到别家?magpie 在两层上路由请求:一个供应商的多个账号或 Key 之间,以及多个供应商、多个模型组成的路由组之间。回复还没开始发给 Agent 时上游出错,magpie 就换下一个候选,Agent 不会察觉。

+

一个供应商的多个账号或 Key

+

给同一个供应商加上第二个账号或第二个 Key 并打开后,它的编辑页会多出 路由 和 会话保持 两项,决定请求在这些账号或 Key 之间怎么分。

+

被限流(429)但还有额度的那个怎么办,也可以选:保持原位:休息到供应商要求的时间,再回到原来的位置;排到最后:排到所有没被限流的后面,让负载轮转起来,而不是每次都回到第一个。

+

路由方式

+
  • 智能(默认):第一个在额度充足时接请求,额度快用完时由剩得最多的接手。没余额的歇半小时,额度用完的歇到重置,被限流的歇到供应商要求的时间,出错的歇一分钟,再错就更久。
  • 按顺序:请求都发给第一个,它额度用完、被限流或出错时由下一个接手。
  • 轮流:会话的每一轮交给下一个,均摊负载;一轮之内的请求留在开始的地方,提示缓存不失效。
  • 用量少的优先:订阅按已用额度的比例,Key 按最近几小时用掉的 token。
  • 重置前用完:交给本周剩余额度按小时算最多的订阅,让每周重置时浪费得最少;用到 90% 以上的,等别的都答不了才用。
  • 按权重:按每个 Key 旁边设的权重分,权重 3 的接 3 个请求,权重 1 的接 1 个。只有 Key 能用,账号不行。
  • 免费优先:先用不占额度、不花钱的模型,它们答不了时才用花钱的。
+

会话保持

+

会话保持 决定一段对话是否留在答过它的那个账号或 Key 上:

+
  • 自动(默认):在供应商为它缓存的内容还值得保留时留下,一轮之内总是留下。
  • 整个会话:整个会话都留在那里,只要它还能答。
  • 一轮之内:Agent 发回工具结果时不动,你再说话时重新路由。
  • 关闭:每个请求都重新路由。
  • 严格:永远不换,哪怕它被限流或额度用完,错误直接交给 Agent。新会话照常路由。
+

路由组

+

路由组把不同供应商的模型放在一起,比如官方 Claude 订阅里的 Opus 和 Copilot 里的 Opus,或者几个免费模型。Agent 选 group/<id> 作为模型,magpie 按组的路由方式和规则决定每个请求交给谁。组在 路由 页的 路由组 里,用 新建组 创建。

+
    +
  1. magpie 自己会找组两个及以上供应商都提供的模型,自动成为一个组(auto-<模型>),不用设置。不想要可以关掉 自动创建路由组。
  2. +
  3. 组里放什么任意模型,用 provider/model 写;也可以放另一个组(最多 8 层),或者用通配符:openrouter/*:free 会把以后新出的免费模型也加进来。
  4. +
  5. 组的路由方式除了上面几种,组还有 按权重(按每个模型的权重)和 手动(只用你选的那个,不切换)。
  6. +
  7. 规则可以按一轮的长度、是否带图、要求的推理强度或 Agent,决定一轮先交给哪个模型。
  8. +
+

组还能定推理强度:每个成员可以写死 :high 这类强度;或者让分类模型在每轮开始时判断难度,再决定 low 到 xhigh。

+

命令行

+
终端
magpie groups                       # yours, then those magpie found
+magpie group add "Opus anywhere" models=claude/claude-opus-5-5,copilot/claude-opus-5.5 routing=order
+magpie group set opus-anywhere stays=session models+=openrouter/anthropic/claude-opus-5.5
+magpie group set opus-anywhere routing=weight weight=claude/claude-opus-5-5=3
+magpie group add my-free-pool models='openrouter/*:free,opencode-zen/*-free' routing=order
+magpie group pick opus-anywhere copilot/claude-opus-5.5
+magpie claude group/opus-anywhere
+

路由方式写法:smart、order、rotate、usage、pace、weight、manual;会话保持写法:auto、session、turn、off、strict。magpie group help 列出全部字段。

+

现成的组

+

magpie group template 用你自己的模型一次建好常用的组:

+
  • smart:难的一轮给最强的模型,简单的给便宜的,由分类模型区分。
  • thrifty:先用便宜模型,要高推理或便宜的都失败时才用最强的。
  • steady:最多三个供应商各自最强的模型,一个接一个兜底。
+
终端
magpie group template            # lists smart, thrifty, steady and the models each would take
+magpie group template steady
+ +

常见问题

+

多个 Claude 账号能轮流用吗?

+

能。把账号都加到同一个 Claude 订阅里,编辑页出现 路由 后选 轮流 或 用量少的优先;一个额度用完时请求自动交给下一个。

+

API Key 被限流(429)时会怎样?

+

被限流的 Key 休息到供应商要求的时间,请求交给同一供应商的其他 Key;选 排到最后 则让它排到队尾,负载轮转。

+

DeepSeek 挂了能自动换别的模型吗?

+

能。建一个路由组,把 DeepSeek 和备用模型按顺序放进去,路由方式选 按顺序,Agent 选 group/。回复开始前上游出错就换下一个。

+

切换账号会让提示缓存失效吗?

+

会话保持 默认 自动:缓存还值得保留时对话留在原账号,一轮之内总是留下,所以轮转不会每个请求都丢缓存。

+ +

相关页面:在任意 Agent 中使用 Claude Pro/Max、ChatGPT Plus/Pro、GitHub Copilot 订阅。遇到报错?见 常见错误排查:401、429、502、504 等,或到 Discord 提问。

+
+
+ + + + + + + diff --git a/site/public/docs/zh/subscriptions.html b/site/public/docs/zh/subscriptions.html index 75425d0fc..d0f9d8094 100644 --- a/site/public/docs/zh/subscriptions.html +++ b/site/public/docs/zh/subscriptions.html @@ -257,6 +257,8 @@

其他工具

任何能设置 base URL 的工具,也能通过网关用订阅。网关 标签页的 接入 部分有地址和 Key 可以直接复制。OpenAI 客户端的 base URL 是 http://127.0.0.1:3425/v1,Anthropic 或 Gemini 客户端是 http://127.0.0.1:3425。见 接入你的应用。

+

多个账号或 Key 可以分担负载、互相兜底,见 多个账号、Key 和供应商轮询与故障切换。

+

常见问题

Claude Code 能用 ChatGPT Plus 或 Pro 订阅吗?

能。在 magpie 里登录 ChatGPT,在 Claude Code 那一行选一个 codex/… 模型,或者运行 magpie claude codex/gpt-5.5。magpie 把 Claude Code 的 Anthropic 请求转成 GPT 模型的格式,再把回复转回来,工具调用也包括在内。分档、推理强度等完整设置见 Claude Code 用 ChatGPT。

diff --git a/site/public/llms-full.txt b/site/public/llms-full.txt index 30e3f49e4..3d057b1fc 100644 --- a/site/public/llms-full.txt +++ b/site/public/llms-full.txt @@ -766,6 +766,8 @@ The routing modes are in [Get started](https://usemagpie.ai/docs/start#routing). Any tool with a base-URL setting can use a subscription through the gateway too. The Gateway tab’s Connect section has the address and key to copy. The base URL is `http://127.0.0.1:3425/v1` for an OpenAI client and `http://127.0.0.1:3425` for an Anthropic or Gemini one. See [Integrate your app](https://usemagpie.ai/docs/integrate). +Several accounts or keys can share the load and stand in for each other. See [Round robin and failover across accounts, keys and providers](https://usemagpie.ai/docs/routing-groups). + ## FAQ ### Can I use my ChatGPT Plus or Pro subscription in Claude Code? @@ -8982,6 +8984,98 @@ Related: [DeepSeek in Claude Code, Codex, Gemini CLI and OpenCode](https://usema --- +Source: https://usemagpie.ai/docs/routing-groups + +# Round robin and failover across accounts, keys and providers + +One Claude subscription isn't enough, one API key keeps getting rate limited, or you want another vendor to take over when DeepSeek is down? magpie routes requests at two levels: between a provider's accounts or keys, and between the providers and models in a routing group. When an upstream fails before any of the reply is sent to the agent, magpie moves to the next candidate, and the agent never knows. + +## Several accounts or keys + +Once a provider has a second account or key switched on, its editor gets Routing and Stays, which decide how requests go between them. + +You can also choose what one rate limited (429) while it still has quota does: Keeps its place rests as long as the vendor asks, then takes its place again; Goes to the back goes behind every one not rate limited since, so the load goes round rather than back to the first each time. + +## Routings + +- **Smart.** (default): the first takes requests while it has quota to spare; when it runs low, the one with the most left takes over. One out of credit sits out half an hour, one out of quota until it resets, one rate limited as long as the vendor asks, and one that fails a minute, longer each time it fails again. +- **In order.** : requests go to the first; the next takes over when the one before runs out of quota, hits a rate limit or fails. +- **In turn.** : each turn of a conversation goes to the next one, spreading the load; the requests within a turn stay where it began, so the prompt cache holds. +- **Least used first.** : a subscription by the share of its allowance used, a key by the tokens it served in the last hours. +- **Weekly pace.** : the subscription with the most of its week left per hour until it renews, so less of each week is lost at its reset; one at 90% or more waits until the others can't answer. +- **By weight.** : by the weight beside each key; a key weighing 3 takes three requests for every one a key weighing 1 takes. Keys only, not accounts. +- **Free first.** : what costs nothing first, and only when those can't answer one that spends. + +## Stays + +Stays decides whether a conversation stays with the account or key that answered it: + +- **Auto.** (default): while what the vendor cached of it is worth keeping; within a turn always. +- **Session.** : for the whole session, while it can answer. +- **Within a turn.** : stays put while the agent sends tool results back; routed afresh when you speak again. +- **Off.** : every request routed afresh. +- **Strict.** : never moved, even rate limited or out of quota; the error goes to the agent. New conversations are routed as usual. + +## Routing groups + +A routing group puts models from different providers together: Opus from a Claude subscription and from Copilot, say, or several free models. An agent picks `group/` as its model, and magpie sends each request as the group's routing and rules say. Groups are under Routing groups on the Routing page; New group makes one. + +1. **magpie finds groups by itself.** A model two or more of your providers serve becomes a group of them (auto-), with nothing to set. Switch off Find groups on their own if you don't want them. +2. **What goes in.** Any model as provider/model, another group (up to 8 deep), or a pattern: `openrouter/*:free` takes in free models the vendor adds later too. +3. **A group's routing.** Besides the ones above, a group can go By weight (each model's weight) or Manual (only the model you pick, with no failover). +4. **Rules.** Which model a turn goes to first, by its length, an image, the reasoning asked for or the agent. + +A group can set reasoning too: a member can be fixed at `:high` and the like, or a classifier rates each turn as it begins and picks low to xhigh. + +## CLI + +``` +magpie groups # yours, then those magpie found +magpie group add "Opus anywhere" models=claude/claude-opus-5-5,copilot/claude-opus-5.5 routing=order +magpie group set opus-anywhere stays=session models+=openrouter/anthropic/claude-opus-5.5 +magpie group set opus-anywhere routing=weight weight=claude/claude-opus-5-5=3 +magpie group add my-free-pool models='openrouter/*:free,opencode-zen/*-free' routing=order +magpie group pick opus-anywhere copilot/claude-opus-5.5 +magpie claude group/opus-anywhere +``` + +Routings: smart, order, rotate, usage, pace, weight, manual. Stays: auto, session, turn, off, strict. `magpie group help` lists every field. + +## Ready-made groups + +`magpie group template` makes a group for a common need from your own models in one go: + +- **smart.** : hard turns to the strongest model, easy ones to a cheap one, a classifier telling them apart. +- **thrifty.** : a cheap model first, the strongest for high reasoning or when the cheap ones fail. +- **steady.** : the strongest model of each of up to three providers, each behind the other. + +``` +magpie group template # lists smart, thrifty, steady and the models each would take +magpie group template steady +``` + +## FAQ + +### Can I use several Claude accounts in turn? + +Yes. Add them to the same Claude subscription; once Routing shows in its editor, pick In turn or Least used first. When one runs out, requests go to the next. + +### What happens when an API key is rate limited (429)? + +It rests as long as the vendor asks and requests go to the provider's other keys; with Goes to the back it goes behind the others, so the load goes round. + +### Can another model take over when DeepSeek is down? + +Yes. Make a routing group with DeepSeek and a fallback in order, routing In order, and pick group/ in the agent. An upstream that fails before the reply starts gives way to the next. + +### Does switching accounts lose the prompt cache? + +Stays is Auto by default: a conversation stays with its account while the cache is worth keeping, and always within a turn, so rotating doesn't lose the cache on every request. + +Related: [Use your Claude Pro/Max, ChatGPT Plus/Pro or GitHub Copilot subscription in any coding agent](https://usemagpie.ai/docs/subscriptions). Something fails? See [Fixing common errors: 401, 429, 502, 504 and more](https://usemagpie.ai/docs/troubleshooting), or ask on [Discord](https://discord.gg/vGSnD3ZKQF). + +--- + Source: https://usemagpie.ai/docs/library # Library diff --git a/site/public/llms.txt b/site/public/llms.txt index 442707885..f27e529f1 100644 --- a/site/public/llms.txt +++ b/site/public/llms.txt @@ -138,6 +138,7 @@ DeepSeek, Kimi (Moonshot), GLM (Zhipu), Qwen, MiniMax, Anthropic (Claude), OpenA - [Fixing common errors](https://usemagpie.ai/docs/troubleshooting): what the gateway's errors mean and the fix: 401 and 403, 429 and rest periods, 502 and 504, model not found, an agent that doesn't show a model, port 3425 in use, agents in WSL, use from another computer and subscriptions moved to plugins. - [When an agent stops going through magpie](https://usemagpie.ai/docs/agent-drift): what the Agents page means when an agent's config was changed, a model was switched outside magpie, an agent still runs on its old config, an address off loopback doesn't answer (WSL's firewall) or Codex's proxy doesn't pass requests on, and the fix for each. - [Web search for any model](https://usemagpie.ai/docs/web-search): how magpie gives web search to models that can't search (DeepSeek, GLM, Qwen) in Claude Code's WebSearch and Codex's web_search: providers that search for other models, Search APIs (Tavily, Brave Search, Exa, You.com, SearXNG and more), results per search, and the search as an MCP server for Cursor and Claude Desktop. +- [Round robin and failover across accounts, keys and providers](https://usemagpie.ai/docs/routing-groups): several accounts or API keys on one provider and routing groups across providers: Smart, In order, In turn, Least used first, Weekly pace, By weight, Free first and Manual routings, Stays for the prompt cache, auto-found groups, patterns, rules, magpie group CLI and templates. - [Library](https://usemagpie.ai/docs/library): instructions, MCP servers, skills, hooks and subagents for each agent. - [MCP router](https://usemagpie.ai/docs/mcp-router): one magpie MCP server per agent. - [Remote magpie](https://usemagpie.ai/docs/remote): use one magpie from several computers. diff --git a/site/public/sitemap.xml b/site/public/sitemap.xml index 81a1b3446..655b84e9a 100644 --- a/site/public/sitemap.xml +++ b/site/public/sitemap.xml @@ -90,6 +90,7 @@ https://usemagpie.ai/docs/kirocrew https://usemagpie.ai/docs/agent-drift https://usemagpie.ai/docs/web-search +https://usemagpie.ai/docs/routing-groups https://usemagpie.ai/docs/local-models https://usemagpie.ai/docs/opencode-models https://usemagpie.ai/docs/alternatives @@ -201,6 +202,7 @@ https://usemagpie.ai/docs/zh/kirocrew https://usemagpie.ai/docs/zh/agent-drift https://usemagpie.ai/docs/zh/web-search +https://usemagpie.ai/docs/zh/routing-groups https://usemagpie.ai/docs/zh/local-models https://usemagpie.ai/docs/zh/opencode-models https://usemagpie.ai/docs/zh/alternatives @@ -311,6 +313,7 @@ https://usemagpie.ai/docs/ja/kirocrew https://usemagpie.ai/docs/ja/agent-drift https://usemagpie.ai/docs/ja/web-search +https://usemagpie.ai/docs/ja/routing-groups https://usemagpie.ai/docs/ja/local-models https://usemagpie.ai/docs/ja/opencode-models https://usemagpie.ai/docs/ja/alternatives