Deploy LiteLLM | (Just Updated) AI Gateway, Add Models in the UI, Zero Required Keys

LiteLLM AI gateway. Keys auto-set, add models in UI, saved in Postgres

Deploy LiteLLM | (Just Updated) AI Gateway, Add Models in the UI, Zero Required Keys

Just deployed

/var/lib/postgresql

Deploy and Host LiteLLM on Railway

LiteLLM is an open-source AI gateway: one OpenAI-compatible endpoint in front of 100+ model providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, OpenRouter, Ollama and more), with virtual API keys, spend tracking, budgets, rate limits, fallbacks and an admin dashboard.

This template runs LiteLLM v1.104 from the official litellm-database image (pinned by digest) next to a Postgres 17 service with a Railway volume. Nothing has to be typed into the deploy form.

About Hosting LiteLLM

  • No required fields. The master key, the encryption salt key and the dashboard password are generated per deploy. You do not paste provider keys or a config YAML at deploy time; add models and provider keys in the dashboard afterwards.
  • Models and keys live in Postgres. The start command turns on STORE_MODEL_IN_DB, so every model, virtual key and budget you create in the dashboard is stored in the database and survives redeploys and restarts. Provider keys are encrypted at rest with the generated LITELLM_SALT_KEY; do not change that variable after you add your first model, or the stored keys can no longer be decrypted.
  • Locked from the first request. Every API call needs the master key or a virtual key you issued, and the dashboard login is admin plus the generated UI_PASSWORD. Anonymous calls get 401.
  • Waits for its database. The start command waits for Postgres on the private network before starting, so a first deploy does not fail because the two services booted in a different order.
  • Healthcheck on /health/readiness, which reports the database connection.

Common Use Cases

  • One OpenAI-compatible base URL for every app and agent, so switching provider is a dashboard change
  • Per-team and per-project virtual keys with budgets and rate limits
  • Fallbacks and load balancing across providers and deployments
  • Spend and usage tracking for LLM calls across a team

Dependencies for LiteLLM Hosting

  • A Postgres service (created by the template) with one Railway volume

Deployment Dependencies

Implementation Details

VariablePurpose
LITELLM_MASTER_KEYAdmin API key (starts with sk-), generated per deploy. Send it as Authorization: Bearer ....
LITELLM_SALT_KEYEncrypts provider keys stored in Postgres. Generated per deploy; never change it afterwards.
UI_PASSWORDPassword for the dashboard at /ui, user admin (set UI_USERNAME to change the user).

Python:

from openai import OpenAI

client = OpenAI(base_url="https://", api_key="")
client.chat.completions.create(model="<a>", messages=[{"role": "user", "content": "hi"}])

Why Deploy LiteLLM 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 LiteLLM 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

More templates in this category

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

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

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

codestorm
84