
Deploy 9Router — Self-Hosted OpenRouter Alternative
Zero-markup OpenRouter alternative — self-host 60+ LLM providers
9Router
Just deployed
/app/data
Deploy and Host 9Router on Railway
9Router is a self-hosted, open-source OpenRouter alternative — one OpenAI-compatible endpoint in front of 60+ LLM providers, with zero markup on your usage and no third-party cloud in the request path. It's the middle ground the LLM-gateway market is missing: the zero-fee, bring-your-own-keys model of a self-hosted proxy like LiteLLM, but with a one-click deploy and a management dashboard instead of an ops project. Point Claude Code, Cursor, Codex, or any OpenAI-compatible tool at one URL and route across providers with automatic fallback.
What This Template Deploys
| Service | Purpose |
|---|---|
| 9Router | Routing proxy, web dashboard, and OpenAI-compatible API on port 20128 |
A single service — no Postgres, no Redis to operate. 9Router stores configuration and usage data in SQLite on a persistent volume at /app/data, so the whole gateway is one container rather than the multi-service stack self-hosted proxies usually require.
About Hosting
If you're moving off OpenRouter, you're weighing two options, and each has a catch this template is built to sidestep.
OpenRouter is managed and simple, but you pay for it — and route through it. Every credit purchase carries a platform fee (around 5.5%), bring-your-own-key still costs roughly 5% past the free cap, and every request passes through a third-party cloud you can't self-host, which is a hard stop for data-residency and compliance work. At $1,000/month of API spend that's $55/month in fees alone; at $5,000 it's $250 — pure routing overhead.
LiteLLM is the usual self-hosted answer, but you become the platform team. It's a bare proxy: you deploy and patch it, run its Postgres and Redis, and own uptime — a production setup commonly runs a few hundred dollars a month in infrastructure plus your time.
9Router sits between the two. It's self-hosted so there's zero markup — you bring your own provider keys and pay providers directly — and your requests never leave your infrastructure, which satisfies data residency. But it deploys in one click with SQLite instead of a Postgres-plus-Redis stack, and it ships a dashboard for keys, routing tiers, and usage rather than a config file you hand-edit. Zero-fee like LiteLLM, near-zero-ops like a managed gateway.
Because Railway assigns a public HTTPS domain, treat the instance as a credential store: it holds every provider key you connect, so set a strong dashboard password before adding any.
Typical cost: ~$5/month on Railway for the single container — versus OpenRouter's percentage fees or LiteLLM's multi-service infrastructure bill. 9Router is MIT-licensed; you pay providers directly.
How It Compares
| 9Router (self-hosted) | OpenRouter | LiteLLM (self-hosted) | Portkey | |
|---|---|---|---|---|
| Markup on usage | None (BYOK) | ~5–5.5% fee | None (BYOK) | Usage-based |
| Request path | Your infra | Their cloud | Your infra | Their cloud / OSS |
| Setup | One-click + dashboard | Instant, managed | Deploy + Postgres + Redis | Managed / self-host |
| Ops burden | Minimal (single container) | None | You run the platform | Low (managed) |
| Data residency | Full | No | Full | Depends |
| Free-tier routing | Yes | No | Manual | No |
OpenRouter wins on instant setup and model breadth if you accept the fee and the shared cloud. LiteLLM wins on raw configurability if you have DevOps capacity to run it. 9Router's niche is the gap between them — self-hosted and zero-markup, but deployable in one click with a dashboard, aimed at individuals and small teams who want OpenRouter's convenience without its fees or LiteLLM's operational weight.
Deploy in Under 5 Minutes
- Click Deploy on Railway and wait for the build (~2 minutes)
- Set a strong dashboard password before the service is publicly reachable
- Confirm the volume is mounted at
/app/dataso config and usage history persist - Open your Railway domain, log in, and add your provider API keys across the routing tiers
- Point your tool or app at
https://your-domain/v1instead of OpenRouter's endpoint
Migration is a base-URL change — any OpenAI-compatible client or SDK works with one line.
Common Use Cases
- Drop the OpenRouter fee — self-host the same one-endpoint, many-provider model with zero markup and pay providers directly
- Skip LiteLLM's ops stack — get a self-hosted gateway without running Postgres, Redis, and patch cycles
- Data-residency compliance — keep every request on your own infrastructure, never through a third-party gateway cloud
- One endpoint for coding tools — route Claude Code, Cursor, Codex, and Copilot through a single URL with fallback
- Never hit a rate limit mid-session — automatic failover to the next available provider when one returns 429
- Unified usage visibility — per-model cost, tokens, and latency across every provider in one dashboard
Configuration
| Variable | Required | Description |
|---|---|---|
JWT_SECRET | Required | Signs dashboard and API tokens — use a long random value, never a default |
DASHBOARD_PASSWORD | Required | Login for the web dashboard — use a strong, unique value |
PORT | Pre-set | 20128 |
DATA_DIR | Pre-set | /app/data — must point at the mounted volume |
HOST | Pre-set | 0.0.0.0 so Railway can route to the service |
LOG_LEVEL | Optional | info in production, debug for troubleshooting |
Set authentication before you connect providers. On a public Railway domain, a weak or default dashboard password exposes every provider key stored on the instance. Set a strong
JWT_SECRETandDASHBOARD_PASSWORDfirst.
The volume at
/app/dataholds everything. Provider keys, routing tiers, and usage history live in SQLite there. Without it, a redeploy resets the gateway to a blank state.
Dependencies for 9Router Hosting
- Railway account — Hobby plan (~$5/month) runs the single service
- A persistent Railway volume mounted at
/app/data(included) - Your own API keys for the providers you want to route to
- Optional: nothing else — no database or cache service to run
Deployment Dependencies
Implementation Details
The template runs the official decocua/9router image on port 20128 with a Railway volume at /app/data. Unlike self-hosted proxies that require a separate Postgres and Redis, 9Router keeps configuration and usage analytics in SQLite inside that directory, so a single volume covers the full application state and there is no additional infrastructure to run — the reason it deploys in one click rather than as a platform project.
The router exposes an OpenAI-compatible API at /v1, so switching from OpenRouter or any OpenAI-format endpoint is a base-URL change with no code rewrite. Requests are matched against a tiered provider configuration and retried against the next available model when one is rate-limited or unavailable, giving failover comparable to a managed gateway while keeping every request on your infrastructure.
Because Railway assigns a public HTTPS domain, JWT and dashboard authentication are required rather than optional. For OAuth-based providers, callback URLs must point at your Railway domain rather than localhost; API-key providers need no extra setup.
Frequently Asked Questions
How is this different from OpenRouter? OpenRouter is a managed gateway that adds a platform fee (~5–5.5%) and routes every request through its own cloud. 9Router is self-hosted with zero markup — you bring your own keys, pay providers directly, and requests never leave your infrastructure.
How is this different from LiteLLM? LiteLLM is a bare self-hosted proxy that you deploy, patch, and run alongside Postgres and Redis. 9Router is also self-hosted and zero-markup, but deploys in one click with SQLite and ships a dashboard, so you skip the platform-team operational burden.
How do I migrate my code? Change the base URL to https://your-domain/v1. Any OpenAI-compatible client, SDK, or tool (Claude Code, Cursor, Codex) works with that single change — no rewrite.
Is it safe to run publicly? Only with strong authentication. The instance stores every provider credential you connect, so set a long JWT_SECRET and a strong dashboard password before adding keys. Treat it as a credential store.
Does 9Router see my prompts? No. Self-hosted, requests go only to the providers you configure — nothing routes through 9Router's own servers unless you explicitly enable cloud sync.
What's the real cost difference versus OpenRouter? OpenRouter charges a percentage on usage; at $1,000/month that's ~$55/month in fees. 9Router is a flat ~$5/month of Railway infrastructure plus what you already pay providers — the crossover favors self-hosting quickly.
Does my configuration survive a redeploy? Yes, on the /app/data volume. Provider setup, routing tiers, and usage history persist there across redeploys.
Why Deploy 9Router on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying 9Router on Railway you get an OpenRouter alternative that removes the fee without adding LiteLLM's ops burden — a self-hosted, zero-markup gateway in one click, with a dashboard, automatic fallback across 60+ providers, and a persistent volume for your config. The convenience of a managed router, the economics of self-hosting, on infrastructure you own.
Template Content
9Router
decolua/9router:latestINITIAL_PASSWORD
