---
title: "Deploy Hermes Agent OpenAI API"
description: "OpenAI-compatible Hermes endpoint for Open WebUI"
category: "AI/ML"
url: https://railway.com/deploy/deploy-hermes-agent-openai-api-server
---

# Deploy Hermes Agent OpenAI API

OpenAI-compatible Hermes endpoint for Open WebUI

**[Deploy Hermes Agent OpenAI API on Railway](https://railway.com/template/deploy-hermes-agent-openai-api-server)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/deploy-hermes-agent-openai-api-server/manifest.json

- **Creator:** onepush
- **Category:** AI/ML

## Template content

### hermes-agent

- **Image:** nousresearch/hermes-agent:v0.22.0@sha256:c69536a39e885b8943329bda68cdf44492458b96aa74a212239bde9d2aeb406a
- **Start command:** `sh -c "mkdir -p /opt/data && chown -R 10000:10000 /opt/data && exec /opt/hermes/docker/entrypoint-dispatch.sh hermes gateway run"`
- **Health check:** /health
- **Public domain:** Yes

## Documentation

# Deploy and Host self hosted Hermes Agent OpenAI API (Open-Source AI Agent API) on Railway

This template runs Hermes Agent with its OpenAI-compatible API server on port 8642. For ops who want a tool-using agent behind familiar chat UIs: point Open WebUI, LobeChat, LibreChat or the OpenAI SDK at https://your-domain/v1.

## About Hosting Hermes Agent OpenAI API open-source software on Railway (self hosted Hermes Agent template)

This template runs Hermes with its API server on port 8642 and a generated API_SERVER_KEY. Chat history, skills, and memory stay in the /opt/data volume, not a vendor account.

## Why Deploy Hermes Agent OpenAI API, the OpenAI Assistants alternative on Railway (Railway Free Trial)

You keep the agent logic, memory, and tool calls on your own Railway service instead of paying OpenAI for hosted tools like file search on top of tokens.

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 Hermes Agent OpenAI API 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.

### Railway vs Other Hosting Providers and VPS for Hermes Agent OpenAI API self hosting

Railway gives you the API server, generated key, HTTPS, and logs in one service; VPS hosts make you assemble those pieces.

| Provider | What You Get with Railway | What You Get with the Other Provider |
| --- | --- | --- |
| DigitalOcean | Deployed container with port 8642 exposed, API key generated, domain and health checks ready | A Droplet where you install Docker, open the port, add TLS, and manage restarts |
| AWS | Managed service with env vars, logs, and one public /v1 endpoint | EC2 or ECS plus IAM, load balancer, security groups, and extra config |
| Hetzner | Quick start with $5 trial credit and no server admin | Cheaper compute, but you handle firewall, reverse proxy, updates, and uptime |

## Common Use Cases for hosted Hermes Agent OpenAI API

- **Open WebUI front end:** Add an OpenAI API connection with base URL https://your-domain/v1 and the generated key, then chat with an agent that has tools and memory.
- **Team chat in LibreChat:** Connect LibreChat as an OpenAI provider so every teammate shares one Hermes agent, its skills, and its accumulated memory.
- **Backend jobs with the OpenAI SDK:** Set base_url in the Python or JS SDK and call model "hermes-agent" from workers that need real actions like file access.
- **One agent, several front ends:** Keep a single Hermes deployment behind the API and let Open WebUI, LobeChat, and custom code hit the same tools and memory.
- **Scripted agent tasks from CI:** Use curl or the SDK in pipelines to ask Hermes to run a command and return a summary without a human in the loop.

## Dependencies for Hermes Agent OpenAI API Docker hosted on Railway

The template runs one Railway service from the official Hermes image with `hermes gateway run` on port 8642, a `/health` check, and a persistent volume at `/opt/data` for memory and skills.

### Deployment Dependencies for Managed Hermes Agent OpenAI API Service (AI Agent API)

- Fixed environment: `PORT=8642`, `HERMES_ALLOW_ROOT_GATEWAY`, `RAILWAY_RUN_UID`, `HERMES_UID`, `HERMES_GID`.
- API settings: `API_SERVER_ENABLED=true`, `API_SERVER_HOST=0.0.0.0`, `API_SERVER_PORT=8642`, generated `API_SERVER_KEY`, `API_SERVER_CORS_ORIGINS=*`, `HERMES_API_URL=https://your-domain/v1`.
- Optional but empty by default: `OPENROUTER_API_KEY`, `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `TELEGRAM_BOT_TOKEN`, `TELEGRAM_ALLOWED_USERS`.
- At least one model provider key is required or requests fail.

### Implementation Details for Hermes Agent OpenAI API (Using Hermes Agent official docker image)

- Start command is `hermes gateway run`, which serves the gateway and the OpenAI-compatible API on the same port.
- Volume `/opt/data` holds skills, memory, and the FTS5 index, so it survives redeploys.
- Clients POST to `/v1/chat/completions` or the Responses API with model `hermes-agent` and a Bearer token from `API_SERVER_KEY`.
- Full toolset, memory, and skills run per request, so expect extra latency and tokens compared to a raw model call.

## How does Hermes Agent OpenAI API compare against other AI agent platforms

### Hermes Agent vs OpenAI Assistants API (OpenAI Assistants Alternative)

- **Provider lock-in:** Hermes runs on your Railway service and works with OpenRouter, Anthropic, OpenAI, or Nous Portal. OpenAI Assistants is OpenAI-only.
- **Tool surface:** Hermes ships with 40+ tools, cron, subagents, and MCP. Assistants gives you a narrower function-calling setup you wire yourself.
- **OpenAI wins:** Assistants is simpler if you already pay for OpenAI and never need another model provider or self-hosted data controls.

### Hermes Agent vs OpenClaw (OpenClaw Alternative)

- **Shared lineage:** Both are MIT-licensed, self-hosted agent runtimes with memory, skills, and messaging gateways.
- **API focus:** This template exposes Hermes as an OpenAI-compatible endpoint immediately. OpenClaw can be API-wrapped but usually wants its own CLI or chat surfaces.
- **OpenClaw wins:** OpenClaw has a larger plugin ecosystem and a browser image with Chromium.

### Hermes Agent vs Letta (Letta Alternative)

- **Memory model:** Hermes uses skills and FTS5 memory in /opt/data. Letta is built around persistent memory blocks and is stronger if you want fine-grained memory editing.
- **Deployment:** Hermes is one gateway service with a single volume. Letta tends to be more service-heavy for equivalent features.
- **Letta wins:** Letta's memory APIs are more explicit for developers who treat memory as a first-class object.

### Hermes Agent vs plain model APIs (Plain Model API Alternative)

- **What a request does:** A call to hermes-agent runs the full agent loop with tools, memory, and skills. A plain model API call is one inference.
- **Latency and cost:** Expect multiple model and tool calls per request, so Hermes is slower and burns more tokens than a raw endpoint.
- **Plain model APIs win:** If you only need chat completions with no tools or state, a direct model endpoint is cheaper and faster.

## How to use Hermes Agent OpenAI API (the OSS AI agent)?

1. Set OPENROUTER_API_KEY (or ANTHROPIC_API_KEY or OPENAI_API_KEY) on the service and redeploy.
2. Copy API_SERVER_KEY from Railway Variables.
3. Test the endpoint:

```bash
curl https://your-domain/v1/chat/completions -H "Authorization: Bearer $API_SERVER_KEY" -H "Content-Type: application/json" -d '{"model":"hermes-agent","messages":[{"role":"user","content":"hi"}]}'
```

4. In Open WebUI, add an OpenAI connection with base URL https://your-domain/v1 and the key.
5. In code, set base_url to https://your-domain/v1:

```python
from openai import OpenAI
client = OpenAI(base_url="https://your-domain/v1", api_key="API_SERVER_KEY")
client.chat.completions.create(model="hermes-agent", messages=[{"role":"user","content":"hi"}])
```

## How to self host Hermes Agent OpenAI API on other VPS Services (Hermes Agent self hosting guide)

### Clone the Repository

Clone the official Hermes repo and enter it.

```bash
git clone https://github.com/NousResearch/hermes-agent
cd hermes-agent
```

### Install Dependencies

Run the install script and finish the setup wizard.

```bash
curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash
hermes setup
```

### Configure Environment Variables

Edit `~/.hermes/.env`. Turn on the API server, set a key, and add a model provider.

```bash
API_SERVER_ENABLED=true
API_SERVER_PORT=8642
API_SERVER_KEY=make-up-a-long-random-string
OPENROUTER_API_KEY=your-openrouter-key
```

### Start the Hermes Agent OpenAI API Application

Run the gateway on port 8642 and test the endpoint.

```bash
hermes gateway run
```

```bash
curl https://your-domain/v1/chat/completions \
  -H "Authorization: Bearer make-up-a-long-random-string" \
  -H "Content-Type: application/json" \
  -d '{"model":"hermes-agent","messages":[{"role":"user","content":"hello"}]}'
```

## Official Pricing of Hermes Agent OpenAI API (Hermes Agent pricing)

Hermes Agent is free and MIT-licensed: no license fee, no per-request surcharge, no paid tier.

## Hermes Agent OpenAI API cloud vs self hosted comparison (Pricing, features, costs, and more)

Self hosting gives you the full agent API on your own infrastructure, but you still pay model providers for tokens.

### Monthly cost of self hosting Hermes Agent OpenAI API on Railway

Plan on roughly $5 to $10 per month for the Railway service at 512 MB to 1 GB RAM. Model API usage is separate and usually the larger line item.

### System Requirements for Hosting Hermes Agent OpenAI API on a VPS

A modest VPS works: 512 MB to 1 GB of RAM, one CPU core, and a few hundred MB of disk for the /opt/data volume that holds skills and memory.

## Frequently Asked Questions (FAQs)

### Which model name do I send?

Send `hermes-agent` as the model in every request.

### Does it support streaming?

Yes. The OpenAI-compatible endpoint supports streaming responses through the chat completions and Responses API, so Open WebUI and the SDKs can render tokens as they arrive.

### Can I use the OpenAI SDK?

Yes. Point the Python SDK at `base_url="https://your-domain/v1"` or the JS SDK at `baseURL` and pass the API server key as a Bearer token. No custom client is required.

### Why is it slower than calling a model directly?

Every request runs the full agent, so one request can make several model and tool calls.

### How do I lock down CORS?

The template ships with `API_SERVER_CORS_ORIGINS=*`. Set it to your front-end origin if browsers call the API, and keep the key out of public front-end code.

### Who pays for tokens?

You do, through your OpenRouter, Anthropic or OpenAI account.


## 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/deploy-hermes-agent-openai-api-server
