---
title: "Deploy 9Router Docker"
description: "Pinned 9Router Docker image with a persistent volume"
category: "AI/ML"
url: https://railway.com/deploy/deploy-9router-docker-image
---

# Deploy 9Router Docker

Pinned 9Router Docker image with a persistent volume

**[Deploy 9Router Docker on Railway](https://railway.com/template/deploy-9router-docker-image)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/deploy-9router-docker-image/manifest.json

- **Creator:** onepush
- **Category:** AI/ML

## Template content

### 9router

- **Image:** decolua/9router:0.5.95@sha256:4316fefb95ea642d57db885d906b1227b1768b15ac5def314621fd781da7b3f1
- **Health check:** /api/health
- **Public domain:** Yes

## Documentation

# Deploy and Host self hosted 9Router Docker (Open-Source AI Router) on Railway

This template runs the official decolua/9router image (tag 0.5.95, pinned by digest) as one Railway service. For people who want the 9Router Docker image without managing TLS, volumes, or restart policies on a VPS.

## About Hosting 9Router Docker open-source software on Railway (self hosted 9Router Docker template)

This template runs the exact decolua/9router image you would pull locally, pinned to tag 0.5.95 by digest so a redeploy never silently changes versions. Railway removes the VPS chores: TLS, reverse proxy, restart policy and host patching.

## Why Deploy 9Router Docker, the OpenRouter alternative on Railway (Railway Free Trial)

OpenRouter adds a fee when you buy credits, and you don't control the routing. The $5 Railway trial covers a modest one-user instance.

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 Docker on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

### Railway vs Other Hosting Providers and VPS for 9Router Docker self hosting

Railway turns the docker run command into a managed service, while a VPS provider gives you raw infrastructure you still have to secure and patch.

| Provider | What You Get with Railway | What You Get with the Other Provider |
| --- | --- | --- |
| DigitalOcean | One pinned image, HTTPS domain, persistent volume, health check, env vars | A Droplet where you run Docker, set up TLS, a reverse proxy, backups, and monitoring yourself |
| AWS | Same managed service: deploy the decolua/9router:0.5.95 digest, Railway handles port 20128 and /app/data | EC2 or ECS where you manage networking, load balancer certs, persistent storage, and patching |
| Hetzner | Same one-click service with automatic redeploys and SQLite volume | A cheap VPS with Docker installed, but you own renewing certificates, restart policies, and data recovery |

## Common Use Cases for hosted 9Router Docker

- **Home server rescue:** Move a docker compose 9Router install off a home server to Railway, so the router stays up without your ISP, power, or port forwarding.
- **One HTTPS endpoint for tools:** Point Claude Code, Codex, Cursor, and Cline at the Railway /v1 endpoint and let the container translate formats across 40+ providers.
- **Pinned upgrades with rollback:** Keep the 0.5.95 digest until you are ready, then change the tag and redeploy, with a fresh SQLite backup in hand.
- **SQLite volume backups:** The /app/data volume holds providers, combos, keys, and usage history, so you can copy db/data.sqlite off Railway on a schedule.
- **Team router with keys:** Set REQUIRE_API_KEY=true so teammates use their own API keys instead of sharing provider credentials.

## Dependencies for 9Router Docker Docker hosted on Railway

This template runs the official decolua/9router image, tag 0.5.95, pinned by digest, as one Railway service. The health check hits /api/health; Railway's restart policy replaces restart=always.

### Deployment Dependencies for Managed 9Router Docker Service (AI Router)

Needs a Railway volume on /app/data, port 20128 via the public domain, and health check /api/health.

### Implementation Details for 9Router Docker (Using 9Router official docker image)

Pinned digest references decolua/9router:0.5.95. The volume holds SQLite at db/data.sqlite and backups in db/backups. Upgrades: change tag and digest, redeploy after backing up. One replica only due to SQLite.

## How does 9Router Docker compare against other AI gateway platforms

### 9Router vs OpenRouter (OpenRouter Alternative)

- **Hosting:** OpenRouter is hosted and paid; 9Router is free self-hosted software you run on Railway with your own keys.
- **Control:** 9Router keeps provider keys and request logs on your volume; OpenRouter sees every request and token.
- **Cost:** OpenRouter charges a fee on credit purchases; 9Router has no markup, you pay providers directly.

### 9Router vs LiteLLM (LiteLLM Alternative)

- **Config:** LiteLLM uses YAML and CLI; 9Router has a web dashboard for providers, combos, and keys.
- **Fallbacks:** 9Router combos tier subscriptions, cheap, and free models with auto fallback; LiteLLM fallbacks are less visual.
- **Token saving:** 9Router's RTK saver compresses tool results; LiteLLM lacks an equivalent built-in.

### 9Router vs OmniRoute (OmniRoute Alternative)

- **Overlap:** Both are self-hosted open-source AI routers with API translation; features are close.
- **Extras:** 9Router stays lean with combos, multi-account round robin, quota tracking and the RTK token saver; OmniRoute adds more routing strategies, MCP and A2A.
- **Cloud sync:** 9Router offers optional sync to 9router.com; skip it to stay fully local.

### 9Router vs running Docker on a VPS (VPS Self Hosting)

- **TLS:** Railway gives HTTPS and renews certs; on a VPS you run Nginx/Caddy and Let's Encrypt yourself.
- **Ops:** Railway restarts crashes and redeploys pinned images; on a VPS you manage systemd and image pulls.
- **Cost:** A $5 VPS is cheaper but you patch OS and secure SSH; Railway removes that work for a few dollars more.

## How to use 9Router Docker (the OSS AI router)?

1. Deploy, wait for /api/health to return ok.
2. Open /dashboard and log in with INITIAL_PASSWORD from Railway variables.
3. Connect providers, create a combo with fallback across subscription, cheap, and free tiers.
4. Create an API key.
5. Point a client at https://your-domain/v1 with that key.
6. To upgrade, change the image tag and digest in service settings and redeploy; back up the db first.
7. Back up /app/data by downloading the volume before changes.

For a local smoke test, the same image runs with:

```bash
docker run -d --name 9router -p 20128:20128 -v 9router-data:/app/data -e DATA_DIR=/app/data -e INITIAL_PASSWORD=change-me decolua/9router:0.5.95
```

Then open http://localhost:20128/dashboard.

## How to self host 9Router Docker on other VPS Services (9Router self hosting guide)

### Clone the Repository

You do not need to clone anything for the standard Docker route. The Railway template pins the published decolua/9router image directly, so there is no source checkout on the host.

### Install Dependencies

Install Docker Engine or Podman on the VPS. The image bundles Node.js and SQLite, so no system packages beyond a container runtime are required.

### Configure Environment Variables

Set these as environment variables or a .env file. Use a strong INITIAL_PASSWORD for your first dashboard login.

```
PORT=20128
DATA_DIR=/app/data
INITIAL_PASSWORD=change-me
JWT_SECRET=some-long-random-string
API_KEY_SECRET=another-random-string
BASE_URL=https://your-domain
```

### Start the 9Router Docker Application

Run the container with a named volume. The port mapping and volume path mirror the Railway service exactly.

```bash
docker run -d --name 9router \
  -p 20128:20128 \
  -v 9router-data:/app/data \
  -e DATA_DIR=/app/data \
  -e INITIAL_PASSWORD=change-me \
  decolua/9router:0.5.95
```

Railway handles TLS, the public domain, health checks, and the volume mount, so you skip cert renewals and reverse proxy config.

## Official Pricing of 9Router Docker (9Router pricing)

9Router Docker is free, open-source software under the MIT license. There is no paid plan, premium tier, or per-seat fee for the router itself. No subscription to 9Router is required.

## 9Router Docker cloud vs self hosted comparison (Pricing, features, costs, and more)

Self hosting on Railway trades a small monthly fee for control of your data and no gateway markup. You pay only for the container and your own AI providers.

### Monthly cost of self hosting 9Router Docker on Railway

Expect roughly $3-8 per month for a small Railway service, and the $5 trial credit covers early testing. 9Router is MIT licensed and free; there is no paid 9Router plan. Provider usage is billed by the providers you connect, not by 9Router.

### System Requirements for Hosting 9Router Docker on a VPS

512 MB of RAM is enough for one user. The app uses SQLite only, so no Postgres or Redis is required. Run a single replica, because the SQLite database sits on one volume. The pinned image keeps resource use predictable across redeploys.

## Frequently Asked Questions (FAQs)

### What Docker image does this template use?

It pins decolua/9router:0.5.95 by digest from Docker Hub, so a redeploy never silently pulls a newer version. You control upgrades by changing the tag and digest yourself.

### Where is my data stored?

Everything stateful lives in the Railway volume at /app/data: SQLite at db/data.sqlite with providers, combos, API keys, settings, and usage history, plus automatic backups under db/backups. Losing the volume loses those connections and keys.

### How do I upgrade 9Router?

Read the release notes, change the image tag and digest in the service settings, then redeploy. Back up the latest db backup first. Keep one replica, because SQLite sits on a single volume.

### Can I move my existing Docker volume to Railway?

Yes, but it's a manual step: copy the data.sqlite file from your old volume into the Railway volume. If you set JWT_SECRET and API_KEY_SECRET, keep them identical, or existing API keys and sessions stop validating.

### Why is there no Postgres or Redis?

9Router uses SQLite, so one volume on a single replica is all it needs. No extra services, no managed database cost, no separate cache to babysit.

### What happens when Railway redeploys the service?

The container restarts from the pinned image and reattaches the same volume, so your database and backups persist. The health check at /api/health tells you when the service is ready again.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [stella](https://railway.com/deploy/stella) — Self-host stella with web, API, Postgres, Redis, and object storage.
- [Hermes Agent | OpenClaw Alternative with Dashboard](https://railway.com/deploy/hermes-agent-or-openclaw-alternative-wit) — Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

Open this page in a browser: https://railway.com/deploy/deploy-9router-docker-image
