---
title: "Deploy Bifrost"
description: "Fast Go LLM gateway with dashboard, virtual keys, budgets and fallbacks"
category: "AI/ML"
url: https://railway.com/deploy/bifrost-2
---

# Deploy Bifrost

Fast Go LLM gateway with dashboard, virtual keys, budgets and fallbacks

**[Deploy Bifrost on Railway](https://railway.com/template/bifrost-2)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/bifrost-2/manifest.json

- **Creator:** Protemplate
- **Category:** AI/ML
- **Total deploys:** 2

## Template content

### Bifrost https://avatars.githubusercontent.com/u/139708451?v=4

- **Image:** maximhq/bifrost:v2.1.1
- **Health check:** /health
- **Public domain:** Yes

## Documentation

# Deploy and Host Bifrost on Railway

Bifrost is an open-source LLM gateway written in Go. It puts one OpenAI-compatible endpoint in front of OpenAI, Anthropic, Bedrock, Vertex, Azure, Mistral, Groq, Ollama and more, with a built-in dashboard for providers, virtual keys, budgets, fallbacks, semantic caching, MCP tools, and request logs.

## About Hosting Bifrost

Hosting Bifrost is a single container. This template uses the official `maximhq/bifrost:v2.1.1` image with a Railway volume mounted at `/app/data`, which is where Bifrost keeps its SQLite configuration store and request logs, the same layout as the upstream Docker Compose example. `PORT` and `APP_PORT` are pinned to 8080 so Railway's healthcheck hits `/health` on the right port, `APP_HOST` is `::` so other Railway services can reach it over IPv6 private networking, and `RAILWAY_RUN_UID=0` works around the image's non-root user against Railway's root-owned volumes. An encryption key and a one-time setup token are generated for you.

## Common Use Cases

- **Unified LLM API**: one base URL for every provider, with `provider/model` naming
- **Drop-in SDK replacement**: point the OpenAI, Anthropic, or GenAI SDK at `/openai`, `/anthropic`, or `/genai`
- **Virtual keys and budgets**: per-team or per-app keys with spend and rate limits
- **Fallbacks and load balancing**: retry across keys, models, and providers
- **Observability**: request logs in the dashboard, Prometheus `/metrics`, OTel export
- **Private gateway for other Railway services**: keep provider keys off your app containers

## Dependencies for Bifrost Hosting

- **Railway volume** at `/app/data` (included)
- **Provider API keys**: optional at boot; `OPENAI_API_KEY` / `ANTHROPIC_API_KEY` are auto-registered on first boot, or add any provider in the dashboard
- **No database service required**: SQLite is the OSS default. PostgreSQL 16+ is an optional alternative

### Deployment Dependencies

- [Bifrost deployment requirements](https://docs.getbifrost.ai/deployment-guides/runtime-contract)
- [Bifrost on Railway (upstream guide)](https://docs.getbifrost.ai/deployment-guides/platforms/railway)
- [Setting up auth](https://docs.getbifrost.ai/quickstart/gateway/setting-up-auth)
- [Bifrost GitHub repository](https://github.com/maximhq/bifrost)

### Implementation Details

The image entrypoint runs `/app/main -app-dir "$APP_DIR" -port "$APP_PORT" -host "$APP_HOST"`, so no custom start command is needed. Key variables:

```env
PORT=8080
APP_PORT=8080
APP_HOST=::
APP_DIR=/app/data
RAILWAY_RUN_UID=0
BIFROST_ENCRYPTION_KEY=${{secret(64,"abcdef0123456789")}}
BIFROST_SETUP_TOKEN=${{secret(32)}}
```

**First steps after deploy**

1. Wait for `/health` to return `{"status":"ok"}`.
2. Open the dashboard at your Railway domain.
3. Go to **Workspace → Config → Security**, turn on **Password protect the dashboard**, set a username and password, and paste the `BIFROST_SETUP_TOKEN` value into **Setup token**. Until you do this the dashboard is open to anyone with the URL.
4. Add a provider and create a virtual key, then send requests with the `x-bf-vk` header.

Never rotate `BIFROST_ENCRYPTION_KEY` after first boot; stored secrets become unreadable. Keep one replica: SQLite is single-process and Railway volumes do not support replicas.

## Why Deploy Bifrost 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 Bifrost on Railway, you get a pinned, health-checked LLM gateway with persistent storage, generated secrets, managed SSL, and private networking to the rest of your Railway project.


## 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/bifrost-2
