Metadata-Version: 2.4
Name: llmlatency
Version: 0.1.1
Summary: Measured latency, uptime and outages of AI inference APIs (OpenAI, Anthropic, Gemini and 40+) from 4 regions — client for the open llmlatency.dev dataset
Author-email: "llmlatency.dev" <bot@mail.llmlatency.dev>
License: MIT
Project-URL: Homepage, https://llmlatency.dev
Project-URL: Methodology, https://llmlatency.dev/methodology
Project-URL: Uptime comparison, https://llmlatency.dev/best-uptime
Project-URL: Model deprecation calendar, https://llmlatency.dev/deprecations
Project-URL: Incident log, https://llmlatency.dev/incidents
Project-URL: Machine-readable API, https://llmlatency.dev/api/rankings.json
Project-URL: Source, https://github.com/mazamaka/llm-latency-tracker
Project-URL: Citable dataset (DOI), https://doi.org/10.5281/zenodo.21954788
Keywords: llm,latency,benchmark,ai,inference,observability,time-to-first-token,api-monitoring,uptime,status,outage,model-deprecation
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: System :: Monitoring
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# llmlatency

Measured latency and uptime for AI inference APIs, as a small Python client for
the open dataset published at **[llmlatency.dev](https://llmlatency.dev)**.

Probes run every five minutes from four regions and are never routed through a
gateway or an aggregator, so the numbers describe the providers themselves
rather than a proxy in front of them.

- **Network probe** — DNS → TCP → TLS → time to first byte.
- **Inference probe** — time to first token on a real completion request.

These are different quantities, an order of magnitude apart, and this library
never mixes them in one ranking.

## What the data answers

Every question below has a page on llmlatency.dev, rebuilt automatically from
the probes:

- **Which AI API has the best uptime?** —
  [AI provider uptime comparison](https://llmlatency.dev/best-uptime): observed
  availability of OpenAI, Anthropic, Google and 40+ other APIs from four
  regions, with the worst region shown next to the average.
- **Is the OpenAI, Claude or Gemini API down right now?** — live status per
  provider: [OpenAI](https://llmlatency.dev/provider/openai),
  [Anthropic](https://llmlatency.dev/provider/anthropic),
  [Google Gemini](https://llmlatency.dev/provider/google).
- **What failed, and when?** — [incident log](https://llmlatency.dev/incidents).
  An outage is attributed to a provider only when it failed from two or more
  regions at once and no other provider was failing in the same minutes.
- **Which LLM API has the lowest time to first token?** —
  [measured TTFT vs TTFB](https://llmlatency.dev/time-to-first-token).
- **When is a model retired, and what replaces it?** —
  [AI model deprecation calendar](https://llmlatency.dev/deprecations):
  OpenAI, Anthropic, Google, Mistral and Azure retirement dates, each row linked
  to the provider's own announcement.
- **Fastest AI API from my region** —
  [Europe](https://llmlatency.dev/region/eu-hetzner),
  [US](https://llmlatency.dev/region/us-central),
  [Asia](https://llmlatency.dev/region/ap-tokyo),
  [South America](https://llmlatency.dev/region/sa-east).

### Snapshot: 18 October 2026

Taken from those pages on that day. They change every few minutes; the links
always show current figures.

- 46 providers probed from 4 regions, 52,897 probes in the preceding 24 hours.
- 33 of the 46 providers answered every probe from every region.
- Lowest measured time to first token: 440 ms (typesafe, `jev-1.13.0`, from
  São Paulo). This is not a provider ranking — each provider answers on a
  different model, and model size drives TTFT more than the provider does.
- Next retirement date: 2026-10-23 — 28 OpenAI models and fine-tunes, among
  them `gpt-4`, `gpt-4-turbo`, `gpt-3.5-turbo`, `o1-2024-12-17` and
  `gpt-image-1`.

## Install

```bash
pip install llmlatency
```

No dependencies — standard library only.

## Use it from Python

```python
import llmlatency

llmlatency.regions()
# ['ap-tokyo', 'eu-hetzner', 'sa-east', 'us-central']

llmlatency.fastest("eu-hetzner")
# {'rank': 1, 'provider': 'nscale', 'p50_ms': 99, 'p95_ms': 203,
#  'uptime_pct': 100, 'samples': 289}

for row in llmlatency.ranking("us-central")[:3]:
    print(row["rank"], row["provider"], row["p50_ms"], "ms")

llmlatency.provider("anthropic")          # one provider across every region
llmlatency.generated_at()                 # snapshot timestamp, ISO-8601 UTC
```

Fetch once and pass the snapshot around if you make several queries:

```python
data = llmlatency.fetch()
fast = {r: llmlatency.fastest(r, data=data) for r in llmlatency.regions(data)}
```

## Use it from the shell

```bash
llmlatency fastest                        # fastest provider in every region
llmlatency ranking --region eu-hetzner --top 5
llmlatency provider openai
llmlatency fastest --probe inference --json
```

## Data, methodology, licence

- Live rankings: <https://llmlatency.dev>
- Methodology: <https://llmlatency.dev/methodology>
- Machine-readable snapshot: <https://llmlatency.dev/api/rankings.json>
- Citable archive with a DOI: <https://doi.org/10.5281/zenodo.21954788>
- Daily snapshots in git: <https://github.com/mazamaka/llm-latency-tracker>

The dataset is **CC-BY-4.0**; this client library is MIT.

**Limitations, stated up front.** Vantage points are cloud data centres, not
consumer networks, so absolute values are lower than an end user would see — the
comparison between providers is the meaningful part. Provider coverage changes
over time as APIs appear and shut down.
