Multi-provider cost waste
Static gateways leave 30–50% of cost savings on the table.
WARDEN is a self-hosted multi-tenant LLM gateway. Adaptive routing across providers, multi-agent prompt-injection defense, semantic caching, and a closed-loop cost optimizer — so your platform team owns the inference layer instead of renting it.
Problem
Static gateways leave 30–50% of cost savings on the table.
Single-model classifiers miss; monolithic guardrails are too slow.
Routing rules drift. Nobody re-tunes. Until now.
How it works
Every request runs the same path. Defense lands before cache so blocked prompts never serve a cached response. Cache lands before routing so hits never burn an LLM call.
Benchmarks
Every figure on this page corresponds to a named test you can run from a fresh clone. No marketing-grade hand-waving.
0.833 recall · 0.909 F1 · p99 1ms
PromptInjectionBench · 30 injection + 30 benign prompts
Synthetic 24h workload · 4.5× over the 20% bar
End-to-end replay test against a seeded workload
10k-prompt corpus · 10× under the 30ms budget
SemanticCacheMicrobench · 10k-row corpus
Quickstart
One interactive script for local exploration, one for production multi-instance deploy. No long config files either way.
Interactive setup. Defaults to Ollama for everything — zero API keys, zero cloud bill.
$0 / month# 1) Clone and enter the repo
git clone https://github.com/Abhishek-Aditya-bs/Warden.git
cd Warden
# 2) One command — interactive Q&A then it starts everything
./start.sh
# 3) In another terminal, drive traffic so dashboards populate
./load.sh allStuck? Both scripts have a ./start.sh stop equivalent — clean teardown in one command.
Paper
A tech report — not a novel-algorithm paper. The contribution is the integrated system design: how to compose a defense cascade, a semantic cache, an adaptive router, and a closed-loop optimizer into one self-hostable artifact, with honest precision / recall / latency numbers across cost-tier profiles.
On a 100-prompt corpus seeded with adversarial-benign and obfuscated prompts, the regex classifier alone falls to P=0.909, R=0.600. Routing the residual through current LLMs (claude-haiku-4.5, gpt-5.4-mini, gemini-3.5-flash, claude-sonnet-4.6) recovers recall to 1.000 for cents; full LLM adjudication lifts precision to 1.000. The whole sweep cost ~$1.3.
What's inside
Each piece is independently testable and independently optional. Bring up only what you need — the rest stays off until you turn it on.
Drop-in /v1/chat/completions. SSE streaming, OTel traceparent.
Anthropic, OpenAI, Ollama, Mistral, Bedrock — config-only swap.
YAML policy DSL, live-reload, per-provider circuit breakers.
pgvector HNSW with a Caffeine exact-match fast path.
Classifier → critic → judge. Runs before cache.
Lua-atomic Redis token bucket, Postgres-backed tenants, admin CRUD.
Prometheus, OpenTelemetry, LangSmith, Grafana dashboards.
LangGraph sidecar that opens routing-policy PRs nightly.
Next.js 15. Polls /actuator/prometheus and the admin API.
Toxiproxy provider outages, k6 mixed-workload scenarios.