Deploy 9Router
9 Router Pro Stack: persistent 9router AI router with API keys and backups.
9Router
Just deployed
/app/data
Deploy and Host 9Router on Railway
About Hosting 9Router
For a self-hosted model gateway on Railway, use 9Router Pro Stack. It deploys the official application with a protected administrator dashboard, generated session and API-key secrets, persistent SQLite storage and volume backup schedules. Connect authorized providers after first login, then configure compatible coding or chat clients. Provider accounts and model access are separate; the gateway does not supply free API credits or bypass provider restrictions.
Why Deploy 9Router on Railway?
- No mandatory provider API key at deployment. Open the dashboard first, then connect an authorized provider from its Providers page.
- Protected dashboard from the first launch.
INITIAL_PASSWORD,JWT_SECRET,API_KEY_SECRETandMACHINE_ID_SALTare generated separately for every deployment. There is no shared default password. - Authenticated inference API. Create an endpoint key in the dashboard before using
/v1from an external client. Dashboard login and inference API keys serve different purposes. - Persistent configuration and SQLite data on a Railway volume mounted at
/app/data, including provider connections, endpoint keys and routing combinations. - Reproducible application image. The template pins the official 9Router 0.5.104 image by immutable digest, rather than silently following
latest. - Native OpenAI JSON and streaming compatibility. A version-checked startup correction lets the native OpenAI provider honor the client's
streamsetting. Non-streaming requests return JSON; streaming requests return SSE. The correction targets OpenAI only. - Daily and weekly volume backup schedules, configured in the template. Railway's backup retention and storage billing apply; confirm your schedule in the deployed volume's Backups tab.
- Native readiness endpoint and restart policy. Railway checks
/api/healthbefore routing traffic. The application starts through its official image entrypoint and custom server. - Request-content logging and observability recording disabled by default. Enable the corresponding controls deliberately if you need to retain request contents.
- One application service. No separate Redis or PostgreSQL service is required by this SQLite-based deployment.
Common Use Cases
- Connect your coding clients to one authenticated, self-hosted inference endpoint.
- Manage authorized model providers and routing combinations from a private dashboard.
- Keep provider connections, endpoint API keys and configuration on persistent storage.
- Test compatible provider integrations and streamed responses without maintaining a VPS.
First use
- Deploy the template and wait for the 9Router service to become healthy.
- Open the generated HTTPS domain.
- In Railway, open the service's Variables tab and copy
INITIAL_PASSWORD. Use it on the 9Router login screen. - Open Providers and connect your chosen provider with your own authorized credentials.
- Create an endpoint API key in 9Router. Copy the model ID shown in the dashboard.
- Set your client's base URL to
https://YOUR-DOMAIN/v1, use the endpoint key you just created, and select that model ID.
No model, provider account, subscription or inference credits are bundled. Successful application deployment does not mean an external provider is configured.
Configuration
| Variable | Purpose |
|---|---|
INITIAL_PASSWORD | Generated login password for a fresh installation. Once you set a password inside 9Router, its persisted password takes precedence. |
JWT_SECRET | Generated secret signing dashboard sessions. Keep stable across redeployments. |
API_KEY_SECRET / MACHINE_ID_SALT | Per-deployment application secrets. Keep stable with the volume. |
DATA_DIR | /app/data; must match the persistent volume mount. |
PORT / HOSTNAME | 20128 / 0.0.0.0, matching Railway's HTTP proxy. |
BASE_URL / NEXT_PUBLIC_BASE_URL | Generated HTTPS domain. Update both when attaching a custom domain. |
AUTH_COOKIE_SECURE | true; dashboard cookies are sent over HTTPS. |
ENABLE_REQUEST_LOGS / OBSERVABILITY_ENABLED | false by default. Application settings may also control observability. |
Persistence, backups and upgrades
The official application stores its database under /app/data/db/data.sqlite and other durable state under DATA_DIR. Keep the volume attached when restarting or redeploying. Deleting the volume deletes that data.
Daily and weekly volume backups provide recovery points. The authenticated database export in the 9Router settings provides a separate portable configuration export; exports may include provider credentials and must be stored privately. Backups do not make two replicas of the same SQLite volume safe: use one replica.
The image is pinned to the tested digest. The custom start command includes a compatibility correction specifically checked against version 0.5.104. When upgrading the image, review and update or remove that correction together with the image; it deliberately refuses an unrecognized build. Back up the volume, redeploy and verify login, providers, endpoint keys and routing. Do not use the application's package updater to replace the running immutable Docker image. Review release notes before upgrading.
Frequently asked questions
Can I deploy 9Router without an OpenAI API key?
Yes. The application and private dashboard launch without a model-provider key. Connect a supported provider after deployment. The generated administrator password is already supplied by Railway.
Is 9Router limited to OpenAI?
No. Upstream supports multiple providers and OpenAI-compatible or Anthropic-compatible endpoints. Availability, authentication, model names and provider terms depend on the provider. A third-party client integration does not confer access to that client's subscriptions or models.
How is this different from a basic 9Router template?
This deployment explicitly supplies fresh secrets, secure cookies, correct persistent storage, scheduled volume backups, a pinned official image, native startup, and an authenticated API setup. These are concrete deployment choices, not a guarantee that every provider or future release will work.
Are model routing and streaming supported?
Yes. 9Router supplies an OpenAI-compatible API and routing combinations. Use endpoint API keys and the model IDs from your dashboard. Provider support varies by API feature. Configure fallback models that you are authorized to use.
Will my providers and API keys survive a Railway restart?
They are stored on the attached /app/data volume. Keep that volume and the generated application secrets. Backup recovery and image upgrades should be tested before relying on the service for critical workloads.
Is this guaranteed to deploy successfully or rank first?
No universal guarantee is possible. Deployment depends on Railway capacity, plan limits, registry availability and user configuration. Search positions also change. The template uses explicit defaults and a tested, immutable image to reduce avoidable failures.
Dependencies for 9Router Hosting
A Railway account with sufficient service and volume capacity. Provider credentials are optional for deployment and necessary when using a provider that requires authentication. One application replica uses the attached SQLite volume.
Deployment Dependencies
Community-maintained Railway deployment configuration. Not an official endorsement by 9Router or any model provider.
Other deployment choices from this publisher
Template Content
9Router
decolua/9router
