"), the most calls first.
-func Vias(since time.Time) map[string][]Via {
+func Vias(since time.Time) ViaIndex {
return cachedVias(since)
}
-func buildVias(snapshot *logSnapshot, since time.Time) map[string][]Via {
+func buildVias(snapshot *logSnapshot, since time.Time) *viaLists {
out := map[string][]Via{}
+ first := map[string]time.Time{}
+ keep := keptStrings{}
snapshot.visit(since, func(r Record) {
if r.IsRejected() || r.IsReported() || r.Session == "" || r.Model == "" {
return
}
+ r.Provider, r.Model, r.Effort = keep.of(r.Provider), keep.of(r.Model), keep.of(r.Effort)
k := ReportedAs(r.Agent) + "|" + r.Session
vs := out[k]
+ if t, seen := first[k]; !seen || r.Time.Before(t) {
+ first[k] = r.Time
+ }
i := slices.IndexFunc(vs, func(v Via) bool { return v.Provider == r.Provider && v.Model == r.Model && v.Effort == r.Effort })
if i < 0 {
vs, i = append(vs, Via{Provider: r.Provider, Model: r.Model, Effort: r.Effort}), len(vs)
@@ -1029,7 +1035,7 @@ func buildVias(snapshot *logSnapshot, since time.Time) map[string][]Via {
for _, vs := range out {
sort.SliceStable(vs, func(i, j int) bool { return vs[i].Calls > vs[j].Calls })
}
- return out
+ return &viaLists{m: out, first: first}
}
// Saw notes a request from an agent arriving now.
diff --git a/internal/usage/vias_cache.go b/internal/usage/vias_cache.go
index de63bd367..656019703 100644
--- a/internal/usage/vias_cache.go
+++ b/internal/usage/vias_cache.go
@@ -6,29 +6,105 @@ import (
"time"
)
+// viaLists is what the gateway sent each session's calls to, and when each
+// session's first call was: a list counted from any time at or before that
+// first call is the same list.
+type viaLists struct {
+ m map[string][]Via
+ first map[string]time.Time
+}
+
+// viasCache keeps one index of the whole log, which answers every since a
+// session's calls all came after, and one window for a session that had
+// calls before its since. The Sessions list, each agent's manage page and
+// a session's detail each ask from a since of their own; one kept since
+// was built again from the whole log at almost every ask, ~280 MB a time
+// over ~720k calls, on every poll of an open page (#2776).
var viasCache struct {
sync.Mutex
version uint64
- since time.Time
clients string // the clients counted as agents (#1958)
- value map[string][]Via
+ all *viaLists
+ window struct {
+ version uint64
+ clients string
+ since time.Time
+ m map[string][]Via
+ }
}
-func cachedVias(since time.Time) map[string][]Via {
+// ViaIndex is Vias' answer: the one copy every caller shares, handed out
+// whole and read only through Of, which gives each session's list as a
+// copy of its own. Each ask cloned every session's list, ~66 MB a time
+// over ~720k calls, where a page reads the few sessions it lists (#2776).
+type ViaIndex struct {
+ all *viaLists
+ since time.Time
+ snapshot *logSnapshot
+ clients string
+}
+
+// Of is what the gateway sent one session's calls to ("agent|id") since
+// the index's time, the most calls first; nil for a session it sent none
+// of.
+func (x ViaIndex) Of(key string) []Via {
+ vs, ok := x.all.m[key]
+ if !ok {
+ return nil
+ }
+ if x.since.IsZero() || !x.all.first[key].Before(x.since) {
+ return slices.Clone(vs)
+ }
+ return slices.Clone(x.window()[key])
+}
+
+// Len is how many sessions have a list.
+func (x ViaIndex) Len() int {
+ if x.since.IsZero() {
+ return len(x.all.m)
+ }
+ n := 0
+ for _, vs := range x.all.m {
+ if slices.ContainsFunc(vs, func(v Via) bool { return !v.Last.Before(x.since) }) {
+ n++
+ }
+ }
+ return n
+}
+
+// window is the lists counted from the index's since, for a session that
+// had calls before it.
+func (x ViaIndex) window() map[string][]Via {
+ viasCache.Lock()
+ defer viasCache.Unlock()
+ w := &viasCache.window
+ if w.m != nil && w.version == x.snapshot.version && w.clients == x.clients && w.since.Equal(x.since) {
+ return w.m
+ }
+ m := buildVias(x.snapshot, x.since).m
+ if x.snapshot.complete() {
+ w.version, w.clients, w.since, w.m = x.snapshot.version, x.clients, x.since, m
+ }
+ return m
+}
+
+func cachedVias(since time.Time) ViaIndex {
snapshot := readLogSnapshot()
clients := clientAgentsKey()
viasCache.Lock()
defer viasCache.Unlock()
- value := viasCache.value
- if value == nil || viasCache.version != snapshot.version || !viasCache.since.Equal(since) || viasCache.clients != clients {
- value = buildVias(snapshot, since)
- if snapshot.info != nil && snapshot.off == snapshot.info.Size() {
- viasCache.version, viasCache.since, viasCache.value, viasCache.clients = snapshot.version, since, value, clients
+ all := viasCache.all
+ if all == nil || viasCache.version != snapshot.version || viasCache.clients != clients {
+ all = buildVias(snapshot, time.Time{})
+ if snapshot.complete() {
+ viasCache.version, viasCache.clients, viasCache.all = snapshot.version, clients, all
}
}
- out := make(map[string][]Via, len(value))
- for k, vs := range value {
- out[k] = slices.Clone(vs)
- }
- return out
+ return ViaIndex{all: all, since: since, snapshot: snapshot, clients: clients}
+}
+
+// complete is whether the snapshot reached the end of the log, so what is
+// built from it can be kept for its version.
+func (s *logSnapshot) complete() bool {
+ return s.info != nil && s.off == s.info.Size()
}
diff --git a/internal/usage/vias_cache_test.go b/internal/usage/vias_cache_test.go
new file mode 100644
index 000000000..9a8f0a551
--- /dev/null
+++ b/internal/usage/vias_cache_test.go
@@ -0,0 +1,61 @@
+package usage
+
+import (
+ "encoding/json"
+ "fmt"
+ "os"
+ "path/filepath"
+ "runtime"
+ "testing"
+ "time"
+)
+
+// Vias hands every caller the one copy it keeps, not a clone of every
+// session's list: a Sessions page reads the few sessions it lists, and
+// each ask cloned all of them, ~66 MB a time over ~720k calls (#2776).
+// A list read through Of is still the caller's own.
+func TestViasHandOutTheKeptCopy(t *testing.T) {
+ pageHome(t)
+ settleLogClock(t)
+ const sessionCount = 20000
+ if err := os.MkdirAll(filepath.Dir(Path()), 0o700); err != nil {
+ t.Fatal(err)
+ }
+ f, err := os.Create(Path())
+ if err != nil {
+ t.Fatal(err)
+ }
+ enc := json.NewEncoder(f)
+ now := Clock()
+ for i := range sessionCount {
+ if err := enc.Encode(Record{Time: now.Add(-time.Duration(i) * time.Second), Agent: "pi", Session: fmt.Sprintf("s%d", i), Provider: "p", Model: "m", Input: 10, Status: 200}); err != nil {
+ t.Fatal(err)
+ }
+ }
+ if err := f.Close(); err != nil {
+ t.Fatal(err)
+ }
+ vias := Vias(time.Time{})
+ if vias.Len() != sessionCount {
+ t.Fatalf("%d sessions, want %d", vias.Len(), sessionCount)
+ }
+ vias.Of("pi|s1")[0].Calls = 999
+ if got := Vias(time.Time{}).Of("pi|s1")[0].Calls; got != 1 {
+ t.Fatalf("a caller changed the kept copy: %d calls", got)
+ }
+ const asks = 20
+ var before, after runtime.MemStats
+ runtime.GC()
+ runtime.ReadMemStats(&before)
+ for range asks {
+ Vias(time.Time{}).Of("pi|s7")
+ }
+ runtime.ReadMemStats(&after)
+ // a clone of 20000 lists is a few MB; the log's check and one list
+ // are tens of KB
+ per := (after.TotalAlloc - before.TotalAlloc) / asks
+ t.Logf("an ask allocated %d bytes", per)
+ if per > 256<<10 {
+ t.Fatalf("an ask allocated %d bytes", per)
+ }
+}
diff --git a/internal/usage/vias_since_test.go b/internal/usage/vias_since_test.go
new file mode 100644
index 000000000..c1ad8b7ed
--- /dev/null
+++ b/internal/usage/vias_since_test.go
@@ -0,0 +1,86 @@
+package usage
+
+import (
+ "encoding/json"
+ "fmt"
+ "os"
+ "path/filepath"
+ "runtime"
+ "testing"
+ "time"
+)
+
+// The Sessions list, each agent's manage page and a session's detail each
+// ask Vias from a since of their own. One kept since was built again from
+// the whole log at almost every ask, ~280 MB a time over ~720k calls, on
+// every poll of an open page (#2776). One index now answers every since a
+// session's calls all came after, and a session with calls before its
+// since still counts only those after it.
+func TestViasAnswerEverySinceFromOneIndex(t *testing.T) {
+ pageHome(t)
+ settleLogClock(t)
+ const sessionCount = 20000
+ if err := os.MkdirAll(filepath.Dir(Path()), 0o700); err != nil {
+ t.Fatal(err)
+ }
+ f, err := os.Create(Path())
+ if err != nil {
+ t.Fatal(err)
+ }
+ enc := json.NewEncoder(f)
+ now := Clock()
+ write := func(r Record) {
+ if err := enc.Encode(r); err != nil {
+ t.Fatal(err)
+ }
+ }
+ for i := range sessionCount {
+ write(Record{Time: now.Add(-time.Duration(sessionCount-i) * time.Second), Agent: "pi", Session: fmt.Sprintf("s%d", i), Provider: "p", Model: "m", Input: 10, Status: 200})
+ }
+ // one session with a call on each side of a since
+ write(Record{Time: now.Add(-time.Hour), Agent: "pi", Session: "both", Provider: "p", Model: "m", Input: 10, Status: 200})
+ write(Record{Time: now, Agent: "pi", Session: "both", Provider: "p", Model: "m", Input: 10, Status: 200})
+ if err := f.Close(); err != nil {
+ t.Fatal(err)
+ }
+ if got := Vias(now.Add(-time.Minute)).Of("pi|both"); len(got) != 1 || got[0].Calls != 1 {
+ t.Fatalf("since a minute ago: %+v, want the one call after it", got)
+ }
+ if got := Vias(time.Time{}).Of("pi|both"); len(got) != 1 || got[0].Calls != 2 {
+ t.Fatalf("since ever: %+v, want both calls", got)
+ }
+ // the last 60 sessions, a second apart up to a second ago, and "both"
+ if n := Vias(now.Add(-time.Minute)).Len(); n != 61 {
+ t.Fatalf("%d sessions with calls since a minute ago, want 61", n)
+ }
+ if n := Vias(time.Time{}).Len(); n != sessionCount+1 {
+ t.Fatalf("%d sessions, want %d", n, sessionCount+1)
+ }
+ // the list, a manage page and a detail, asking in turn
+ sinces := []time.Time{
+ now.Add(-(sessionCount + 60) * time.Second),
+ now.Add(-(sessionCount/2 + 60) * time.Second),
+ now.Add(-(sessionCount - 10 + 60) * time.Second),
+ }
+ key := fmt.Sprintf("pi|s%d", sessionCount-10)
+ for _, since := range sinces {
+ if got := Vias(since).Of(key); len(got) != 1 || got[0].Calls != 1 {
+ t.Fatalf("since %v: %+v", since, got)
+ }
+ }
+ const asks = 30
+ var before, after runtime.MemStats
+ runtime.GC()
+ runtime.ReadMemStats(&before)
+ for i := range asks {
+ Vias(sinces[i%len(sinces)]).Of(key)
+ }
+ runtime.ReadMemStats(&after)
+ // building the lists of 20000 sessions is several MB; the log's check
+ // and one list are tens of KB
+ per := (after.TotalAlloc - before.TotalAlloc) / asks
+ t.Logf("an ask allocated %d bytes", per)
+ if per > 256<<10 {
+ t.Fatalf("an ask allocated %d bytes: the lists were built again", per)
+ }
+}
diff --git a/internal/webview2env/webview2env.go b/internal/webview2env/webview2env.go
new file mode 100644
index 000000000..d0d75b93b
--- /dev/null
+++ b/internal/webview2env/webview2env.go
@@ -0,0 +1,19 @@
+// Package webview2env keeps WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS as magpie
+// was started with. Wails' WebView2 loader blanks the variable in its own
+// init (webviewloader.preventEnvAndRegistryOverrides, so neither it nor the
+// registry's policy can change the browser's arguments), before magpie's
+// code runs, and a user's --disable-features=RendererCodeIntegrity never
+// reached the renderer (#2753). This package reads it first. Go
+// initializes, at each step, the first package by import path whose
+// imports are all done. This one imports only syscall, so it is ready as
+// soon as syscall is, and it sorts before "os"; the loader needs os, so
+// os, and the loader after it, can't start while this one waits.
+package webview2env
+
+import "syscall"
+
+// Name is the variable WebView2 reads extra browser arguments from.
+const Name = "WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS"
+
+// Args is the variable's value when magpie started, "" when it wasn't set.
+var Args, _ = syscall.Getenv(Name)
diff --git a/site/public/docs/docker.html b/site/public/docs/docker.html
index 9269ebdea..defe1d07a 100644
--- a/site/public/docs/docker.html
+++ b/site/public/docs/docker.html
@@ -93,7 +93,7 @@
| Volume | /config: providers, keys, sign-ins, plugins and usage |
| User | nonroot (uid 65532) |
- The image holds magpie’s terminal-only build on distroless, with bash and busybox for a terminal in the container. It runs magpie serve (the gateway alone) unless given another command. The container finds no agents to wire, so magpie in it is a gateway: the agents that use it run elsewhere.
+ The image holds magpie’s terminal-only build on Debian 12 slim, with bash for a terminal in the container and curl for the installers of the CLIs some subscriptions sign in with (Cursor, Devin, Grok Build). It runs magpie serve (the gateway alone) unless given another command. The container finds no agents to wire, so magpie in it is a gateway: the agents that use it run elsewhere.
Run it with the browser UI, a key for that page you keep across restarts, and both ports on the host’s loopback only:
diff --git a/site/public/docs/integrate.html b/site/public/docs/integrate.html
index e34b9c2da..1ff43e88a 100644
--- a/site/public/docs/integrate.html
+++ b/site/public/docs/integrate.html
@@ -108,6 +108,7 @@ curl -s http://127.0.0.1:3425/v1/models -H "Authorization: Bearer magpie-acme"
/v1/messages, /v1/messages/count_tokens | Anthropic Messages |
/v1beta/models/{model}:generateContent (and :streamGenerateContent) | Google Gemini |
/v1/models | the catalog |
+ /api/version, /api/tags, /api/show | the catalog as an Ollama server lists it, for a client that takes only an Ollama endpoint (Copilot in Visual Studio and VS Code: enter http://127.0.0.1:<port> as the Ollama URL; it chats on /v1/chat/completions, and /api/chat isn’t served) |
The key names your app
diff --git a/site/public/docs/ja/docker.html b/site/public/docs/ja/docker.html
index 43302c61c..550632cb8 100644
--- a/site/public/docs/ja/docker.html
+++ b/site/public/docs/ja/docker.html
@@ -93,7 +93,7 @@
| ボリューム | /config:プロバイダ、キー、サインイン、プラグイン、使用量 |
| ユーザー | nonroot(uid 65532) |
- イメージに入っているのはターミナル専用ビルドの magpie で、distroless をベースに、コンテナ内でターミナルを使うための bash と busybox を含みます。コマンドを指定しなければ magpie serve(ゲートウェイのみ)を実行します。コンテナ内には設定するエージェントがないので、ここでの magpie はゲートウェイです。それを使うエージェントはほかのマシンで動きます。
+ イメージに入っているのはターミナル専用ビルドの magpie で、Debian 12 slim をベースに、コンテナ内でターミナルを使うための bash と、一部のサブスクリプションのサインインに必要な CLI(Cursor、Devin、Grok Build)をインストールするための curl を含みます。コマンドを指定しなければ magpie serve(ゲートウェイのみ)を実行します。コンテナ内には設定するエージェントがないので、ここでの magpie はゲートウェイです。それを使うエージェントはほかのマシンで動きます。
ブラウザ UI 付きで、再起動しても変わらないページ用のキーを渡し、両方のポートをホストのループバックだけに公開して起動します。
diff --git a/site/public/docs/ja/start.html b/site/public/docs/ja/start.html
index 3d1df78f8..3819f7be1 100644
--- a/site/public/docs/ja/start.html
+++ b/site/public/docs/ja/start.html
@@ -168,7 +168,7 @@
1 つのモデルを複数のプロバイダで
グループとは、1 つまたは複数のプロバイダのモデルを、エージェントが 1 つとして選べるようにまとめたものです。ピッカーの Routing groups の下に group/<id> として表示されます。2 つのプロバイダが同じ名前で提供しているモデルは、それだけでグループになります。Routing タブの New group では、好きなモデルを組み合わせてグループを作れます。グループで何ができるかは、最初のモデルが基準になります。
- 何もしなくてもできるグループ。 すでに持っているモデルを提供する 2 つ目のプロバイダを追加すると(Claude サブスクリプションと Copilot の Claude Opus、DeepSeek 自身の API と OpenRouter の DeepSeek など)、magpie はそれを提供するすべてのプロバイダにまたがるグループ group/auto-<model> を自動で作ります。名前はベンダーごとの表記の違い(deepseek/deepseek-chat、deepseek-chat)を吸収して照合されます。エージェントにこれを選ぶとリクエストがすべてに分散されます。不要なものは magpie group rm で非表示にできます。
+ 何もしなくてもできるグループ。 すでに持っているモデルを提供する 2 つ目のプロバイダを追加すると(Claude サブスクリプションと Copilot の Claude Opus、DeepSeek 自身の API と OpenRouter の DeepSeek など)、magpie はそれを提供するすべてのプロバイダにまたがるグループ auto/<model>(モデル自身の ID。例: auto/claude-opus-4.6。以前の group/auto-… も引き続き使えます)を自動で作ります。名前はベンダーごとの表記の違い(deepseek/deepseek-chat、deepseek-chat)を吸収して照合されます。エージェントにこれを選ぶとリクエストがすべてに分散されます。不要なものは magpie group rm で非表示にできます。
| ルーティング | 先に使われるもの |
スマート smart | デフォルトです。メンバーのアカウントとキーをまとめて扱い(グループ内のグループは 1 つとして扱います。下記参照)、クォータに余裕のあるサブスクリプションのうち、利用枠が最も早く更新されるもの。基準は週の枠です。週の枠がなく 5 時間枠だけのアカウント(Claude Enterprise)は 5 時間枠で判断されるため、それより後に週の枠が更新されるものすべてより先になります。リセットのないクレジット(WorkBuddy のパッケージはそれぞれの日に失効します)は、残りのうち最も早く失効する時点で判断されるため、クレジットが最も早く失効する WorkBuddy アカウントが先になります。失敗後に休止中のものは最後に回ります。 |
diff --git a/site/public/docs/start.html b/site/public/docs/start.html
index 88730bddd..2a1bfff0d 100644
--- a/site/public/docs/start.html
+++ b/site/public/docs/start.html
@@ -168,7 +168,7 @@
One model over several providers
A group is several models, from one provider or many, that an agent picks as one: group/<id>, under Routing groups in the picker. A model two of your providers serve under the same name becomes a group on its own; New group in the Routing tab makes one of any models you like. The first model answers for what the group can do.
- Groups you get without doing anything. Add a second provider that serves a model you already have — Claude Opus from your Claude subscription and from Copilot, DeepSeek from its own API and from OpenRouter — and magpie makes it a group by itself, group/auto-<model>, over every provider that serves it. The name is matched however each vendor spells it (deepseek/deepseek-chat, deepseek-chat). Pick it for an agent to spread its requests over all of them; magpie group rm hides one you don’t want.
+ Groups you get without doing anything. Add a second provider that serves a model you already have — Claude Opus from your Claude subscription and from Copilot, DeepSeek from its own API and from OpenRouter — and magpie makes it a group by itself, auto/<model> (the model's own id, as in auto/claude-opus-4.6; the older group/auto-… id still works), over every provider that serves it. The name is matched however each vendor spells it (deepseek/deepseek-chat, deepseek-chat). Pick it for an agent to spread its requests over all of them; magpie group rm hides one you don’t want.
| Routing | What goes first |
Smart smart | The default. Over the members’ accounts and keys together (a group in the group as one, see below): of the subscriptions with quota to spare, the one whose allowance renews soonest. The week decides; an account with five hours and no week (Claude Enterprise) goes by its five hours, so ahead of every week renewing later. Credits with no reset (WorkBuddy’s packages, each ending on its own day) count as renewing when the soonest of those left run out, so the WorkBuddy account whose credits end first goes first. One resting after a failure goes last. |
diff --git a/site/public/docs/zh/docker.html b/site/public/docs/zh/docker.html
index 5ac2be38f..9d12a9787 100644
--- a/site/public/docs/zh/docker.html
+++ b/site/public/docs/zh/docker.html
@@ -93,7 +93,7 @@
| 数据卷 | /config:供应商、密钥、登录、插件和用量 |
| 用户 | nonroot(uid 65532) |
- 镜像里是 magpie 的纯终端版本,基于 distroless,并带了 bash 和 busybox,方便在容器里开终端。不指定命令时运行 magpie serve(只有网关)。容器里找不到需要配置的 Agent,所以这里的 magpie 是一个网关:用它的 Agent 运行在别的机器上。
+ 镜像里是 magpie 的纯终端版本,基于 Debian 12 slim,带 bash,方便在容器里开终端,也带 curl,用来安装部分订阅登录时需要的 CLI(Cursor、Devin、Grok Build)。不指定命令时运行 magpie serve(只有网关)。容器里找不到需要配置的 Agent,所以这里的 magpie 是一个网关:用它的 Agent 运行在别的机器上。
带 Web 界面运行,给页面一个重启后不变的 key,两个端口都只发布在宿主机的回环地址上:
diff --git a/site/public/docs/zh/integrate.html b/site/public/docs/zh/integrate.html
index 3b1e1db81..4ea3cae2f 100644
--- a/site/public/docs/zh/integrate.html
+++ b/site/public/docs/zh/integrate.html
@@ -108,6 +108,7 @@ curl -s http://127.0.0.1:3425/v1/models -H "Authorization: Bearer magpie-acme"
/v1/messages、/v1/messages/count_tokens | Anthropic Messages |
/v1beta/models/{model}:generateContent(以及 :streamGenerateContent) | Google Gemini |
/v1/models | 模型目录 |
+ /api/version、/api/tags、/api/show | 以 Ollama 服务器的格式列出模型目录,供只接受 Ollama 端点的客户端使用(Visual Studio 和 VS Code 里的 Copilot:Ollama 地址填 http://127.0.0.1:<端口>;对话走 /v1/chat/completions,不提供 /api/chat) |
用 key 标明你的应用
diff --git a/site/public/docs/zh/start.html b/site/public/docs/zh/start.html
index f03cecadb..8a9b8b8d1 100644
--- a/site/public/docs/zh/start.html
+++ b/site/public/docs/zh/start.html
@@ -168,7 +168,7 @@
跨供应商的同一个模型
路由组是几个模型(来自一个或多个供应商),Agent 把它当作一个来选:group/<id>,在选择列表的 路由组 下面。两个供应商用同一个名字提供的模型会自动成组;在 路由 标签页点 新建组 可以把任意模型组到一起。排第一的模型决定这个组对外的能力。
- 不用手动建的组。再加一个供应商,只要它提供的模型和已有的同名(比如 Claude 订阅和 Copilot 都有 Claude Opus,DeepSeek 官方 API 和 OpenRouter 都有 DeepSeek),magpie 就会自动把它们组成一个路由组:group/auto-<模型>,包含所有提供这个模型的供应商。名字按各家不同的写法匹配(deepseek/deepseek-chat 和 deepseek-chat 算同一个)。给 Agent 选这个组,请求就会分摊到这些供应商上;不想要的可以用 magpie group rm 隐藏。
+ 不用手动建的组。再加一个供应商,只要它提供的模型和已有的同名(比如 Claude 订阅和 Copilot 都有 Claude Opus,DeepSeek 官方 API 和 OpenRouter 都有 DeepSeek),magpie 就会自动把它们组成一个路由组:auto/<模型>(模型自己的 id,比如 auto/claude-opus-4.6;以前的 group/auto-… 也照样能用),包含所有提供这个模型的供应商。名字按各家不同的写法匹配(deepseek/deepseek-chat 和 deepseek-chat 算同一个)。给 Agent 选这个组,请求就会分摊到这些供应商上;不想要的可以用 magpie group rm 隐藏。
| 路由 | 谁排在前面 |
智能 smart | 默认。把成员的账号和 Key 放在一起排(组里的路由组算一个,见下文):还有余量的订阅里,额度最先重置的排第一。看周额度的重置时间;只有 5 小时额度、没有周额度的账号(如 Claude Enterprise)看它的 5 小时重置,所以排在所有更晚重置的周额度前面。没有重置时间的积分(WorkBuddy 的积分包,各自到期)按剩余积分最早过期的时间算,所以积分最先过期的 WorkBuddy 账号排第一。失败后在休息的排最后。 |