
Deploy One API
Self Hosted LLM API management. Supports OpenAI, Claude, Gemini, and more.
one-api
Just deployed
/data
Deploy and Host One API on Railway
One API is a self-hosted LLM API management and key distribution system. It provides a unified interface to manage API keys from multiple providers such as OpenAI, Claude, Gemini, DeepSeek, and others, with built-in quota control and load balancing.
About Hosting One API on Railway
This template deploys One API using its default SQLite database for simplicity and ease of use. It is designed for quick deployment where users only need to set an admin password via the INIT_ROOT_PASSWORD environment variable before clicking deploy. The template is lightweight, requires minimal configuration, and is suitable for both personal use and small to medium production workloads. Railway automatically handles HTTPS, scaling, and monitoring.
Key Features of This Template
- Self-hosted LLM API gateway and key management
- Supports multiple providers (OpenAI, Claude, Gemini, DeepSeek, etc.)
- Simple deployment — user only needs to set admin password before deploy
- Uses SQLite by default (lightweight and no additional database required)
- Built-in quota management, key rotation, and usage tracking
- Easy to enable authentication on first deploy
- Production-ready with Railway's automatic scaling and HTTPS
Comparison with Alternatives
| Feature | This Template (One API on Railway) | Manual Self-Hosting | OpenRouter / LiteLLM Proxy | Custom Gateway |
|---|---|---|---|---|
| One-click deployment on Railway | ✅ Yes | ❌ No | ✅ Yes | ❌ No |
| Simple setup (no extra database) | ✅ Yes (SQLite default) | ❌ Manual | ✅ Yes | ❌ No |
| Simple admin password setup | ✅ Yes (INIT_ROOT_PASSWORD) | ❌ Complex | ✅ Limited | ❌ Complex |
| Multi-provider support | ✅ Excellent | ✅ Depends | ✅ Good | ✅ Depends |
| Quota & key management | ✅ Built-in | ❌ Manual | ✅ Yes | ❌ Manual |
| Automatic HTTPS & Scaling | ✅ Fully managed | ❌ Self-managed | ✅ Yes | ❌ Self-managed |
| Easy to self-host | ✅ Very easy | ❌ Difficult | ✅ Easy | ❌ Hard |
| Best for production workloads | ✅ Good | ❌ High maintenance | ⚠️ Limited control | ✅ Full control |
Common Use Cases
- Managing and distributing LLM API keys from multiple providers in one place
- Building internal LLM gateways with quota control and usage tracking
- Creating a unified API layer for teams or applications using different LLM providers
- Self-hosting an alternative to paid API management services
- Monitoring and rotating API keys to avoid rate limits and reduce costs
Dependencies for One API Hosting
- SQLite (default database - no additional setup required)
- (Optional) MySQL if you want to use external database instead of SQLite
Deployment Dependencies
- Official One API Docker image (
ghcr.io/songquanpeng/one-api:latest) - Environment variable
INIT_ROOT_PASSWORDfor initial admin setup
Implementation Details
This template is designed to be as simple as possible:
- Initial Admin Password: Set
INIT_ROOT_PASSWORDbefore deploying. This will be the password for therootuser on first login. - Database: Uses SQLite by default. No additional database service is needed.
- Default Login (after deployment):
- Username:
root - Password: The value you set in
INIT_ROOT_PASSWORD
- Username:
Important: After first login, immediately change the admin password from the dashboard for security.
Why Deploy One 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 One 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
INIT_ROOT_PASSWORD
