quse
Quota and usage checks for coding-agent CLIs.
quse reports normalized usage for providers used by tools such as Codex,
Claude Code, GitHub Copilot, Grok Build, Z.AI, and OpenCode Go.
quse
quse codex
quse copilot --json
The CLI prints one normalized line per provider by default. --json emits the
same normalized records as JSON keyed by provider name:
{
"claude": {
"details": {},
"error": null,
"status": "ok",
"windows": {
"5h": {
"percent_remaining": 55.0,
"reset_at": "2026-05-24T14:30:00Z",
"rolling": false
},
"7d": {
"percent_remaining": 87.0,
"reset_at": "2026-05-28T14:59:59Z"
},
"monthly": {
"percent_remaining": null,
"reset_at": null
}
}
}
}
Supported providers:
codexclaudezaicopilotgrok(alias:grok-build)go
gemini is accepted and reports unsupported because it does not currently
expose a usage endpoint.
Provider mapping:
- Every provider has the same normalized
windows.5h,windows.7d, andwindows.monthlyrecords. An unavailable window hasnullvalues. Therollingfield is present on5h; if a provider does not identify the window as rolling, it isfalse. codex: API windows map to5hand7d; when the API returns one window, it is7donly. Codex JSON output also includesdetails.banked_resetsfrom ChatGPT's rate-limit reset-credit endpoint when available.claude: the API's short and long signals map to5hand7d.copilot: the monthly premium-interactions signal maps tomonthly.zai: the five-hour quota maps to rolling5hand the token quota maps to7d; itsmonthlywindow is unavailable.details.banked_resetslists quota reset cards fromcustomer-package-reset/list(personal plan, read-only) with the same unified shape as other providers.go: OpenCode Go's rolling and weekly API windows map to5hand7d, and its monthly API window maps tomonthly.grok: the weekly SuperGrok / X Premium window and the monthly credit window map to7dandmonthlywhen both are present. When the API returns one window, it is assigned to7d. Weekly remaining prefers theGrokBuildentry inproductUsage, thencreditUsagePercent. Grok's proto3 billing payload omits a 0% used figure, so a weekly period with no reported percent is treated as 100% remaining. Grok JSON output includesdetails.product_usage. When Codex or Grok expose one-time usage resets,details.banked_resetslists them with one unified shape (expires_at,available,label) for both providers and both human and JSON output render them asbanked_resets. The one-time reset RPC is separate from Grok's CLI billing responses.qusequeries it with the stored OAuth token and uses the localcurlcommand for thegrok.comrequest because Cloudflare can challenge Python's TLS client. If a deployment requires the browser session, setGROK_RESET_COOKIEto the fullCookieheader from the logged-ingrok.combrowser session and, when needed, setGROK_RESET_USER_AGENTto that browser's user agent. Alternatively, pointGROK_RESET_COOKIE_FILEat a local Cookie-Editor JSON export;~/.grok/cookies.jsonand~/.grok/browser-cookies.jsonare checked automatically. A browser's Network-panel Copy as cURL export can be saved viaGROK_RESET_CURL_FILE;~/.grok/reset.curland~/.grok/grok-reset.curlare also checked automatically, including the matching browser user agent. If browser cookies are stored in acookiesfield in~/.grok/auth.json,quseuses those too. Do not commit or share these values.
Z.AI credentials are resolved in this order:
- The OpenCode auth file at
~/.local/share/opencode/auth.json, using thezai-coding-planentry. - The legacy goz config at
~/.config/goz/config.json, usingzai_token.
OpenCode Go uses the same OpenCode auth file and the opencode-go entry. Run
/connect in OpenCode, choose OpenCode Go, and paste the key from
opencode.ai/auth; Quse will reuse that stored key. For a separately managed
key, set OPENCODE_GO_API_KEY. Do not commit or share these values.
Install
For a local checkout, install the project environment and add its .venv/bin
to your shell PATH:
uv sync --dev
./install.sh
Open a new shell after running ./install.sh, then verify:
quse --help
This is the same local-checkout style used by tmuxctl: the script appends
the checkout's .venv/bin directory to ~/.bashrc.
For one-off use from a checkout without changing PATH:
uv run quse
uv run quse codex --json
For the latest released package from PyPI:
uvx quse
uv tool install quse
# or
pipx install quse
Use uvx quse for a one-off run without installing a persistent tool.
Release
Releases are published by GitHub Actions when a tag starting with v is pushed:
git tag v0.0.6
git push origin main --tags
The workflow verifies that the tag version matches pyproject.toml, runs the
tests, builds the wheel and sdist, then publishes to PyPI with the repository
secret PYPI_API_TOKEN.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quse-0.0.16.tar.gz.
File metadata
- Download URL: quse-0.0.16.tar.gz
- Upload date:
- Size: 75.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80f6ad4c711d9db52a371663e60f8048ee2c652ff43378b1b6d80737863d162a
|
|
| MD5 |
f1c602234a408fcaed4d69a62ef908d6
|
|
| BLAKE2b-256 |
c495a4fa4beb36c7c5a6c1a2970cfb5c272670c3878c5df9da31f0e630097485
|
File details
Details for the file quse-0.0.16-py3-none-any.whl.
File metadata
- Download URL: quse-0.0.16-py3-none-any.whl
- Upload date:
- Size: 37.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69b64c5768898c8868f5a2d0cf43a9991604e2fe405d692af08cd34e47916c96
|
|
| MD5 |
bb3bbcf5f4fab77535f6b995444dda01
|
|
| BLAKE2b-256 |
9181bfdcd51edee00438636c7ee17fb899f4eb858b0af94365f884d4a923555d
|