Tuesday, October 27, 2026

AGY Token Tracker: Total Control Over Tokens, Costs, and Quotas Across Google Antigravity

Menu Bar Item

The landscape of software engineering has shifted dramatically with the rise of autonomous agentic AI tools like Google Antigravity. Whether we are running multi-step codebase refactorings or building features side-by-side with an AI assistant, our development workflows are faster and more ambitious than ever.

However, anyone actively working in the Antigravity ecosystem quickly encounters familiar challenges:

  • How many tokens did that deep autonomous refactoring session actually consume?
  • Is Prompt Caching working effectively, and how much money is it really saving?
  • When will the rolling 5-hour and weekly rate limits reset?
  • What is the actual daily or monthly cost when jumping between the Desktop app, terminal CLI, and IDE extension?

To eliminate guesswork and make this data available at a glance without context switching, we built AGY Token Tracker — an open-source, native macOS menu bar utility designed specifically for the Google Antigravity ecosystem.

AGY Token Tracker Overview Dashboard

Unified Overview: Real-time tokens, prompt cache efficiency, and estimated cost

What is AGY Token Tracker?

AGY Token Tracker is a native, ultra-lightweight menu bar application built with SwiftUI and AppKit for macOS 14.0+ (Sonoma and Sequoia). Designed with a modern Liquid Glass aesthetic, it operates as a discreet background helper (LSUIElement — no Dock icon clutter) that stays out of your way until you need it.

Its standout feature is multi-surface unified tracking, aggregating data across all three Antigravity touchpoints:

  1. 🖥️ Antigravity 2.0 (Desktop): Streams and parses session trajectories directly from ~/.gemini/antigravity/brain/**/transcript.jsonl.
  2. 💻 Antigravity CLI (agy): Scans console sessions and trajectory databases from ~/.gemini/antigravity-cli.
  3. 📝 Antigravity IDE: Tracks workspace conversations and VS Code language server activity from ~/.gemini/antigravity-ide.

Key Features

1. Granular Token & Cache Accounting

Modern models (like Gemini 3.8 / 4 and Claude 3.7 / 5) leverage aggressive prompt caching. AGY Token Tracker breaks down token usage so you can evaluate context efficiency:

  • 📥 Input Tokens: Fresh prompts and context sent to the model.
  • ⚡️ Cache Read Tokens: Cached context retrieved at a standard 75–80% cost reduction.
  • 📤 Output Tokens: Generated answers and invisible reasoning/thinking steps.
  • 🎯 Cache Efficiency: Real-time Cache Hit Ratio (%) to verify that repetitive context is actually hitting the cache.

2. Real-Time Cost Estimation ($ USD)

The app integrates with the open-source LiteLLM pricing catalog, periodically syncing the latest model prices in the background. It also ships with offline fallback rate cards covering Gemini, Claude, and OpenAI families. You always know your exact expenditure across multiple time horizons: Today, Yesterday, This Week, This Month, or All Time.

3. Live Quotas & Rolling Limit Countdowns

Avoid hitting sudden Rate limit reached walls in the middle of active development. The app queries your live usage quotas (agy --print /usage) in the background, rendering visual gauges for rolling quotas (such as 5-hour windows and weekly limits) along with exact countdowns until your allowances reset.

Models Analytics & Quotas

Models Analytics & Quotas: Real-time usage gauges and reset countdowns

4. Models Analytics & Interactive Filtering

  • Distribution Bar: A color-coded breakdown bar (similar to GitHub’s language bar) displays token consumption per model.
  • Instant Filtering: Click any model badge or card to instantly filter recent sessions down to that specific model.
  • History Tab & Charts: A dedicated annual overview with year switcher (< 2026 >), Swift Charts monthly spending trends, and persistent local storage (monthly_history.json) so your metrics remain safe even if old log files are cleared.
Annual & Monthly History

History View: Yearly summary and interactive monthly breakdown charts

Under the Hood: Performance-First Architecture

Running a background monitor should never compete with your IDE or build tools for system resources:

  • Zero-Dependency Protobuf Decoder: CLI and IDE SQLite stores wrap conversation metadata inside Google Protobuf blobs (gen_metadata). Instead of bundling heavy third-party C++ libraries, we implemented a custom zero-dependency binary wire-format Protobuf decoder in pure Swift.
  • Streaming JSONL Parser: Desktop session trajectories are read incrementally, preventing memory spikes even with large context logs.
  • FSEvents Integration: Zero polling loops. The app subscribes to kernel file system notifications and only recalculates metrics when Antigravity writes to disk.

Getting Started

AGY Token Tracker is completely free and open-source under the MIT License.

# Quick Run via Swift Package Manager:
git clone https://github.com/rsimenok/agy-token-tracker.git
cd agy-token-tracker
swift run

# Build a standalone .app bundle:
./scripts/build_app.sh
open build/AGYTokenTracker.app

(You can drag build/AGYTokenTracker.app directly into your /Applications folder.)

Join the Project

If you use Google Antigravity on macOS, try out AGY Token Tracker, star the repository on GitHub, and share your feedback or feature suggestions in the issue tracker!

👉 GitHub Repository: github.com/rsimenok/agy-token-tracker

How do you currently monitor token efficiency and LLM expenses in your development workflow? Let us know in the comments below!

No comments:

Post a Comment