Introduction¶
The DeepSeek Harness (DSH) plugin dsh-antigravity-usage is designed to monitor the quota consumption and usage of Antigravity. Maintained by kirigayakazima, it addresses a common pain point: while Antigravity runs as a local language server, token consumption data is not persisted; only session metadata is stored.
This plugin implements a dual-data-source architecture: real-time quota is retrieved by calling the local language server API, while offline session usage is calculated via a read-only scan of the local SQLite database. This means historical usage can be viewed even when Antigravity is not running.
Core Features¶
The plugin registers a “🛰️ Antigravity Quota” entry in the DSH sidebar. Clicking it opens a dedicated panel in the main area. The panel includes the following six tabs:
- Quota: Displays remaining quota percentages, progress bars, reset countdowns, credits, and account plans for each group/model.
- Trends: A line chart showing remaining quota over time (supporting 24h / 7d / 30d / All).
- Heatmap: A calendar heatmap for the last 182 days, with switchable metrics for sessions, steps, or quota consumption.
- Summary: Statistical tables showing monthly and daily quota consumption, reset counts, and session counts.
- Reset: Displays cumulative consumption, recovery, and reset events for each quota bucket.
- Sessions: A list of local sessions (title, workspace, model, steps, generation count) with support for filtering by workspace and searching.
Data Acquisition Mechanism¶
The plugin categorizes data sources into two complementary types.
1. Real-time Quota (Requires Antigravity running)¶
Real-time quota is fetched from the local language server’s HTTP interface. The plugin parses the random port started by Antigravity from logs and authenticates using a CSRF Token. The main interfaces include:
* POST /exa.language_server_pb.LanguageServerService/GetUserStatus
* POST /exa.language_server_pb.LanguageServerService/RetrieveUserQuotaSummary
2. Offline Usage (No Antigravity required)¶
Offline usage is read from the SQLite file in the local session database. The file path is typically located at ~/.gemini/antigravity/conversations/ or conversation_summaries.db.
The plugin uses Node’s built-in node:sqlite to open the database in read-only mode. Token consumption and cache hit rates are not stored directly; instead, they are calculated by parsing the Protobuf data within gen_metadata and mapping fields against the modelUsage returned by the language server’s GetCascadeTrajectory.
The key field mappings are as follows:
| Protobuf Path | Meaning |
|---|---|
1.4.2 |
inputTokens input tokens |
1.4.3 |
outputTokens output tokens |
1.4.5 |
cacheReadTokens cache read hits |
1.4.9 |
thinkingOutputTokens thinking tokens |
1.4.10 |
responseOutputTokens response tokens |
API Endpoints¶
The plugin host provides a set of HTTP interfaces that can be used directly to check status or retrieve data:
GET /api/antigravity-usage: Gets{ status, snapshot, lastKnown }.GET /api/antigravity-usage/history?range=24h\|7d\|30d\|all: Gets the quota time series.GET /api/antigravity-usage/usage: Gets daily/monthly summaries and reset events.GET /api/antigravity-usage/conversations?full=1: Gets offline session usage.POST /api/antigravity-usage/refresh: Triggers immediate data collection.POST /api/antigravity-usage/diag: Client self-diagnostic interface.
These interfaces do not require authentication (except for the page /). You can perform a self-check via curl http://127.0.0.1:<port>/api/antigravity-usage.
Configuration & Environment Variables¶
The plugin supports configuration via environment variables. A DSH restart is required after changes to take effect:
ANTIGRAVITY_USAGE_INTERVAL_MS: Real-time quota sampling interval, default 120000ms.ANTIGRAVITY_USAGE_DATA_DIR: Data directory, default$DSH_HOME/antigravity-usage.ANTIGRAVITY_USAGE_RETAIN_DAYS: History retention days, default 180.ANTIGRAVITY_USAGE_MAX_POINTS: Maximum number of sampling points returned by the history API, default 400.ANTIGRAVITY_USAGE_PORT: Language server port, default 0 (auto-discovery).ANTIGRAVITY_USAGE_TIMEOUT_MS: HTTP request timeout, default 8000ms.
Development & Hot Reloading¶
- Client Code: Located in
lib/client.js, with no build step required. Supports HMR (Hot Module Replacement); DSH polls for changes every 500ms and the page refreshes automatically without needing a restart. - Host Code: Located in
lib/*.js(non-client). A DSH restart is mandatory after modifications. - Sidebar Registration: Must use the
sidebar.panellistandmainslots. Registering insidebar.footer.actionis not recommended, as that area is a horizontal Flex row where the plugin would be pushed off-screen.
Use Cases & Notes¶
This plugin is suitable for developers who need to continuously monitor Antigravity quotas and historical consumption within the DSH environment. Since the plugin runs with the permissions of the current DSH process, please review the source code and license before use.
- Offline Availability: Historical usage can be viewed by scanning the local session database even if the Antigravity service is not started.
- Read-only Safety: All SQLite operations are in read-only mode; the Antigravity directory will not be modified.
- Cache Versioning: Scanning caches must include a structure version number (
CACHE_VERSION); otherwise, Token data may display as 0 after an upgrade.
The plugin directory structure includes lib/index.js (host side), lib/client.js (client side), and test scripts under the scripts directory.