API usage monitoring SDK for Python
Project description
quotawatch
Python SDK for QuotaWatch — passive API usage monitoring.
Never get surprised by a rate limit again.
Installation
pip install quotawatch
Quick start
from quotawatch import QuotaWatch
from quotawatch.types import QuotaWatchConfig, ApiConfig, ApiLimits
QuotaWatch.init(QuotaWatchConfig(
api_key="qw_live_your_key_here",
ingest_url="https://ingest.quotawatch.app", # or http://localhost:3001 for local dev
environment="production",
apis=[
ApiConfig(
name="OpenAI",
base_url="https://api.openai.com",
limits=ApiLimits(
requests_per_minute=60,
requests_per_day=10_000,
tokens_per_day=1_000_000,
),
),
],
))
# That's it. Your existing requests/httpx calls are now monitored automatically.
# No record() calls needed — the SDK patches the HTTP clients on init().
import requests
response = requests.get("https://api.openai.com/v1/models", headers={...})
How it works
On init(), the SDK monkey-patches requests.Session.send and httpx.Client.send (both sync and async). Every outgoing HTTP call matching a configured base_url is recorded asynchronously — fire-and-forget. A background daemon thread flushes buffered events to the ingest API every 5 seconds.
You never call record() manually — the interceptors handle everything.
Supported HTTP clients
| Client | Supported |
|---|---|
requests |
✅ Auto-patched on init |
httpx (sync) |
✅ Auto-patched on init |
httpx (async) |
✅ Auto-patched on init |
aiohttp |
🔜 v1.1 |
urllib |
❌ Not supported |
Requirements
- Python 3.9+
- Optional:
requests,httpx(patches whichever is installed)
Documentation
Full docs at quotawatch.app/docs/python
License
MIT
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 quotawatch-0.0.1.tar.gz.
File metadata
- Download URL: quotawatch-0.0.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee4787e1cf04f3acaea0c91d2c6181edfc9041c15720b520506553e90ec363a2
|
|
| MD5 |
b14af3566e3ea3c666338e8d3d7f5079
|
|
| BLAKE2b-256 |
45a94fbd754da25991aa8b689d74f913e5902c904713101373a11052409a4973
|
File details
Details for the file quotawatch-0.0.1-py3-none-any.whl.
File metadata
- Download URL: quotawatch-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae491a8346317824c6d8b34e6a563bce6747f37b04656e8bbc0882d9472b9daf
|
|
| MD5 |
90f5edba1eeed9e4d944791da3d89036
|
|
| BLAKE2b-256 |
9097cc404b2e13a6fa303b95a6b7f9933658d1959acedb48da324d75c8c7ae31
|