Deploy 9Router Aider

Run the Aider pair programmer through your own 9Router

Deploy 9Router Aider

Just deployed

/app/data

Deploy and Host self hosted 9Router Aider (Self-Hosted Routing for Aider Pair Programming) on Railway

This template runs 9Router as one service on Railway, giving you an OpenAI-compatible endpoint you control.

About Hosting 9Router Aider open-source software on Railway (self hosted OpenAI-compatible routing for the Aider terminal pair programmer template)

This template runs one service, the official decolua/9router image pinned to 0.5.95, on port 20128 with a volume at /app/data.

Railway handles the container build, the public HTTPS domain, the health check at /api/health, and keeping the volume attached across redeploys.

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

OpenRouter is the obvious hosted alternative, and it's convenient, but you pay its markup and your Aider traffic runs through someone else's gateway.

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 Aider 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 Aider self hosting

Where the router lives affects latency and upkeep for every Aider edit. Here is how the common alternatives compare.

ProviderWhat You Get with RailwayWhat You Get with the Other Provider
DigitalOceanA one-click template, a persistent volume at /app/data, and a public HTTPS domain.A Droplet you manage, including Docker, TLS and volume backups.
AWSOne service with a mounted volume and no VPC or load balancer to set up.Full control over networking, but EC2 or ECS, DNS and security groups to wire up first.
HetznerDeployment from the template in minutes, with /v1 ready for OPENAI_API_BASE.A cheap VM, but you install Docker and keep the container and its data running yourself.

Common Use Cases for hosted 9Router Aider

  • One endpoint, one key: Point Aider at a single base URL and key instead of juggling separate credentials per provider. The router decides which upstream account answers each request.
  • Mid-session fallback: When your first model is rate-limited partway through a refactor, a combo can fall through to the next model in the list. Aider keeps going without a config edit or restart.
  • Traffic on your own infrastructure: Prompts and code snippets pass through a router you control on Railway, not a third-party gateway. You still pay upstream providers directly for model usage.
  • Combos sized to the job: Use a heavier combo for large multi-file refactors and a faster one for quick single-file edits. Switching is just a different model name after the openai/ prefix.
  • Team setup in version control: Commit a .aider.conf.yml with the base URL and model defaults so everyone on the repo shares the same routing. Keep the API key in a local .env file, out of the committed config.

Dependencies for 9Router Aider Docker hosted on Railway

This template runs one service from the pinned decolua/9router:0.5.95 image on port 20128, with state on a volume at /app/data.

Deployment Dependencies for Managed 9Router Aider Service (AI Router)

  • Persistent volume: mounted at /app/data. The SQLite database at /app/data/db/data.sqlite holds your providers, combos, API keys and usage history, so without it everything is lost on redeploy.
  • Generated secrets: INITIAL_PASSWORD for the first dashboard login, plus JWT_SECRET, API_KEY_SECRET and MACHINE_ID_SALT.
  • Fixed variables: PORT=20128, HOSTNAME=0.0.0.0, DATA_DIR=/app/data, BASE_URL and NEXT_PUBLIC_BASE_URL set to your public domain, and REQUIRE_API_KEY=true.
  • Health check: /api/health on the same port.

Implementation Details for 9Router Aider (Using 9Router official docker image)

The image is the upstream 9Router build, so the dashboard and routing behave the same here as on your own machine.

How does 9Router Aider compare against other ways to run Aider against multiple model providers

9Router Aider vs Aider with direct API keys (Direct Provider Keys)

  • Key sprawl: Direct keys mean one key per provider, each set in its own env var. 9Router gives Aider a single OPENAI_API_KEY and lets the dashboard hold the upstream keys.
  • Mid-session fallback: Aider on direct keys stops when one provider rate-limits you. A 9Router combo can fall through to the next model in the list.
  • Where direct wins: Fewer moving parts. If you use one provider, skip the router and point Aider straight at that provider.

9Router Aider vs OpenRouter (Hosted Gateway)

  • Hosting: OpenRouter is a managed service you do not run. 9Router Aider is a service you deploy and keep alive on Railway.
  • Data path: With 9Router your API traffic runs through infrastructure you control. With OpenRouter it runs through their gateway.
  • Where OpenRouter wins: Nothing to deploy or patch, and a much broader catalog without you adding providers yourself.

9Router Aider vs LiteLLM (Self-Run Proxy)

  • Overlap: Both give Aider one OpenAI-compatible base URL in front of many providers, and both are self-hosted.
  • Setup: LiteLLM is a Python proxy you configure with its own YAML. 9Router ships as one container with a dashboard for providers, combos, and keys.
  • Where LiteLLM wins: More mature proxy features and a config model you can fully script in version control.

9Router Aider vs Ollama (Local Model Runner)

  • Location: Ollama runs models on your own machine with no per-token bill. 9Router routes to hosted providers over the network.
  • Quality and speed: Hosted frontier models usually beat local models on large refactors. Ollama wins on privacy and offline work.
  • Where Ollama wins: Zero API spend and nothing leaving your laptop. Pick it when a local model is good enough for the job.

How to use 9Router Aider (the OSS AI model router)?

  1. Deploy the template on Railway and note the public domain.
  2. Log in to /dashboard with the INITIAL_PASSWORD the template generated, and change it.
  3. Add your providers. Nothing routes until at least one is connected.
  4. Create an API key in the dashboard and copy it. This is the key Aider sends, not your upstream provider key.
  5. Install Aider's helper and run it:
python -m pip install aider-install
aider-install
  1. In your .env file, point Aider at the router:
OPENAI_API_BASE=https:///v1
OPENAI_API_KEY=
  1. Optionally mirror both values in .aider.conf.yml:
openai-api-base: https:///v1
openai-api-key: 
  1. Start Aider with a model prefixed openai/, such as aider --model openai/premium-coding.
  2. Run a small test edit on a scratch file first. If it fails, check that the base URL ends in /v1.

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

Clone the Repository

Clone the upstream code and check out the pinned release tag so your VPS matches what you tested on Railway.

git clone https://github.com/decolua/9router.git
cd 9router
git checkout v0.5.95

Install Dependencies

Install the packages and build the app.

npm install
npm run build

Configure Environment Variables

Set the public address and secrets, replacing your-domain with your hostname and generating fresh secret values.

export PORT=20128
export HOSTNAME=0.0.0.0
export DATA_DIR=/var/lib/9router
export BASE_URL=https://your-domain
export NEXT_PUBLIC_BASE_URL=https://your-domain
export AUTH_COOKIE_SECURE=true
export REQUIRE_API_KEY=true
export INITIAL_PASSWORD=choose-a-strong-password
export JWT_SECRET=your-jwt-secret
export API_KEY_SECRET=your-api-key-secret
export MACHINE_ID_SALT=your-machine-id-salt

Start the 9Router Aider Application

Start the server and check the health endpoint.

npm run start
curl https://your-domain/api/health

Railway handles the TLS certificate, public domain, and persistent volume for you, which you have to set up yourself on a plain VPS.

Official Pricing of 9Router Aider (9Router pricing)

9Router Aider is free and open source under the MIT license, and there is no paid 9Router plan to buy.

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

Running 9Router Aider on Railway versus a VPS mostly comes down to how much upkeep you want and how many sessions you run.

Monthly cost of self hosting 9Router Aider on Railway

On Railway, expect roughly $3-8 per month for this single service for one user.

System Requirements for Hosting 9Router Aider on a VPS

One user runs comfortably on about 512 MB of RAM, so the smallest VPS plan with persistent disk works.

Frequently Asked Questions (FAQs)

How do I point Aider at 9Router instead of OpenAI?

Set OPENAI_API_BASE to your 9Router base URL, which on this template is your public Railway domain with /v1 on the end.

Which key goes in OPENAI_API_KEY?

Use a key you created in the 9Router dashboard, not your upstream provider key.

Do I use a provider model ID or a combo name after openai/?

Either works in principle, since aider --model openai/NAME passes the name through to the router.

Where should I store the key safely?

Put it in a .env file in your project and keep that file out of git.

Does .aider.conf.yml load from the repo root?

Yes, Aider also checks your home directory and the current directory.

Why does Aider show an unknown model warning for combo names?

Aider does not recognize 9Router combo names as built-in models, so it warns that it lacks metadata for them.


Template Content

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
117
View Template
NEW
Weaviate
Vector database with hybrid search and an API key-protected API

zer0person
1
View Template
Möbius v0.1 Personal AI OS
Self-hosted AI agent that builds and runs apps for you, with memory.

bento
1