latenzy
Per-model LLM latency monitoring for enterprises. latenzy is a synthetic prober and
Prometheus exporter that measures what the lab-level status pages can't: the latency
your account gets from each model — claude-sonnet-4-6 vs gpt-4o vs
gemini-2.0-flash, not "Anthropic is up".
Latency is tenant-specific: it depends on your rate-limit tier, your region, and the path you take to the model (direct API, Bedrock, Vertex). latenzy runs inside your network on your keys and exports per-model metrics your existing Prometheus + Grafana stack can alert on.
What it measures
Every probe cycle, for each configured (provider, model, endpoint, prompt_class):
| Metric | Meaning |
|---|---|
latenzy_ttft_seconds |
time to first streamed token (histogram) |
latenzy_request_duration_seconds |
total request duration (histogram) |
latenzy_output_tokens_per_second |
streaming throughput over the generation span (histogram) |
latenzy_probes_total{outcome=...} |
probe count by ok / rate_limited / timeout / error |
latenzy_last_success_timestamp_seconds |
staleness signal for alerting |
Histograms are observed only for successful probes, so failures never skew latency
percentiles. Prompts are deterministic per prompt_class (small/medium/large) —
comparing models on unequal inputs is meaningless.
Quick start
pip install latenzy
export ANTHROPIC_API_KEY=... OPENAI_API_KEY=... GEMINI_API_KEY=...
latenzy doctor -c latenzy.yaml # validate config, check keys are present
latenzy once -c latenzy.yaml # one probe cycle, human-readable results
latenzy run -c latenzy.yaml # probe on an interval + serve /metrics
See latenzy.example.yaml for the full configuration.
API keys are read from environment variables only — they have no place in config files.
Grafana + Prometheus
- Dashboard — Grafana dashboard library ID
25642 (Dashboards → Import →
25642), or importdashboards/latenzy-model-comparison.json: the model-comparison view (TTFT p95, total-latency p95, tokens/sec, failure and 429 ratio, staleness) filterable by provider, model, endpoint, and prompt class. Import it into any Grafana; it prompts for your Prometheus datasource. Thedashboards-share/copy is the same dashboard in Grafana's "export for sharing externally" format for grafana.com uploads (generated byscripts/share_dashboard.py; a test keeps the two in sync). - Recording rules —
prometheus/recording_rules.yml: hourly and daily p50/p95/p99 series (latenzy:ttft_seconds:p95_1h, ...), so dashboards and alerts never recompute histogram quantiles. - Alert rules —
prometheus/alert_rules.yml: probe staleness, TTFT SLO breach, rate-limit pressure, failure ratio.
Standalone bundle (no existing Grafana needed)
cd deploy
mkdir -p secrets && openssl rand -hex 32 > secrets/latenzy_token
export ANTHROPIC_API_KEY=... OPENAI_API_KEY=... GEMINI_API_KEY=...
export GRAFANA_ADMIN_PASSWORD=... # no default password ships with the bundle
docker compose up -d # prober + Prometheus + Grafana, pre-provisioned
Grafana serves the comparison dashboard read-only at http://localhost:3000
(loopback-published only). The bundle mounts the same dashboards/ and
prometheus/ files from the repo, so the bundled and published copies cannot drift.
Security posture
- Binds
127.0.0.1by default. Binding a routable interface refuses to start unlessexporter.auth_token_envis set; the token is checked in constant time. - API keys are sent in request headers only and never appear in logs, URLs, metrics, or error output.
- Probe cost is bounded:
max_output_tokensdefaults to 16.
Status
v0.1.0 — first real release: prober + exporter, Grafana dashboard (library ID
25642), recording/alert rules, standalone bundle, security-hardened through a
four-round red-team loop (see SECURITY.md). Coming next: passive
OpenTelemetry middleware for real-traffic latency.
License: AGPL-3.0-only. Dual licensing available for enterprises — contact the author.
— amitpatole
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 latenzy-0.1.0.tar.gz.
File metadata
- Download URL: latenzy-0.1.0.tar.gz
- Upload date:
- Size: 90.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Rocky Linux","version":"9.5","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b71d34be231083efe98141e182ad1bde14b1f73e0d027388b646d48d4f0b071c
|
|
| MD5 |
ac1ed6ee08aa3ac56d0e11b4bab3727e
|
|
| BLAKE2b-256 |
204513732c4df65c83ce3d228d07a267bebae7d94213c8c2ae7925bc5042b85c
|
File details
Details for the file latenzy-0.1.0-py3-none-any.whl.
File metadata
- Download URL: latenzy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 30.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Rocky Linux","version":"9.5","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4abd38131bce526b0b9279d79b3209d5ab64bec1953f2276a8b7e4a0e515ee0
|
|
| MD5 |
086240290b355ad2eb4e88477d40c1d5
|
|
| BLAKE2b-256 |
268be019619532759d574c14a93def681dec2290f337923198cb484a17d1f29e
|