Deploy Magpie AI Gateway

Magpie AI gateway + Web UI, one HTTPS domain and persistent storage

Deploy Magpie AI Gateway

Just deployed

/config

Deploy and Host Magpie AI Gateway on Railway

Deploy Magpie on Railway to manage your AI model providers and serve them through a shared API endpoint. Configure providers, accounts and routing groups in the Web UI, then connect your AI tools and applications to the gateway.

About Hosting Magpie AI Gateway

The template includes one service, persistent storage at /config, an automatically generated management key and a healthcheck. The Web UI and model API share one HTTPS domain.

Magpie supports OpenAI, Anthropic and Gemini API formats, including streaming responses. Available models depend on the providers and accounts you configure.

Common Use Cases

  • Connect multiple AI tools to a shared model gateway.
  • Manage provider credentials and routing groups in one place.
  • Give applications a compatible API endpoint for different model providers.
  • Use a cloud-hosted Magpie gateway from a local Magpie installation.

Dependencies for Magpie AI Gateway Hosting

  • A Railway workspace to deploy the service and persistent Volume.
  • Your own model-provider credentials or subscription account.
  • An AI client that accepts a configurable Base URL and API key.

Getting started

1. Deploy the template

Deploy the template to your Railway workspace and wait for the service to become Online.

The template configures the service, public HTTPS endpoint and persistent Volume automatically.

2. Open the Web UI

Open the service’s Variables tab in Railway and copy MAGPIE_WEB_KEY.

Find the generated domain under Networking, then open:

https://YOUR-DOMAIN/?k=YOUR-WEB-KEY

Replace YOUR-DOMAIN with your Railway domain and YOUR-WEB-KEY with the value of MAGPIE_WEB_KEY.

Magpie exchanges the key for a browser session cookie. Keep this key private: it grants access to the management interface.

3. Add a model provider

In Providers, add a provider and enter its credentials. Select the models you want to use.

The provider’s endpoint must be reachable from Railway. For a local model server, configure an address that the Railway service can access.

4. Create a Gateway Key

Open Gateway → Gateway keys and create a key for your client.

Use this Gateway Key as the client’s API key. MAGPIE_WEB_KEY is for management access; model API requests use Gateway Keys.

5. Connect your client

Configure your client with the appropriate Base URL:

Client APIBase URL
OpenAI-compatiblehttps://YOUR-DOMAIN/gateway/v1
Anthropic-compatiblehttps://YOUR-DOMAIN/gateway
Gemini-compatiblehttps://YOUR-DOMAIN/gateway, with requests targeting /v1beta beneath this base

Use a model ID listed by your gateway, such as provider/model, or a configured routing group.

For an OpenAI-compatible client:

Base URL: https://YOUR-DOMAIN/gateway/v1
API key: YOUR-GATEWAY-KEY
Model: YOUR-PROVIDER/YOUR-MODEL

You can also add the deployment as a Remote Magpie provider in your local Magpie installation. Use https://YOUR-DOMAIN/gateway as the address and supply a Gateway Key.

Subscription accounts

Subscription providers require their own sign-in through Magpie.

Some OAuth flows redirect your browser to a localhost callback address. For these flows, copy the complete callback URL from your browser and paste it into Magpie’s callback field.

Claude subscriptions require installing Claude Code through Magpie’s supported installation flow. Availability depends on each provider’s authentication requirements.

Persistent storage

The template mounts a Railway Volume at /config. It retains:

  • Provider settings and credentials.
  • Gateway Keys and routing groups.
  • Saved account sign-ins.
  • Plugins and caches.
  • Usage records.

Keep the service at one replica. Back up the Volume before upgrading or making major configuration changes. Deployments with an attached Volume may briefly interrupt service.

Updates

The template pins Magpie to version 0.1.1203.

To upgrade, update the Magpie image version in the repository’s Dockerfile and redeploy. Keep the existing /config Volume attached to preserve your configuration.

Costs

Railway charges for the service’s resource usage and persistent storage. Model providers may charge separately or require a subscription.

The template does not include model-provider credentials or inference credits. Add your own provider credentials after deployment.

Verification

The deployment has been tested on Railway for:

  • Startup and healthchecks.
  • Web UI login.
  • Gateway Key authentication.
  • Model request forwarding.
  • SSE streaming responses.
  • Configuration and key persistence across redeployments.

Model-response tests used a deterministic test upstream. Paid model inference and subscription sign-in have not been tested.

Why Deploy Magpie AI Gateway on Railway?

The template configures the service, public HTTPS endpoint and persistent Volume automatically. Manage providers in the Web UI and connect your clients through the shared gateway endpoint.

Links


Template Content

More templates in this category

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

okisdev
116
View Template
stella
Self-host stella with web, API, Postgres, Redis, and object storage.

Jan Kubica
7
View Template
Hermes Agent | OpenClaw Alternative with Dashboard
Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

codestorm
85