ARCHOS 525 BLUEPRINT · /d/dgm_llm-cost-control
LLM Token Budget, Semantic Cache & Cost Control Architecture
8 COMPONENTS · 7 FLOWS · UPDATED 2026-11-24
GITHUB README / PR PREVIEW CARD
[](https://archos.sageideas.dev/d/dgm_llm-cost-control) *Interactive architecture diagram powered by [ArchOS Studio](https://archos.sageideas.dev/d/dgm_llm-cost-control)*
NOTION / DOCS / CONFLUENCE EMBED
<iframe src="https://archos.sageideas.dev/embed/dgm_llm-cost-control" width="100%" height="580" style="border:1px solid rgba(240,236,225,0.14);border-radius:6px;" loading="lazy" title="LLM Token Budget, Semantic Cache & Cost Control Architecture — Interactive in ArchOS"></iframe>
PORTABLE MERMAID SPEC (GITHUB / NOTION / RFC)
flowchart LR
client_0["Tenant Workload"]
bud_1[("Budget Enforcer")]
sem_2[("Semantic Cache")]
cls_3["Complexity Router"]
sm_4["Fast Small Model"]
lg_5["Frontier Model"]
fin_6[("Cost Attribution Ledger")]
downstream_7["Downstream & OTel"]
client_0 -->|"1. Reserve · RESP3"| bud_1
bud_1 -->|"2a. Check · gRPC"| sem_2
bud_1 -->|"2b. Cache miss · HTTP"| cls_3
cls_3 -->|"3a. Route 80% · HTTPS"| sm_4
cls_3 -->|"3b. Escalate · HTTPS"| lg_5
cls_3 -.->|"3c. Reconcile · Kafka"| fin_6
lg_5 -.->|"4. Emit / · OTLP/API"| downstream_7COMPONENT STACK (8)
- Tenant WorkloadSTATELESSPrompt + Tenant Tier
- Budget EnforcerSTATEFULRedis atomic $ & TPM caps
- Semantic CacheSTATEFULCosine > 0.96 -> 0 token cost
- Complexity RouterSTATELESS80% small model / 20% frontier
- Fast Small ModelSTATELESS8B / Haiku / Flash
- Frontier ModelSTATELESSComplex reasoning only
- Cost Attribution LedgerSTATEFULPer-tenant $/feature telemetry
- Downstream & OTelSTATELESSConsumers, metrics & SLOs
REQUEST & DATA FLOW (7)
- Tenant Workload → Budget Enforcer (Reserve)[RESP3]
- Budget Enforcer → Semantic Cache (Check)[gRPC]
- Budget Enforcer → Complexity Router (Cache miss)[HTTP]
- Complexity Router → Fast Small Model (Route 80%)[HTTPS]
- Complexity Router → Frontier Model (Escalate)[HTTPS]
- Complexity Router → Cost Attribution Ledger (Reconcile)[Kafka]
- Frontier Model → Downstream & OTel (Emit /)[OTLP/API]