Railway

Deploy GPT Load

Distribute requests and load balance multiple GPT API keys

Deploy GPT Load

/var/lib/postgresql/data

Just deployed

/data

Just deployed

/app/data

Deploy and Host GPT-Load on Railway

GPT-Load is a high-performance proxy and API management tool designed to distribute traffic across multiple OpenAI-compatible and LLM service providers. It offers request load balancing, detailed token usage tracking, and persistent configuration management. It is built for developers, teams, and service providers who need reliable API access management and failover support.

About Hosting GPT-Load

Hosting GPT-Load on Railway provides an isolated and scalable environment to manage and route your AI traffic. Railway automatically builds and deploys the container using the official prebuilt Docker image or repository configuration. The deployment requires internal listening on port 3001 with HTTP public networking exposed via a generated Railway domain.

Persistent storage is essential to retain SQLite configuration data and log files across service restarts. For enhanced multi-node or high-availability setups, GPT-Load can optionally integrate with Railway PostgreSQL and Redis services. Railway manages automatic SSL certificate generation, domain routing, and environment variable injection to streamline the infrastructure setup.

Common Use Cases

  • API Traffic Load Balancing: Distribute incoming completion and chat requests across multiple API keys or providers to prevent rate limits and ensure maximum uptime.
  • Centralized API Management: Unify access keys, monitor request volumes, and manage administrative settings through a single dashboard interface.
  • LLM Gateway Proxy: Serve as an intermediary gateway between frontend applications and backend LLM providers with customizable request timeouts and CORS settings.

Dependencies for GPT-Load Hosting

DependencyTypeRequirementDescription
Railway VolumeStorageRequiredPersists local database configurations, logs, and application state at /app/data.
PostgreSQLDatabaseOptionalReplaces default SQLite database for centralized data storage.
RedisIn-Memory CacheOptionalHandles high-concurrency state caching and distributed session management.

Deployment Dependencies

Implementation Details

Docker

The application deploys using the official Docker image:

ghcr.io/tbphp/gpt-load:latest

Railway automatically handles deployment when referencing this image.

Public Networking

SettingValue
Proxy TypeHTTP Proxy
Target Port3001

Generate a public domain under Service Settings → Networking → Generate Domain.

Environment Variables

VariableRequiredDescription
AUTH_KEYYesSecret password required to secure administrative API and management UI.
PORTYesInternal HTTP listening port (default: 3001).
HOSTYesInterface binding address for Railway (default: 0.0.0.0).
DATABASE_DSNNoPostgreSQL connection string (${{Postgres.DATABASE_URL}}). Uses SQLite if empty.
REDIS_DSNNoRedis connection string (${{Redis.REDIS_URL}}).
ALLOW_CREDENTIALSNoToggles credential allowance for CORS requests (default: false).
ALLOWED_HEADERSNoAllowed CORS headers (default: *).
ALLOWED_METHODSNoAllowed CORS HTTP methods (default: GET,POST,PUT,DELETE,OPTIONS).
ALLOWED_ORIGINSNoAllowed CORS origin patterns (default: *).
ENABLE_CORSNoEnables cross-origin resource sharing (default: true).
IS_SLAVENoToggles execution in slave node mode (default: false).
LOG_ENABLE_FILENoEnables logging to file storage (default: true).
LOG_FILE_PATHNoOutput path for log files (default: ./data/logs/app.log).
LOG_FORMATNoLog output format type (default: text).
LOG_LEVELNoLevel of logging detail (default: info).
MAX_CONCURRENT_REQUESTSNoMaximum allowed concurrent requests limit (default: 100).
SERVER_GRACEFUL_SHUTDOWN_TIMEOUTNoGraceful server shutdown timeout window in seconds (default: 10).
SERVER_IDLE_TIMEOUTNoMaximum connection idle duration in seconds (default: 120).
SERVER_READ_TIMEOUTNoMaximum request read duration in seconds (default: 60).
SERVER_WRITE_TIMEOUTNoMaximum response write duration in seconds (default: 600).
TZNoTimezone configuration (default: Asia/Shanghai).
AUTH_KEY=your_secure_admin_key_here
PORT=3001
HOST=0.0.0.0
ALLOW_CREDENTIALS=false
ALLOWED_HEADERS=*
ALLOWED_METHODS=GET,POST,PUT,DELETE,OPTIONS
ALLOWED_ORIGINS=*
ENABLE_CORS=true
IS_SLAVE=false
LOG_ENABLE_FILE=true
LOG_FILE_PATH=./data/logs/app.log
LOG_FORMAT=text
LOG_LEVEL=info
MAX_CONCURRENT_REQUESTS=100
SERVER_GRACEFUL_SHUTDOWN_TIMEOUT=10
SERVER_IDLE_TIMEOUT=120
SERVER_READ_TIMEOUT=60
SERVER_WRITE_TIMEOUT=600
TZ=Asia/Shanghai

Persistent Storage

Persistent storage is required to store SQLite data and application logs.

  1. Open your Railway Service.
  2. Go to SettingsVolumes.
  3. Click Add Volume.
  4. Set the Mount Path:
/app/data

Database

  • SQLite (Default): Enabled automatically when DATABASE_DSN is empty. Stores data inside /app/data.
  • PostgreSQL (Optional): Add a PostgreSQL plugin to your Railway project and set DATABASE_DSN=${{Postgres.DATABASE_URL}}.
  • Redis (Optional): Add a Redis plugin to your Railway project and set REDIS_DSN=${{Redis.REDIS_URL}}.

Build & Start

No custom build or start commands are required.

Accessing the Application

  1. Open Service SettingsNetworking and click Generate Domain.
  2. Access the dashboard via the generated Railway URL (e.g., https://.up.railway.app).
  3. Log in to the management interface using the password configured in AUTH_KEY.
  4. Navigate to System Settings and update the project address field with your public Railway URL.

Why Deploy GPT-Load on Railway?

Railway provides a seamless platform for deploying web applications, databases, and microservices with zero configuration. Featuring automatic SSL provisioning, integrated environment variable management, instant database deployments, and continuous delivery from source code repositories or Docker images, Railway reduces infrastructure overhead so developers can focus entirely on building software.


Template Content

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
113
View Template
stella
Self-host stella with web, API, Postgres, Redis, and object storage.

Jan Kubica
1
View Template
Hermes Agent | OpenClaw Alternative with Dashboard
Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

codestorm
56