Skip to content

feat(web,server): accurate usage limits and pricing for Pi and Antigravity - #3

Merged
wianvdm merged 4 commits into
mainfrom
feat/usage-limits-pi-antigravity
Oct 22, 2026
Merged

wianvdm merged 4 commits into
mainfrom
feat/usage-limits-pi-antigravity

Conversation

@wianvdm

@wianvdm wianvdm commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Problem

Usage reporting was accurate only for Claude and Codex. Pi reported no subscription limits, even with a Kimi Code login. Antigravity's limits card showed only the unused Claude/GPT group, priced models it had used at $0, and skipped conversation data under profiles of unconfigured instances or other state directories.

Change

  • Pi: a new Kimi Code probe reads the credential from the pi agent auth.json, queries the Kimi usage endpoints, and labels windows "Kimi Code 5-hour" and "Kimi Code Weekly", so a pi limit names its subscription.
  • Antigravity usage: tier suffixes (-high, -low, -trial) now map to a rateModel the rate tables resolve, so used models get a price. gemini-3.8-flash-n stays unpriced because no rate exists for it. The scan covers every /providers/antigravity profile, and OpenRouter run tags (:free, :batch) resolve to the base model rate.
  • Antigravity limits: the quota endpoint picks its groups from the client version in the User-Agent. hub/1.0.0 got only Claude/GPT, 2.x adds Gemini, and hub/2.25.0 adds Gemini 4 Argon. The probe now sends 2.25.0 and labels Argon buckets "Gemini 4 Argon" so they do not collide with Gemini windows.
  • Web: ModelVendorIcon maps a model or window name to a vendor logo (Claude, OpenAI, Gemini, Kimi, Qwen, MiniMax, DeepSeek, Zhipu, Mistral, Meta, Grok; SVGs from the lobehub icons set). Pi, OpenCode and Antigravity use it in the model breakdown, pooled limit cards and composer limit rows. Other drivers keep the provider mark.

One PR because all four commits fix the same defect: usage accuracy for providers that front other vendors' models. The commits are separable for review.

Surfaces: web only (desktop wraps it, mobile unchanged). The server probes are client-agnostic, so local, relay and tunnel connections behave the same. OpenCode gets logos only.

Scope and approval

Fork PR into WianVDM/t3code main requested by the fork owner. This change is not proposed to pingdotgg/t3code, so the upstream prior-approval rule does not apply.

Verification

Automated tests:

  • Ran 'vp test run' on packages/provider-pi/src/server/usageLimits.test.ts, apps/server/src/usage/usagePricing.test.ts, apps/server/src/provider/Drivers/AntigravityUsage.test.ts, apps/server/src/provider/Drivers/antigravityUsageReader.test.ts, and apps/server/src/provider/antigravityUsageLimits.test.ts: 5 files, 52 tests passed.
  • Ran existing web browser tests for the usage page (apps/web/src/components/usage/UsageLimits.browser.test.tsx and apps/web/src/components/usage/UsageLimitsPooled.browser.test.tsx): 11 tests passed.
  • Ran per-package typecheck across apps/server, apps/web, and packages/provider-pi with tsc-rs: 0 errors.
  • Ran 'vp fmt' and 'vp lint' on changed files: clean.

Manual verification:

  • Tested live Antigravity quota endpoint: the old User-Agent returned only 3p-weekly and 3p-5h buckets, whereas hub/2.25.0 added gemini-weekly, gemini-5h, and gemini-argon-wtu-weekly. Returned values matched the local Antigravity language server (Gemini weekly 58.5% left, Gemini 5-hour 87.6%, Argon weekly 2.2%).
  • Replayed real Antigravity conversation data through the pricing path: gemini-3.8-flash-high, gemini-4-argon-trial, and gemini-4-argon-high priced as model-priced; gemini-3.8-flash-n and antigravity-unknown remained unpriced as intended.
  • Inspected live web client: confirmed limits cards, model breakdown, and vendor logos render correctly.

Before and after, same instance and data, 1280px wide, dark theme. Before is main at 6460ba9, after is this branch at 26d761d.

Limits tab. Before: Antigravity shows only the Claude/GPT group and Pi shows nothing. After: Gemini 5-hour, Gemini weekly and Gemini 4 Argon weekly appear, Pi shows the Kimi Code windows, and each row carries its vendor logo.

Before After
Limits tab before Limits tab after

Cost tab, model breakdown. Before: Antigravity totals $0.00 and every Gemini row is Unpriced. After: Gemini rows are priced (Antigravity $82.49, the total moves from $2,325.25 to $2,407.63), and multi-vendor providers show the model vendor logo.

Before After
Model breakdown before Model breakdown after

Not checked:

  • Shells: mobile and desktop shells were not exercised.
  • Logo tests: omitted component render tests per AGENTS.md guidance against render-only assertions.

Models and harness: Claude Sonnet 5.5 (orchestration), Gemini 3.8 Flash (commits and PR prep) and earlier Pi-provider runs, in T3 Code.

Wian van der Merwe added 4 commits October 22, 2026 13:32
- Read the Kimi credential from the pi agent auth.json and query the usage endpoints
- Label windows with the upstream ("Kimi Code 5-hour") so a pi limit names its subscription
- Probe during provider status checks, only when pi is enabled and authenticated
- Strip tier suffixes (-high, -low, -trial) into a rateModel the rate tables resolve
- Leave unknown SKUs such as gemini-3.8-flash-n unpriced rather than guess
- Scan all <stateDir>/providers/antigravity profiles, including unconfigured instances
- Resolve OpenRouter run tags (:free, :batch) to the base model rate
- Send client version 2.25.0: the quota endpoint only returns the Gemini and Argon groups to newer clients
- Label Argon buckets "Gemini 4 Argon" so they stay apart from Gemini windows
- Add ModelVendorIcon, which maps a model or window name to a vendor logo
- Use it for pi, OpenCode and Antigravity in the model breakdown, pooled limit cards and composer limit rows
- Fall back to the provider mark when no vendor matches
@wianvdm
wianvdm merged commit ee232f7 into main Oct 22, 2026
@wianvdm
wianvdm deleted the feat/usage-limits-pi-antigravity branch November 14, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant