
Deploy 9Router (Self-Hosted AI Gateway & Router)
Self-hosted AI gateway: one OpenAI-compatible API for 60+ LLM providers
9Router
Just deployed
Deploy and Host 9Router on Railway
9Router is a self-hosted AI gateway and router. It exposes a single OpenAI-compatible endpoint (/v1) in front of 60+ providers — OpenAI, Anthropic, Google Gemini, DeepSeek, Groq, OpenRouter, Ollama and more — with per-key routing, fallbacks, usage tracking and a web dashboard. Point Claude Code, Cursor, Codex, Cline, Continue or any OpenAI SDK at your 9Router URL and switch models without touching your apps.
About Hosting 9Router
This template deploys the official decolua/9router image as a single Next.js service on port 20128 with a persistent volume at /app/data for its SQLite database (providers, API keys, routes, request logs). JWT_SECRET, API_KEY_SECRET and MACHINE_ID_SALT are generated per deployment, and BASE_URL is wired to your Railway public domain so OAuth-style provider logins and the dashboard work out of the box. Optionally set INITIAL_PASSWORD to pre-seed the admin password; otherwise you set it on first visit. The service is lightweight (well under 512 MB RAM at idle) and keeps a heartbeat log so it never sleeps mid-request.
Common Use Cases
- One API key and one base URL for every LLM provider your team uses
- Route Claude Code / Cursor / Codex through your own gateway with fallbacks and spend visibility
- Mix free-tier and paid providers with automatic failover
- Self-hosted OpenRouter alternative that keeps prompts and keys in your own infrastructure
Dependencies for 9Router Hosting
- Docker image
decolua/9router:latest - A Railway volume at
/app/data - Provider API keys (added in the dashboard after deploy)
Implementation Details
After deploy, open your public domain, set the admin password, add providers and create a 9Router API key. Then in any OpenAI-compatible client:
export OPENAI_BASE_URL=https:///v1
export OPENAI_API_KEY=
For Claude Code use ANTHROPIC_BASE_URL=https:// with the same key.
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 are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
9Router
decolua/9router:latest