---
title: "Deploy 9Router Roo Code"
description: "Point Roo Code in VS Code at your own AI router"
category: "AI/ML"
url: https://railway.com/deploy/deploy-9router-for-roo-code
---

# Deploy 9Router Roo Code

Point Roo Code in VS Code at your own AI router

**[Deploy 9Router Roo Code on Railway](https://railway.com/template/deploy-9router-for-roo-code)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/deploy-9router-for-roo-code/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 Roo Code (Self-Hosted AI Router for Roo Code) on Railway

This template runs a self-hosted 9Router on Railway for Roo Code in VS Code. It's for developers who want one endpoint with fallback across providers.

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

This template runs one 9Router service on the decolua/9router:0.5.95 image, port 20128, with the dashboard at /dashboard and the OpenAI-compatible endpoint at /v1.

Point Roo Code at https://your-9router-domain/v1 with the OpenAI Compatible provider and a 9Router API key. REQUIRE_API_KEY is set to true, so the public endpoint rejects anonymous requests.

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

OpenRouter is the easy path: one bill and one key, working in Roo Code in minutes. Railway's $5 trial covers testing it before any monthly bill.

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 Roo Code 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 Roo Code self hosting

Hosting choice mostly comes down to how much setup you want to own for one small router.

| Provider | What You Get with Railway | What You Get with the Other Provider |
| --- | --- | --- |
| DigitalOcean | A one-click template with Docker, a persistent volume, generated secrets and HTTPS. | A Droplet you manage, including Docker, reverse proxy, TLS and backups. |
| AWS | A single service with usage billing and no VPC or IAM setup first. | Full EC2 and networking control, which is heavy for a router needing about 512 MB of RAM. |
| Hetzner | A managed deploy with domain and environment variables handled for you. | Cheap fixed-price servers, but OS updates, Docker and HTTPS are on you. |

If you already run a VPS with Docker and Caddy, Hetzner or DigitalOcean can be cheaper over time. For one Roo Code router, Railway gets you to a working endpoint faster.

## Common Use Cases for hosted 9Router Roo Code

- **One endpoint across several subscriptions:** Point Roo Code's OpenAI Compatible provider at your 9Router domain once, and the router picks the upstream account behind each model ID.
- **Cheap model for Code mode, stronger model for Architect mode:** Save one Roo Code profile per mode, so planning gets a heavier model and bulk edits stay cheap.
- **Fallback when a provider rate-limits:** Put a few models in a 9Router combo so a long task moves to the next provider in the chain instead of stalling mid-refactor.
- **Sharing one router with a small team:** Each person uses their own 9Router API key against the same domain, and you watch usage in one dashboard.
- **Keeping provider keys off laptops:** Upstream keys stay on the server, and developers hold only a 9Router key, so revoking one person's access is simple.

## Dependencies for 9Router Roo Code Docker hosted on Railway

This section covers what the template runs and what you need to wire it up. One Railway service runs the pinned decolua/9router:0.5.95 image with state kept in a single volume.

### Deployment Dependencies for Managed 9Router Roo Code Service (AI Router)

- A Railway project with one service running the decolua/9router:0.5.95 image on port 20128.
- A public domain for the dashboard at /dashboard and the OpenAI-compatible API at /v1.
- A persistent volume at /app/data holding the SQLite database and backups.
- Health checks against /api/health.

No Postgres or Redis is needed.

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

The template sets PORT to 20128, HOSTNAME to 0.0.0.0, and DATA_DIR to /app/data. BASE_URL and NEXT_PUBLIC_BASE_URL point at your public domain.

Generated secrets cover INITIAL_PASSWORD, JWT_SECRET, API_KEY_SECRET, and MACHINE_ID_SALT. Change INITIAL_PASSWORD after your first login, since the upstream default is 123456.

## How does 9Router Roo Code compare against other ways to give Roo Code many models

### 9Router vs OpenRouter (Hosted Aggregator Alternative)

- **Hosting:** 9Router runs on your own Railway service. OpenRouter is a hosted service you send traffic through.
- **Billing:** OpenRouter gives you one bill. With 9Router you pay each provider directly.
- **Where OpenRouter wins:** zero infrastructure and a single invoice.

### 9Router vs LiteLLM (Open-Source Python Proxy Alternative)

- **Audience:** LiteLLM targets platform teams with budgets and admin tooling. 9Router is one Docker service a single developer can run.
- **Subscriptions:** 9Router pools subscription logins alongside API keys in one combo.
- **Where LiteLLM wins:** org-wide spend controls and a mature enterprise proxy.

### 9Router vs direct provider keys in Roo Code (No Router Alternative)

- **Setup:** Pasting provider keys straight into Roo Code is the fastest start.
- **Fallback:** Direct keys have no automatic failover. You switch profiles by hand when a provider hits its limit.
- **Secrets:** With 9Router, laptops hold one router key and provider keys stay on the server.

### 9Router vs Roo Code Cloud (Roo's Hosted Service Alternative)

- **Control:** With 9Router you choose the providers, models and combos behind the endpoint and read the request log yourself.
- **Where Roo Code Cloud wins:** you run no service at all and get Roo's managed experience.

## How to use 9Router Roo Code (the OSS AI coding router)?

1. Open your Railway 9Router domain and log in with INITIAL_PASSWORD.
2. Connect at least one provider in the dashboard.
3. Create an API key in the 9Router dashboard and copy it.
4. In VS Code, open Roo Code settings and choose API Provider OpenAI Compatible.
5. Set Base URL to https://your-9router-domain/v1, paste the key, and set Model to a model or combo name from the dashboard.
6. Save a profile per mode (Architect, Code, Debug), each on a different model or combo.
7. Run a small task, then check the dashboard request log.

Check the endpoint with curl first:

```bash
curl https://your-9router-domain/v1/models -H "Authorization: Bearer your-9router-key"

curl https://your-9router-domain/v1/chat/completions \
  -H "Authorization: Bearer your-9router-key" \
  -H "Content-Type: application/json" \
  -d '{"model":"your-model-or-combo","messages":[{"role":"user","content":"Say hi"}]}'
```

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

You need a Linux VPS with Docker installed. The steps below are all you need.

### Clone the Repository

Clone the upstream 9Router source for reference and move into the folder.

```bash
git clone https://github.com/decolua/9router.git
cd 9router
```

### Install Dependencies

Docker is the only host dependency, since the image ships everything else. Pull the pinned image.

```bash
docker pull decolua/9router:0.5.95
```

### Configure Environment Variables

Create a `.env` file with your public domain and real secrets.

```bash
PORT=20128
HOSTNAME=0.0.0.0
DATA_DIR=/app/data
BASE_URL=https://your-domain
NEXT_PUBLIC_BASE_URL=https://your-domain
INITIAL_PASSWORD=change-this-first-login
JWT_SECRET=replace-with-random-string
API_KEY_SECRET=replace-with-random-string
MACHINE_ID_SALT=replace-with-random-string
REQUIRE_API_KEY=true
```

### Start the 9Router Roo Code Application

Run the container with a persistent volume at `/app/data`, where the SQLite database lives. Then check the health endpoint.

```bash
docker run -d --name 9router --env-file .env -p 20128:20128 -v 9router-data:/app/data decolua/9router:0.5.95
curl http://localhost:20128/api/health
```

Railway handles the public domain, TLS, and volume persistence for you, which is the part you'd otherwise build yourself on a VPS.

## Official Pricing of 9Router Roo Code (9Router pricing)

9Router is free and open source under the MIT license, so there is no paid 9Router plan and no per-seat or per-request fee from the project itself.

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

Self hosting 9Router means you pay for the Railway service and your provider bills, with no router subscription on top. Hosted alternatives fold the routing layer into their own price.

### Monthly cost of self hosting 9Router Roo Code on Railway

Expect roughly $3 to $8 per month on Railway for one 9Router service, enough for a single person running Roo Code. 9Router is MIT licensed with no paid plan, so the router adds no license fee.

### System Requirements for Hosting 9Router Roo Code on a VPS

One user needs about 512 MB of RAM. 9Router keeps its state in SQLite under /app/data, so attach a persistent volume there and back it up.

## Frequently Asked Questions (FAQs)

### Which provider should I pick in Roo Code for 9Router?

Choose "OpenAI Compatible" as the API Provider. 9Router speaks the OpenAI API, so Roo Code treats it like any other compatible endpoint.

### What Base URL do I enter?

Use https://your-9router-domain/v1 with your actual Railway domain in place of your-9router-domain.

### Why don't my models show up in the dropdown?

Roo Code's OpenAI Compatible provider usually needs the exact model ID or combo name typed in the Model ID field.

### Does fallback keep a task running if one provider hits its limit?

Yes, if you point the profile at a 9Router combo with an ordered chain.

### Do image and tool use work through Roo Code?

It depends on the model behind the route.

### Can my team share one router?

Yes, several people can point Roo Code at the same 9Router, each with a 9Router API key. Keep REQUIRE_API_KEY enabled so the public endpoint rejects anonymous requests.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius v0.1 Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/deploy-9router-for-roo-code
