Keep AI features up, fast and on budget.
LLM Gateway sits between your apps and model providers. Apps change one base URL; the gateway routes, retries, fails over, caches and enforces budgets.
One request, four steps.
The app keeps using the OpenAI SDK. Everything else happens in the gateway.
Change one line
Point the OpenAI SDK at the gateway's base URL and use a gateway key. The request shape does not change.
The key is checked
Rate limits, the monthly budget and guardrail hooks run before any model is called. A refusal costs nothing.
The alias is routed
The cache answers if it can. Otherwise the route policy picks a target, with retries, circuit breakers and fallback.
Everything is recorded
Each request gets a cost, a trace with time to first token, and counts toward its key's spend.
The parts every team ends up building.
Keys, routing, resilience, caching, guardrails and cost tracking, in one place instead of in every app.
Virtual keys
One key per app, with allowed aliases, requests and tokens per minute, and a monthly budget in dollars.
Routing by alias
Apps ask for smart, fast or local. Priority, weighted A/B, cheapest healthy or lowest p95 decides who serves it.
Retries and fallback
Jittered backoff, per-target circuit breakers and failover to the next target before the first token is streamed.
Exact and semantic cache
Repeated and reworded questions are answered from a per-key cache, with a similarity threshold you can tune.
Guardrail hooks
Model allow-lists, max token caps, PII redaction and an HTTP hook to your own policy service.
Cost and traces
Cost per request, key, model and day, and a waterfall trace for every request in the log.
How the full system is designed.
The demo on this page runs on simulated data in your browser. This is the design it represents.
Fail over only before the first token
If a provider fails before streaming starts, the gateway retries and moves to the next target. Once tokens are flowing it ends the stream with an error event instead of splicing two models' answers.
Breaker state is shared
Circuit breakers live in Redis, so every gateway replica skips a failing provider at the same moment, and probes are not repeated by each pod.
Budgets are checked twice
Before the call the gateway reserves the worst-case cost from max_tokens; after the call it settles the real cost. A key cannot overspend by racing requests.
The cache is per key
Cache entries are scoped to the key that created them, so one app never receives an answer written for another.
Plain answers.
Is this a real product?
It is a portfolio project. The gateway is designed in full, but this site is a static front end with an animated walkthrough and a read-only workspace. All numbers, keys and requests are simulated.
Can I sign up or use it with my own keys?
No. Sign-ups and sign-ins are closed and there is no backend. Nothing you do in the workspace is sent anywhere or saved; reloading the page resets it.
What does it cost to run?
Nothing. The site is a set of static files on free hosting. It makes no model calls and has no servers, databases or analytics.
Are the charts and savings real measurements?
No. They come from seeded fixtures that are kept consistent with each other (the request log, totals and breaker history agree), and anything that looks like a result is labelled Simulated.
Where is the code?
The code for this demo, including the fixtures and their tests, is public at github.com/tiju07/llm-gateway.
Who built it?
Tiju Lukose. The About me link has more projects and contact details.
Built by Tiju Lukose
I design and build infrastructure for AI products. See my other projects and how to reach me.