---
title: "Deploy OpenMonetize"
description: "Open-source AI usage metering and billing platform."
category: "AI/ML"
url: https://railway.com/deploy/openmonetize
---

# Deploy OpenMonetize

Open-source AI usage metering and billing platform.

**[Deploy OpenMonetize on Railway](https://railway.com/template/openmonetize)**

- **Creator:** om-founder's Projects
- **Category:** AI/ML

## Template content

### API Gateway https://i.imgur.com/yEl7v03.jpeg

- **Source:** https://github.com/openmonetize/openmonetize
- **Start command:** `npm run start:api`
- **Health check:** /health
- **Public domain:** Yes

### Rating Engine https://i.imgur.com/yEl7v03.jpeg

- **Source:** https://github.com/openmonetize/openmonetize
- **Start command:** `npm run start:rating`

### Dashboard https://i.imgur.com/yEl7v03.jpeg

- **Source:** https://github.com/openmonetize/openmonetize
- **Start command:** `npm start --workspace=dashboard`
- **Health check:** /health
- **Public domain:** Yes

### Ingestion Service https://i.imgur.com/yEl7v03.jpeg

- **Source:** https://github.com/openmonetize/openmonetize
- **Start command:** `npm run start:ingestion`

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2.1
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:17

## Documentation

# Deploy and Host OpenMonetize on Railway

OpenMonetize is an open-source, offline-first AI monetization infrastructure. It provides precise token metering, real-time credit management, and usage-based billing for LLM applications. It supports major providers like OpenAI and Anthropic, enabling developers to easily monetize their AI products with a drop-in SDK and comprehensive dashboard.

## About Hosting OpenMonetize

Hosting OpenMonetize involves deploying a set of microservices and data stores. The architecture consists of an API Gateway for handling requests, a high-throughput Ingestion Service for tracking usage events, and a Rating Engine for calculating costs. These services rely on a PostgreSQL database for persistent storage of customer and ledger data, and Redis for high-speed caching, rate limiting, and event queuing. Deploying on Railway simplifies this by orchestrating these interconnected components, ensuring they can communicate securely and scale independently to handle production traffic.

## Common Use Cases

- **LLM Wrappers & SaaS**: Monetize AI applications by charging users based on their actual token consumption.
- **Internal Chargeback**: Track and allocate AI infrastructure costs across different teams or departments within an organization.
- **API Metering**: Implement usage limits and credit-based access control for any API service.

## Dependencies for OpenMonetize Hosting

- **PostgreSQL**: Primary database for storing user data, ledgers, and configuration.
- **Redis**: Used for event queues, rate limiting, and caching.

### Deployment Dependencies

- [OpenMonetize GitHub Repository](https://github.com/openmonetize/openmonetize)

### Implementation Details

The template deploys four services:
1.  **Dashboard**: The administrative UI for managing customers and viewing analytics.
2.  **API Gateway**: The main entry point for API requests.
3.  **Ingestion Service**: Handles high-volume event tracking.
4.  **Rating Engine**: Calculates costs and manages credit deduction.

It automatically provisions Postgres and Redis. Default credentials are set, but you should update `NEXTAUTH_SECRET` and other sensitive keys for production.

## Why Deploy OpenMonetize 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 OpenMonetize 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.
- [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/openmonetize
