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 -e .

Requires Python 3.10+.

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.

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.0.tar.gz (19.8 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.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ratewatch-0.1.0.tar.gz
  • Upload date:
  • Size: 19.8 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.0.tar.gz
Algorithm Hash digest
SHA256 1c4fc2fc78b2e0a7d2df70360f8853230c8ce84b815eea1766aea2cfd76a8ec8
MD5 835dfcd429bb9ade98abeb001db78873
BLAKE2b-256 bfe196fd5caefdf91dae009e149a10955513b5e44ed5489be7faa8a2a6213305

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ratewatch-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.7 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2dfe4d70ff0cb5532d8bb427870deb893c31eb543a9ac320af6b6c7ca55b01af
MD5 08ea43e5a501896a49171ab500f69db6
BLAKE2b-256 c79141537558e3db0c4a4601e4236a249d83680f4ad4d1c9cd3d6ee2f4adfae0

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