---
title: "Deploy New API"
description: "LLM gateway: one OpenAI-compatible API and keys for many AI providers"
category: "AI/ML"
url: https://railway.com/deploy/new-api-2
---

# Deploy New API

LLM gateway: one OpenAI-compatible API and keys for many AI providers

**[Deploy New API on Railway](https://railway.com/template/new-api-2)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/new-api-2/manifest.json

- **Creator:** Agaz Self-Host
- **Category:** AI/ML

## Template content

### new-api https://cdn.jsdelivr.net/gh/selfhst/icons/png/new-api.png

- **Image:** calciumion/new-api:v1.0.0-rc.49@sha256:92dbb9b34b2693bf5d4721ab55f83de78b0724e5b3aa780cd485dcbd7c2818fe
- **Start command:** `/bin/sh -c "echo IyEvYmluL3NoCiMgTmV3IEFQSSBvbiBSYWlsd2F5OiBjcmVhdGUgdGhlIGFkbWluIGFjY291bnQgZnJvbSBBRE1JTl9VU0VSTkFNRSAvIEFETUlOX1BBU1NXT1JECiMgb24gYSBwcml2YXRlIHBvcnQgYmVmb3JlIHRoZSBwdWJsaWMgcG9ydCBvcGVucywgY2xvc2UgcHVibGljIHNpZ24tdXAsIHRoZW4gcnVuIG9uICRQT1JULgpzZXQgLWV1CmV4cG9ydCBFUlJPUl9MT0dfRU5BQkxFRD0iJHtFUlJPUl9MT0dfRU5BQkxFRDotdHJ1ZX0iCmV4cG9ydCBCQVRDSF9VUERBVEVfRU5BQkxFRD0iJHtCQVRDSF9VUERBVEVfRU5BQkxFRDotdHJ1ZX0iCmV4cG9ydCBUWj0iJHtUWjotVVRDfSIKZXhwb3J0IE5PREVfTkFNRT0iJHtOT0RFX05BTUU6LW5ldy1hcGktcmFpbHdheX0iCkFETUlOX1VTRVJOQU1FPSIke0FETUlOX1VTRVJOQU1FOi1hZG1pbn0iCkxPR19ESVI9L2RhdGEvbG9ncwpta2RpciAtcCAiJExPR19ESVIiCkI9aHR0cDovLzEyNy4wLjAuMTozOTk5CiMgVGhlIGRhdGFiYXNlIG1heSBzdGlsbCBiZSBzdGFydGluZywg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c3MiOnRydWUnIFwKICAgICYmIGVjaG8gIltzZXR1cF0gcHVibGljIHNpZ24tdXAgZGlzYWJsZWQiIHx8IHsgZWNobyAiW3NldHVwXSBjb3VsZCBub3QgZGlzYWJsZSBzaWduLXVwIjsgZXhpdCAxOyB9CmZpCmtpbGwgIiRQSUQiOyB3YWl0ICIkUElEIiAyPi9kZXYvbnVsbCB8fCB0cnVlCmVjaG8gIltzZXR1cF0gc3RhcnRpbmcgTmV3IEFQSSBvbiBwb3J0ICR7UE9SVDotMzAwMH0iCmV4ZWMgL25ldy1hcGkgLS1sb2ctZGlyICIkTE9HX0RJUiIK | base64 -d > /tmp/start.sh && exec sh /tmp/start.sh"`
- **Health check:** /api/status
- **Public domain:** Yes

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2.11@sha256:b0b01167ff47bc3868e56a967895a26be4230891a1f42a78ab61cdd227accc8d
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18.6@sha256:4fc833b43d2aaf6ecc9b18615f5533602b723a32d0e2efe2dae8ca0f7217c863

## Documentation

# Deploy and Host New API on Railway

New API is an open-source LLM gateway and key manager. It puts OpenAI, Claude, Gemini, DeepSeek, Azure and dozens of other providers behind one OpenAI-compatible endpoint. You issue your own API keys with quotas, route requests across channels, and track usage and cost per key, user and model in a web dashboard.

## About Hosting New API

New API is a single Go service with a web dashboard. It stores users, keys, channels and logs in a SQL database, and uses Redis for caching and rate limits. This template runs the official `calciumion/new-api` image pinned by digest, with Railway Postgres and Redis on the private network and a volume for the app's data and logs. On first start it creates your admin account from template variables before the public port opens, so nobody can claim the setup page, and it turns off public sign-up. You add provider keys as channels in the dashboard after deploying.

## Common Use Cases

* Give a team or app one OpenAI-compatible endpoint for many model providers
* Hand out API keys with quotas, model limits and expiry, and track spend per key
* Fail over or load-balance between several provider keys and channels

## Dependencies for New API Hosting

* PostgreSQL (Railway Postgres) for users, keys, channels and logs
* Redis (Railway Redis) for caching and rate limiting

### Deployment Dependencies

* New API source and docs: https://github.com/QuantumNous/new-api
* Release used by this template (v1.0.0-rc.49): https://github.com/QuantumNous/new-api/releases/tag/v1.0.0-rc.49
* Docker image: https://hub.docker.com/r/calciumion/new-api
* Start script used by this template: https://github.com/aalfath/new-api-railway-template

### Implementation Details

**Sign in:** open the service's public URL and log in as `admin` (or the `ADMIN_USERNAME` you set). The password is the `ADMIN_PASSWORD` variable on the `new-api` service. You can change it later in your account settings. The variable is only read on the first start.

**Add a provider:** open the Channels page in the admin console, add a channel and paste your own provider key. New channels are picked up for routing within about 60 seconds. Then create a key under API Keys and call the gateway like OpenAI:

```bash
curl https://YOUR-DOMAIN.up.railway.app/v1/chat/completions \
  -H "Authorization: Bearer sk-YOUR-NEW-API-KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Hello"}]}'
```

**Defaults set by the template:** self-use mode is on, so models without a configured price still work. To start with it off instead, set `NEW_API_SELF_USE_MODE=false` before the first deploy. Public sign-up is off, and you can turn it back on in the admin system settings. `SESSION_SECRET` and `CRYPTO_SECRET` are generated. Keep them unchanged: they sign sessions and internal data, so changing them later signs everyone out.

**Version:** upstream has published only `v1.0.0` release candidates since v0.13.2 (April 2026), and its `latest` image points to them. This template pins v1.0.0-rc.49 by digest. 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.



## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/new-api-2
