DEV Community

Cover image for I built an LLM router that hands you a receipt for every request
Developer at Fortitude Omnis Group
Developer at Fortitude Omnis Group

Posted on Originally published at omnisrouter.fortitude-omnis.group

I built an LLM router that hands you a receipt for every request

A router that decides where your money goes is asking for a lot of trust. It sits in front of every request, quietly picks a model, and sends you a bill at the end of the month. If it tells you it saved you 60%, you mostly have to take its word for it.

I did not want to take its word for it. So OmnisRouter attaches a receipt to every response, and the receipt is the whole point.

It is an open source (Apache 2.0), self-hosted proxy that speaks the Anthropic, OpenAI and Gemini formats. You change one base URL, keep your own provider keys, and each request goes to the cheapest model that can actually handle it. The response comes back in your client's own format, with a note explaining what was chosen and what it cost.

The receipt

Every response carries a set of headers:

X-Omnis-Model: gemini/gemini-2.5-flash
X-Omnis-Decision: Routed
X-Omnis-Confidence: 0.26
X-Omnis-Policy: v3-omnisbench-2026-08-20
X-Omnis-Cost-Delta-Vs-Big: -0.0121
Enter fullscreen mode Exit fullscreen mode

And if you want to know what it would do before spending anything, there is a cost-free endpoint that returns the full decision without calling a provider:

curl -s localhost:8080/v1/route -H "authorization: bearer $TOKEN" \
     -d '{"messages":[{"role":"user","content":"Summarize this thread."}]}'
Enter fullscreen mode Exit fullscreen mode
{ "policy_version": "v3-omnisbench-2026-08-20",
  "decision": "ROUTED", "reason": "cheapest_capable",
  "chosen": { "provider": "gemini", "model_id": "gemini-2.5-flash" },
  "est_cost_delta_vs_big_usd": -0.0121 }
Enter fullscreen mode Exit fullscreen mode

No screenshot, no dashboard you have to trust. The decision is in the response, and you can log it.

How it actually decides

There is no network hop to work out where to send a request. A small pinned ONNX model (bge-small-en-v1.5) embeds the prompt in-process, the embedding maps to the nearest intent cluster, and the cluster's policy table picks the cheapest candidate that clears the quality bar for that kind of work. If it is not confident, it escalates to a strong model rather than guessing. The whole thing happens in well under the 50ms I gave it as a budget.

Here is a live trace from the shipped model:

Request Routed to Decision
Summarize this thread gemini-2.5-flash routed (cheap)
Prove sqrt(2) is irrational gpt-5-nano routed (cheap)
Write a Python function to merge two lists gpt-5 routed (strong)
Hello. claude-opus-5 escalated

The maths row is the interesting one. On grade-school maths, the tiny gpt-5-nano is essentially as accurate as the frontier model, so OmnisRouter sends the work there and keeps the roughly 25x price difference. That is not a guess. It comes from measurement.

Where the numbers come from

The routing model is not a black box I am asking you to believe in. The intent clusters and the policy table ship in the repo and rebuild from public data, so the same inputs produce the same model, and every decision is stamped with the policy version that made it.

The coding and maths policy is driven by OmnisBench, a companion benchmark that grades each model per task and publishes every response so you can re-grade it offline. So when the router says "the cheap model is good enough here", that is a number you can go and check, not a line on a slide. Other domains use sensible estimates for now, and the benchmark coverage grows from there.

The honest bit

Cheapest-capable is not the same as cheapest. The point is not to slam everything into the smallest model and hope. It is to spend frontier money only where the work needs it, and to be able to show, per request, why it went where it went. When a capability cannot be carried faithfully to the chosen provider, it refuses with an explicit error instead of silently dropping it. Surprising the first time, correct every time.

It runs as a single self-hosted process with an embedded database, your keys are encrypted at rest, and prompt content only ever leaves your infrastructure to go to the model you chose.

Have a look

If you can make it route something badly, or you think the receipt should carry more than it does, tell me. That is what the open model and the decision log are for.

OmnisRouter is built by Fortitude Omnis. We make small, sharp tools, and we try not to lie in our own marketing.

Top comments (0)