AI platform project 01
One door for every model.
Teams should not each hold their own Bedrock and Azure OpenAI credentials, limits and cost reports. This gateway gives them one endpoint and puts those controls in one place.
The request path
Six stages, each in its own module. Select one to see what it does and why.
Break the primary and watch it fail over
A browser port of the gateway's router, breaker and team limits. Move the outage, change the breaker, or make the primary refuse prompts instead of failing.
240 requests through the router
Each bar is one request, 0.5 s apart. The shaded window is the primary's outage. The band underneath is the primary's circuit breaker. Click a bar, or use the slider, to inspect a request.
primary: 500 → fallback: ok
Breaker after this request: open
Per-team attribution
Every successful request is priced as tokens × that target's price table (illustrative prices, ~30 input and 20 output tokens per request). Failover changes the bill as well as the latency.
| Target | $ / 1K in | $ / 1K out |
|---|---|---|
| Bedrock Claude 3.5 Haiku | 0.0008 | 0.004 |
| Azure OpenAI gpt-4o-mini | 0.00015 | 0.0006 |
Illustrative list prices from the repo config. Check the AWS and Azure pricing pages before using them for real chargeback.
scripts/simulate.py drives the actual Python gateway (auth, limiter, router, breaker, metrics) with mock providers. Its committed output: 161 requests served by Bedrock and 59 by Azure. Only 3 calls reached Bedrock while it was failing. The batch team had 20 of 48 requests throttled. The lab above is a browser port of the same rules. Its team mix is a fixed pattern rather than seeded random, so counts differ slightly.Test me
Questions an interviewer could ask about this design, including numbers from the committed run.
Concept checks, scenario calls and numbers from the real runs. Answer, then read why. Wrong answers can be retried at the end.
Run it yourself
Free and local: pip install -e ".[dev]" && pytest -q (36 tests), python scripts/simulate.py, and docker compose -f deploy/docker-compose.yml up for Prometheus and Grafana. The Terraform for a Bedrock Guardrail, least-privilege IAM, a Bedrock budget, an Azure OpenAI deployment with a custom content filter, and an optional APIM policy is cost-flagged. It is validated but has not been applied.