File size: 14,029 Bytes
90e0d20
1428d20
7f1876a
b9d12d1
 
90e0d20
b9d12d1
 
 
 
 
9277464
b9d12d1
9277464
0f02e7f
 
b9d12d1
 
 
0f02e7f
b9d12d1
9277464
b9d12d1
0f02e7f
90e0d20
 
0f02e7f
 
 
 
 
b9d12d1
9277464
b9d12d1
0f02e7f
e04b24a
0f02e7f
158cba5
0f02e7f
 
 
 
 
 
9277464
0f02e7f
 
9277464
0f02e7f
 
e04b24a
0f02e7f
e04b24a
9277464
 
 
 
 
 
 
e04b24a
158cba5
 
 
 
0f02e7f
e04b24a
0f02e7f
08d8db1
1428d20
08d8db1
0f02e7f
08d8db1
9277464
08d8db1
9277464
 
 
 
 
 
 
08d8db1
9277464
08d8db1
9277464
08d8db1
0f02e7f
08d8db1
9277464
08d8db1
9277464
 
08d8db1
0f02e7f
08d8db1
9277464
08d8db1
9277464
 
 
 
 
b9d12d1
9277464
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b9d12d1
0f02e7f
b9d12d1
0f02e7f
9277464
 
b9d12d1
0f02e7f
728bb65
9277464
728bb65
9277464
728bb65
9277464
728bb65
9277464
728bb65
9277464
b9d12d1
9277464
b9d12d1
 
 
0f02e7f
9277464
 
 
0f02e7f
 
b9d12d1
0f02e7f
b9d12d1
 
 
0f02e7f
 
b9d12d1
 
0f02e7f
b9d12d1
0f02e7f
 
 
9277464
0f02e7f
b9d12d1
0f02e7f
b9d12d1
9277464
 
 
 
 
b9d12d1
0f02e7f
b9d12d1
0f02e7f
b9d12d1
0f02e7f
 
 
 
 
 
b9d12d1
0f02e7f
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
---
title: HuggingMes
emoji: πŸ’¬
colorFrom: blue
colorTo: indigo
sdk: docker
app_port: 7861
pinned: true
license: mit
secrets:
  - name: LLM_API_KEY
    description: "Your LLM provider API key for direct providers such as OpenRouter, Anthropic, OpenAI, Google, DeepSeek, xAI, and others."
  - name: LLM_MODEL
    description: "Model or provider model ID, such as openrouter/anthropic/claude-sonnet-4 or openai/gpt-4o."
  - name: GATEWAY_TOKEN
    description: "Strong token to secure your dashboard and API (generate: openssl rand -hex 32)."
  - name: TELEGRAM_BOT_TOKEN
    description: "Telegram bot token from @BotFather."
  - name: TELEGRAM_ALLOWED_USERS
    description: "Comma-separated list of numeric user IDs allowed to use the bot."
  - name: HF_TOKEN
    description: "Hugging Face token with write access. Used for automatic workspace backup and HF providers."
  - name: CLOUDFLARE_WORKERS_TOKEN
    description: "Cloudflare API token for automatic Worker proxy and KeepAlive setup."
---

<!-- Badges -->
[![GitHub Stars](https://img.shields.io/github/stars/NousResearch/hermes-agent?style=flat-square)](https://github.com/NousResearch/hermes-agent)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)
[![HF Space](https://img.shields.io/badge/πŸ€—%20HuggingFace-Space-blue?style=flat-square)](https://huggingface.co/spaces)
[![Hermes](https://img.shields.io/badge/Hermes-Agent-indigo?style=flat-square)](https://github.com/NousResearch/hermes-agent)

**Self-hosted Hermes AI agent gateway for Hugging Face Spaces.** HuggingMes runs [Nous Research Hermes Agent](https://github.com/NousResearch/hermes-agent) on HuggingFace Spaces, giving you a 24/7 personal AI assistant with a management dashboard, persistent HF Dataset backup, and automatic connectivity fixes for blocked outbound traffic. HuggingMes directly wires the startup providers listed below, and it can also use Hermes providers configured through `hermes model` or `config.yaml`.

## Table of Contents

- [✨ Features](#-features)
- [πŸŽ₯ Video Tutorial](#-video-tutorial)
- [πŸš€ Quick Start](#-quick-start)
- [πŸ” Access Control](#-access-control)
- [πŸ€– LLM Providers](#-llm-providers)
- [πŸ“± Telegram Setup](#-telegram-setup)
- [🌐 Cloudflare Proxy](#-cloudflare-proxy)
- [πŸ’Ύ Backup & Persistence](#-backup--persistence)
- [πŸ’“ Staying Alive](#-staying-alive-recommended-on-free-hf-spaces)
- [πŸ” Security & Advanced](#-security--advanced)
- [πŸ’» Local Development](#-local-development)
- [πŸ—οΈ Architecture](#-architecture)
- [πŸ› Troubleshooting](#-troubleshooting)
- [🌟 More Projects](#-more-projects)

## ✨ Features

- 🧠 **Hermes Core:** Runs Hermes Agent for multi-turn chat, tools, memory, and agent workflows.
- πŸ” **Secure by Default:** Protects the dashboard and API with a single gateway token.
- 🌐 **Built-in Connectivity:** Adds Cloudflare Worker proxy support for Telegram and other blocked outbound traffic.
- πŸ“Š **Dashboard:** Real-time view of uptime, sync health, and agent status at `/`.
- πŸ’Ύ **Persistent Backup:** Syncs chats, config, and session data to a private HF Dataset.
- ⏰ **Keep-Alive:** Can provision a cron-triggered Cloudflare Worker to keep the Space awake.
- πŸ€– **Broad Provider Support:** Supports Hermes' native providers, direct API-key providers, OAuth providers, and custom OpenAI-compatible endpoints.

## πŸŽ₯ Video Tutorial

Watch a quick walkthrough on YouTube: [Deploying HuggingMes on HF Spaces](https://www.youtube.com/watch?v=kagB1ID-NtE).

## πŸš€ Quick Start

### Step 1: Duplicate this Space

[![Duplicate this Space](https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-xl.svg)](https://huggingface.co/spaces/somratpro/HuggingMes?duplicate=true)

### Step 2: Add Your Secrets

In your Space's **Settings β†’ Variables and secrets**, add these under **Secrets**:

- `LLM_API_KEY` - Your provider API key for direct providers.
- `LLM_MODEL` - The model ID to use, such as `openrouter/anthropic/claude-sonnet-4`, `openai/gpt-4o`, or `google/gemini-2.5-flash`.
- `GATEWAY_TOKEN` - A strong token to secure the dashboard.
- `TELEGRAM_BOT_TOKEN` - Telegram bot token from BotFather.
- `TELEGRAM_ALLOWED_USERS` - Comma-separated numeric Telegram user IDs.
- `HF_TOKEN` - Hugging Face token with write access for backups and HF providers.
- `CLOUDFLARE_WORKERS_TOKEN` - Cloudflare token for outbound proxying and keep-alive automation.

### Step 3: Deploy & Run

After the Space builds, open it and click **Open Hermes UI** to access the agent interface.

## πŸ” Access Control

Hermes' built-in dashboard is wrapped by HuggingMes:

- **Dashboard:** Opening `/app/` requires `GATEWAY_TOKEN`.
- **API:** Routes under `/v1/*` require `Authorization: Bearer <GATEWAY_TOKEN>`.

## πŸ€– LLM Providers

HuggingMes supports Hermes providers in two different ways:

- **Direct startup providers:** Set `LLM_API_KEY` and `LLM_MODEL`, and HuggingMes maps them during boot.
- **Hermes-native providers:** Use `hermes model` after the Space starts, or edit `config.yaml` through the Hermes UI.
- **Custom OpenAI-compatible endpoints:** Point Hermes at your own `/v1` endpoint.

### Direct startup providers

These are the providers that HuggingMes maps directly from `LLM_MODEL` and `LLM_API_KEY` at startup.

| Provider | Prefix | Example `LLM_MODEL` | Key env |
| :--- | :--- | :--- | :--- |
| OpenRouter | `openrouter/` | `openrouter/anthropic/claude-sonnet-4` | `LLM_API_KEY` -> `OPENROUTER_API_KEY` |
| Hugging Face Inference Providers | `huggingface/` or `hf/` | `huggingface/Qwen/Qwen3-235B-A22B-Thinking-2507` | `LLM_API_KEY` -> `HF_TOKEN` |
| AI Gateway / Vercel AI Gateway | `ai-gateway/` or `vercel-ai-gateway/` | `ai-gateway/openai/gpt-4o` | `LLM_API_KEY` -> `AI_GATEWAY_API_KEY` |
| Anthropic | `anthropic/` | `anthropic/claude-sonnet-4-6` | `LLM_API_KEY` -> `ANTHROPIC_API_KEY` |
| OpenAI / OpenAI Codex | `openai/` or `openai-codex/` | `openai/gpt-4o` | `LLM_API_KEY` -> `OPENAI_API_KEY` |
| Google Gemini | `google/` or `gemini/` | `google/gemini-2.5-flash` | `LLM_API_KEY` -> `GOOGLE_API_KEY` and `GEMINI_API_KEY` |
| DeepSeek | `deepseek/` | `deepseek/deepseek-chat` | `LLM_API_KEY` -> `DEEPSEEK_API_KEY` |
| Kimi / Moonshot | `kimi-coding/` or `moonshot/` | `kimi-coding/kimi-for-coding` | `LLM_API_KEY` -> `KIMI_API_KEY` |
| Kimi / Moonshot (China) | `kimi-coding-cn/` | `kimi-coding-cn/kimi-k2.5` | `LLM_API_KEY` -> `KIMI_CN_API_KEY` |
| Arcee AI | `arcee/` | `arcee/trinity-large-thinking` | `LLM_API_KEY` -> `ARCEEAI_API_KEY` |
| GMI Cloud | `gmi/` | `gmi/zai-org/GLM-5.1-FP8` | `LLM_API_KEY` -> `GMI_API_KEY` |
| MiniMax | `minimax/` | `minimax/MiniMax-M2.7` | `LLM_API_KEY` -> `MINIMAX_API_KEY` |
| MiniMax (China) | `minimax-cn/` | `minimax-cn/MiniMax-M2.7` | `LLM_API_KEY` -> `MINIMAX_CN_API_KEY` |
| Alibaba Cloud | `alibaba/` | `alibaba/qwen3.5-plus` | `LLM_API_KEY` -> `DASHSCOPE_API_KEY` |
| Alibaba Coding Plan | `alibaba-coding-plan/` | `alibaba-coding-plan/qwen3-coder-plus` | `LLM_API_KEY` -> `DASHSCOPE_API_KEY` |
| Xiaomi MiMo | `xiaomi/` | `xiaomi/mimo-v2-pro` | `LLM_API_KEY` -> `XIAOMI_API_KEY` |
| Tencent TokenHub | `tencent-tokenhub/` | `tencent-tokenhub/hy3-preview` | `LLM_API_KEY` -> `TOKENHUB_API_KEY` |
| Z.ai / GLM | `zai/`, `z-ai/`, `z.ai/`, or `glm/` | `zai/glm-5` | `LLM_API_KEY` -> `GLM_API_KEY` |
| NVIDIA NIM | `nvidia/` | `nvidia/nemotron-3-super-120b-a12b` | `LLM_API_KEY` -> `NVIDIA_API_KEY` |
| xAI / Grok | `xai/` or `grok/` | `xai/grok-4-1-fast-reasoning` | `LLM_API_KEY` -> `XAI_API_KEY` |
| Kilo Code | `kilocode/` | `kilocode/<model-id>` | `LLM_API_KEY` -> `KILOCODE_API_KEY` |
| OpenCode Zen | `opencode-zen/` | `opencode-zen/<model-id>` | `LLM_API_KEY` -> `OPENCODE_ZEN_API_KEY` |
| OpenCode Go | `opencode-go/` | `opencode-go/<model-id>` | `LLM_API_KEY` -> `OPENCODE_GO_API_KEY` |

### Hermes-native providers and OAuth flows

These providers are supported by Hermes and can be used in HuggingMes once the agent config is set through `hermes model` or `config.yaml`. HuggingMes does not auto-map them from `LLM_MODEL` at boot unless Hermes itself handles that provider.

| Provider | How to use | Notes |
| :--- | :--- | :--- |
| Nous Portal | `hermes model` | Subscription-based OAuth provider in Hermes |
| OpenAI Codex | `hermes model` | ChatGPT OAuth / Codex models |
| GitHub Copilot | `hermes model` | Uses `COPILOT_GITHUB_TOKEN`, `GH_TOKEN`, or `gh auth token` |
| GitHub Copilot ACP | `hermes model` | Spawns the Copilot CLI backend |
| Anthropic (OAuth / Claude Code) | `hermes model` | Also supports `ANTHROPIC_API_KEY` |
| Google Gemini (OAuth) | `hermes model` | Browser OAuth flow, including free-tier Gemini OAuth |
| Qwen Portal (OAuth) | `hermes model` | Alibaba Qwen portal OAuth login |
| MiniMax (OAuth) | `hermes model` | Portal login for MiniMax models |
| Hugging Face Inference Providers | `hermes model` | Unified HF provider routing with model suffixes like `:fastest` and `:cheapest` |
| AWS Bedrock | `hermes model` or `config.yaml` | Uses AWS credentials chain, not an API key |
| Ollama Cloud | `hermes model` | Managed Ollama catalog with `OLLAMA_API_KEY` |
| Arcee AI | `hermes model` | First-class Hermes provider |
| GMI Cloud | `hermes model` | First-class Hermes provider |
| Alibaba Cloud / DashScope | `hermes model` | First-class Hermes provider for Qwen models |
| Tencent TokenHub | `hermes model` | First-class Hermes provider |
| Custom endpoint | `hermes model` or `config.yaml` | Any OpenAI-compatible endpoint |

### Custom and self-hosted endpoints

HuggingMes also works with any OpenAI-compatible server. Common examples include local Ollama, LM Studio, llama.cpp / llama-server, vLLM, SGLang, LocalAI, Jan, LiteLLM, ClawRouter, Together AI, Groq, Fireworks AI, Azure OpenAI, and similar services.

Use either the Hermes model wizard or a direct `config.yaml` entry with a `base_url`, `model`, and optional API key. For local servers that do not require auth, leave the key empty.

### Recommended provider choices

- **Just want it to work:** OpenRouter or Hermes' Nous Portal.
- **Want local models:** Ollama, LM Studio, llama.cpp, vLLM, or SGLang through a custom endpoint.
- **Need cloud APIs:** OpenAI, Anthropic, Google Gemini, DeepSeek, xAI, Hugging Face, or any other direct provider above.
- **Need routing or fallback:** Use a custom endpoint such as LiteLLM or ClawRouter.

## πŸ“± Telegram Setup

To use Hermes via Telegram:

1. Add `TELEGRAM_BOT_TOKEN` from [@BotFather](https://t.me/BotFather).
2. Add `TELEGRAM_ALLOWED_USERS` if you want to restrict access.
3. Add `CLOUDFLARE_WORKERS_TOKEN` if you need automatic outbound proxying for Telegram API traffic.

## 🌐 Cloudflare Proxy

Hugging Face Spaces often block outbound calls to APIs used by Telegram and some provider backends. HuggingMes can provision a Cloudflare Worker proxy automatically when you add `CLOUDFLARE_WORKERS_TOKEN`.

## πŸ’Ύ Backup & Persistence *(Optional)*

Set `HF_TOKEN` with write access to enable backup. HuggingMes syncs workspace data to a private HF Dataset named `huggingmes-backup` every 600 seconds by default.

## πŸ’“ Staying Alive

With `CLOUDFLARE_WORKERS_TOKEN` set, HuggingMes can create a keep-alive worker that pings the Space's `/health` endpoint on a schedule so the free tier stays awake longer.

## πŸ” Security & Advanced *(Optional)*

| Variable | Default | Description |
| :--- | :--- | :--- |
| `GATEWAY_TOKEN` | β€” | Token for dashboard and API auth |
| `HF_TOKEN` | β€” | HF token with write access for backups and HF providers |
| `CLOUDFLARE_WORKERS_TOKEN` | β€” | Cloudflare API token for proxying and keep-awake |
| `SYNC_INTERVAL` | `600` | Backup frequency in seconds |
| `CLOUDFLARE_KEEPALIVE_ENABLED` | `true` | Set `false` to disable keep-awake worker |
| `TELEGRAM_MODE` | `webhook` | `webhook` or `polling` |

## πŸ’» Local Development

```bash
docker compose up --build
# Dashboard: http://localhost:7861
# Hermes App: http://localhost:7861/app/
```

## πŸ—οΈ Architecture

- **Dashboard (`/`)**: Real-time management and monitoring.
- **Hermes App (`/app/`)**: Secure proxied access to the Hermes UI.
- **API (`/v1/*`)**: Proxied OpenAI-compatible agent API.
- **Health Check (`/health`)**: Readiness probe for HF and keep-alive.
- **Sync Engine**: Python background task for HF Dataset persistence.

## πŸ› Troubleshooting

- **Telegram bot not responding:** Ensure `CLOUDFLARE_WORKERS_TOKEN` is set and check logs for the proxy setup step.
- **Authentication failed:** Clear browser cookies or use an incognito window if `GATEWAY_TOKEN` changed.
- **Data not persisting:** Ensure `HF_TOKEN` has write access.
- **Provider not showing up:** If it is a Hermes-native provider, run `hermes model` and complete the provider-specific setup there. If it is a custom endpoint, verify the `base_url` exposes `/v1/models` or `/v1/chat/completions`.
- **Space keeps sleeping:** Add `CLOUDFLARE_WORKERS_TOKEN` to enable automatic keep-awake monitoring.

## 🌟 More Projects

Similar projects by [@somratpro](https://github.com/somratpro) β€” all free, one-click deploy on HF Spaces:

| Project | What it runs | HF Space | GitHub |
| :--- | :--- | :--- | :--- |
| **Hugging8n** | n8n β€” workflow & automation platform | [Space](https://huggingface.co/spaces/somratpro/Hugging8n) | [Repo](https://github.com/somratpro/hugging8n) |
| **HuggingClaw** | OpenClaw β€” Claude Code in the browser | [Space](https://huggingface.co/spaces/somratpro/HuggingClaw) | [Repo](https://github.com/somratpro/huggingclaw) |
| **HuggingClip** | Paperclip β€” AI agent orchestration platform | [Space](https://huggingface.co/spaces/somratpro/HuggingClip) | [Repo](https://github.com/somratpro/huggingclip) |
| **HuggingPost** | Postiz β€” social-media scheduler | [Space](https://huggingface.co/spaces/somratpro/HuggingPost) | [Repo](https://github.com/somratpro/huggingpost) |

---
*Made with ❀️ by [@somratpro](https://github.com/somratpro)*