openrouter-model-availability
Monitor OpenRouter model availability and implement health checks. Use when building systems that depend on specific models being online. Triggers: 'openrouter model status', 'is model available', 'openrouter health check', 'model availability'.
Best use case
openrouter-model-availability is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Monitor OpenRouter model availability and implement health checks. Use when building systems that depend on specific models being online. Triggers: 'openrouter model status', 'is model available', 'openrouter health check', 'model availability'.
Teams using openrouter-model-availability should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/openrouter-model-availability/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How openrouter-model-availability Compares
| Feature / Agent | openrouter-model-availability | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Monitor OpenRouter model availability and implement health checks. Use when building systems that depend on specific models being online. Triggers: 'openrouter model status', 'is model available', 'openrouter health check', 'model availability'.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
ChatGPT vs Claude for Agent Skills
Compare ChatGPT and Claude for AI agent skills across coding, writing, research, and reusable workflow execution.
SKILL.md Source
# OpenRouter Model Availability
## Overview
OpenRouter's `/api/v1/models` endpoint is the source of truth for model availability. Models can be temporarily unavailable, have degraded performance, or be permanently removed. This skill covers querying model status, building health probes, tracking availability over time, and automating failover.
## Query Model Status
```bash
# Check if specific models exist and their status
curl -s https://openrouter.ai/api/v1/models | jq '[.data[] | select(
.id == "anthropic/claude-3.5-sonnet" or
.id == "openai/gpt-4o" or
.id == "openai/gpt-4o-mini"
) | {
id,
context_length,
prompt_per_M: ((.pricing.prompt | tonumber) * 1000000),
completion_per_M: ((.pricing.completion | tonumber) * 1000000)
}]'
# List all available models (just IDs)
curl -s https://openrouter.ai/api/v1/models | jq '[.data[].id] | sort'
# Count models by provider
curl -s https://openrouter.ai/api/v1/models | jq '[.data[].id | split("/")[0]] | group_by(.) | map({provider: .[0], count: length}) | sort_by(-.count)'
```
## Health Check Service
```python
import os, time, logging
from datetime import datetime, timezone
from dataclasses import dataclass
import requests
from openai import OpenAI, APIError, APITimeoutError
log = logging.getLogger("openrouter.health")
@dataclass
class HealthStatus:
model: str
available: bool
latency_ms: float
checked_at: str
error: str = ""
client = OpenAI(
base_url="https://openrouter.ai/api/v1",
api_key=os.environ["OPENROUTER_API_KEY"],
timeout=15.0,
default_headers={"HTTP-Referer": "https://my-app.com", "X-Title": "health-check"},
)
def probe_model(model_id: str) -> HealthStatus:
"""Send a minimal request to test model availability."""
start = time.monotonic()
try:
response = client.chat.completions.create(
model=model_id,
messages=[{"role": "user", "content": "hi"}],
max_tokens=1, # Minimal cost
)
latency = (time.monotonic() - start) * 1000
return HealthStatus(
model=model_id, available=True, latency_ms=round(latency, 1),
checked_at=datetime.now(timezone.utc).isoformat(),
)
except (APIError, APITimeoutError) as e:
latency = (time.monotonic() - start) * 1000
return HealthStatus(
model=model_id, available=False, latency_ms=round(latency, 1),
checked_at=datetime.now(timezone.utc).isoformat(),
error=str(e),
)
def check_critical_models() -> list[HealthStatus]:
"""Probe all critical models."""
CRITICAL_MODELS = [
"anthropic/claude-3.5-sonnet",
"openai/gpt-4o",
"openai/gpt-4o-mini",
"google/gemini-2.0-flash-001",
]
results = []
for model in CRITICAL_MODELS:
status = probe_model(model)
log.info(f"{'OK' if status.available else 'FAIL'} {model} ({status.latency_ms}ms)")
results.append(status)
return results
```
## Catalog-Based Availability Check
```python
def check_model_exists(model_id: str) -> dict:
"""Check if a model exists in the catalog (no API call cost)."""
resp = requests.get("https://openrouter.ai/api/v1/models")
models = {m["id"]: m for m in resp.json()["data"]}
if model_id in models:
m = models[model_id]
return {
"exists": True,
"context_length": m["context_length"],
"pricing": m["pricing"],
}
return {"exists": False, "suggestion": find_similar(model_id, models)}
def find_similar(model_id: str, models: dict) -> list[str]:
"""Find models with similar names (for migration when model is removed)."""
prefix = model_id.split("/")[0]
return [m for m in models if m.startswith(prefix)][:5]
```
## Availability Monitoring Script
```bash
#!/bin/bash
# Run as cron job: */5 * * * * /path/to/check_models.sh
MODELS=("anthropic/claude-3.5-sonnet" "openai/gpt-4o" "openai/gpt-4o-mini")
LOG_FILE="/var/log/openrouter-health.log"
for MODEL in "${MODELS[@]}"; do
START=$(date +%s%N)
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" \
https://openrouter.ai/api/v1/chat/completions \
-H "Authorization: Bearer $OPENROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"model\":\"$MODEL\",\"messages\":[{\"role\":\"user\",\"content\":\"ping\"}],\"max_tokens\":1}" \
--max-time 15)
END=$(date +%s%N)
LATENCY=$(( (END - START) / 1000000 ))
STATUS="OK"
[ "$HTTP_CODE" != "200" ] && STATUS="FAIL"
echo "$(date -u +%Y-%m-%dT%H:%M:%SZ) $STATUS $MODEL $HTTP_CODE ${LATENCY}ms" >> "$LOG_FILE"
done
```
## Error Handling
| Error | Cause | Fix |
|-------|-------|-----|
| Model not in catalog | Model renamed or removed | Use `find_similar()` to find replacement |
| Health check timeout (>15s) | Model overloaded or cold-starting | Distinguish slow vs down; increase timeout for probes |
| False positive down | Transient network issue | Require 2-3 consecutive failures before alerting |
| 402 on health check | Credits exhausted | Health checks cost ~$0.0001 each; ensure adequate credits |
## Enterprise Considerations
- Health probes cost tokens ($0.0001 or less per probe with `max_tokens: 1`) -- budget for monitoring
- Require 2-3 consecutive failures before marking a model as down to avoid false positives
- Cache the models list and refresh every 5 minutes -- don't hit `/api/v1/models` on every request
- Subscribe to OpenRouter announcements for model deprecations and new additions
- Maintain a model alias map so your code uses logical names (e.g., "primary-chat") that you can remap
- Alert when critical models disappear from the catalog, not just when they fail probes
## References
- [Examples](${CLAUDE_SKILL_DIR}/references/examples.md) | [Errors](${CLAUDE_SKILL_DIR}/references/errors.md)
- [Models API](https://openrouter.ai/docs/api/api-reference/models/get-models) | [Status](https://status.openrouter.ai)Related Skills
openrouter-usage-analytics
Track and analyze OpenRouter API usage patterns, costs, and performance. Use when building dashboards, optimizing spend, or reporting on AI usage. Triggers: 'openrouter analytics', 'openrouter usage', 'openrouter metrics', 'track openrouter spend'.
openrouter-upgrade-migration
Migrate to OpenRouter from direct provider APIs or upgrade between SDK/model versions. Triggers: 'openrouter migrate', 'openrouter upgrade', 'switch to openrouter', 'migrate from openai to openrouter'.
openrouter-team-setup
Configure OpenRouter for multi-user teams with per-user keys, budget controls, and usage attribution. Triggers: 'openrouter team', 'openrouter multi-user', 'openrouter organization', 'team api keys openrouter'.
openrouter-routing-rules
Define custom routing rules for OpenRouter requests based on user tier, task type, cost budget, and availability. Triggers: 'openrouter rules', 'routing rules', 'custom routing openrouter', 'conditional model selection'.
openrouter-reference-architecture
Design production architectures using OpenRouter as the LLM gateway. Use when planning system design, reviewing architecture, or scaling AI applications. Triggers: 'openrouter architecture', 'openrouter system design', 'openrouter at scale', 'llm gateway architecture'.
openrouter-rate-limits
Understand and handle OpenRouter rate limits. Use when hitting 429 errors, building high-throughput systems, or implementing retry logic. Triggers: 'openrouter rate limit', 'openrouter 429', 'openrouter throttle', 'rate limiting openrouter'.
openrouter-prod-checklist
Validate production readiness of your OpenRouter integration. Use before launching to production or during operational reviews. Triggers: 'openrouter production', 'openrouter launch', 'production checklist openrouter', 'openrouter deploy'.
openrouter-pricing-basics
Understand OpenRouter pricing, calculate costs, and optimize spend. Use when budgeting, comparing model costs, or tracking spend. Triggers: 'openrouter pricing', 'openrouter cost', 'model pricing', 'openrouter budget', 'how much does openrouter cost'.
openrouter-performance-tuning
Optimize OpenRouter request latency and throughput. Use when building real-time applications, reducing TTFT, or scaling request volume. Triggers: 'openrouter performance', 'openrouter latency', 'openrouter speed', 'optimize openrouter throughput'.
openrouter-openai-compat
Migrate from OpenAI to OpenRouter with minimal code changes. Use when switching to OpenRouter or maintaining dual compatibility. Triggers: 'openrouter openai compatible', 'openrouter drop-in', 'openai to openrouter', 'openrouter migration'.
openrouter-multi-provider
Use multiple AI providers (OpenAI, Anthropic, Google, Meta) through OpenRouter's unified API. Use when comparing providers, building cross-provider workflows, or maximizing availability. Triggers: 'openrouter providers', 'multi provider', 'openrouter openai anthropic', 'compare models openrouter'.
openrouter-model-routing
Implement intelligent model routing to optimize cost, quality, and latency on OpenRouter. Use when building multi-model systems or optimizing spend across task types. Triggers: 'openrouter routing', 'model routing', 'route to model', 'model selection openrouter'.