mahyar.cloud sits between your apps and OpenRouter, Bedrock, Groq, NIM, and Gemini. It routes every call, fails over automatically, and meters usage per app, org, and user.
Routes acrossOpenRouterAmazon BedrockGroqNVIDIA NIMGoogle GeminiHow it works
Every request, routed and guarded.
1
Your app calls one endpoint
Your web app, Telegram bot, or Slack app sends one request to /api/v1 with its own API key. It never talks to a provider directly.
2
Gateway authenticates and checks limits
The key resolves to an app, org, and user. Rate limits and monthly quotas get checked before anything else runs.
3
An ordered chain gets tried in sequence
Each tier maps to an ordered list of provider and model pairs. The gateway calls the first healthy one.
4
A circuit breaker skips sick providers
Three failures in 120 seconds trips a 60 second cooldown, and the executor falls through to the next model automatically.
5
Usage gets recorded
Tokens, cost, latency, and status are logged per app and per provider.
Built for production
Everything the proxy layer should do.
Automatic failover
A circuit breaker watches every provider. Three failures in 120 seconds trips a 60 second cooldown, and the gateway moves to the next model in the chain.
Per-scope rate limits
Requests-per-minute limits at the app, org, and user level, enforced before a single token is spent.
Usage quotas
Monthly token and USD caps per org or user. Go over, and you get a clean quota_exceeded response, not a surprise bill.
Usage metering
Every request gets logged: tokens, cost, latency, and status, broken down by app and by provider.
Provider-agnostic routing
Swap OpenRouter for Bedrock without touching app code. Model chains are configured, not hardcoded.
A clean error contract
invalid_key, rate_limited, quota_exceeded, all_providers_failed: structured JSON, with a Retry-After header when it matters.
Architecture
Everything routes through one place.
Your apps
Web app
Telegram bot
Slack app
mahyar.cloud
API key auth Rate limit and quota check Ordered model chain Circuit breaker