Skip to main content

Check rate-limit status for LLM API providers before you hit a limit.

Project description

ratewatch

A small CLI that probes your LLM API providers and tells you how close you are to a rate limit — before you hit it.

groq:       ✅ 142/500 requests remaining (resets in 12m)
openrouter: ⚠️  18/100 requests remaining
gemini:     ❌ rate limited, resets in 4m
custom_x:   ℹ️  key valid, limit info unavailable

Install

pip install ratewatch

Requires Python 3.10+. To install from a local checkout instead:

pip install -e .

Usage

# add a provider (prompted for key only when a preset is known)
ratewatch add openai
ratewatch add anthropic

# probe a single provider
ratewatch check groq

# probe everything configured
ratewatch check

ratewatch check exits with a non-zero status if any provider is rate-limited, so it's scriptable:

ratewatch check && echo "every provider is healthy"

Other commands:

ratewatch list     # show providers with masked keys
ratewatch remove <provider>
ratewatch reset    # delete the entire config file

Supported out of the box

OpenAI, Anthropic, NVIDIA NIM, OpenRouter, Gemini, DeepSeek, Mistral, Mistral Codestral, OpenCode Zen, OpenCode Go, Wafer, Kimi, Cerebras, Groq, Fireworks, Z.ai.

A preset is just a base URL, an auth header format, and a cheap probe endpoint (usually /models). When a preset's URL or header drifts, the probe still runs — it just falls through to "key valid, limit info unavailable" instead of crashing.

Not every provider exposes live rate-limit data on every endpoint. Some providers (e.g. NVIDIA NIM) don't expose remaining-quota info at all — you'll see "key valid, limit info unavailable" until you actually hit a 429. Use --live mode for a more accurate read on providers that support it, but note this uses a small amount of real quota since it sends an actual request.

Custom providers

If your provider isn't in the preset list, ratewatch add will ask for:

  • base URL — e.g. https://api.example.com/v1
  • auth header format — e.g. Authorization: Bearer {key} or x-api-key: {key}. {key} is replaced with your API key at probe time.
  • test endpoint — a cheap GET path, typically /models.
  • API key

On first save, ratewatch makes one probe request to validate the key before persisting the config.

Security

Keys are stored in plaintext at ~/.config/ratewatch/config.toml (%APPDATA%\ratewatch\config.toml on Windows). The file is created with mode 0o600 where the platform supports it. Keys never leave your machine — every probe is issued from your own process. ratewatch list only ever prints a masked key (●●●●●●abcd).

If that's not acceptable, don't use this tool.

Header coverage

Different providers publish rate-limit metadata under different header names. ratewatch scans for all of these (case-insensitive):

  • x-ratelimit-*-requests|tokens, x-ratelimit-*-reset
  • ratelimit-remaining|limit|reset
  • x-rate-limit-*
  • anthropic-ratelimit-*-remaining|limit|reset
  • retry-after

Reset values are parsed as integer seconds, OpenAI-style durations (1m23s), ISO timestamps, or HTTP-date. If none are present, the key is reported valid and the limit is listed as unknown.

Exit codes

  • 0 — every checked provider is not rate-limited
  • 1 — at least one provider is rate-limited (or a non-rate-limit error)
  • 2 — misconfiguration (missing arg, empty key, validation failure, etc.)

License

MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ratewatch-0.1.1.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ratewatch-0.1.1-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file ratewatch-0.1.1.tar.gz.

File metadata

  • Download URL: ratewatch-0.1.1.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for ratewatch-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7c5b9ff896a47c2359caa12e1cf3122c8a9520a8d2e7c8358d45c34eabcf999b
MD5 058231f786ea3a2897833a67bea50ad0
BLAKE2b-256 bb07caaa4e88ac90d0841f0b67fc114878cb9b7be1ceb7a3c321a008abc3a5f9

See more details on using hashes here.

File details

Details for the file ratewatch-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ratewatch-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for ratewatch-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d8242a904f15bdf96f22d1e773a24c929aa459264f5aea33b287c4d1ea3ef15e
MD5 053e9d84535b171485223b17dc69f892
BLAKE2b-256 738ab7311ad115de064b583047b6f4362dcfdf4e0307ef372a0936a997fbb85d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page