OpenRouter gives your application access to 200+ language models from 30+ providers — OpenAI, Anthropic, Google, Mistral, Meta, Cohere, and more — through a single OpenAI-compatible endpoint. It handles automatic fallback between providers, cost-based routing, prompt caching, and rate limit management so your team can switch LLMs without code changes. But a unified API still has a single point of failure: if OpenRouter itself is unreachable, every AI feature in your application goes dark simultaneously. Vigilmon gives you HTTP uptime checks, synthetic API probes, and instant alerts so you detect OpenRouter incidents before your users notice degraded AI features.
What You'll Set Up
- HTTP monitor for the OpenRouter API endpoint
- Status page monitor for OpenRouter service incidents
- Synthetic probe to validate end-to-end model routing
- Alert channels for on-call notification
Prerequisites
- An OpenRouter account with an API key from openrouter.ai
- A service that calls OpenRouter (any language — OpenRouter is OpenAI-API compatible)
- A free Vigilmon account
Step 1: Add a Health Endpoint to Your OpenRouter Service
Your application wraps OpenRouter calls in a service or API layer. Add a /health endpoint with two tiers: a fast process check and a deeper OpenRouter probe:
import { Router } from 'express';
const router = Router();
// Fast check — no external calls
router.get('/health', (_req, res) => {
res.json({ status: 'ok', service: 'openrouter-client' });
});
// Deep check — probes OpenRouter API reachability
router.get('/health/deep', async (_req, res) => {
const start = Date.now();
try {
const response = await fetch('https://openrouter.ai/api/v1/models', {
headers: {
'Authorization': `Bearer ${process.env.OPENROUTER_API_KEY}`,
'HTTP-Referer': process.env.APP_URL ?? 'https://yourapp.com',
},
signal: AbortSignal.timeout(8000),
});
if (!response.ok) {
return res.status(503).json({
status: 'error',
code: response.status,
latencyMs: Date.now() - start,
});
}
const data = await response.json();
const modelCount = data?.data?.length ?? 0;
return res.json({
status: 'ok',
modelCount,
latencyMs: Date.now() - start,
});
} catch (err: any) {
return res.status(503).json({
status: 'error',
detail: err.message,
latencyMs: Date.now() - start,
});
}
});
export default router;
The /api/v1/models endpoint lists available models — a 200 response with a non-empty model list confirms OpenRouter is reachable and your API key is valid. It costs no tokens and is safe to probe every few minutes.
Step 2: Monitor the OpenRouter Models Endpoint
OpenRouter's models endpoint is the best lightweight probe because it requires authentication, confirms the API is routing correctly, and returns quickly:
- Log in to vigilmon.online and click Add Monitor.
- Set Type to
HTTP / HTTPS. - URL:
https://openrouter.ai/api/v1/models - Method:
GET - Custom headers:
Authorization: Bearer or-your-api-keyHTTP-Referer: https://yourapp.com
- Keyword check:
"data"(the models array field in the JSON response) - Check interval:
5 minutes - Response timeout:
10 seconds - Click Save.
Security note: Create a separate, read-only API key in your OpenRouter dashboard specifically for monitoring — do not reuse your production key.
Step 3: Monitor the OpenRouter Status Page
OpenRouter publishes a status page for API incidents. Add a status page monitor so you know about provider-side problems immediately:
- In Vigilmon, click Add Monitor → HTTP / HTTPS.
- URL:
https://status.openrouter.ai - Keyword check:
All Systems Operational - Check interval:
5 minutes - Click Save.
Status page failures often precede widespread routing errors — catching this early lets you add an in-app banner before users start filing support tickets.
Step 4: Synthetic Model Routing Check
A models-endpoint probe confirms OpenRouter is reachable but not that it's successfully routing requests. Set up a minimal synthetic probe that makes a real (but cheap) completion call:
import os
import time
import httpx
from fastapi import FastAPI
from fastapi.responses import JSONResponse
app = FastAPI()
@app.get("/health/ai")
async def ai_health():
"""Synthetic probe — makes a real OpenRouter completion call."""
start = time.time()
headers = {
"Authorization": f"Bearer {os.environ['OPENROUTER_API_KEY']}",
"HTTP-Referer": os.environ.get("APP_URL", "https://yourapp.com"),
"Content-Type": "application/json",
}
payload = {
"model": "meta-llama/llama-3.1-8b-instruct:free", # free tier — no cost
"messages": [{"role": "user", "content": "Reply with just: ok"}],
"max_tokens": 5,
}
try:
async with httpx.AsyncClient(timeout=15.0) as client:
resp = await client.post(
"https://openrouter.ai/api/v1/chat/completions",
headers=headers,
json=payload,
)
resp.raise_for_status()
data = resp.json()
reply = data["choices"][0]["message"]["content"].strip()
latency_ms = int((time.time() - start) * 1000)
return {
"status": "ok",
"reply": reply,
"model": data.get("model"),
"latencyMs": latency_ms,
}
except Exception as e:
return JSONResponse(
status_code=503,
content={"status": "error", "detail": str(e)},
)
Use a free-tier model (meta-llama/llama-3.1-8b-instruct:free) so the synthetic probe costs nothing. Monitor https://yourapp.com/health/ai with Vigilmon at a 5-minute interval with keyword check "ok".
Step 5: Detecting Provider Fallback Events
OpenRouter silently falls back to another provider when the primary fails. That's a feature — but silent fallbacks mean you might not know your preferred model is unavailable. Capture the model actually used and log it:
const response = await fetch('https://openrouter.ai/api/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.OPENROUTER_API_KEY}`,
'HTTP-Referer': process.env.APP_URL,
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'openai/gpt-4o',
messages: [{ role: 'user', content: prompt }],
}),
});
const data = await response.json();
const modelUsed = data.model; // may differ from requested model on fallback
if (modelUsed !== 'openai/gpt-4o') {
console.warn(`[OpenRouter] Fallback: requested gpt-4o, got ${modelUsed}`);
// Optionally push to a monitoring metric or alert channel
}
In Vigilmon, your synthetic probe's "model" field in the response lets you verify the expected model was used. If the model changes unexpectedly, your keyword check will fail and you'll receive an alert.
Step 6: Configure Alert Channels
- Go to Alert Channels in Vigilmon and add Slack, email, or a webhook.
- Set Consecutive failures before alert to
2— OpenRouter occasionally has brief transient errors during provider switching that self-resolve within one check interval. - Set a Response time threshold to catch latency degradation:
- Warning: 8000ms (LLM routing is slower than a typical API)
- Critical: 20000ms
Use the Vigilmon API to suppress alerts during your maintenance windows:
curl -X POST https://vigilmon.online/api/maintenance \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"monitor_id": "abc123", "duration_minutes": 15}'
Summary
| Monitor | Target | What It Catches |
|---|---|---|
| Models endpoint | openrouter.ai/api/v1/models | API unreachable, key invalid |
| Status page | status.openrouter.ai | OpenRouter provider-side incidents |
| Synthetic AI probe | /health/ai | Routing failure, completion errors |
| Response time threshold | All monitors | Latency degradation, slow fallback |
OpenRouter consolidates your LLM provider risk behind one API — Vigilmon ensures that single API is monitored with the same rigor you'd apply to each provider individually. With a health check on the models endpoint and a synthetic routing probe, you'll detect OpenRouter incidents in minutes instead of finding out when users report broken AI features.