---
title: "Deploy Antirion"
description: "Deploy Antirion on Railway. Official AI gateway image. Always latest."
category: "AI/ML"
url: https://railway.com/deploy/antirion
---

# Deploy Antirion

Deploy Antirion on Railway. Official AI gateway image. Always latest.

**[Deploy Antirion on Railway](https://railway.com/template/antirion)**

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

- **Creator:** RBR Digital
- **Category:** AI/ML
- **Total deploys:** 3

## Template content

### Caddy Port (for API) https://cdn-icons-png.flaticon.com/512/11152/11152993.png

- **Source:** douglasrubims/railway-second-port
- **Public domain:** Yes

### Antirion https://raw.githubusercontent.com/eliasbiondo/antirion/main/console/public/icon.svg

- **Image:** eliasbiondo/antirion:latest
- **Health check:** /-/readyz
- **Public domain:** Yes

## Documentation

# Deploy and Host Antirion on Railway

[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/deploy/antirion?referralCode=9uHSFr&utm_medium=integration&utm_source=template&utm_campaign=generic)

Antirion is an open-source AI gateway: one Rust binary, with the admin console built in, between your apps and every model provider. Point official SDKs at a single URL, then route, budget, guard, and log calls to OpenAI, Anthropic, Gemini, Bedrock, and many others. A standalone node keeps state in an embedded store—no PostgreSQL or Valkey required.

## About Hosting Antirion

This template runs the official image (`eliasbiondo/antirion:latest`) with one volume at `/var/lib/antirion`. A new deploy or rebuild pulls the newest release rather than a pinned third-party image. It gives each plane its own HTTPS domain:

- **Console domain** (Antirion, port 8081): the admin console and Admin API. The console lives at **`/ui/`**, so open `https://<console-domain>/ui/`. The root path returns a `not_found` JSON, which is expected.
- **API domain** (a small Caddy service, port 3000, proxying Antirion's private port 8080): the `/v1` data plane your apps and SDKs call.

The image is distroless and runs as UID 65532. The bootstrap token is set as a Railway variable so you can copy it from the Variables tab.

## Common Use Cases

- Point apps at one OpenAI-, Anthropic-, Gemini-, or Bedrock-compatible URL and route to many providers
- Issue virtual keys per app or team, with rate limits and dollar or token budgets
- Keep traffic up with fallback chains, least-latency or least-cost routing, retries, and circuit breakers
- Watch spend and the request log per key, team, and model, with alerts before a budget runs out
- Screen prompts and responses for PII, secrets, and other guardrails, with format-preserving redaction

## Dependencies for Antirion Hosting

- Official Docker image `eliasbiondo/antirion:latest` (amd64 and arm64)
- One persistent volume mounted at `/var/lib/antirion` (embedded store, spool, generated encryption key)
- A Caddy service that exposes the data plane on its own domain
- No PostgreSQL or Valkey in standalone mode (this template)
- Your own provider API keys, added in the console after deploy (stored encrypted on the volume)
- Optional: SMTP (`ANTIRION_SMTP_*`) for invites, password resets, and email alerts

### Deployment Dependencies

- [Antirion](https://antirion.ai)
- [Getting started](https://github.com/eliasbiondo/antirion/blob/main/docs/getting-started.md)
- [Antirion GitHub](https://github.com/eliasbiondo/antirion)
- [Antirion on Docker Hub](https://hub.docker.com/r/eliasbiondo/antirion)
- [Railway Documentation](https://docs.railway.app)

### Implementation Details

**Environment variables (Antirion service):**

| Variable | Value | Notes |
|----------|-------|-------|
| `ANTIRION_BOOTSTRAP_TOKEN` | `${{secret(48, "abcdef0123456789")}}` | Paste this into the console's **Admin token** field. It is also the Admin API bearer token. |
| `ANTIRION_PUBLIC_ORIGIN` | `https://${{RAILWAY_PUBLIC_DOMAIN}}` | The console domain. Cookie-authenticated console writes must come from this origin. |
| `ANTIRION_DATA_PLANE_URL` | *(set after deploy)* | Optional. The API domain, used only in the console's code examples. |

`ANTIRION_ENCRYPTION_KEY` is optional (base64 of 32 random bytes, `openssl rand -base64 32`). If unset, the gateway generates one into the volume. Back up the volume either way: stored provider keys cannot be read without that key. Optional SMTP: `ANTIRION_SMTP_HOST`, `ANTIRION_SMTP_PORT`, `ANTIRION_SMTP_TLS`, `ANTIRION_SMTP_USERNAME`, `ANTIRION_SMTP_PASSWORD`, `ANTIRION_SMTP_FROM`.

**Health check:** `GET /-/readyz` on port 8081, no credential needed.

**First run:**

1. Wait until both services are healthy.
2. Open the console at **`https://<console-domain>/ui/`** (don't forget `/ui/`) and paste `ANTIRION_BOOTSTRAP_TOKEN` from the Variables tab into **Admin token**.
3. Optional: copy the API domain from the Caddy service and set it as `ANTIRION_DATA_PLANE_URL` on the Antirion service so the console shows the right URL in its examples.
4. Add a provider with your LLM API key, then a model that points at it.
5. Create a virtual key for the app or team (it is shown once).
6. Point your SDK at the **API domain**:

```bash
curl -s https://<api-domain>/v1/chat/completions \
  -H "Authorization: Bearer sk-antirion-…" -H 'Content-Type: application/json' \
  -d '{"model": "chat", "messages": [{"role": "user", "content": "Hello"}]}'
```

`/v1/responses`, `/v1/messages`, `/v1/embeddings`, and Gemini and Bedrock paths are supported too.

## Why Deploy Antirion 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 Antirion 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.

This template uses the official `latest` tag and a single `/var/lib/antirion` volume for a standalone node.

---

## Template Author

Created and maintained by **Douglas Rubim**.

GitHub: https://github.com/douglasrubims

## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/antirion
