Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.
usage: an Antigravity card's pools draw their curve, say when they run out and what the whole holds
yetone14e4d804023b
diff --git a/internal/provider/quota_history.go b/internal/provider/quota_history.goindex f4daff317..5ef0f137e 100644--- a/internal/provider/quota_history.go+++ b/internal/provider/quota_history.go@@ -172,9 +172,12 @@ func newCycle(a, b QuotaPoint) bool {}// pointOf is what w, read at at, says, if it is something to draw; a-// reset told in seconds counts from now, when the windows were made.+// reset told in seconds counts from now, when the windows were made. A+// pool's window is drawn though it is aside for routing: it is the row+// the card shows, where its models' own windows are not (max2020 on+// Discord: an Antigravity card had no curve and no "runs out" line).func pointOf(w QuotaWindow, at, now time.Time) (QuotaPoint, bool) {- if w.Unlimited || w.Aside || w.Family != "" || w.Name == "" || math.IsNaN(w.Used) {+ if w.Unlimited || w.Aside && !w.PoolWindow() || w.Family != "" || w.Name == "" || math.IsNaN(w.Used) {return QuotaPoint{}, false}p := QuotaPoint{At: at.UTC().Truncate(time.Second), Left: math.Round(max(0, min(100, 100-w.Used))*100) / 100}@@ -296,10 +299,7 @@ func noteQuotaHistory(qs []SubscriptionQuota, now time.Time) {if h[key] == nil {h[key] = map[string][]QuotaPoint{}}- name := w.Name- if w.Pool != "" { // Antigravity's pools each have a 5-hour window- name = w.Pool + " · " + w.Name- }+ name := w.LineName() // Antigravity's pools each have a 5-hour windowbefore := h[key][name]k := len(before)var last QuotaPointdiff --git a/internal/provider/quota_history_test.go b/internal/provider/quota_history_test.goindex 1f7f2b366..544385259 100644--- a/internal/provider/quota_history_test.go+++ b/internal/provider/quota_history_test.go@@ -203,3 +203,41 @@ func TestMergeQuotaHistory(t *testing.T) {t.Error("a broken file merged")}}++// max2020 on Discord: an Antigravity card had no curve and no "runs out+// at this pace" line, as its rows are its pools' windows, which are aside+// for routing, and its models' own windows are a family's. Each pool's+// window is kept under its pool's name, as the card's line looks it up;+// the models' windows still aren't, nor another window set aside.+func TestQuotaHistoryKeepsAntigravityPools(t *testing.T) {+ testenv.SetHome(t, t.TempDir())+ t.Setenv("XDG_CONFIG_HOME", t.TempDir())+ t0 := time.Date(2026, 10, 27, 8, 0, 0, 0, time.UTC)+ r5, rw := t0.Add(3*time.Hour), t0.Add(4*24*time.Hour)+ card := func(gemini float64) []SubscriptionQuota {+ return []SubscriptionQuota{{Provider: "antigravity", Name: "Antigravity", User: "[email protected]", Windows: []QuotaWindow{+ {Name: "Gemini 3.8 Flash (Medium)", Model: "gemini-3.8-flash-medium", Family: "Gemini", Pool: "Gemini", Used: gemini, ResetsAt: &r5},+ {Name: "Claude Sonnet 4.6 (Thinking)", Model: "claude-sonnet-4-6-thinking", Family: "Claude", Pool: "Claude & GPT", Used: 40, ResetsAt: &r5},+ {Name: "5 hours", Pool: "Gemini", Span: 5 * time.Hour, Aside: true, Used: gemini, ResetsAt: &r5},+ {Name: "7 days", Pool: "Gemini", Span: 7 * 24 * time.Hour, Aside: true, Used: gemini / 2, ResetsAt: &rw},+ {Name: "5 hours", Pool: "Claude & GPT", Span: 5 * time.Hour, Aside: true, Used: 40, ResetsAt: &r5},+ {Name: "Extra", Aside: true, Used: 10, ResetsAt: &rw},+ }}}+ }+ noteQuotaHistory(card(10), t0)+ noteQuotaHistory(card(30), t0.Add(time.Hour))+ hs := QuotaHistories(t0.Add(-time.Hour), "", "")+ if len(hs) != 1 || len(hs[0].Lines) != 3 {+ t.Fatalf("histories = %+v, want the three pool windows' lines", hs)+ }+ five := lineOf(t, hs, "[email protected]", "Gemini · 5 hours")+ if len(five) != 2 || five[0].Left != 90 || five[1].Left != 70 || five[0].Start == nil || !five[0].Start.Equal(r5.Add(-5*time.Hour)) {+ t.Errorf("Gemini · 5 hours = %+v", five)+ }+ if week := lineOf(t, hs, "[email protected]", "Gemini · 7 days"); len(week) != 2 || week[1].Left != 85 || !week[0].Start.Equal(rw.Add(-7*24*time.Hour)) {+ t.Errorf("Gemini · 7 days = %+v", week)+ }+ if cl := lineOf(t, hs, "[email protected]", "Claude & GPT · 5 hours"); len(cl) != 2 || cl[0].Left != 60 {+ t.Errorf("Claude & GPT · 5 hours = %+v", cl)+ }+}diff --git a/internal/provider/window_holds.go b/internal/provider/window_holds.goindex ff5309338..21a4d9f29 100644--- a/internal/provider/window_holds.go+++ b/internal/provider/window_holds.go@@ -7,6 +7,7 @@ package provider// the window's bounds.import (+ "slices""strings""time")@@ -75,3 +76,69 @@ func (w QuotaWindow) Bounds(readAt time.Time) (start, end time.Time, ok bool) {func (w QuotaWindow) Counts(model string) bool {return Limit{Model: w.Model, matches: w.matches}.applies(strings.ToLower(model))}++// PoolWindow is whether w is one of an Antigravity pool's own windows+// ("Gemini" · 5 hours, · 7 days), the allowance its models share, not a+// model's own window drawing on it.+func (w QuotaWindow) PoolWindow() bool { return w.Pool != "" && w.Family == "" }++// LineName is the name w's readings are kept under (quota-history.json)+// and its line drawn by: a pool's window with its pool's name before its+// own ("Gemini · 5 hours"), as every pool has a "5 hours".+func (w QuotaWindow) LineName() string {+ if w.Pool != "" {+ return w.Pool + " · " + w.Name+ }+ return w.Name+}++// CountsIn is whether a call to model counts against w, one of ws, the+// windows of its account's card: a pool's window counts its models' calls+// (PoolMembers), by the model's own id or the one its effort word is a+// level of (gemini-3.8-flash is gemini-3.8-flash-medium's); any other as+// Counts says.+func (w QuotaWindow) CountsIn(ws []QuotaWindow, model string) bool {+ if !w.PoolWindow() {+ return w.Counts(model)+ }+ m := strings.ToLower(strings.TrimSpace(model))+ if m == "" {+ return false+ }+ for _, o := range PoolMembers(ws, w) {+ id := strings.ToLower(o.Model)+ if id == m || strings.ToLower(EffortFamily(id)) == m || EffortFamily(m) == EffortFamily(id) {+ return true+ }+ }+ return false+}++// PoolMembers are the per-model windows among ws whose models draw on+// pool window w's allowance: the ones its pool's name was given to+// (googleAccount.pools), else, when none was (a pool read with only its+// 7 days, as an Antigravity Starter plan's), the ones of a family its+// name says ("Claude & GPT": Claude, GPT-OSS) and no other pool took. A+// pool named for one model ("Gemini 4 Argon") has only the models it was+// given.+func PoolMembers(ws []QuotaWindow, w QuotaWindow) []QuotaWindow {+ var given, family []QuotaWindow+ words := strings.FieldsFunc(strings.ToLower(w.Pool), func(r rune) bool { return r == ' ' || r == '&' })+ for _, o := range ws {+ if o.Family == "" || o.Model == "" {+ continue+ }+ if o.Pool == w.Pool {+ given = append(given, o)+ continue+ }+ f, _, _ := strings.Cut(strings.ToLower(o.Family), "-")+ if o.Pool == "" && !versioned(w.Pool) && f != "" && slices.Contains(words, f) {+ family = append(family, o)+ }+ }+ if len(given) > 0 {+ return given+ }+ return family+}diff --git a/internal/usage/window_holds.go b/internal/usage/window_holds.goindex 4c340ec98..532e163dd 100644--- a/internal/usage/window_holds.go+++ b/internal/usage/window_holds.go@@ -70,7 +70,11 @@ func holdsBounds(q provider.SubscriptionQuota, w provider.QuotaWindow, at time.Tif q.Error != "" || q.From != "" || q.User == "" || q.Balance != "" {return time.Time{}, time.Time{}, "-"}- if w.Unlimited || w.Aside || w.Family != "" || w.Pool != "" || math.IsNaN(w.Used) {+ // An Antigravity pool's window is told, by its models' calls (max2020 on+ // Discord); the models' own windows drawing on it, and a pool whose+ // models aren't known, aren't.+ pool := w.PoolWindow() && len(provider.PoolMembers(q.Windows, w)) > 0+ if w.Unlimited || w.Aside && !pool || w.Family != "" || w.Pool != "" && !pool || math.IsNaN(w.Used) {return time.Time{}, time.Time{}, "-"}if w.Used < provider.HoldsFloor {@@ -232,7 +236,7 @@ func windowHolds(qs []provider.SubscriptionQuota, now, first time.Time, priceOf}for _, s := range byAccount[acct] {b := want[s]- if r.Time.Before(b.start) || r.Time.After(b.end) || !qs[s.q].Windows[s.w].Counts(r.Model) {+ if r.Time.Before(b.start) || r.Time.After(b.end) || !qs[s.q].Windows[s.w].CountsIn(qs[s.q].Windows, r.Model) {continue}inRun[s] = append(inRun[s], runs...)diff --git a/internal/usage/window_holds_history.go b/internal/usage/window_holds_history.goindex 25d621780..91898c800 100644--- a/internal/usage/window_holds_history.go+++ b/internal/usage/window_holds_history.go@@ -99,7 +99,7 @@ func withRecordedWindowStarts(cards []provider.SubscriptionQuota, hist []providecontinue}for _, l := range h.Lines {- if l.Name != w.Name {+ if l.Name != w.LineName() {continue}var observed time.Timediff --git a/internal/usage/window_holds_test.go b/internal/usage/window_holds_test.goindex bfb8e403e..ad4d6de8b 100644--- a/internal/usage/window_holds_test.go+++ b/internal/usage/window_holds_test.go@@ -388,3 +388,72 @@ func TestHoldsPriceTheModelItIsTheSameAs(t *testing.T) {t.Errorf("a model with no Same as was priced: %+v", pr)}}++// max2020 on Discord: an Antigravity card told no whole for its windows,+// not even "not enough data", as its rows are its pools' (Gemini · 5+// hours, Claude & GPT · 5 hours, their weeks) and a pool's window was+// never reckoned. A pool's window counts its own models' calls, a model+// asked for by its family's id (gemini-3.8-flash for the medium level's+// window) too; a pool read with only its week, whose models were given no+// pool (a Starter plan), counts the families its name says. The models'+// own windows are still not told.+func TestWindowHoldsReckonsAntigravityPools(t *testing.T) {+ holdsHome(t)+ now := holdClock(t, time.Date(2026, 10, 27, 12, 0, 0, 0, time.UTC))+ at := func(d time.Duration) *time.Time { x := now.Add(d); return &x }+ call := func(user string, ago time.Duration, model string, in, out int) Record {+ return Record{Time: now.Add(-ago), Agent: "pi", Provider: "antigravity", ProviderAccount: user, Status: 200, Model: model, Input: in, Output: out}+ }+ for _, r := range []Record{+ call("[email protected]", 9*24*time.Hour, "gemini-3.8-flash", 1, 1), // the log's first call+ call("[email protected]", time.Hour, "gemini-3.8-flash", 1000, 1000),+ call("[email protected]", 2*time.Hour, "claude-sonnet-4-6", 2000, 2000),+ call("[email protected]", 3*time.Hour, "some-other-model", 50000, 50000), // no pool of the card's+ call("[email protected]", time.Hour, "gpt-oss-120b", 3000, 1000),+ call("[email protected]", 2*time.Hour, "gemini-3-flash", 500, 500),+ } {+ Append(r)+ }+ five, week := 5*time.Hour, 7*24*time.Hour+ qs := []provider.SubscriptionQuota{+ {Provider: "antigravity", User: "[email protected]", Windows: []provider.QuotaWindow{+ {Name: "Gemini 3.8 Flash (Medium)", Model: "gemini-3.8-flash-medium", Family: "Gemini", Pool: "Gemini", Used: 20, ResetsAt: at(2 * time.Hour)},+ {Name: "Claude Sonnet 4.6", Model: "claude-sonnet-4-6", Family: "Claude", Pool: "Claude & GPT", Used: 25, ResetsAt: at(2 * time.Hour)},+ {Name: "5 hours", Pool: "Gemini", Span: five, Aside: true, Used: 20, ResetsAt: at(2 * time.Hour)},+ {Name: "5 hours", Pool: "Claude & GPT", Span: five, Aside: true, Used: 25, ResetsAt: at(2 * time.Hour)},+ }},+ {Provider: "antigravity", User: "[email protected]", Windows: []provider.QuotaWindow{+ {Name: "GPT-OSS 120B (Medium)", Model: "gpt-oss-120b-medium", Family: "GPT-OSS", Used: 50, ResetsAt: at(3 * 24 * time.Hour)},+ {Name: "Gemini 3 Flash", Model: "gemini-3-flash", Family: "Gemini", Used: 10, ResetsAt: at(3 * 24 * time.Hour)},+ {Name: "7 days", Pool: "Claude & GPT", Span: week, Aside: true, Used: 50, ResetsAt: at(3 * 24 * time.Hour)},+ }},+ }+ got := WithWindowHolds(qs, now)+ sonnet := (2000*3 + 2000*15) / 1e6+ for _, x := range []struct {+ q, w int+ tokens, routed int64+ cost float64 // 0: not priced+ }{+ {0, 2, 2000 * 5, 2000, 0}, // gemini-3.8-flash has no API price here+ {0, 3, 4000 * 4, 4000, sonnet * 4},+ {1, 2, 4000 * 2, 4000, 0},+ } {+ w := got[x.q].Windows[x.w]+ h := w.Holds+ if h == nil {+ t.Fatalf("%s · %s of %s: no whole reckoned (why %q)", w.Pool, w.Name, got[x.q].User, w.HoldsWhy)+ }+ if h.Tokens != x.tokens || h.Routed.Tokens != x.routed {+ t.Errorf("%s · %s of %s: %d tokens whole from %d, want %d from %d", w.Pool, w.Name, got[x.q].User, h.Tokens, h.Routed.Tokens, x.tokens, x.routed)+ }+ if h.Priced != (x.cost > 0) || !near(h.Cost, x.cost) {+ t.Errorf("%s · %s of %s: cost %v (priced %v), want %v", w.Pool, w.Name, got[x.q].User, h.Cost, h.Priced, x.cost)+ }+ }+ for _, x := range [][2]int{{0, 0}, {0, 1}, {1, 0}, {1, 1}} {+ if w := got[x[0]].Windows[x[1]]; w.Holds != nil || w.HoldsWhy != "" {+ t.Errorf("model window %s: reckoned %+v, why %q", w.Name, w.Holds, w.HoldsWhy)+ }+ }+}