Uniform quota collection for LLM providers
Project description
usage-limits
Uniform quota collection and rendering for CLI- and API-backed LLM providers.
Current Provider Coverage
| Provider | Status | Window(s) | Mechanism | Reliance |
|---|---|---|---|---|
| Amp | ✅ | Continual | amp usage |
Local CLI |
| Antigravity | ✅ | Dynamic | antigravity-usage quota |
Local CLI |
| Claude | ✅ | 5h, 7d | OAuth API | ~/.claude/.credentials.json |
| Codex | ✅ | 5h, 7d | WHAM API | ~/.codex/auth.json |
| Ollama | ✅ | 5h, 7d | HTML Scrape | OLLAMA_SESSION_COOKIE |
| Qwen | ✅ | Daily | Local Logs | ~/qwen-logs/*.json |
| OpenRouter | 🛠️ | Daily | Not Implemented | Tracking mechanism needed |
How It Works
First-Party CLI Wrappers
- Amp: Credits replenish at a fixed rate up to $10.00. Collection parses
amp usagetext. - Antigravity: Multi-model quotas (Flash, Pro, Claude, GPT-OSS). Collection parses
antigravity-usage --json.
Web & OAuth APIs
- Claude Code: Anthropic OAuth API. Relies on the JSON credentials file created by
claude login. - Codex: ChatGPT WHAM (Usage) API. Relies on the JSON auth file created by
codex login. - Ollama Cloud: Scrapes
ollama.com/settings. RequiresOLLAMA_SESSION_COOKIEexported in your environment.
Local Observability
- Qwen Code: Free tier allows 1000 requests/day (UTC reset).
- Requires enabling OpenAI logging in
~/.qwen/settings.json:{ "model": { "enableOpenAILogging": true, "openAILoggingDir": "~/qwen-logs" } }
- Collection counts files matching
openai-YYYY-MM-DD*.jsonfor the current UTC day.
- Requires enabling OpenAI logging in
Usage
Simple Collection
By default, usage-limits collects data for all supported providers and renders a Rich table.
usage-limits
JSON Output
For programmatic use or custom filtering via jq, use the -j / --json flag.
usage-limits --json | jq '.providers[] | {p: .provider, a: .availability}'
Options
-p, --provider <slug>: Collect only specified provider(s).-n, --notify: Send notifications (via localntfytopic).-a, --anchor: Allow providers to "anchor" (warm up) windows (e.g., runningclaudeorollamawith a trivial prompt).
Setup
direnv allow
just setup
JSON Contract
The canonical JSON contract includes:
version: Contract version.captured_at: UTC timestamp.providers: List of provider snapshots.
Each provider snapshot contains:
status:okorerror.rows: List of usage rows (Identifier, % used, Reset time).availability: High-level summary of model readiness.errors: List of provider-specific error messages.
Development
just check: Run lint, typecheck, and tests.just bump: Increment the patch version and tag it.just publish: Push tags to trigger the PyPI publishing workflow.
Project details
Release history Release notifications | RSS feed
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 usage_limits-1.0.3.tar.gz.
File metadata
- Download URL: usage_limits-1.0.3.tar.gz
- Upload date:
- Size: 56.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bd8a0f2be31ae1179adfafec137b47c85d3dd4b10c3939ebc4d8bae1e1eaa12
|
|
| MD5 |
657fb36cb18767e2f594e985a2518ee7
|
|
| BLAKE2b-256 |
e2d8435f80cb606c9f06f2fa2a23c28a2e8607c4074aa1e81f87db0eee7adb9b
|
File details
Details for the file usage_limits-1.0.3-py3-none-any.whl.
File metadata
- Download URL: usage_limits-1.0.3-py3-none-any.whl
- Upload date:
- Size: 26.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8abab1d64ce086276fc0983a0e77b07e1ca8d9ce5e2abe06725e1bba7fb374b2
|
|
| MD5 |
57600fffa1d8aea1cbc911aaebbed7af
|
|
| BLAKE2b-256 |
39ca4eccd6bb86fb51791fe55538cb8909074cf8628af20158eaf95d6e0c4789
|