PYPI PACKAGE AUDIT v0.1.0 Needs Improvement

gemini-usage-limits

CLI for Antigravity plan usage and rate limits, with Antigravity CLI fallback and warning thresholds.

PyPkgScore gemini-usage-limits
Methodology & Criteria โ™ฅ Donate
570 / 1000
Quick Install
pip install gemini-usage-limits
1. Governance
50/200
2. PEP Metadata
200/200
3. Security
150/200
4. Docs & SEO
105/200
5. CI Engineering
65/200
๐Ÿ“ฃ Share Audit: Share this report and visual preview in the current language
Advertisement
PYPI TELEMETRY

Downloads & Community Adoption

Last 30 days (without mirrors)
Last 7 days
91
Last 30 days
91
Total (180 days)
91
Metric / Ecosystem Status / Value Source
Downloads (30d / 180d) โ€” PyPI Stats (without mirrors)
Trusted Publishing (PEP 740) โœ• Not detected PyPI Integrity / Sigstore
Django Packages โ€” djangopackages.org
PyTech / PyPkgScore 570 / 1000 PyPkgScore Engine

Health & Engineering Analysis (5 Pillars)

1. Governance & Community50 / 200 โ–พ
LICENSEโœ“ 50 pts
SECURITY.mdโœ• 0 pts
CONTRIBUTING.mdโœ• 0 pts
CODE_OF_CONDUCT.mdโœ• 0 pts
2. PEP Metadata & Packaging200 / 200 โ–พ
Wheel (.whl)โœ“ 50 pts
pyproject.tomlโœ“ 50 pts
Project URLsโœ“ 50 pts
Trove Classifiersโœ“ 50 pts
3. Security & Supply Chain150 / 200 โ–พ
Zero CVEs (OSV)โœ“ 60 pts
Trusted Publishing (OIDC)โœ• 0 pts
Snyk / Audit Linkโœ“ 40 pts
HTTPS Repositoryโœ“ 50 pts
4. Documentation, SEO & Ecosystem105 / 200 โ–พ
Structured READMEโœ“ 60 pts
Read the Docsโœ• 0 pts
Django Packagesโœ• 0 pts
Website / Technical Articlesโœ“ 45 pts
5. Engineering, CI & Quality65 / 200 โ–พ
Automated Testsโœ“ 65 pts
GitHub Actions CIโœ• 0 pts
CHANGELOG.mdโœ• 0 pts
Env & Lockfile (uv/rye/poetry/pdm/hatch)โœ• 0 pts
Advertisement
README & DOCS

Official Documentation & Usage Guide โ€” gemini-usage-limits

PyPI Metadata v0.1.0
Show full original documentation (English README) โ–พ

Antigravity shows your plan limits with its /usage command. gemini-usage gives you plan usage from the shell, for scripts, hooks, and AI agents deciding when to back off. It uses the Antigravity login already on your machine.

The 5-hour and weekly windows cover Gemini models and Claude/GPT models in separate groups.

Install gemini-usage-limits from PyPI for the gemini-usage command.

$ gemini-usage
Gemini 5-hour: 1% used, resets 21:18 (in 4h44m)
Gemini 7-day: 18% used, resets Tue 19:33 (in 146h58m)
Claude/GPT 5-hour: 0% used
Claude/GPT 7-day: 0% used

โœจ Features

  • โฑ๏ธ Usage windows with 5-hour and weekly percentages and local reset times for each group.
  • ๐Ÿšฆ Thresholds for scripts with --warn [N] for any window and --warn-7d [N] for the Gemini weekly window. Both exit 1 at or above N%.
  • ๐Ÿ“Š Extra detail with model group descriptions and the plan when available through --all.
  • ๐Ÿ“œ Antigravity CLI fallback through agy -p /usage when the direct endpoint path fails.
  • ๐Ÿงพ Plain, JSON, or short output for terminals and scripts.
  • ๐ŸŒ Cross-platform with keyring access on macOS and Linux and CLI fallback on Windows.
  • ๐Ÿ”‹ Zero dependencies beyond the Python 3.9+ standard library.
  • ๐Ÿ”’ Local & private with existing login credentials sent only to Google's Antigravity endpoint.

๐Ÿš€ Quickstart

Install Antigravity and run agy once to sign in with Google.

curl -fsSL https://antigravity.google/cli/install.sh | bash
agy

After signing in, install and run the usage CLI.

pip install gemini-usage-limits
gemini-usage

๐Ÿง‘โ€๐Ÿ’ป Usage

Command What it does
gemini-usage Available usage windows and their reset times
gemini-usage --json Raw quota-only JSON (alias for --format json)
gemini-usage --warn [N] Exit 1 when any usage window reaches N% (default 70)
gemini-usage --warn-7d [N] Exit 1 at or above N% of the Gemini 7-day window (default 70)
gemini-usage --all Add group descriptions and the plan in plain format
gemini-usage --format {plain,json,short} Choose output format (default plain)
gemini-usage -v, --verbose Print credential and usage sources and the plan, when available, to stderr
gemini-usage -V, --version Print the version
gemini-usage -h, --help Show help

Flags combine as in gemini-usage --format short --warn 70 --warn-7d 90. The last of --json and --format wins. --all adds detail in plain format. Group descriptions come from the quota endpoint and the plan comes from a separate lookup.

Gemini 5-hour: 1% used, resets 21:18 (in 4h44m)
Gemini 7-day: 18% used, resets Tue 19:33 (in 146h58m)
Claude/GPT 5-hour: 0% used
Claude/GPT 7-day: 0% used
Gemini: Models within this group: Gemini 4 Neon, Gemini 4 Carbon, Gemini 4 Argon, Gemini 4 Hydrogen, Gemini 3.8 Flash
Claude/GPT: Models within this group: Claude Opus 5.5, Claude Sonnet 5.5, GPT-OSS 120B
plan Google AI Pro

๐Ÿค– Using it from scripts and agents

gemini-usage --warn 70 || echo "back off"
gemini-usage --warn 70 --warn-7d 90 --format short
gemini-usage --json

The usual output is printed even when a threshold trips. Exit code 0 means success, 1 means a threshold tripped or no source answered, and 2 means an argument error. Both warning thresholds are inclusive and compare the source percentage before rounding for display. --warn includes all reported windows, and --warn-7d checks the Gemini weekly window when present.

๐Ÿ“œ Antigravity CLI fallback

The direct request needs a current access token. When it is expired or the endpoint path fails, the CLI runs agy -p /usage --print-timeout 60s once in a temporary directory. Antigravity refreshes its own credential as needed. The fallback uses whole percentages from its tab-separated output.

$ gemini-usage
Gemini 5-hour: 1% used, resets 21:18 (in 4h44m)
Gemini 7-day: 18% used, resets Tue 19:33 (in 146h58m)
Claude/GPT 5-hour: 0% used
Claude/GPT 7-day: 0% used
(from the agy CLI)

With --format short, each group and window fits on one line.

Gemini 5h 1% ยท Gemini 7d 18% ยท Claude/GPT 5h 0% ยท Claude/GPT 7d 0%

๐Ÿค” How it works

Sources are tried in this order.

  1. last-usage.json if less than 5 minutes old.
  2. One live POST https://daily-cloudcode-pa.googleapis.com/v1internal:retrieveUserQuotaSummary, saved on success.
  3. One Antigravity /usage run.
  4. last-usage.json if less than 60 minutes old.

The quota cache lives in ~/.gemini-usage, or GEMINI_USAGE_HOME when set. Cache writes are atomic. Cached answers at least a minute old show their source and age, for example (from the endpoint, 3 min ago). If all sources fail, the distinct reasons appear on stderr with a sign-in hint.

The direct quota request has a 15-second timeout. -v and plain --all can make one additional request for the plan using the available Antigravity login.

OS Credential source
macOS Antigravity's system Keychain entry
Linux Antigravity's Secret Service entry through secret-tool, when available
Windows The signed-in Antigravity CLI via the fallback

For the protocol and a recipe to rebuild the tool, see docs/HOW_THIS_WAS_BUILT.md.

๐Ÿ”’ Privacy & security

  • Reads the existing Antigravity login. Antigravity handles token refresh.
  • Sends the access token only to daily-cloudcode-pa.googleapis.com in direct requests.
  • Keeps only quota fields in the cache and JSON output. The plan lookup extracts the tier name for display.
  • Keeps tokens, request headers, and email addresses out of errors and verbose output.
  • No telemetry or third-party calls from this CLI.

โš ๏ธ Good to know

  • The quota endpoint is undocumented and its format may change.
  • Both sources need a signed-in Antigravity CLI and an eligible account.
  • The direct request uses Antigravity's versioned User-Agent to receive the Gemini group.
  • An unused window can have no reset time. The CLI omits the reset clause for it.

๐Ÿ› ๏ธ Install options

pip install gemini-usage-limits        # from PyPI
pipx install gemini-usage-limits       # isolated command installation
pip install .                         # from a local clone

Requires Python 3.9+. The PyPI distribution is gemini-usage-limits. The command and GitHub repo are gemini-usage, and the import package is gemini_usage.

๐Ÿค Contributing

Issues and PRs are welcome. After installing the local project with pip install -e ., run the tests with the following command.

pip install pytest && pytest -q

Tests use temporary directories and mocked HTTP and subprocesses. They never contact the endpoint or read real credentials.

Regenerate the demo with python3 docs/record_demo.py after installing agg and the DejaVu Sans Mono font. The recorder uses illustrative quota data with HTTP and credential access disabled. The README embeds the resulting docs/demo.gif.

๐Ÿ“„ License

MIT โ€” do whatever you like.