Deploy GoModel AI Gateway

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

Deploy GoModel AI Gateway

/app/data

Deploy and Host GoModel on Railway

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.

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

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.


Template Content

More templates in this category

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

okisdev
118
View Template
Weaviate
Vector database with hybrid search and an API key-protected API

GitHub Locker
1
View Template
Möbius Personal AI OS
Self-hosted AI agent that builds and runs apps for you, with memory.

Tracklayer
6