---
title: "Deploy GoModel AI Gateway"
description: "Fast open-source AI gateway: one OpenAI-compatible API for 20+ providers"
category: "AI/ML"
url: https://railway.com/deploy/gomodel-ai-gateway
---

# Deploy GoModel AI Gateway

Fast open-source AI gateway: one OpenAI-compatible API for 20+ providers

**[Deploy GoModel AI Gateway on Railway](https://railway.com/template/gomodel-ai-gateway)**

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

- **Creator:** Paul Zarudnev's Projects
- **Category:** AI/ML

## Template content

### gomodel

- **Source:** https://github.com/RockinPaul/gomodel_railway_template
- **Health check:** /health/ready
- **Public domain:** Yes

## Documentation

# Deploy and Host GoModel on Railway

[GoModel](https://github.com/ENTERPILOT/GoModel) is a fast, open-source AI gateway written in Go: one OpenAI- and Anthropic-compatible endpoint in front of OpenAI, Anthropic, Gemini, OpenRouter, Groq, xAI, DeepSeek, Ollama and 20+ other providers, with an admin dashboard for usage, costs, request logs, budgets, rate limits, managed API keys and an MCP gateway. It is a lightweight alternative to LiteLLM. This template deploys the official `enterpilot/gomodel:0.2.9` image as one service with a SQLite database on a persistent volume, and generates the master key that protects it. No inputs are needed.

## About Hosting GoModel

GoModel is a single static binary. On Railway it runs as one service behind a public HTTPS domain:

- **Auth from the first second.** The template generates `GOMODEL_MASTER_KEY` (48 characters). Model routes (`/v1/*`), provider passthrough routes, the admin API and `/mcp` answer 401 without it or a managed key. Only `/health`, `/health/ready`, `/version` and the dashboard's static sign-in shell are public. Do not delete the variable: with no master key, GoModel runs without authentication.
- **Providers are added in the dashboard**, so the deploy asks for nothing. Open `https://YOUR-DOMAIN/admin/dashboard`, sign in with the master key, and add provider credentials there. They are stored encrypted at rest with a generated `GOMODEL_ENCRYPTION_KEY`. You can also set provider variables such as `OPENAI_API_KEY` or `ANTHROPIC_API_KEY` on the service instead.
- **Persistent state.** The SQLite database (request logs, usage, managed keys, budgets, dashboard-managed providers) and captured media live on a 1 GB volume at `/app/data`, so they survive redeploys.

**First login:** in Railway, open the `gomodel` service → Variables → copy `GOMODEL_MASTER_KEY`. Use it as the bearer token for API calls, and paste it into the dashboard's sign-in. Then create managed API keys for your apps rather than handing out the master key.

```bash
curl https://YOUR-DOMAIN/v1/chat/completions \
  -H "Authorization: Bearer YOUR-MASTER-OR-MANAGED-KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Hello"}]}'
```

## Common Use Cases

- One endpoint and one key for every app and coding agent (Claude Code, Codex, OpenCode, Cursor), with provider keys kept server-side.
- Cost and usage tracking per key, per user path or per label, with budgets and rate limits.
- Virtual models with fallbacks and load balancing across providers.
- Central request logs and live logs for debugging LLM features.
- An MCP gateway that exposes upstream MCP servers behind the same auth.

## Dependencies for GoModel Hosting

- A Railway account. The gateway is a single Go binary with a small memory footprint.
- At least one model provider account (OpenAI, Anthropic, Gemini, OpenRouter, a local Ollama, …), added after deploy.

### Deployment Dependencies

- [GoModel on GitHub](https://github.com/ENTERPILOT/GoModel) (MIT)
- [GoModel documentation](https://gomodel.enterpilot.io/docs)
- [Official Docker image](https://hub.docker.com/r/enterpilot/gomodel)
- [This template's repository](https://github.com/RockinPaul/gomodel_railway_template)

### Implementation Details

- **Service `gomodel`**: built from the template repo's `Dockerfile`, which is `FROM enterpilot/gomodel:0.2.9` plus three settings. It listens on port 8080 (IPv4 and IPv6). Healthcheck `/health/ready`. Restart policy: always.
- **Root user:** the image is distroless (no shell) and normally runs as uid 65532, but Railway volumes are root-owned. The wrapper runs the binary as root so it can write the volume.
- **Volume:** `/app/data`, 1 GB. It holds `gomodel.db` (SQLite) and `media/`. Grow it from the service's volume settings if you log large bodies. Volumes can grow but never shrink.
- **Variables:**
  - `GOMODEL_MASTER_KEY` = generated 48 characters.
  - `GOMODEL_ENCRYPTION_KEY` = generated 48 characters. Keep it: losing it makes dashboard-saved provider credentials unrecoverable.
- **Request bodies are logged by default** (upstream default, kept 30 days in the SQLite request log). Set `LOGGING_LOG_BODIES=false` on the service before real traffic if prompts may hold sensitive data.
- **Metrics:** if you enable Prometheus (`METRICS_ENABLED=true`), also set `METRICS_REQUIRE_AUTH=true`, or `/metrics` is public.
- **Postgres, Redis or MongoDB** are optional upstream features for multi-instance setups, response caching and high-volume logging. They are not included. Add them and set `STORAGE_TYPE`, `POSTGRES_URL` or `REDIS_URL` if you need them.
- **Upgrading:** the template repo pins the image by tag. Redeploying from an updated template repo upgrades in place; take a volume backup first.

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


## 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/gomodel-ai-gateway
