| name | 9router-gateway |
| description | AI routing gateway with RTK compression, tier-based provider fallback, circuit breaker, and real-time dashboard — routes requests through free-tier providers first, paid only on fallback. Use when use when setting up ai model routing, managing provider tiers, or implementing circuit breaker patterns for api resilience Triggers on keywords: routing, gateway, 9router, fallback, circuit-breaker, rtk.
|
| allowed-tools | Read, Write, Bash, Edit, Grep, Glob |
| user-invocable | true |
| mcp-servers | ["filesystem","github","docker"] |
AI Routing Gateway
context
AI routing gateway with RTK compression, tier-based provider selection, and automatic failover. Routes requests to the optimal AI provider based on cost, latency, and capability requirements. This skill provides infrastructure-as-code patterns and operational procedures that ensure reliability, security, and observability of critical infrastructure components.
instructions
Step 1: Assess Infrastructure Requirements
- Identify the infrastructure need — routing, proxying, credential management, or CLI orchestration
- Determine deployment target — local, cloud, or hybrid
- Map dependencies — what services, APIs, or systems must be accessible
- Establish SLOs — uptime, latency, and error rate targets
Step 2: Design Infrastructure Layer
- Architecture — Define the component topology and data flow
- Configuration — Set up environment-specific configuration with secrets management
- Health checks — Implement liveness, readiness, and startup probes
- Failover — Design redundancy with automatic recovery procedures
Step 3: Generate Infrastructure Specification
## Infrastructure Specification
### Architecture
Component diagram and data flow description
### Configuration
- Environment variables: list with descriptions
- Secrets: list with rotation policy
- Resource limits: CPU, memory, disk
### Health and Monitoring
- Liveness: health check endpoint and interval
- Readiness: dependency connectivity check
- Metrics: key metrics to track
- Alerts: threshold-based alerting rules
### Failover Procedures
- Primary failure: automatic recovery steps
- Cascading failure: circuit breaker behavior
- Full outage: manual recovery runbook
Step 4: Operational Readiness
constraints
- NEVER store secrets in code or configuration files — use a vault.
- NEVER deploy without health checks and monitoring.
- NEVER assume network reliability — design for failure at every layer.
- ALWAYS test failover procedures before relying on them.
- ALWAYS maintain audit logs for all credential access.
examples
Example: Infrastructure Setup
Input: "Use when setting up AI model routing, managing provider tiers, or implementing circuit breaker patterns for API resilience"
Output:
## Infrastructure Specification
### Architecture
Multi-layer 9router gateway with automatic failover between primary and backup endpoints.
### Configuration
- PRIMARY_ENDPOINT: configured via environment
- FALLBACK_ENDPOINT: configured via environment
- MAX_RETRIES: 3
- TIMEOUT_MS: 5000
### Health and Monitoring
- Liveness: GET /health every 30s
- Readiness: Dependency connectivity check
- Metrics: request_rate, error_rate, latency_p99
- Alerts: error_rate exceeding threshold for 2 minutes
### Failover Procedures
- Primary failure: Auto-switch to fallback within 5s
- Both down: Queue requests, retry every 30s
- Recovery: Auto-switch back to primary when healthy