Deploy New API LLM Gateway

Self-hosted LLM gateway with a preset root login, Postgres and Redis

Deploy New API LLM Gateway

Just deployed

Deploy and Host New API on Railway

New API is an open source, self-hosted LLM gateway. It puts OpenAI, Claude and Gemini compatible APIs in front of upstream providers such as OpenAI, Anthropic and Google, with model routing, API tokens, per user quotas, usage logs and cost accounting, all managed from a web console.

About Hosting New API

Hosting New API means running the Go gateway next to PostgreSQL for durable data and Redis for caching and rate limits, the same three services as the official Docker Compose file. This template pins the official calciumion/new-api:v1.0.0-rc.49 image, sets PORT=3000 so the Railway healthcheck hits /api/status, and generates SESSION_SECRET and CRYPTO_SECRET so logins survive redeploys.

New API ships without a default account: until setup is finished, anyone who opens the URL can make themselves the root user, and self registration is open by default. This template closes both gaps. Before the public port opens, the start command creates the root account from a password generated for your deploy and turns self registration off.

Common Use Cases

  • One endpoint for every model: OpenAI, Claude and Gemini style clients all talk to one base URL
  • Key management: keep provider keys on the server and hand out revocable sk- tokens with quotas
  • Routing and failover: weight, prioritise and retry across several channels for the same model
  • Usage and cost tracking: per token, per user and per model logs and dashboards
  • Team or customer gateway: groups, quotas and optional top ups when you open registration

Dependencies for New API Hosting

  • PostgreSQL: users, tokens, channels and logs (included, with a volume)
  • Redis: cache and rate limits (included, no volume needed)
  • Provider API keys: optional at boot; add them as channels in the console

Deployment Dependencies

Implementation Details

First steps after deploy:

  1. Open the New API service variables and copy NEW_API_ADMIN_PASSWORD.
  2. Open the public URL and log in as root with that password.
  3. Add a channel with a provider API key, then create a token.
  4. Use https:///v1 as the base URL in any OpenAI compatible client.

Key variables:

PORT=3000
NEW_API_ADMIN_USERNAME=root
NEW_API_ADMIN_PASSWORD=${{secret(24)}}
NEW_API_REGISTER_ENABLED=false
SQL_DSN=${{Postgres.DATABASE_PRIVATE_URL}}
REDIS_CONN_STRING=${{Redis.REDIS_URL}}
SESSION_SECRET=${{secret(48)}}
CRYPTO_SECRET=${{secret(48)}}
SESSION_COOKIE_SECURE=true
SESSION_COOKIE_TRUSTED_URL=https://${{RAILWAY_PUBLIC_DOMAIN}}

NEW_API_ADMIN_PASSWORD is only applied on the first boot; change it later in the console. If you attach a custom domain, add its https:// origin to SESSION_COOKIE_TRUSTED_URL. Set NEW_API_REGISTER_ENABLED=true if you want public signups. To upgrade, change the image tag on the New API service.

Why Deploy New API 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 New API 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

More templates in this category

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

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

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

bento
1