
Deploy 9Router Kilo Code
Point the Kilo Code agent at your own self-hosted AI router
9router
Just deployed
/app/data
Deploy and Host self hosted 9Router Kilo Code (Self-Hosted Model Routing for VS Code) on Railway
This template runs 9Router on Railway as one service that serves an OpenAI-compatible endpoint. It suits developers who want one self-hosted endpoint instead of a set of per-vendor keys.
About Hosting 9Router Kilo Code open-source software on Railway (self hosted self-hosted OpenAI-compatible router for the Kilo Code VS Code extension template)
This template runs one Railway service built from the decolua/9router image pinned to version 0.5.95, listening on port 20128.
Why Deploy 9Router Kilo Code, the Kilo Code built-in provider alternative on Railway (Railway Free Trial)
Kilo's built-in providers suit a single vendor, but each key lives in the editor and there is no one place to change routes. The Railway $5 trial covers a first test before you commit.
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 Kilo 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 Kilo Code self hosting
Railway runs the router and its SQLite state as one managed service, while a VPS leaves the OS, Docker, and TLS to you.
| Provider | What You Get with Railway | What You Get with the Other Provider |
|---|---|---|
| DigitalOcean | A deployed service with a public domain and a volume at /app/data. | A Droplet you secure yourself, with Docker and a reverse proxy to set up. |
| AWS | The volume and domain wired by the template, at a predictable monthly cost. | Broad EC2 and networking control, with more setup than one container needs. |
| Hetzner | A managed deploy with the health check configured, so you add providers and keys. | Low-cost servers where you handle updates, firewalls, and the Docker stack. |
Pick Railway for a quick Kilo Code base URL, or a VPS for full host control.
Common Use Cases for hosted 9Router Kilo Code
- One endpoint instead of many vendor keys: Point Kilo Code's custom OpenAI Compatible provider at your 9Router base URL once, rather than adding a separate provider entry with its own key for every vendor you want to try.
- Credentials stay on your own service: Upstream provider keys live in the 9Router dashboard on your Railway service, so the VS Code install only ever holds the router API key.
- Switching models from the picker: Once the router is configured, you can change models from Kilo's model picker without touching the editor config again.
- Testing a new upstream first: Add and check a new provider in the 9Router dashboard, confirm it answers, and only then expose its model ids to the editor.
- One router key for a small team: Share a single router key across a few VS Code installs, then revoke or rotate it in the dashboard if someone leaves.
Dependencies for 9Router Kilo Code Docker hosted on Railway
This section covers what the template needs before it will run. You don't need a separate database or cache, since 9Router keeps everything in a single SQLite file on a volume.
Deployment Dependencies for Managed 9Router Kilo Code Service (AI Router)
The template deploys one Railway service built from the pinned image decolua/9router:0.5.95 and listens on port 20128. There is no Postgres or Redis to provision.
Implementation Details for 9Router Kilo Code (Using 9Router official docker image)
The template generates INITIAL_PASSWORD, JWT_SECRET, API_KEY_SECRET, and MACHINE_ID_SALT for you. HEADROOM_URL and SEARXNG_URL are optional and can stay empty.
How does 9Router Kilo Code compare against other ways to point Kilo Code at multiple models
9Router Kilo Code vs Kilo Code built-in provider (Native Provider Alternative)
- Setup effort: Built-in providers need only a key and a model pick, so they win on speed. Our route adds a Railway service and a custom provider entry.
- Single endpoint: Once set, every routed model sits behind one Base URL and one router key.
- Credential location: Upstream keys live in the 9Router dashboard on your Railway volume, not spread across Kilo provider entries.
9Router Kilo Code vs OpenRouter (Hosted Router Alternative)
- Hosting: OpenRouter is hosted for you with nothing to deploy, which is the honest win if you just want models.
- Control: With 9Router you choose which upstreams connect and where the SQLite state lives.
- Cost shape: OpenRouter bills per model usage through its own account, while our route costs a small Railway bill plus your upstream charges.
9Router Kilo Code vs LiteLLM (Open-Source Proxy Alternative)
- Ops burden: LiteLLM is a proxy you usually run and maintain yourself, which takes more care than one 9Router service with one volume.
- Interface: Both expose an OpenAI-style interface, so Kilo's OpenAI Compatible provider type works with either.
- Dashboard: 9Router ships a web dashboard at /dashboard for adding providers and keys, which some find quicker than editing proxy config files.
9Router Kilo Code vs Ollama (Local Model Runner Alternative)
- Where models run: Ollama keeps models on your own machine, which beats our route for offline work and strict privacy.
- Model reach: 9Router proxies to the cloud providers you connect, so you reach hosted frontier models a local Ollama install usually can't match.
- Hardware: Ollama needs enough local RAM and GPU for the model you pick, while 9Router runs on a small Railway instance because inference happens upstream.
How to use 9Router Kilo Code (the OSS AI model router)?
- Deploy the 9Router template on Railway and open the service domain Railway assigns to it.
- Log in at
/dashboardwith the INITIAL_PASSWORD value, then add your upstream providers. - Create and copy an API key from the dashboard. This is your router key, and REQUIRE_API_KEY=true means Kilo needs it.
- In VS Code, open the Kilo Code Settings gear and go to the Providers tab.
- Scroll to the bottom and click Custom provider.
- Fill in a Provider ID and a Display name, then set Provider API to OpenAI Compatible.
- Enter the Base URL and the router API key:
Base URL: https:///v1
API key:
- Click Fetch models to load the picker. If detection comes back empty, type a model id such as
cc/claude-opus-4-6by hand. - Click Submit, then select the model from the picker.
How to self host 9Router Kilo Code on other VPS Services (9Router self hosting guide)
Running 9Router on a VPS works like it does on Railway, but you handle the process, storage, and HTTPS yourself.
Clone the Repository
Clone the 9Router source and move into the project folder.
git clone https://github.com/decolua/9router.git
cd 9router
Install Dependencies
Install the packages the project lists, using the Node version its README asks for.
npm install
Configure Environment Variables
Create a .env file in the project folder. Replace the placeholders with your own values.
PORT=20128
HOSTNAME=0.0.0.0
DATA_DIR=/var/lib/9router
BASE_URL=https://your-domain
NEXT_PUBLIC_BASE_URL=https://your-domain
INITIAL_PASSWORD=change-me-now
REQUIRE_API_KEY=true
Also set long random values for JWT_SECRET, API_KEY_SECRET, and MACHINE_ID_SALT.
Start the 9Router Kilo Code Application
Build the app, start it, and put an HTTPS reverse proxy in front of port 20128. Then set Kilo Code's Base URL to https://your-domain/v1.
npm run build
npm start
Railway handles the domain, HTTPS, persistent volume, and restarts for you, which you otherwise have to wire up yourself on a VPS.
Official Pricing of 9Router Kilo Code (9Router pricing)
9Router is free and open source under the MIT license, and there is no paid 9Router plan to buy. The router itself does not add a markup on those calls.
9Router Kilo Code cloud vs self hosted comparison (Pricing, features, costs, and more)
A hosted router means someone else runs it and holds your keys.
Monthly cost of self hosting 9Router Kilo Code on Railway
One 9Router service on Railway typically runs about $3-8 per month, covering the container and its volume. Railway's $5 trial credit can cover your first few weeks of testing.
System Requirements for Hosting 9Router Kilo Code on a VPS
One user needs about 512 MB of RAM, so a small VPS is enough for a personal Kilo Code setup. The router keeps its state in SQLite on the /app/data volume, so choose a plan with persistent disk.
Frequently Asked Questions (FAQs)
Do I need the Kilo built-in provider if I already use this router?
No. Keep the built-in provider only for models you want to run directly.
Why does Fetch models return nothing?
Usually the Base URL or router key is wrong, or no providers are added yet in the dashboard. If the list stays empty, type a model id manually.
Which Provider API should I pick for 9Router?
Choose OpenAI Compatible. 9Router exposes an OpenAI-style /v1 interface, so the Anthropic Messages option doesn't apply.
Does the API key field need to be filled?
Yes. REQUIRE_API_KEY is set to true on this template, so /v1 routes reject requests that don't send the router key as a Bearer token.
Can I switch between multiple custom providers?
Yes. Kilo doesn't document a separate profiles feature, so switching means choosing a different model or provider.
What data does the router store on the Railway volume?
The volume at /app/data holds the SQLite database at $DATA_DIR/db/data.sqlite, with your providers, API keys, settings, and usage history.
Template Content
9router
decolua/9router:0.5.95
