Add Antigravity local spend and usage history - #1139
Merged
Conversation
Adapt FelixIsaac’s SQLite/protobuf implementation from PR #1058. Bound conversation reads, reject malformed generation records, preserve canonical Gemini prices, and enable the standard spend/history layout. Thanks to @FelixIsaac for identifying the conversation database format and contributing the original implementation. Closes #1120
Render the existing and updated Antigravity cards with OpenUsage’s actual SwiftUI share-card renderer for the visual PR review.
Address automated review on #1139 while preserving FelixIsaac as the original feature author.
…ases Keep FelixIsaac’s original feature authorship while removing redundant cache, decoding, and test machinery.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9118579. Configure here.
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.

TL;DR
Add Antigravity usage history, local token counts, and estimated API-equivalent spend to Today, Yesterday, Last 30 Days, and Total Spend. This is the reviewed, hardened replacement for #1058 and preserves @FelixIsaac as the feature commit's Git author.
Fixes #1120.
What was happening
What this changes
~/.gemini/antigravity-cli/conversations/*.dbin bounded SQLite batches and decode only the protobuf fields needed for model names, timestamps, billable system-prompt and input tokens, output tokens, and cached tokens.Heads-up
Tests
swift test -Xlinker -rpath -Xlinker /Users/rebers/.codex/worktrees/7bc2/openusage/.build/out/Products/Debug: 1,331 app tests, four CLI tests, and three Swift Testing cases passed; three existing tests were skipped.Screenshots
Before: quota meters only
After: quota meters, Usage Trend, and local spend history
Thanks to @FelixIsaac for identifying the conversation-database source, reverse-engineering the generation records, and contributing the original implementation in #1058.
Note
Medium Risk
Reads local SQLite conversation DBs and undocumented protobufs, then feeds estimated costs into Total Spend. Bounded queries and skip-on-oversize reduce memory risk, but decoder/pricing mistakes would misreport spend.
Overview
Adds local token usage and estimated API-equivalent spend for Antigravity (Usage Trend, Today, Yesterday, Last 30 Days, and Total Spend). Quota meters stay as they are; spend comes from
~/.gemini/antigravity-cli/conversations/*.db, not JSONL transcripts.AntigravityDbUsageScannerpagesgen_metadatain small SQLite batches, skips blobs over 1 MiB before hex expansion, and incrementally reuses decoded history (including WAL fingerprinting).AntigravityProtoDecoderpulls model, system-prompt + input, output, cache-read, and timestamp fields, treating missing/unpriced models as unknown instead of inventing rates.Gemini slug aliases in the pricing supplement now cover Antigravity variants (
none/a|b|c/preview) without new rate overrides. Default layout enables the new metrics, keeps trend above the fold, and tucks spend rows On Demand.Reviewed by Cursor Bugbot for commit 2fd4fb0. Bugbot is set up for automated code reviews on this repo. Configure here.