---
title: "Deploy LiteLLM (Self-Hosted AI Gateway)"
description: "Self-hosted LLM proxy for any model, with keys, budgets, and usage logs."
category: "AI/ML"
url: https://railway.com/deploy/litellm-self-hosted-ai-gateway
---

# Deploy LiteLLM (Self-Hosted AI Gateway)

Self-hosted LLM proxy for any model, with keys, budgets, and usage logs.

**[Deploy LiteLLM (Self-Hosted AI Gateway) on Railway](https://railway.com/template/litellm-self-hosted-ai-gateway)**

- **Creator:** Nick K's Projects
- **Category:** AI/ML

## Template content

### postgres

- **Image:** postgres:16

### litellm

- **Image:** ghcr.io/berriai/litellm:v1.97.0
- **Public domain:** Yes

## Documentation

# Deploy and Host LiteLLM on Railway

LiteLLM is an open-source AI gateway that puts 100+ LLM providers — OpenAI, Anthropic, Google, Azure, Bedrock, local models, and more — behind a single OpenAI-compatible API. Instead of wiring each app to a different provider SDK, you point everything at LiteLLM and manage virtual API keys, per-team budgets, rate limits, fallbacks, and full request logging from one dashboard. This template deploys the LiteLLM proxy backed by a managed PostgreSQL database, so keys, teams, models, and spend are stored durably and managed from the built-in Admin UI. It boots ready to use with no model pre-configuration required. [Updated August '26]

## About Hosting LiteLLM

LiteLLM runs as a stateless proxy that stores all of its configuration — virtual keys, teams, models, and usage logs — in PostgreSQL. This template provisions the proxy plus a dedicated Postgres database, connected over Railway's private network, and runs the database migrations automatically on first boot. A master key and salt key are auto-generated, and the Admin UI is available at /ui immediately after deploy. You add your provider API keys and models through the UI — nothing needs to be configured before the first deploy.

## Common Use Cases

- Running a single OpenAI-compatible endpoint in front of many LLM providers for all your apps
- Issuing scoped virtual API keys with per-team budgets, rate limits, and spend tracking
- Centralizing LLM request logging, fallbacks, and load balancing across models

## Dependencies for LiteLLM Hosting

- A PostgreSQL database (included as a service in this template) for keys, teams, and logs
- At least one upstream LLM provider API key (OpenAI, Anthropic, etc.), added via the Admin UI after deploy

## Why Deploy LiteLLM on Railway?

Railway provisions the LiteLLM proxy and its PostgreSQL database in one click, with private networking and a public domain already wired up. Prisma migrations run automatically on boot, and the master key, salt key, and admin password are generated for you — so you land on a working Admin UI instead of a config error. Add your provider keys, then scale the gateway up as your traffic grows, all from a single dashboard.

## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [stella](https://railway.com/deploy/stella) — Self-host stella with web, API, Postgres, Redis, and object storage.
- [Hermes Agent | OpenClaw Alternative with Dashboard](https://railway.com/deploy/hermes-agent-or-openclaw-alternative-wit) — Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

Open this page in a browser: https://railway.com/deploy/litellm-self-hosted-ai-gateway
