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
Just deployed
/var/lib/postgresql/data
New API
Just deployed
Deploy and Host New API on Railway
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
Implementation Details
First use:
- Open the New API service's domain once it's green.
- Log in as
root(or yourNEW_API_ADMIN_USERNAME) withNEW_API_ADMIN_PASSWORDfrom the Variables tab. - Under Channels, add a provider and its API key.
- Under Tokens, create a key, then call your gateway:
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_SECRETandSESSION_SECRETunchanged. A newSESSION_SECRETlogs 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.
Template Content

