agy-usage is a CLI tool for checking Antigravity model quotas and triggering model wakeup turns through the Antigravity agy CLI.
- Quota Status Display: Queries
agy -p "/usage" --output-format jsonand renders quota groups, remaining percentages with progress bars, and local reset countdowns (N/Afor unset timers). Outputs Markdown automatically when piped or redirected, and supports raw JSON output via--json. - Dynamic Wakeup Trigger: Queries
agy -p "/usage"for active quota groups andagy modelsfor available models, selects the most cost-effective model for each group (with group-name and heuristic fallbacks), and triggers each selected model viaagy -pwhile reporting duration and token usage. - Wakeup Cooldown Cache: Caches recent triggers per model and
agyaccount for 5 minutes using atomic file writes to avoid redundant triggers. - Account Inspection: Displays the account currently authenticated in the
agyCLI. - Self-Update: Updates the
agy-usagebinary in-place from GitHub Releases.
- The Antigravity
agyCLI must be installed, authenticated, and available in yourPATH.
Prebuilt binaries are available on GitHub Releases.
To build from source (requires Rust 1.88 or newer, Edition 2024):
- Clone this repository.
- Build the release binary:
cargo build --releaseThe compiled binary is written to target/release/agy-usage.
Running agy-usage without a subcommand defaults to quota.
Global options:
--json: Output raw JSON (shorthand forquota --json).--debug: Printagystderroutput forquotaandwakeup.
Display quota groups, remaining percentages, and reset times:
# Display formatted quota status (or Markdown when piped/redirected)
agy-usage
# Equivalent explicit subcommand
agy-usage quota
# Output the raw JSON returned by `agy -p "/usage" --output-format json`
agy-usage quota --jsonWhen stdout is not a terminal (e.g., agy-usage quota > result.md), output switches to plain Markdown tables without ANSI colors. Errors and diagnostics are written to stderr. Unset reset timestamps are displayed as N/A.
Start quota reset timers or wake up models across active quota groups:
# Automatically select and trigger the cheapest model per quota group
agy-usage wakeup
# Trigger specific models with a custom prompt
agy-usage wakeup --models gemini-3.8-flash-low,claude-sonnet-5-5-low --prompt "Hello"Options:
--models <MODELS>: Comma-separated list of model IDs to trigger instead of automatic selection.--prompt <PROMPT>: Custom prompt sent toagy(defaults to".").--debug: Printagystderroutput.
When --models is omitted, wakeup queries agy -p "/usage" for active quota groups and agy models for available models, matches models to their quota groups (falling back to group-name matching and Gemini vs. Claude/GPT heuristic grouping if needed), and selects the lowest-cost model in each group. Each selected model is invoked with agy --disable-slash-commands -p <prompt> --model <model> --output-format json, reporting execution duration and token usage (Input, Output including thinking tokens, Total, and Cache Read when reported).
Triggers are cached for 5 minutes per model and agy account; models triggered within the cooldown window are skipped. wakeup exits with a non-zero status if any trigger fails. Because each target runs a full agy agent turn, use --models to restrict the target list when needed.
Inspect the account authenticated in the agy CLI. These commands read credentials from the OS keyring used by agy (service gemini, user antigravity), falling back to ~/.gemini/antigravity-cli/antigravity-oauth-token if the keyring is unavailable:
# Show authentication status, account email, and auth method
agy-usage status
# List the authenticated account
agy-usage accounts list
# Show the authenticated account
agy-usage accounts currentRun agy-usage wakeup on a schedule to keep quota timers active. Ensure that the scheduled execution environment has agy in PATH and access to agy's credential store (OS keyring or token file).
Open your user crontab:
crontab -eAdd a job to run every hour (use the absolute path to your binary and log file):
0 * * * * /absolute/path/to/agy-usage wakeup >> /absolute/path/to/agy-usage-wakeup.log 2>&1- Create
~/.config/systemd/user/agy-wakeup.service:
[Unit]
Description=Trigger agy-usage wakeup
After=network.target
[Service]
Type=oneshot
ExecStart=/absolute/path/to/agy-usage wakeup- Create
~/.config/systemd/user/agy-wakeup.timer:
[Unit]
Description=Run agy-usage wakeup periodically
[Timer]
OnCalendar=hourly
Persistent=true
[Install]
WantedBy=timers.target- Reload systemd and enable the timer:
systemctl --user daemon-reload
systemctl --user enable --now agy-wakeup.timer- Check timer status or service logs:
systemctl --user status agy-wakeup.timer
journalctl --user -u agy-wakeup.service- Create
~/Library/LaunchAgents/com.user.agy-usage.wakeup.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.user.agy-usage.wakeup</string>
<key>ProgramArguments</key>
<array>
<string>/absolute/path/to/agy-usage</string>
<string>wakeup</string>
</array>
<key>StartInterval</key>
<integer>3600</integer>
<key>StandardOutPath</key>
<string>/tmp/agy-usage-wakeup.stdout.log</string>
<key>StandardErrorPath</key>
<string>/tmp/agy-usage-wakeup.stderr.log</string>
</dict>
</plist>- Load the launch agent:
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.user.agy-usage.wakeup.plist- Unload the launch agent when no longer needed:
launchctl bootout gui/$(id -u) ~/Library/LaunchAgents/com.user.agy-usage.wakeup.plistRun PowerShell to register an hourly scheduled task:
$action = New-ScheduledTaskAction -Execute "C:\path\to\agy-usage.exe" -Argument "wakeup"
$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Hours 1)
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
Register-ScheduledTask -TaskName "AgyUsageWakeup" -Action $action -Trigger $trigger -Settings $settings -Description "Trigger agy-usage wakeup"Alternatively, configure the task in the Task Scheduler GUI:
- Create a Basic Task named
AgyUsageWakeup. - Set the Trigger to Daily, and under Advanced Settings set Repeat task every to 1 hour.
- Set the Action to Start a program, select
agy-usage.exe, and set the arguments towakeup.
Update agy-usage to the latest GitHub release in-place:
agy-usage self-updateThis command checks GitHub Releases, downloads the archive matching your OS and architecture, and replaces the running executable.
Display the installed version:
agy-usage version
agy-usage -V
agy-usage --versionSee CHANGELOG.md for the release history.
Copyright (c) 2026 Yoshihiro OKUMURA orrisroot@gmail.com