feat(quota): collect weekly quota via retrieveUserQuotaSummary#3185
Open
FlintyLemming wants to merge 3 commits into
Open
feat(quota): collect weekly quota via retrieveUserQuotaSummary#3185FlintyLemming wants to merge 3 commits into
FlintyLemming wants to merge 3 commits into
Conversation
Antigravity now exposes grouped quota (weekly + 5h windows) in addition to the per-model 5h quota from fetchAvailableModels. - models/quota.rs: add QuotaBucket, QuotaGroup structs; add optional quota_groups field to QuotaData (serde default for backward compat) - modules/quota.rs: add fetch_quota_summary() calling the retrieveUserQuotaSummary endpoint (best-effort, never blocks the primary 5h quota fetch); embed it in fetch_quota_with_cache so all callers benefit automatically - proxy/server.rs: expose quota_groups through the GET /accounts and GET /accounts/:id API responses via QuotaGroupDto/QuotaBucketDto - types/account.ts: sync TypeScript types for QuotaBucket/QuotaGroup No UI changes; data is collected, persisted to account files, and exposed via the HTTP API only.
…file Dockerfile.backend.localdist was missing cmake, golang-go, clang, libclang-dev, perl, git, and ninja-build — all required by boring-sys2 to compile BoringSSL. This caused the build to panic with "No such file or directory". Align deps with the main Dockerfile.
- quota.rs: add explicit type annotation for groups collect() (E0282) - account.rs: add quota_groups field to QuotaData literal in mark_account_forbidden (E0063) - Dockerfile.backend.localdist: COPY dist to backend-builder stage so tauri::generate_context!() can find frontendDist at build time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Antigravity now exposes a weekly quota alongside the existing 5-hour quota per model group (e.g. "Gemini Models", "Claude and GPT models"). This PR collects that data from the upstream
retrieveUserQuotaSummaryendpoint, persists it to account files, and exposes it through the HTTP API.Background
The
fetchAvailableModelsendpoint only returns a single per-model 5h quota window. The weekly quota is served by a separate endpoint discovered via network inspection of the official client:It returns grouped buckets, each carrying both a
weeklyand a5hwindow. The 5h values returned here are consistent withfetchAvailableModels(e.g. Gemini 0.9545 → 95%, Claude/GPT 0.7015 → 70%), confirming they are complementary rather than conflicting.Changes
src-tauri/src/models/quota.rsQuotaBucket,QuotaGroupstructs; add optionalquota_groupsfield toQuotaData(#[serde(default)]for backward compat)src-tauri/src/models/mod.rssrc-tauri/src/modules/quota.rsfetch_quota_summary()callingretrieveUserQuotaSummary(3-endpoint fallback, best-effort — returnsNoneon failure so the primary 5h quota is never blocked); embed it infetch_quota_with_cacheso all 10+ callers benefit automaticallysrc-tauri/src/proxy/server.rsquota_groupsthroughGET /accountsandGET /accounts/:idviaQuotaGroupDto/QuotaBucketDtosrc/types/account.tsQuotaBucket,QuotaGroup)docker/Dockerfile.backend.localdistCOPY distto the backend-builder stageDesign decisions
quota_groupsis simplyNoneand omitted from the JSON via#[serde(skip_serializing_if = "Option::is_none")].fetch_quota_with_retry, persistence logic, or any UI component. No new Tauri command.quota_groupsdeserialize fine (serde(default)).Proof it works
GET /api/accounts/:id/quotaon a Docker build from this branch:Response (truncated, click to expand)
{ "models": [ { "name": "gemini-2.5-pro", "percentage": 95, "reset_time": "2026-06-16T07:43:38Z", "display_name": "Gemini 2.5 Pro", "..." : "..." }, { "name": "claude-sonnet-4-6", "percentage": 70, "reset_time": "2026-06-16T07:26:50Z", "display_name": "Claude Sonnet 4.6 (Thinking)", "..." : "..." }, { "name": "gpt-oss-120b-medium", "percentage": 70, "reset_time": "2026-06-16T07:26:50Z", "display_name": "GPT-OSS 120B (Medium)", "..." : "..." } ], "last_updated": 1781592425, "subscription_tier": "Google AI Pro", "model_forwarding_rules": { "gemini-3.1-pro-high": "gemini-pro-agent" }, "quota_groups": [ { "display_name": "Gemini Models", "description": "Models within this group: Gemini Flash, Gemini Pro", "buckets": [ { "bucket_id": "gemini-weekly", "window": "weekly", "remaining_fraction": 0.99242574, "reset_time": "2026-06-23T02:43:38Z", "display_name": "Weekly Limit", "description": "You have used some of your weekly limit, it will fully refresh in 6 days, 19 hours." }, { "bucket_id": "gemini-5h", "window": "5h", "remaining_fraction": 0.9545545, "reset_time": "2026-06-16T07:43:38Z", "display_name": "Five Hour Limit", "description": "You have used some of your 5-hour limit, it will fully refresh in 56 minutes." } ] }, { "display_name": "Claude and GPT models", "description": "Models within this group: Claude Opus, Claude Sonnet, GPT-OSS", "buckets": [ { "bucket_id": "3p-weekly", "window": "weekly", "remaining_fraction": 0.6558833, "reset_time": "2026-06-18T03:29:41Z", "display_name": "Weekly Limit", "description": "You have used some of your weekly limit, it will fully refresh in 1 day, 20 hours." }, { "bucket_id": "3p-5h", "window": "5h", "remaining_fraction": 0.7015412, "reset_time": "2026-06-16T07:26:50Z", "display_name": "Five Hour Limit", "description": "You have used some of your 5-hour limit, it will fully refresh in 39 minutes." } ] } ] }Data consistency check — the 5h values from
quota_groupsmatch the per-model percentages inmodels:quota_groups5hremaining_fractionmodelspercentage0.954554595%✅0.701541270%✅The weekly reset times (6d19h, 1d20h) are sliding windows, matching the behavior shown in the official Antigravity client.
Commits
feat(quota): add weekly quota collection via retrieveUserQuotaSummaryfix(docker): add missing build deps for BoringSSL in localdist Dockerfilefix: resolve compile errors and missing dist in localdist Dockerfile