---
title: "Deploy New API | AI Gateway for OpenAI, Claude and Gemini (One API Fork)"
description: "New API LLM gateway: one key for OpenAI, Claude, Gemini; usage and quotas"
category: "AI/ML"
url: https://railway.com/deploy/new-api-gateway
---

# Deploy New API | AI Gateway for OpenAI, Claude and Gemini (One API Fork)

New API LLM gateway: one key for OpenAI, Claude, Gemini; usage and quotas

**[Deploy New API | AI Gateway for OpenAI, Claude and Gemini (One API Fork) on Railway](https://railway.com/template/new-api-gateway)**

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

- **Creator:** Two Workspaces
- **Category:** AI/ML
- **Total deploys:** 1

## Template content

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

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### New API https://raw.githubusercontent.com/two-workspaces/new-api/main/icon.png

- **Source:** https://github.com/two-workspaces/new-api
- **Health check:** /api/status
- **Public domain:** Yes

## Documentation

# Deploy and Host New API on Railway

[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/new/template/new-api-gateway?referralCode=sLjDXb&utm_medium=integration&utm_source=button&utm_campaign=new-api-gateway)

[New API](https://github.com/QuantumNous/new-api) is the open-source AI gateway: one OpenAI-, Claude- and Gemini-compatible endpoint in front of 40+ providers (OpenAI, Anthropic, Google, Azure, AWS Bedrock, DeepSeek, OpenRouter, Ollama and more). You add provider keys once as channels, then hand out your own API keys with quotas, model limits and usage tracking. It grew out of One API. This template runs a pinned New API release on Postgres, with your admin account created on first boot.

## About Hosting New API

Two services: New API and Postgres, which holds users, keys, channels, logs and usage.

New API ships with its setup page open, and whoever fills it in first becomes the root user. On a public domain that could be a stranger. This template claims setup the moment the server starts, using `NEW_API_ADMIN_USERNAME` and `NEW_API_ADMIN_PASSWORD`, and turns off public sign-up, so only accounts you create can use your gateway.

## Common Use Cases

- One API key for your apps and agents across OpenAI, Claude, Gemini and open models, with fallback between providers
- Sharing model access with a team or customers, each with their own key, quota and model list
- Tracking spend per key, user and model in one dashboard
- Pointing tools that only speak the OpenAI API (or only the Claude API) at any provider

## Dependencies for New API Hosting

- API keys for the model providers you want to route to, added in New API as channels.

### Deployment Dependencies

- [New API on GitHub](https://github.com/QuantumNous/new-api)
- [New API docs](https://docs.newapi.ai/en/docs)
- [Template source on GitHub](https://github.com/two-workspaces/new-api)

### Implementation Details

**First use:**

1. Open the New API service's domain once it's green.
2. Log in as `root` (or your `NEW_API_ADMIN_USERNAME`) with `NEW_API_ADMIN_PASSWORD` from the Variables tab.
3. Under **Channels**, add a provider and its API key.
4. Under **Tokens**, create a key, then call your gateway:

```bash
curl https://‹your-domain›/v1/chat/completions \
  -H "Authorization: Bearer sk-‹your token›" -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Hello"}]}'
```

Any OpenAI SDK works with `base_url = https://‹your-domain›/v1`. Claude-style clients use `https://‹your-domain›` with the same key.

**Sign-up:** public registration starts off. Create users under **Users**, or turn sign-up back on under **Settings** if you run a public gateway.

**Redis:** not needed for one instance; `MEMORY_CACHE_ENABLED` caches keys and channels in memory. Add a Redis service and set `REDIS_CONN_STRING` if you scale New API to several replicas.

Notes and limits:

- The admin variables only matter on first boot. Change the password in New API afterwards; changing the variable later does nothing.
- Keep `CRYPTO_SECRET` and `SESSION_SECRET` unchanged. A new `SESSION_SECRET` logs everyone out.
- About 40 MB of RAM for New API and 90 MB for Postgres at idle.
- Each template update pins a newer New API release. Back up Postgres (Railway backups) before updating.

## 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 v0.1 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-gateway
