Monitor an OpenAI-Compatible API with Uptime Kuma: 3-Tier Checks
Monitoring an API with Uptime Kuma, especially an OpenAI-compatible LLM endpoint, takes more than a single HTTP monitor. A URL that loads doesn't mean your key is valid, and it certainly doesn't mean the model returns anything. A more reliable setup uses three tiers: tier 1 checks that the endpoint is reachable, tier 2 requests /v1/models with your key, and tier 3 POSTs a very short chat completion and validates the response fields. Below is how to fill in each tier in Uptime Kuma, and how to choose the interval, timeout and cost.
This setup works for any service that exposes a "base URL + API key" interface: official APIs, cloud-hosted offerings, self-hosted gateways and aggregator gateways alike.
Why isn't one HTTP monitor enough?
LLM API failures show up at several layers:
| Where it fails | Typical symptom | Tier 1 catches it | Tier 2 catches it | Tier 3 catches it |
|---|---|---|---|---|
| DNS, TLS or network down | Connection timeout, certificate error | Yes | Yes | Yes |
| Key revoked or quota exhausted | 401, 403, 429 | No | Mostly | Yes |
| Gateway is fine, upstream model is down | 500, 502, 503, 529, or a response body with missing fields | No | Not always | Yes |
| A model name is retired or renamed | 404 or 400 model not found | No | Depends on the list | Yes |
Tier 1 is cheap but only proves the road is open. Tier 3 is closest to a real call but burns tokens every time. With all three configured, when an alert fires you can tell which layer is broken from which tier turned red. For what each status code means, see the LLM API error code cheat sheet.
How do you configure the three tiers in Uptime Kuma?
The steps below follow the Uptime Kuma 1.23 / 2.0 UI. Field names differ slightly between versions, so go by what you see. https://api.example.com and sk-xxx are placeholders; replace them with your own endpoint and key.
Tier 1: the endpoint is reachable
- Monitor type:
HTTP(s) - URL:
https://api.example.com/v1/models - Method:
GET, with no request headers - Accepted status codes:
200-299, plus401
The key is left out on purpose. An OpenAI-compatible API normally answers an unauthenticated request with 401, which is exactly the signal that DNS, TLS and the gateway are all working. If you accept only 2xx, this monitor will stay red forever.
Tier 2: request /v1/models with a key
- Monitor type:
HTTP(s) - Json Query - URL:
https://api.example.com/v1/models - Method:
GET - Headers (JSON format):
{
"Authorization": "Bearer sk-xxx"
}
- Json Query:
$count(data) > 0 - Expected value:
true
/v1/models returns a structure like {"object":"list","data":[...]}. A JSON query is better than keyword matching here because some gateways return 200 on errors and put an error message in the body, which keyword matching can mistake for success.
If you care whether a specific model is still listed, change the query to:
"your-model-name" in data.id
The expected value is again true. When a model is renamed or taken down, this tier will flag it first.
This tier usually isn't billed, but whether it is billed or counts toward rate limits depends on each provider's documentation.
Tier 3: POST a very short chat
- Monitor type:
HTTP(s) - Json Query - URL:
https://api.example.com/v1/chat/completions - Method:
POST - Body encoding:
JSON - Headers:
{
"Authorization": "Bearer sk-xxx",
"Content-Type": "application/json"
}
- Body:
{
"model": "your-model-name",
"messages": [{"role": "user", "content": "ping"}],
"max_tokens": 1,
"stream": false
}
- Json Query:
$count(choices) > 0 - Expected value:
true
A few things to watch:
- Always set
streamtofalse. Uptime Kuma doesn't parse SSE streams, so with streaming on you won't get a complete JSON body. - Some newer models reject
max_tokensand requiremax_completion_tokens. If you get a 400, check this first. - A reasoning model with
max_tokensset to 1 may return no text, but thechoicesarray is usually still there, so validatingchoicesis more robust than validatingcontent. - Use the model your application actually runs. Probing a cheap model you never use tells you little when it's green.
Before filling in the form, run curl once on the same machine that hosts Uptime Kuma to confirm the response shape:
curl -sS https://api.example.com/v1/chat/completions \
-H "Authorization: Bearer sk-xxx" \
-H "Content-Type: application/json" \
-d '{"model":"your-model-name","messages":[{"role":"user","content":"ping"}],"max_tokens":1,"stream":false}' \
-w '\nHTTP %{http_code} total %{time_total}s\n'
How do you set the interval, timeout and retries?
Probe interval and token cost
The interval drives cost. One probe every 5 minutes is 288 a day, or about 8,640 over 30 days. Each probe sends a few input tokens and gets 1 output token, so the absolute amount is tiny, but you multiply it by the number of models and environments you monitor. A reasonable starting point:
| Tier | Suggested interval | Cost |
|---|---|---|
| Tier 1 | 60 seconds | None |
| Tier 2 | 60-120 seconds | Usually none |
| Tier 3 | 300 seconds | A few tokens each |
If tier 3 uses a pay-as-you-go key, create a separate key used only for monitoring. Then the cost shows up as its own line on the bill, and you can revoke it on its own if it leaks.
Set timeouts from baseline latency
Don't leave the timeout at the default. cdnping's edge probe data gives a sense of scale: on October 17, 2026, cdnping probed the official API endpoints from a Cloudflare Denver (DEN) node, collecting 242 samples between 08:40 and 10:05 UTC. cdnping only began collecting that day, so the window is short and the table below is for order of magnitude only.
| API endpoint | p50 | p95 |
|---|---|---|
| OpenAI API | 96 ms | 194 ms |
| Claude API | 73 ms | 84 ms |
| DeepSeek API | 353 ms | 414 ms |
| Zhipu BigModel | 395 ms | 674 ms |
| Kimi (Moonshot AI) open platform | 375 ms | 1125 ms |
| Alibaba Cloud Model Studio | 615 ms | 1152 ms |
| Volcengine Ark | 485 ms | 1149 ms |
These numbers are round-trip times from a US edge to each API endpoint. They exclude model inference time, and they don't represent what you would measure from a server in mainland China. The table shows that the baseline latency from one probe location to different providers can differ by several times (p50 from 73 ms to 615 ms), and some p95 values exceed 1 second. So:
- Tiers 1 and 2: set the timeout to 3-5 times your own measured p95; 5-10 seconds is usually enough.
- Tier 3: include time to first token, so 20-30 seconds is a good range. Set it too tight and a slightly longer model queue will trigger false alarms. For how latency breaks down, see AI API latency breakdown.
Retries to absorb one-off blips
Set "Retries" to 2 and "Heartbeat Retry Interval" to 30-60 seconds. A single occasional timeout then won't push an alert right away; only consecutive failures count as down. Treat 429 separately: if tier 3 often goes red because of 429, your monitoring frequency plus real traffic is hitting the rate limit, so reduce the frequency rather than adding retries.
When an alert fires, is it your network or the upstream?
Uptime Kuma can only tell you "it failed from this machine." It can't distinguish a problem on your server's egress from a real provider outage. For that you need an outside reference:
- Open cdnping's API status page and look at the provider's edge probe results for the same time window (for example /status/openai). cdnping probes the official API endpoints from the Cloudflare edge every 5 minutes, and syncs some official status pages every 15 minutes.
- Then check the Is it down? page, which combines official status, API probes and user reports.
- Compare the results:
| Your Uptime Kuma | cdnping /status | Most likely cause |
|---|---|---|
| Tier 1 red | Green | Your server's network, DNS or egress |
| Tier 1 green, tier 2 red (401/403) | Green | Key or quota problem |
| Tiers 1 and 2 green, tier 3 red | Green | A specific model or upstream supplier problem |
| Tier 1 red | Red | Provider endpoint outage |
If it looks like your own network, continue with the approach in Is ChatGPT down? A three-step check. To push official status updates into your team chat, see Pushing official status updates to Feishu, DingTalk and WeCom (these are the common workplace chat tools in China, and the same approach works for Slack-style webhooks), and send them to the same channel as your Uptime Kuma alerts.
Checklist after setup
- The tier 1 monitor accepts 401 and sends no key
- Tiers 2 and 3 use a dedicated monitoring key
- In the tier 3 body,
streamisfalseand the model is the one your app really uses - The Json Query validates structure (
data,choices), not specific wording - Timeouts are based on measured latency, and tier 3 leaves room for inference
- Retries are at least 2, and you've confirmed 429 isn't triggered by probe frequency
- Break the key on purpose once, and confirm tiers 2 and 3 both turn red and your notification channel gets the message
- You have an outside reference to check during an alert (cdnping /status, /down)
Do the second-to-last item for real. If a monitor has never turned red since you set it up, the Json Query may be wrong and always returning true, and you'd only find out during a real outage.
What if you also want long-term uptime numbers?
Uptime Kuma's built-in uptime figure is computed from probe counts. Tier 3 runs once every 5 minutes, which is only 288 samples a day: good for spotting outages, not for calculating uptime precisely. If you need a success rate based on real requests, with 4xx and 5xx separated, see Measuring AI API uptime yourself for the method and scripts. For how monitors tie into alerting, see the AI app availability monitoring checklist.
Some providers also publish uptime computed from real requests. For example, AGI Plan (AGI Plan is a commercial partner of cdnping) publishes hourly success and failure counts per capability group at https://agiplan.dev/api/status/requests?month=YYYY-MM. Only 5xx responses count as platform failures, and cdnping mirrors this at /status/agiplan. If you monitor a gateway like this, you can compare your own Uptime Kuma results with the public data. The two sides use different definitions, and the gap between them can itself show which side the problem is on.