agy-usage is a CLI tool designed to track Antigravity model quotas and usage.
- Quota Information Display: Runs the Antigravity
agyCLI's/usagecommand and renders the structured result in your terminal. Output automatically falls back to Markdown format when piped or redirected, making it CI/CD and script-friendly. JSON output format is also supported. - Wakeup Functionality: Discovers models with
agy modelsand triggers them viaagy -pto initiate quota limitation timers or wake up models. - Atomic Cache Writes: Cache files are written to a temporary file, flushed securely to physical disk (
sync_all), and renamed atomically to prevent corruption on crash or power loss. - Path Sanitization: Cache keys are sanitized before being used in filesystem paths.
- Per-Account State: Wakeup caches are isolated per agy-authenticated account when the account can be determined.
This tool is built with Rust. Follow the steps below to compile and run it:
- Clone this repository.
- Run the following command to build the release binary:
cargo build --releaseThe compiled binary is generated at target/release/agy-usage.
Note: Quota display and wakeup invoke the Antigravity
agyCLI, soagymust be installed and authenticated, and available in yourPATH. Authentication is handled entirely by theagyCLI.statusandaccountsreport the account currently authenticated in theagyCLI.
Global options:
--json: shorthand forquota --json.--debug: showsagystderr forquotaandwakeup.
Show the account currently authenticated in the agy CLI. These commands read the account from the OS keyring used by agy, falling back to agy's token file when the keyring is unavailable. They do not make API calls.
# Show authentication status and account
agy-usage status
# List the authenticated account
agy-usage accounts list
# Show the authenticated account
agy-usage accounts currentAccount switching and removal are managed by the agy CLI, so agy-usage no longer provides accounts switch or accounts remove.
Display the user quota summary (remaining usage and reset times) by running agy -p "/usage" --output-format json and rendering its output. The agy CLI must be installed and authenticated.
Tip: When you pipe or redirect the output (e.g., agy-usage quota > result.md), it automatically switches to Markdown format and disables terminal colors. Errors and diagnostics are written to stderr to keep your output clean for scripts.
# Display quota
agy-usage quota
# Output the raw JSON produced by `agy /usage`
agy-usage quota --jsonThe account used for quota display is the one authenticated in the agy CLI.
Trigger models to start quota limitation timers or wake them up. By default, the tool runs agy models to discover available models and automatically selects the most cost-effective model across all active quota categories (standard Gemini 3.x Flash/Pro models, dedicated Gemini 4 Argon models, and Claude/GPT models) from the returned list. Actual triggering is performed by agy -p, so no direct API calls are made.
To prevent excessive triggers and save your quota, wakeup implements a 5-minute cache per model and agy account. If triggered multiple times within 5 minutes, subsequent calls will be skipped.
Note:
wakeupruns a fullagyagent turn for each selected model, so it consumes more tokens than a minimal API request. Use--modelsto limit the number of targets.
# Trigger wakeup for dynamically resolved cheapest models
agy-usage wakeup
# Specify models manually (e.g. Gemini 4 Argon Low, Claude Sonnet 5.5 Low) and use a custom prompt
agy-usage wakeup --models gemini-4-argon-low,claude-sonnet-5-5-low --prompt "Hello"To keep models warmed up or to reset/trigger quota limits continuously, you can run the wakeup command periodically. Make sure the agy CLI is authenticated as the user who will run the scheduled job, that it is available in PATH, and that the process can access the same credential store used by agy (the OS keyring or agy's token file).
Open your user crontab:
crontab -eAdd the following line to run the command every hour (adjust the path to your compiled binary and log path):
0 * * * * /absolute/path/to/agy-usage wakeup >> /absolute/path/to/agy-usage-wakeup.log 2>&1Alternatively, you can use systemd user timers which handle logging automatically and run reliably.
- Create a service file
~/.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 a timer file
~/.config/systemd/user/agy-wakeup.timer:
[Unit]
Description=Run agy-usage wakeup periodically
[Timer]
OnCalendar=hourly
Persistent=true
[Install]
WantedBy=timers.target- Reload systemd configuration and enable the timer:
systemctl --user daemon-reload
systemctl --user enable --now agy-wakeup.timer- Check the status or logs:
systemctl --user status agy-wakeup.timer
journalctl --user -u agy-wakeup.serviceCreate a user launch agent plist at ~/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> <!-- Run every hour (3600 seconds) -->
<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 plist:
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.user.agy-usage.wakeup.plistTo stop/unload:
launchctl bootout gui/$(id -u) ~/Library/LaunchAgents/com.user.agy-usage.wakeup.plistOpen PowerShell and run the following command to register a task that runs every hour:
$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"Or you can create the task via the GUI Task Scheduler:
- 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, browse to
agy-usage.exe, and addwakeupin the arguments.
To update the CLI tool to the latest version directly from GitHub releases:
agy-usage self-updateThis command automatically checks for new releases on GitHub, downloads the correct binary for your operating system and architecture, and replaces the running executable in-place.
Show the current version of the CLI tool.
agy-usage versionYou can also use the standard flags -V or --version to display the version:
agy-usage -V
agy-usage --versionPlease see CHANGELOG.md for the release history.
Copyright (c) 2026 Yoshihiro OKUMURA orrisroot@gmail.com