API Documentation

Access AI provider speed rankings, run latency tests, and integrate performance data into your applications.

Base URL

All API endpoints use the following base URL:

Base URL https://myaispeed-worker.vankristoff.workers.dev

All responses are JSON. No authentication is required for read endpoints. HTTPS is required for all requests.

List All Providers

GET /api/providers

Returns the full list of AI providers available for testing, including their display names, brand colors, supported models, and default model.

Response

{ "providers": [ { "slug": "openai", "name": "OpenAI", "color": "#10a37f", "models": ["gpt-4o", "gpt-4o-mini"], "defaultModel": "gpt-4o-mini" } ] }

curl

curl https://myaispeed-worker.vankristoff.workers.dev/api/providers

JavaScript

const res = await fetch( "https://myaispeed-worker.vankristoff.workers.dev/api/providers" ); const data = await res.json(); console.log(data.providers);

Python

import requests res = requests.get( "https://myaispeed-worker.vankristoff.workers.dev/api/providers" ) data = res.json() print(data["providers"])

AI Speed Index

GET /api/index

Returns aggregated speed rankings for all AI providers based on real user measurements over a rolling 30-day window.

Response

{ "rankings": [ { "provider": "openai", "avg_ttfb": 142.5, "avg_ttft": 310.2, "avg_tps": 48.7, "success_rate": 99.1, "test_count": 12450 } ], "updated": "2026-03-08T12:00:00Z" }

curl

# Global rankings curl https://myaispeed-worker.vankristoff.workers.dev/api/index # Filter by country curl "https://myaispeed-worker.vankristoff.workers.dev/api/index?country=US"

JavaScript

const res = await fetch( "https://myaispeed-worker.vankristoff.workers.dev/api/index?country=US" ); const data = await res.json(); console.log(data.rankings);

Python

import requests res = requests.get( "https://myaispeed-worker.vankristoff.workers.dev/api/index", params={"country": "US"} ) data = res.json() print(data["rankings"])

City-Level Rankings

GET /api/index/cities

Returns speed rankings broken down by city. Useful for understanding regional performance differences.

Response

{ "cities": [ { "city": "San Francisco", "country": "US", "provider": "openai", "avg_ttfb": 98.3, "test_count": 3200 } ], "updated": "2026-03-08T12:00:00Z" }

curl

# All cities curl https://myaispeed-worker.vankristoff.workers.dev/api/index/cities # Filter by country curl "https://myaispeed-worker.vankristoff.workers.dev/api/index/cities?country=US"

JavaScript

const res = await fetch( "https://myaispeed-worker.vankristoff.workers.dev/api/index/cities?country=US" ); const data = await res.json(); console.log(data.cities);

Python

import requests res = requests.get( "https://myaispeed-worker.vankristoff.workers.dev/api/index/cities", params={"country": "US"} ) data = res.json() print(data["cities"])

Countries with Data

GET /api/index/countries

Returns a list of all countries that have test data, along with the number of tests from each country.

Response

{ "countries": [ { "country_code": "US", "cnt": 45200 }, { "country_code": "GB", "cnt": 12800 }, { "country_code": "DE", "cnt": 9400 } ] }

curl

curl https://myaispeed-worker.vankristoff.workers.dev/api/index/countries

JavaScript

const res = await fetch( "https://myaispeed-worker.vankristoff.workers.dev/api/index/countries" ); const data = await res.json(); console.log(data.countries);

Python

import requests res = requests.get( "https://myaispeed-worker.vankristoff.workers.dev/api/index/countries" ) data = res.json() print(data["countries"])

Run a Connection Test

POST /api/test/connection

Runs a connection latency test against a specific AI provider. Measures DNS, TLS, and total round-trip time through the Cloudflare edge proxy.

Request body

{ "provider": "openai", "test_id": "550e8400-e29b-41d4-a716-446655440000" }

Response

{ "success": true, "provider": "openai", "ttfb_ms": 142, "dns_ms": 12, "tls_ms": 28, "total_ms": 156, "test_id": "550e8400-e29b-41d4-a716-446655440000" }

curl

curl -X POST \ https://myaispeed-worker.vankristoff.workers.dev/api/test/connection \ -H "Content-Type: application/json" \ -d '{"provider":"openai","test_id":"550e8400-e29b-41d4-a716-446655440000"}'

JavaScript

const res = await fetch( "https://myaispeed-worker.vankristoff.workers.dev/api/test/connection", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ provider: "openai", test_id: crypto.randomUUID() }) } ); const data = await res.json(); console.log(data.ttfb_ms, data.total_ms);

Python

import requests import uuid res = requests.post( "https://myaispeed-worker.vankristoff.workers.dev/api/test/connection", json={ "provider": "openai", "test_id": str(uuid.uuid4()) } ) data = res.json() print(f"TTFB: {data['ttfb_ms']}ms, Total: {data['total_ms']}ms")

CLI Tool

Run a speed test directly from your terminal with a single command. No installation required.

Usage

npx myaispeed

The CLI runs connection tests against all supported AI providers from your machine and prints a ranked table of results. It uses the same infrastructure as the web-based speed test.

Example output

MyAISpeed - AI Provider Speed Test # Provider TTFB Total 1 Groq 48ms 62ms 2 Cerebras 55ms 71ms 3 OpenAI 98ms 142ms 4 Anthropic 112ms 156ms 5 Google 118ms 164ms ... Results submitted to AI Speed Index.

Test results are automatically submitted to the AI Speed Index to help build the global dataset. The same rate limits apply.

Rate Limits

To maintain data quality and prevent abuse, the following rate limits apply to the connection test endpoint:

Per-minute limit
5 test requests per minute per IP address. Exceeding this returns a 429 Too Many Requests response.
Per-hour limit
15 test requests per hour per IP address. This limit resets on a rolling window.
Read endpoints
The GET endpoints (/api/providers, /api/index, /api/index/cities, /api/index/countries) are not rate-limited but may be cached at the edge.

IP addresses are hashed with a salt before rate limit checks. Plaintext IPs are never stored.

Data Collection

Each test automatically collects anonymized metadata to power the AI Speed Index:

We do not collect personally identifiable information. IP addresses are never stored. All geographic and network data is derived from Cloudflare's edge infrastructure and stored in aggregate form only.

For full details, see the Methodology page.