ARCHOS 525 BLUEPRINT · /d/dgm_llm-gateway-routing
AI gateway (model routing, fallback, semantic cache and quotas)
13 COMPONENTS · 18 FLOWS · UPDATED 2026-11-20
GITHUB README / PR PREVIEW CARD
[](https://archos.sageideas.dev/d/dgm_llm-gateway-routing) *Interactive architecture diagram powered by [ArchOS Studio](https://archos.sageideas.dev/d/dgm_llm-gateway-routing)*
NOTION / DOCS / CONFLUENCE EMBED
<iframe src="https://archos.sageideas.dev/embed/dgm_llm-gateway-routing" width="100%" height="580" style="border:1px solid rgba(240,236,225,0.14);border-radius:6px;" loading="lazy" title="AI gateway (model routing, fallback, semantic cache and quotas) — Interactive in ArchOS"></iframe>
PORTABLE MERMAID SPEC (GITHUB / NOTION / RFC)
flowchart LR
client_0[("API Client")]
api_1["API gateway"]
pdp_2["Policy decision point (PDP)"]
rl_3[("Rate limiter")]
rcache_4[("Distributed cache")]
ai_5["AI gateway"]
scache_6[("Semantic cache")]
secrets_7[("Secrets manager")]
tsdb_8[("Time-series database (TSDB)")]
alerting_9[("Alerting")]
pa_10["Inference server"]
pb_11["Inference server"]
capacity_12["Capacity Estimate"]
client_0 -->|"1. Calls with JWT · HTTPS"| api_1
api_1 -->|"2. Asks policy (mTLS) · HTTP/2"| pdp_2
pdp_2 -->|"3. Returns allow or deny · HTTP/2"| api_1
api_1 -->|"4. Asks for quota (mTLS) · HTTP/2"| rl_3
rl_3 -->|"5. Returns decision · HTTP/2"| api_1
api_1 -->|"6. Forwards (mTLS) · HTTP/2"| ai_5
ai_5 -->|"7. Looks up answer (mTLS) · HTTP/2"| scache_6
scache_6 -->|"8. Returns hit or miss · HTTP/2"| ai_5
ai_5 -->|"9a. Calls with API key · HTTPS"| pa_10
ai_5 -->|"9b. Falls back with API key · HTTPS"| pb_11
pa_10 -->|"10a. Returns completion · HTTPS"| ai_5
pb_11 -->|"10b. Returns completion · HTTPS"| ai_5
ai_5 -->|"11. Returns answer · HTTP/2"| api_1
api_1 -->|"12. Returns answer or HTTP 429 · HTTPS"| client_0
ai_5 -->|"Fetches API keys · HTTPS"| secrets_7
rl_3 -->|"Runs bucket script · RESP"| rcache_4
ai_5 -->|"Exports (OTLP) · OTLP"| tsdb_8
tsdb_8 -->|"Feeds metrics · HTTP"| alerting_9COMPONENT STACK (12)
- API ClientSTATEFULSends prompts from an untrusted network
- API gatewaySTATELESSChecks the JWT, then asks policy and quota
- Policy decision point (PDP)STATELESSAllows a model per team; denies if unsure
- Rate limiterSTATEFULToken bucket per key; fails open on timeout
- Distributed cacheSTATEFULHolds the bucket counters
- AI gatewaySTATELESSRoutes by rule, fails over, checks cache first
- Semantic cacheSTATEFULReturns a stored answer for a similar prompt
- Secrets managerSTATEFULHolds the provider API keys
- Time-series database (TSDB)STATEFULStores latency, errors, fallbacks, hits
- AlertingSTATEFULPages on-call when errors or fallbacks spike
- Inference serverSTATELESSProvider A: small and large models
- Inference serverSTATELESSProvider B: fallback for the same tasks
REQUEST & DATA FLOW (18)
- API Client → API gateway (Calls with JWT)[HTTPS]
- API gateway → Policy decision point (PDP) (Asks policy (mTLS))[HTTP/2]
- Policy decision point (PDP) → API gateway (Returns allow or deny)[HTTP/2]
- API gateway → Rate limiter (Asks for quota (mTLS))[HTTP/2]
- Rate limiter → API gateway (Returns decision)[HTTP/2]
- API gateway → AI gateway (Forwards (mTLS))[HTTP/2]
- AI gateway → Semantic cache (Looks up answer (mTLS))[HTTP/2]
- Semantic cache → AI gateway (Returns hit or miss)[HTTP/2]
- AI gateway → Inference server (Calls with API key)[HTTPS]
- AI gateway → Inference server (Falls back with API key)[HTTPS]
- Inference server → AI gateway (Returns completion)[HTTPS]
- Inference server → AI gateway (Returns completion)[HTTPS]
- AI gateway → API gateway (Returns answer)[HTTP/2]
- API gateway → API Client (Returns answer or HTTP 429)[HTTPS]