Most teams calling LLMs end up writing the same plumbing again and again: retry and fall back to another provider when one is down, cache repeated questions, stop one API key from burning the monthly budget, and work out what each feature actually costs.
Aether Gateway is my open-source (MIT) answer to that. It's a self-hosted gateway written in Java 25 / Spring Boot, and it speaks the OpenAI API, so adopting it is a one-line change:
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8080/v1", api_key="aeth_try_me")
reply = client.chat.completions.create(
model="claude", # a route alias: Aether decides which provider serves it
messages=[{"role": "user", "content": "Why use an LLM gateway?"}],
)
Try it in one container
docker run -p 8080:8080 -e AETHER_LITE_BOOTSTRAP_API_KEY=aeth_try_me \
ashishvaghelaa/aether-gateway-proxy:lite
curl http://localhost:8080/v1/chat/completions \
-H "Authorization: Bearer aeth_try_me" -H "Content-Type: application/json" \
-d '{"model":"echo","messages":[{"role":"user","content":"hello"}]}'
You get Echo: hello with X-Aether-Cache: MISS. Send it again and you get EXACT_HIT. Lite mode keeps everything in memory, so there's no Postgres, Redis or model download. Add -e ANTHROPIC_API_KEY=... (or an OpenAI or Gemini key) to talk to a real model. For production, the full stack adds durable storage, semantic caching, Grafana dashboards and Kubernetes manifests.
What it does
- Failover: each model alias maps to a chain of providers (OpenAI, Anthropic, Gemini, Groq, Ollama, or anything OpenAI-compatible). Circuit breakers skip a failing provider, and streams fail over too, as long as the first chunk hasn't been sent.
-
Cost on every response:
X-Aether-Cost-USD,X-Aether-ProviderandX-Aether-Failover-Chainheaders tell you who answered and what it cost. Streams are billed at the provider's reported token usage, not an estimate. - Caching: exact-match by default, with semantic caching as an opt-in (more on that below).
- Quotas: per-key rate limits, concurrency caps and monthly token budgets. Tokens are reserved before the call and reconciled afterwards. If Redis fails, requests are rejected rather than let through unmetered.
- Streaming with cancellation: when the client disconnects, the upstream call is cancelled, so nobody pays for tokens no one will read.
- Tool calling and embeddings across providers, translated to each provider's own format.
Measured, not estimated
Every number in the README comes from a committed run you can reproduce with make bench, including the ones that missed their targets:
| Result | |
|---|---|
| Gateway overhead on a cache miss, p95 | 6.24 ms |
| Cache-hit latency, p95 | 8.9 ms |
| Failover to a healthy provider, p99 (100 injected outages) | 67.92 ms |
| Broken streams during real Kubernetes rolling updates | 0 of 1,000 |
| 2,000 concurrent streams on 2 vCPU / 4 GB | 37% failed (target not met) |
The hard part: semantic caching
Semantic caching sounds like free money: if someone asks a question similar to an earlier one, return the earlier answer. The trouble is that "similar" isn't the same as "the same question". A sentence-embedding model sees "Is aspirin safe during pregnancy?" and "Is aspirin not safe during pregnancy?" as near-identical.
On my labelled set of 502 prompts, embedding similarity alone (threshold 0.94) gave a wrong cached answer for 28% of the tricky pairs. Aether adds a cheap guard on top. It needs no network calls and compares numbers, units, dates, named entities, negation and common opposites. With it:
- Wrong answers on the labelled set fell from 28% to 0%. The previous version of the guard reached 8%.
- But that 0% is on pairs I studied while building the guard. On 20 new tricky pairs written afterwards, it catches only 6. Opposites like faster/slower or tenant/landlord still slip through.
So semantic caching ships off by default, the docs say exactly why, and lowering the threshold waits for a proper held-out test set. A cache that's fast but occasionally wrong isn't a cache I'd want in front of real users.
Why the JVM?
Most LLM gateways are Python or TypeScript. That's fine, but plenty of teams run their infrastructure on the JVM and want a gateway they can read, debug, profile and run with the tools they already know. Aether is a hexagonal Spring Boot codebase with its architecture rules enforced by ArchUnit, so it should be approachable to change.
If you need the widest provider coverage today, LiteLLM and Portkey are more mature, and I say so in the README.
What's next, and how you can help
The next items are a typed JVM client / Spring Boot starter and a held-out evaluation set for semantic caching. What would really help:
- Try the one-container quickstart and tell me where it was confusing.
- Tell me what would stop you from putting this in front of production traffic.
If it's useful, a ⭐ on GitHub helps other people find it.
GitHub: https://github.com/Ashish-CodeJourney/aether-gateway
Docs and demo video: https://ashish-codejourney.github.io/aether-gateway/
Benchmarks: https://github.com/Ashish-CodeJourney/aether-gateway/blob/trunk/BENCHMARKS.md


Top comments (2)
Really appreciate how transparent you are about the numbers—especially showing where semantic caching falls short and why you left it off by default. That kind of honesty is rare in launch posts.
Honestly, I think those semantic edge cases will keep slipping through as long as we rely mostly on vector similarity at the gate—not because your guard is weak, but because there's a human on the other side, with their own slang, phrasing, and messy context. Where humans are involved, pure binary rules or similarity thresholds never hit 100%, and a hard "no" usually just makes people ask "why?" and try to reword their way to a "yes."
In real human conversation, when something is ambiguous, we don't guess—we dig into context and ask clarifying questions. For an LLM gateway, I feel like vector matching works much better after the entry layer, whereas right at the front door you actually save more tokens with a smart "bouncer" or secretary that checks intent and asks a quick clarifying question before passing the request on to the model.
Great work on the gateway—dropping a ⭐ on the repo!
Exactly, I believe when publishing a project along with talking about the Pro's and good things we should also talk about cons as well.
Thanks for the ⭐.