Writing
What Is OmniRoute? Setting Up AI Model Routing with Hermes Agent on a Hostinger VPS
An exploratory guide to routing requests from Hermes through OmniRoute, including the path a request takes and when a router adds overhead.
By Ka Lun Chan · The lab · Learning / AI / Architecture
What OmniRoute is
This research note looks at using a model gateway in front of Hermes. The remote setup guide covers the host, and the job-search design supplies a workload to reason about.
OmniRoute is an open-source, MIT-licensed AI gateway you run yourself. It exposes one OpenAI-compatible endpoint, and behind it you connect the providers you have accounts with: Anthropic, OpenAI, Google, OpenRouter, free tiers, local models. Your application sends every request to the gateway, which picks a provider and model by the name you asked for or by a routing policy, retries and falls back when a provider fails or a quota runs out, and records usage, cost and latency in a dashboard.
The point of a model router is that your application talks to one address with one key. Calling Anthropic, OpenAI and Google directly means three SDKs or three request formats, three keys in three places, three places to look when something fails, and a code change when you want to move a workload from one to another. A router collapses that to one. OmniRoute speaks the OpenAI chat-completions protocol, which almost every agent framework already supports, so the application usually needs nothing more than a base URL and a key.
The project’s documentation describes an OpenAI-compatible /v1 endpoint, provider configuration and a dashboard. Confirm the installed version’s interface before using the settings below.
A gateway routes model requests. The application still decides whether a particular step needs a stronger model or can tolerate fallback.
Why put a router in front of an agent
Hermes and OmniRoute do different jobs. Hermes is the agent runtime: it holds the conversation, keeps memory, runs tools, talks to Telegram, schedules jobs with its cron, and loads skills. OmniRoute is the model gateway: it holds provider credentials, chooses a model and provider for each request, handles retries and fallback, and keeps the ledger. Hermes already supports many providers directly, including Anthropic through an API key or a Claude Code login, so the router is not required to make the agent work.
Separating the two is useful when the model choice is a thing you expect to change. Switching the agent from one provider to another becomes a dashboard change rather than a config edit and restart. A provider outage or an exhausted quota becomes a fallback instead of a failed cron run at three in the morning. Several agents, or several jobs within one agent, can share one set of credentials and one cost report. And the credentials live in one hardened place instead of inside every container that needs them.
One agent using one provider can connect directly. A gateway becomes easier to justify when centralized spend tracking or fallback solves a real problem.
Two architectures, side by side
- MacBook to Hermes Agent
- Hermes Agent to Anthropic API
What you gain
- One container, one key, one bill
- Nothing between the agent and the model to fail or secure
- Hermes native provider features, including Anthropic OAuth
What it costs you
- Changing provider means changing Hermes config
- No fallback when the provider or the quota is down
- Cost visibility is whatever the provider’s console shows
- MacBook to Hermes Agent
- Hermes Agent to OmniRoute
- OmniRoute to Anthropic
- OmniRoute to OpenAI
- OmniRoute to Google Gemini
- OmniRoute to Others
What you gain
- One endpoint, many providers, swapped in a dashboard
- Quota-aware fallback and retries when a provider fails
- Usage, cost and latency in one place, per key
What it costs you
- A second container to run, update, back up and secure
- A second place to store API keys
- Added hop on every request, and a new failure domain
Both diagrams start from the same laptop and the same VPS. The difference is one box, and every item in the second list is the price of that box. If the left list does not hurt yet, the right list is not worth paying for yet.
Step by step on the VPS
This is a documentation-based setup example. An end-to-end request and its recorded usage are the evidence needed to confirm an actual installation.
1. Connect and look around. From the laptop, ssh hermes, or open the remote window in VS Code. Then see what is running and where Hermes keeps its state.
docker ps
docker inspect HERMES_CONTAINER --format '{{json .Mounts}}'The mounts matter because Hermes's configuration file is what you will edit, and it has to be on a volume or the change disappears when the container is recreated. The previous post covers finding the container and its volumes in detail.
2. Verify the image. The official image is diegosouzapw/omniroute on Docker Hub, published by the project that lives at github.com/diegosouzapw/OmniRoute. Several forks mirror the README under other names; use the upstream one, and check the README's install section for the current command before running mine.
3. Create a shared network. This is the step that makes the rest work. Inside a container, localhost means that container, so Hermes cannot reach a gateway bound to the host's loopback address. Two containers on the same user-defined Docker network can reach each other by container name, with no host port involved.
docker network create ai
docker network connect ai HERMES_CONTAINER4. Run OmniRoute. The example uses a loopback dashboard binding and a named data volume. The services need a shared network if Hermes will call the gateway by container name.
docker run -d --name omniroute --restart unless-stopped --stop-timeout 40 \
--network ai \
-p 127.0.0.1:20128:20128 \
-v omniroute-data:/app/data \
-e OMNIROUTE_MEMORY_MB=3072 \
diegosouzapw/omniroute:latest
docker logs -f omniroute # wait for it to finish starting5. Open the dashboard from your laptop. It is bound to the VPS's loopback, so tunnel it over SSH rather than exposing it.
ssh -L 20128:127.0.0.1:20128 hermes
# then open http://localhost:20128 in a browser on the laptop6. Add providers and get the gateway key. In the dashboard, open Providers, choose a provider and paste its API key or complete its sign-in flow. Then open Endpoints and copy the OmniRoute key. That key is what Hermes will send; the provider keys stay inside OmniRoute, encrypted on its data volume. Nothing in this step belongs in a file you commit or a screenshot you post.
7. Test the gateway from the VPS. First from the host, then from inside the Hermes container, because those are two different networks.
# from the host, over the published loopback port
curl -s http://127.0.0.1:20128/v1/models -H "Authorization: Bearer $OMNIROUTE_KEY" | head -c 400
# from inside the Hermes container, over the shared network
docker exec -it HERMES_CONTAINER sh -c \
'curl -s http://omniroute:20128/v1/models -H "Authorization: Bearer $OMNIROUTE_KEY" | head -c 400'If the second one fails and the first works, the containers are not on the same network, or the API is on a different port than the dashboard in your version. The self-host compose file, for example, puts the API on 20129 and the dashboard on 20128; the single-container README command uses 20128 for both. Check which you are running before changing anything in Hermes.
8. Point Hermes at it. Hermes treats any OpenAI-compatible server as a custom endpoint. Inside the container, run the interactive picker and choose the custom endpoint option, or edit the config directly. The base URL is the container name on the shared network, ending in /v1. Put the key in the env file through key_env rather than inline.
hermes config set OMNIROUTE_API_KEY omr_... # written to ~/.hermes/.env
hermes config editmodel:
provider: custom
base_url: http://omniroute:20128/v1
key_env: OMNIROUTE_API_KEY
default: auto/coding # or a specific provider/model name OmniRoute exposeshermes config check
hermes chat # ask something small and watch the OmniRoute dashboard register it9. Verify end to end. Check that a harmless test request appears in Hermes’s logs and in the OmniRoute dashboard. Compare the provider and usage shown on both sides.
10. Make it survive a rebuild. OmniRoute's state is in the omniroute-data volume. Hermes's config is in its own volume if the template mounted one, which step 1 told you. The network connection to the Hermes container does not survive if the container is recreated by a template update, so after any Hermes update, run the docker network connect command again, or recreate the container with --network ai. Write that down; it is the kind of thing that fails silently a month later.
How a request travels
TelegramThe user sends a message to the bot.
HermesThe gateway receives it and loads the session, memory and any skill the task needs.
HermesThe agent decides the next action: answer, call a tool, or ask the model.
HermesIt sends a chat completion request to its configured endpoint, which is now OmniRoute’s /v1.
OmniRouteThe router picks a provider and model according to the requested model name, direct or an auto alias or a combo, and applies its fallback rules if the first choice fails.
ProviderAnthropic, OpenAI, Google or whoever was chosen generates the response.
HermesIt reads the response, runs any tool call the model asked for, and loops until the task is done.
TelegramThe result appears in Telegram.
The distinction the sequence makes visible is between routing a model request and orchestrating an agent. OmniRoute owns one step: given a chat-completion request, choose a provider and model and get a response back, retrying if it must. Hermes owns the loop around it: what to ask, which tools to run on the answer, what to remember, when to stop, and how to report. A router makes step five cheaper, more reliable or more flexible. It does nothing for steps two through four and six through eight, which is where most of an agent's quality comes from.
Costs, performance and security
The gateway software and the model provider are separate costs. Check provider terms, usage limits and the account charged before relying on free tiers or subscription-based access.
Model fallback can change tool behavior or response quality. Pin a model for steps that need predictable behavior and evaluate any fallback on representative inputs.
Security. You now have two containers holding secrets: Hermes with the gateway key, OmniRoute with every provider key. The gateway's port stays bound to loopback and the dashboard is reached through an SSH tunnel; the self-host compose file ships with API-key enforcement off and says explicitly not to bind to all interfaces until it is on. Trust the image you run: pull the upstream image, pin a version once you are happy, and read the release notes before upgrading. Keep OmniRoute's data volume in your backups, because the encrypted keys and the usage history are in it. And remember that every prompt now passes through one more process that logs it: if the agent will handle anything sensitive, decide what the gateway retains and for how long, and which providers are allowed to see it at all. The habits are the ones from network security: least privilege, nothing exposed by default, and know where the keys are.
A gateway adds another service to patch and monitor, plus credential and backup responsibilities.
A proposed job search agent
A proposed job-search workflow has several steps with different requirements: extraction, scoring, drafting and a daily summary.
Extraction is a smaller structured task. Scoring and gap analysis need consistency. Drafts still need review before anyone relies on them.
The application chooses a model name or alias for each step. The gateway can route within that policy and apply a configured fallback.
Do you really need an AI model router?
A gateway can justify its cost when multiple providers, fallback or centralized spend visibility are real requirements. See the operating cost of adding another component.
Vendor lock-in is the argument people reach for first, and it is weaker than it sounds for agents: the OpenAI-compatible protocol is already the common language, and Hermes itself can switch providers. The stronger arguments are reliability, where fallback is hard to build well inside every application, and observability, where one ledger of usage and cost per key is worth a lot once more than one job is spending money. Against those sit the new security boundary and the operational overhead, which are real and permanent.
For a single-provider learning exercise, the point of a gateway is to study how routing works and what it adds to operations.
Short answers
What is OmniRoute?
OmniRoute is an open-source, MIT-licensed AI gateway you run yourself. It exposes one OpenAI-compatible endpoint on port 20128 and routes each request to a provider and model you have connected in its dashboard, with quota-aware fallback, retries, usage and cost tracking, and per-key spend limits. Provider keys are stored encrypted on its data volume.
How does Hermes Agent connect to OmniRoute?
As a custom OpenAI-compatible endpoint: in Hermes’s config.yaml set model.provider to custom, model.base_url to the OmniRoute address ending in /v1, and the gateway key through key_env so it lives in the .env file. When both run in Docker on one host, put them on a shared Docker network and use the container name as the host, because localhost inside a container means that container.
When does an agent need an AI model router?
Not if the agent calls one provider and will for the foreseeable future; the router then adds a container, a second key store and a failure domain without hiding anything that varies. It earns its place when you use several providers, want fallback when one fails, or need one ledger of usage and cost across jobs.
What is the difference between routing a model request and orchestrating an agent?
The router owns one step: given a chat-completion request, pick a provider and model and return a response, retrying on failure. The agent runtime owns the loop around it: what to ask, which tools to run on the answer, what to remember, when to stop and how to report. Most of an agent’s quality comes from the loop, not the routing.
Deciding whether to run a model router
A model router gives an agent one endpoint, many providers, fallback and a cost ledger, and in return it asks to be run, secured, updated and backed up like any other infrastructure.
Add it when the model choice varies or you need fallback and visibility; until then, connect the agent directly.
Next in the series: the first end-to-end run, Telegram to Hermes to OmniRoute to a provider, and what it cost.