---
title: "Deploy 9Router Cursor"
description: "Connect Cursor IDE to a self-hosted AI router"
category: "AI/ML"
url: https://railway.com/deploy/deploy-9router-for-cursor
---

# Deploy 9Router Cursor

Connect Cursor IDE to a self-hosted AI router

**[Deploy 9Router Cursor on Railway](https://railway.com/template/deploy-9router-for-cursor)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/deploy-9router-for-cursor/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 Cursor (Open-Source AI Router) on Railway

9Router Cursor points Cursor IDE at your own AI router. Host the open-source 9Router template on Railway, get a public HTTPS domain, and route Cursor chats through provider combos with fallback. This guide covers setup, costs, and operations. If Cursor shows a model as unavailable, check that the model name in Cursor matches a 9Router combo name exactly.

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

9Router Cursor is the MIT-licensed 9Router codebase as one Railway service from the pinned decolua/9router:0.5.95 digest. One container runs the dashboard, the /v1 API, SQLite, and routing. No Postgres, Redis, or worker. The volume at /app/data persists SQLite and automatic backups.

Railway issues a public HTTPS URL immediately. Cursor sends model requests from its own backend, not your laptop, so localhost never works. Railway handles TLS and port exposure, skipping firewall and cert work. The template generates INITIAL_PASSWORD, JWT_SECRET, API_KEY_SECRET, and MACHINE_ID_SALT.

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

OpenRouter adds per-token markup and sees every request. 9Router Cursor is free software. You own the instance, keys, and logs. Railway costs about $3 to $8 per month for one user, and the $5 trial usually covers the first month.

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

| Provider | Setup effort | Public HTTPS for Cursor | Cost per month | Notes |
|---|---|---|---|---|
| DigitalOcean | Medium | Manual domain plus reverse proxy | $4 to $12 | You manage TLS, firewall, and OS updates. |
| AWS | High | Manual ALB plus ACM cert | $5 to $30 | Cheap EC2, but IAM and networking add time. |
| Hetzner | Low to medium | Manual domain plus Caddy or nginx | $3 to $8 | Best raw price, but DNS and failover are on you. |

Railway removes the domain and TLS work. You get an automatic HTTPS URL and paste it directly into Cursor settings.

## Common Use Cases for hosted 9Router Cursor

- **Cursor with multi-provider fallback.** Combo tries Claude, then GPT-4o, then a free model.
- **Claude Code on a team.** Separate 9Router API keys, quota tracking, round robin, RTK saving.
- **Codex, Cline, GitHub Copilot, OpenCode, OpenClaw.** Any OpenAI-compatible client uses /v1.

## Dependencies for 9Router Cursor Docker hosted on Railway

9Router Cursor runs entirely inside the Docker image. The only external dependency is a public HTTPS domain, which Railway provides. No separate database, object storage, or message queue is needed. The volume at /app/data persists SQLite, backups, and provider config.

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

- **Railway project with one service.** Image, port, health check, volume set by template.
- **Volume at /app/data.** Without it, SQLite data disappears on redeploy.
- **Public domain.** Cursor's backend cannot reach a private IP.
- **Initial password.** Generated as INITIAL_PASSWORD; use once at /dashboard, then change it.

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

The service uses decolua/9router:0.5.95, port 20128, health check /api/health. Dashboard at /dashboard, API at /v1.

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

### 9Router Cursor vs LiteLLM

- **Service vs library.** LiteLLM is a Python proxy you wrap. 9Router Cursor is a complete Docker service.
- **Format translation.** 9Router translates OpenAI to Claude automatically. LiteLLM needs per-route config.
- **Cursor fallback.** 9Router combos and three-tier fallback suit long IDE sessions. LiteLLM retries are code-level.

### 9Router Cursor vs OpenRouter

- **No per-token markup.** OpenRouter adds a percentage. 9Router is free software; you pay providers directly.
- **Data stays local.** OpenRouter sees every request. 9Router logs stay in your SQLite volume.
- **No shared limits.** OpenRouter aggregates demand and can throttle. Your 9Router instance uses your provider keys.

### 9Router Cursor vs Portkey

- **Pricing.** Portkey has free and paid tiers. 9Router has no paid plan; you pay Railway and providers.
- **RTK token saver.** 9Router compresses tool_result content, claiming 20 to 40 percent savings. Portkey lacks it.
- **Multi-account round robin.** 9Router rotates accounts per provider to dodge rate limits.

### 9Router Cursor vs OmniRoute

- **Maturity.** 9Router supports 40+ providers and 100+ models with more frequent updates.
- **Cloud sync.** 9Router can sync config to 9router.com. OmniRoute lacks it.
- **Storage.** OmniRoute may need Postgres. 9Router uses SQLite with backups.

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

1. Deploy the 9Router template on Railway and wait for health check.
2. Open dashboard at your Railway URL plus /dashboard. Log in with INITIAL_PASSWORD.
3. Add provider API keys for Anthropic, OpenAI, Google, or others.
4. Create a combo with two or three models, or define three-tier fallback.
5. Generate a 9Router API key in the dashboard.

Cursor sends requests from its own backend, so localhost will not work. Use the public Railway HTTPS domain. Cursor features like Tab autocomplete and some inline edits may still use Cursor's own models unless configured separately. The router handles chat and agent requests through the base URL override.

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

The same Docker image works on any VPS. Railway just automates domain and TLS setup.

### Clone the Repository

Clone the 9Router repository from GitHub. It includes docker-compose.yml and .env.example. Use the prebuilt decolua/9router:0.5.95 image; no build step.

### Install Dependencies

Install Docker and Docker Compose. On Ubuntu, run sudo apt install docker.io docker-compose-plugin. No Node.js, Python, or database packages needed.

### Configure Environment Variables

Copy .env.example to .env. Set PORT=20128, HOSTNAME=0.0.0.0, DATA_DIR=/app/data, BASE_URL and NEXT_PUBLIC_BASE_URL to your public HTTPS domain. Generate JWT_SECRET, API_KEY_SECRET, MACHINE_ID_SALT, INITIAL_PASSWORD. If using a reverse proxy, set AUTH_COOKIE_SECURE=true.

### Start the 9Router Cursor Application

Run docker compose up -d. The container listens on port 20128. Configure a reverse proxy with TLS to expose /dashboard and /v1. Without public HTTPS, Cursor cannot reach the router. Health check at /api/health.

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

9Router Cursor is free and open-source under MIT. No paid plan, enterprise tier, or usage fee. You pay model providers directly and Railway for the container, roughly $3 to $8 per month for one user. The Railway trial includes $5 credit. Optional cloud sync at 9router.com is free; leave CLOUD_URL unset to disable it.

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

The 9Router project does not run a hosted router. 9router.com offers optional config sync only. Comparing cloud vs self-hosted means OpenRouter, Portkey, or LiteLLM Cloud against your own 9Router Cursor. Self-hosting gives data control, no per-token markup, unlimited API keys, but you manage updates, backups, uptime.

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

A single Railway service with 512 MB RAM and small volume costs about $3 to $8 per month. The $5 trial credit covers the first month. Provider costs depend on models; 9Router adds zero markup. If you route only free models, total is just the Railway container.

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

- **RAM:** 512 MB enough for one user or a few Cursor sessions. Use 1 GB if request logs enabled.
- **CPU:** One shared vCPU is fine. 9Router proxies and translates formats; no inference.
- **Disk:** 1 GB volume sufficient for SQLite and backups. Full request logs grow faster.

## Frequently Asked Questions (FAQs)

### How do I configure Claude Code to use my hosted 9Router Cursor?

Set ANTHROPIC_BASE_URL to your Railway domain and ANTHROPIC_API_KEY to the 9Router key. Some clients use OPENAI_BASE_URL instead. The router accepts both formats.

### Is the 9Router API key the same as my provider key?

No. You paste provider keys into 9Router once. Clients use only the 9Router key. If that key leaks, revoke it in the dashboard without touching provider accounts.

### Does using 9Router with Cursor violate any terms of service?

It can. Routing subscription accounts like Claude Pro or ChatGPT Plus through 9Router may break those providers' ToS. Use pay-as-you-go API keys for production.

### What is RTK and how does it save tokens?

RTK is 9Router's token saver for tool_result content. It compresses redundant parts of tool results, claiming 20 to 40 percent savings. Enable it per combo. It affects tool results only, not user prompts.

### Can I use 9Router Cursor without Railway?

Yes. Any VPS with Docker works. The key requirement is a public HTTPS endpoint, because Cursor's backend cannot reach localhost or private IPs. Railway automates that part.

### Does 9Router Cursor store my prompts or responses?

By default, ENABLE_REQUEST_LOGS is off. 9Router stores usage metadata like provider, model, tokens, cost, timestamp in SQLite. Full bodies saved only if you enable request logs. Data stays on your Railway volume unless you turn on cloud sync.


## 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-for-cursor
