Deploy OmniRoute v3.8 Self-Hosted AI Gateway
One OpenAI-compatible endpoint for your own AI keys, with fallback.
OmniRoute
Just deployed
Deploy and Host OmniRoute with Railway
OmniRoute is an open-source AI gateway: one OpenAI-compatible endpoint in front of the AI providers you already use, with routing, automatic fallback, usage tracking and a web dashboard. This template runs OmniRoute 3.8.53 on Railway with a generated dashboard password, a generated API key and a persistent volume.
About Hosting OmniRoute
OmniRoute stores your provider keys and OAuth tokens, so a public instance must be locked down. This community template pins the official OmniRoute 3.8.53 image by digest and starts it behind a small wrapper. The dashboard needs a password generated at deploy, and every /v1 request needs an API key. Provider credentials are encrypted in SQLite on a Railway volume, so they survive redeploys. The wrapper checks every variable: a wrong value falls back to a safe default instead of failing the deploy, and an unusable password locks the login instead of leaving it open. Keyless third-party endpoints are blocked by default.
Common Use Cases
- One endpoint and one key for Claude Code, Codex, Cursor, Cline, OpenCode and other OpenAI-compatible tools, in front of your own provider accounts
- Fallback between your providers and keys when one hits a rate limit or goes down, with per-key budgets and usage logs
- A shared gateway for a team: separate API keys per person or app, while provider keys stay on the server
- A private model endpoint for your other Railway services over the private network
Dependencies for OmniRoute Hosting
- OmniRoute 3.8.53, the official
diegosouzapw/omnirouteimage, pinned by digest (included) - A Railway volume at
/app/datafor the SQLite database and generated secrets (included) - Accounts or API keys with the AI providers you want to route to (yours to add)
Deployment Dependencies
- OmniRoute source and docs: https://github.com/cheaper-inference/OmniRoute
- OmniRoute environment reference: https://github.com/cheaper-inference/OmniRoute/blob/v3.8.53/.env.example
- Railway volumes: https://docs.railway.com/reference/volumes
- Railway private networking: https://docs.railway.com/guides/private-networking
- Railway Fair Use Policy: https://railway.com/legal/fair-use
Implementation Details
| Service | Source | Purpose |
|---|---|---|
| OmniRoute | Dockerfile in services/omniroute: diegosouzapw/omniroute:3.8.53@sha256:b52a1766… plus a start-up wrapper | Dashboard and /v1 API on PORT 20128 (public domain, /healthz healthcheck); data on the volume at /app/data |
First login. Open the public domain and sign in with OMNIROUTE_PASSWORD from the service's Variables tab. Then connect your providers under Providers (API keys or OAuth sign-in for accounts you hold) and try a model in the Playground.
Connect your tools. Use OMNIROUTE_ENDPOINT (https://{your-domain}/v1) as the OpenAI base URL and OMNIROUTE_API_KEY as the key:
curl https://{your-domain}/v1/chat/completions \
-H "Authorization: Bearer $OMNIROUTE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "{provider}/{model}", "messages": [{"role": "user", "content": "Hello"}]}'
GET /v1/models lists the models your connected providers offer. The dashboard's CLI Tools page writes ready-made settings for Claude Code, Codex and other agents. Other services in this project can reference ${{OmniRoute.OMNIROUTE_ENDPOINT_PRIVATE}}, which stays on the private network.
Authentication.
- Dashboard and management API: the password, with brute-force protection.
/v1: an API key:OMNIROUTE_API_KEYor keys you create in the dashboard, each with its own limits.- Password changes: change it in the dashboard, or change
OMNIROUTE_PASSWORDand redeploy to reset it (useful if you forget it). A dashboard change stays until the variable changes. - Variable checks: a password shorter than 8 characters, longer than 200 or empty locks the login with a random one; the log says how to fix it. An API key shorter than 24 characters is ignored, so
/v1then accepts only dashboard keys. - Always on: dashboard login and the API key requirement stay on, because the domain is public. Switching either off is ignored or undone at the next start.
Your accounts only. The template blocks providers that need no account of yours (anonymous endpoints such as web chat front-ends) and turns off anonymous fallback for gateways that offer it, so routes use only the accounts and keys you connect. Set OMNIROUTE_BLOCK_KEYLESS_PROVIDERS=false to manage that list yourself under Settings.
Memory and plans. The wrapper sizes the Node heap from the service's memory limit (OMNIROUTE_MEMORY_MB overrides it). Measured on Railway: about 0.35-0.41 GB idle and up to 0.51 GB with the dashboard open and 400 API requests. Under a 0.5 GB limit (Free plan) it ran at 0.35-0.39 GB idle and peaked at 0.44 GB with 1,000 API requests, without a restart. So every plan works, including Free for personal use. For a team, coding agents or large fan-out combos use Trial (1 GB) or Hobby and more memory. Keep PORT at 20128: the public domain points there.
Scaling. Keep one replica: the SQLite database lives on the volume, and a volume belongs to one service. For more throughput give the service more CPU and memory. Streaming responses count as egress.
Backups. OmniRoute keeps SQLite backups in /app/data/db_backups. Use the dashboard's backup export, or Railway volume backups, before upgrades.
Pinning and upgrades. The OmniRoute version and digest are in the FROM line of services/omniroute/Dockerfile. To upgrade, change both to a newer release from Docker Hub, read the release notes, back up, and redeploy. Database migrations run on start.
Provider terms and fair use. Connect only accounts and API keys you are entitled to use, and use each one within its provider's terms, including limits on sharing an account or using a consumer subscription through other tools. OmniRoute's fallback is for reliability across your own providers. Do not use it to get around providers' usage limits, and do not run it as a public proxy or anonymization service: Railway's Fair Use Policy forbids both. This is a community template, not affiliated with OmniRoute or any AI provider.
Why Deploy OmniRoute on Railway?
Railway gives OmniRoute an HTTPS domain, a persistent volume and private networking to your other services, with nothing to administer. You get your own AI gateway with authentication on from the first minute, and you pay only for the small amount of memory and CPU it uses.
Template Content
OmniRoute
baranberkay96/omniroute-railway
