---
title: "Deploy One API"
description: "Self Hosted LLM API management. Supports OpenAI, Claude, Gemini, and more."
category: "Other"
url: https://railway.com/deploy/one-api
---

# Deploy One API

Self Hosted LLM API management. Supports OpenAI, Claude, Gemini, and more.

**[Deploy One API on Railway](https://railway.com/template/one-api)**

- **Creator:** codestorm
- **Category:** Other
- **Total deploys:** 4

## Template content

### one-api https://raw.githubusercontent.com/songquanpeng/one-api/main/web/default/public/logo.png

- **Image:** ghcr.io/songquanpeng/one-api:latest
- **Public domain:** Yes

## Documentation

# 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.

![One-API](https://opengraph.githubassets.com/4a3fa291732195ae8467266dd5a49902a29d66a2efa92dcdd854c9c7a7e035f3/songquanpeng/one-api)

## 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_PASSWORD` for initial admin setup

### Implementation Details
This template is designed to be as simple as possible:

- **Initial Admin Password**: Set `INIT_ROOT_PASSWORD` before deploying. This will be the password for the `root` user 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`

> **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.

## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — [Jul'26] Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

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