Spaces:
Building
Building
docs: refactor and simplify README sections for setup, backups, keep-alive, and LLM providers
Browse files
README.md
CHANGED
|
@@ -114,53 +114,34 @@ To chat via Telegram:
|
|
| 114 |
| `TELEGRAM_USER_ID` | β | Single Telegram user ID allowlist |
|
| 115 |
| `TELEGRAM_USER_IDS` | β | Comma-separated Telegram user IDs for team access |
|
| 116 |
|
| 117 |
-
## π Cloudflare Proxy
|
| 118 |
|
| 119 |
-
Hugging Face
|
| 120 |
|
| 121 |
-
Automatic
|
| 122 |
|
| 123 |
-
|
| 124 |
-
2. Add `CLOUDFLARE_WORKERS_TOKEN` as a Space secret.
|
| 125 |
-
3. Restart the Space.
|
| 126 |
|
| 127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
|
| 129 |
-
|
| 130 |
-
- Token type: `API Token`
|
| 131 |
-
- Account permission: `Workers Scripts: Edit`
|
| 132 |
-
- Resource scope: your target Cloudflare account
|
| 133 |
-
- Account auto-discovery is built in; `CLOUDFLARE_ACCOUNT_ID` is not required
|
| 134 |
|
| 135 |
-
|
|
|
|
|
|
|
| 136 |
|
| 137 |
-
|
| 138 |
|
| 139 |
-
|
| 140 |
-
- generate a private shared secret automatically
|
| 141 |
-
- export `CLOUDFLARE_PROXY_URL` and `CLOUDFLARE_PROXY_SECRET` before OpenClaw starts
|
| 142 |
-
- transparently proxy outbound external requests through Cloudflare by default
|
| 143 |
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
- Hugging Face internal hosts stay direct automatically
|
| 149 |
-
|
| 150 |
-
That wider default is intentional so Telegram, WhatsApp-related APIs, Google integrations, and other external providers work without extra domain tuning.
|
| 151 |
-
|
| 152 |
-
Optional variables:
|
| 153 |
-
|
| 154 |
-
| Variable | Default | Description |
|
| 155 |
-
| :--- | :--- | :--- |
|
| 156 |
-
| `CLOUDFLARE_WORKERS_TOKEN` | β | Cloudflare API token for automatic Worker setup |
|
| 157 |
-
| `CLOUDFLARE_ACCOUNT_ID` | auto | Optional Cloudflare account ID override if you want to pin a specific account |
|
| 158 |
-
| `CLOUDFLARE_WORKER_NAME` | derived from Space host | Optional Worker script name |
|
| 159 |
-
| `CLOUDFLARE_PROXY_URL` | auto | Use an existing Worker URL instead of auto-provisioning |
|
| 160 |
-
| `CLOUDFLARE_PROXY_SECRET` | auto | Optional shared secret override |
|
| 161 |
-
| `CLOUDFLARE_PROXY_DOMAINS` | `*` | Comma-separated proxied domains or `*` for all external traffic |
|
| 162 |
-
|
| 163 |
-
Manual setup is also available with [cloudflare-worker.js](/Users/somrat/Development/hf-space/HuggingClaw/cloudflare-worker.js) if you prefer to deploy the Worker yourself.
|
| 164 |
|
| 165 |
## π¬ WhatsApp Setup *(Optional)*
|
| 166 |
|
|
@@ -172,47 +153,27 @@ To use WhatsApp, enable the channel and scan the QR code from the Control UI (**
|
|
| 172 |
|
| 173 |
## πΎ Workspace Backup *(Optional)*
|
| 174 |
|
| 175 |
-
|
| 176 |
|
| 177 |
-
|
|
|
|
|
|
|
| 178 |
|
| 179 |
| Variable | Default | Description |
|
| 180 |
| :--- | :--- | :--- |
|
| 181 |
-
| `
|
| 182 |
-
| `
|
| 183 |
-
| `BACKUP_DATASET_NAME` | `huggingclaw-backup` | Dataset name for backup repo |
|
| 184 |
-
| `SYNC_INTERVAL` | `180` | Sync interval in seconds |
|
| 185 |
-
|
| 186 |
-
> [!TIP]
|
| 187 |
-
> This backup also stores a hidden copy of your WhatsApp session credentials, allowing paired logins to survive Space restarts automatically.
|
| 188 |
|
| 189 |
## π Staying Alive *(Recommended on Free HF Spaces)*
|
| 190 |
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
Use the **Main API key** from UptimeRobot.
|
| 194 |
-
Do **not** use the `Read-only API key` or a `Monitor-specific API key`.
|
| 195 |
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
1. Open `/`.
|
| 199 |
-
2. Find **Keep Space Awake**.
|
| 200 |
3. Paste your UptimeRobot **Main API key**.
|
| 201 |
4. Click **Create Monitor**.
|
| 202 |
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
- HuggingClaw creates a monitor for `https://your-space.hf.space/health`
|
| 206 |
-
- UptimeRobot keeps pinging it from outside Hugging Face
|
| 207 |
-
- You only need to do this once
|
| 208 |
-
|
| 209 |
-
You do **not** need to add this key to Hugging Face Space Secrets.
|
| 210 |
-
The dashboard helper also rate-limits setup requests and rejects cross-origin submissions.
|
| 211 |
-
|
| 212 |
-
Note:
|
| 213 |
-
|
| 214 |
-
- This works for **public** Spaces.
|
| 215 |
-
- It does **not** work reliably for **private** Spaces, because external monitors cannot access private HF health URLs.
|
| 216 |
|
| 217 |
## π Webhooks *(Optional)*
|
| 218 |
|
|
@@ -235,38 +196,24 @@ Configure password access and network restrictions:
|
|
| 235 |
|
| 236 |
## π€ LLM Providers
|
| 237 |
|
| 238 |
-
HuggingClaw supports **all providers** from OpenClaw. Set `LLM_MODEL=<provider/model>` and the provider is auto-detected.
|
| 239 |
-
|
| 240 |
-
| Provider | Prefix | Example Model | API Key Source |
|
| 241 |
-
| :--------------- | :-------------- | :------------------------------------ | :--------------------------------------------------- |
|
| 242 |
-
| **Anthropic** | `anthropic/` | `anthropic/claude-sonnet-4-6` | [Anthropic Console](https://console.anthropic.com/) |
|
| 243 |
-
| **OpenAI** | `openai/` | `openai/gpt-5.4` | [OpenAI Platform](https://platform.openai.com/) |
|
| 244 |
-
| **Google** | `google/` | `google/gemini-2.5-flash` | [AI Studio](https://ai.google.dev/) |
|
| 245 |
-
| **DeepSeek** | `deepseek/` | `deepseek/deepseek-v3.2` | [DeepSeek](https://platform.deepseek.com) |
|
| 246 |
-
| **xAI (Grok)** | `xai/` | `xai/grok-4` | [xAI](https://console.x.ai) |
|
| 247 |
-
| **Mistral** | `mistral/` | `mistral/mistral-large-latest` | [Mistral Console](https://console.mistral.ai) |
|
| 248 |
-
| **Moonshot** | `moonshot/` | `moonshot/kimi-k2.5` | [Moonshot](https://platform.moonshot.cn) |
|
| 249 |
-
| **Cohere** | `cohere/` | `cohere/command-a` | [Cohere Dashboard](https://dashboard.cohere.com) |
|
| 250 |
-
| **Groq** | `groq/` | `groq/mixtral-8x7b-32768` | [Groq](https://console.groq.com) |
|
| 251 |
-
| **MiniMax** | `minimax/` | `minimax/minimax-m2.7` | [MiniMax](https://platform.minimax.io) |
|
| 252 |
-
| **NVIDIA** | `nvidia/` | `nvidia/nemotron-3-super-120b-a12b` | [NVIDIA API](https://api.nvidia.com) |
|
| 253 |
-
| **Z.ai (GLM)** | `zai/` | `zai/glm-5` | [Z.ai](https://z.ai) |
|
| 254 |
-
| **Volcengine** | `volcengine/` | `volcengine/doubao-seed-1-8-251228` | [Volcengine](https://www.volcengine.com) |
|
| 255 |
-
| **HuggingFace** | `huggingface/` | `huggingface/deepseek-ai/DeepSeek-R1` | [HF Tokens](https://huggingface.co/settings/tokens) |
|
| 256 |
-
| **OpenCode Zen** | `opencode/` | `opencode/claude-opus-4-6` | [OpenCode.ai](https://opencode.ai/auth) |
|
| 257 |
-
| **OpenCode Go** | `opencode-go/` | `opencode-go/kimi-k2.5` | [OpenCode.ai](https://opencode.ai/auth) |
|
| 258 |
-
| **Kilo Gateway** | `kilocode/` | `kilocode/anthropic/claude-opus-4.6` | [Kilo.ai](https://kilo.ai) |
|
| 259 |
-
|
| 260 |
-
### OpenRouter β 200+ Models with One Key
|
| 261 |
-
|
| 262 |
-
Get an [OpenRouter](https://openrouter.ai) API key to use *all* providers. For example:
|
| 263 |
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
LLM_MODEL=openrouter/openai/gpt-5.4
|
| 267 |
-
```
|
| 268 |
|
| 269 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 270 |
|
| 271 |
### Any Other Provider
|
| 272 |
|
|
@@ -340,27 +287,26 @@ openclaw channels login --gateway https://YOUR_SPACE_NAME.hf.space
|
|
| 340 |
|
| 341 |
## ποΈ Architecture
|
| 342 |
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
|
|
|
| 352 |
|
| 353 |
**Startup sequence:**
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
9. On `SIGTERM`, save workspace and exit cleanly.
|
| 363 |
-
```
|
| 364 |
|
| 365 |
## π Troubleshooting
|
| 366 |
|
|
@@ -394,9 +340,11 @@ Similar projects by [@somratpro](https://github.com/somratpro) β all free, one
|
|
| 394 |
If HuggingClaw saves you time, consider buying me a coffee to keep the projects alive!
|
| 395 |
|
| 396 |
**USDT (TRC-20 / TRON network only)**
|
|
|
|
| 397 |
```
|
| 398 |
TELx8TJz1W1h7n6SgpgGNNGZXpJCEUZrdB
|
| 399 |
```
|
|
|
|
| 400 |
> [!WARNING]
|
| 401 |
> Send **USDT on TRC-20 network only**. Sending other tokens or using a different network will result in permanent loss.
|
| 402 |
|
|
|
|
| 114 |
| `TELEGRAM_USER_ID` | β | Single Telegram user ID allowlist |
|
| 115 |
| `TELEGRAM_USER_IDS` | β | Comma-separated Telegram user IDs for team access |
|
| 116 |
|
| 117 |
+
## π Cloudflare Proxy Setup
|
| 118 |
|
| 119 |
+
Hugging Face Free Tier often restricts outbound connections to services like Telegram, Discord, and WhatsApp. HuggingClaw solves this with a **Transparent Outbound Proxy** via Cloudflare Workers.
|
| 120 |
|
| 121 |
+
### β‘ Automatic Setup (Recommended)
|
| 122 |
|
| 123 |
+
This is the easiest way. HuggingClaw will handle the deployment for you.
|
|
|
|
|
|
|
| 124 |
|
| 125 |
+
1. Create a **Cloudflare API Token**:
|
| 126 |
+
- Go to [API Tokens](https://dash.cloudflare.com/profile/api-tokens).
|
| 127 |
+
- Create Token -> **Edit Cloudflare Workers** template.
|
| 128 |
+
- Ensure it has `Account: Workers Scripts: Edit` permissions.
|
| 129 |
+
2. Add the token as a secret named `CLOUDFLARE_WORKERS_TOKEN` in your Space Settings.
|
| 130 |
|
| 131 |
+
**What happens next?**
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
|
| 133 |
+
- HuggingClaw automatically creates a Worker named after your Space host.
|
| 134 |
+
- It generates a secure, private `CLOUDFLARE_PROXY_SECRET`.
|
| 135 |
+
- All restricted outbound traffic is automatically routed through this Worker.
|
| 136 |
|
| 137 |
+
### π οΈ Manual Setup
|
| 138 |
|
| 139 |
+
If you prefer to manage the Worker yourself:
|
|
|
|
|
|
|
|
|
|
| 140 |
|
| 141 |
+
1. Create a new Cloudflare Worker.
|
| 142 |
+
2. Paste the code from [cloudflare-worker.js](./cloudflare-worker.js) and deploy.
|
| 143 |
+
3. Add the Worker URL to your Space as `CLOUDFLARE_PROXY_URL`.
|
| 144 |
+
4. (Optional) Set a `CLOUDFLARE_PROXY_SECRET` in both the Worker (as a variable) and the Space (as a secret).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
|
| 146 |
## π¬ WhatsApp Setup *(Optional)*
|
| 147 |
|
|
|
|
| 153 |
|
| 154 |
## πΎ Workspace Backup *(Optional)*
|
| 155 |
|
| 156 |
+
HuggingClaw automatically syncs your workspace (chats, settings, sessions) to a private HF Dataset named `huggingclaw-backup`.
|
| 157 |
|
| 158 |
+
- **Persistence:** Survived restarts and restores your state on boot.
|
| 159 |
+
- **WhatsApp:** Stores session credentials so you don't have to scan the QR code every time.
|
| 160 |
+
- **Interval:** Syncs every 3 minutes by default.
|
| 161 |
|
| 162 |
| Variable | Default | Description |
|
| 163 |
| :--- | :--- | :--- |
|
| 164 |
+
| `HF_TOKEN` | β | HF token with **Write** access |
|
| 165 |
+
| `SYNC_INTERVAL` | `180` | Backup frequency in seconds |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
|
| 167 |
## π Staying Alive *(Recommended on Free HF Spaces)*
|
| 168 |
|
| 169 |
+
To help keep your Space awake, set up an external [UptimeRobot](https://uptimerobot.com/) monitor directly from the dashboard UI.
|
|
|
|
|
|
|
|
|
|
| 170 |
|
| 171 |
+
1. Open your Space's dashboard (`/`).
|
| 172 |
+
2. Find the **Keep Space Awake** section.
|
|
|
|
|
|
|
| 173 |
3. Paste your UptimeRobot **Main API key**.
|
| 174 |
4. Click **Create Monitor**.
|
| 175 |
|
| 176 |
+
HuggingClaw will automatically create a monitor for your Space's `/health` endpoint.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
|
| 178 |
## π Webhooks *(Optional)*
|
| 179 |
|
|
|
|
| 196 |
|
| 197 |
## π€ LLM Providers
|
| 198 |
|
| 199 |
+
HuggingClaw supports **all providers** from OpenClaw. Set `LLM_MODEL=<provider/model>` and the provider is auto-detected.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 200 |
|
| 201 |
+
<details>
|
| 202 |
+
<summary><b>Click to see supported providers and examples</b></summary>
|
|
|
|
|
|
|
| 203 |
|
| 204 |
+
| Provider | Prefix | Example Model |
|
| 205 |
+
| :--- | :--- | :--- |
|
| 206 |
+
| **Anthropic** | `anthropic/` | `anthropic/claude-3-5-sonnet-latest` |
|
| 207 |
+
| **OpenAI** | `openai/` | `openai/gpt-4o` |
|
| 208 |
+
| **Google** | `google/` | `google/gemini-2.0-flash` |
|
| 209 |
+
| **DeepSeek** | `deepseek/` | `deepseek/deepseek-chat` |
|
| 210 |
+
| **xAI (Grok)** | `xai/` | `xai/grok-2-latest` |
|
| 211 |
+
| **Mistral** | `mistral/` | `mistral/mistral-large-latest` |
|
| 212 |
+
| **HuggingFace** | `huggingface/` | `huggingface/deepseek-ai/DeepSeek-R1` |
|
| 213 |
+
| **OpenRouter** | `openrouter/` | `openrouter/anthropic/claude-3.5-sonnet` |
|
| 214 |
+
|
| 215 |
+
*And many more: Cohere, Groq, NVIDIA, Mistral, Moonshot, etc.*
|
| 216 |
+
</details>
|
| 217 |
|
| 218 |
### Any Other Provider
|
| 219 |
|
|
|
|
| 287 |
|
| 288 |
## ποΈ Architecture
|
| 289 |
|
| 290 |
+
HuggingClaw uses a multi-layered approach to ensure stability and persistence on Hugging Face's ephemeral infrastructure.
|
| 291 |
+
|
| 292 |
+
<details>
|
| 293 |
+
<summary><b>Click to view technical details</b></summary>
|
| 294 |
+
|
| 295 |
+
- **Dashboard (`/`)**: Management, monitoring, and keep-alive tools.
|
| 296 |
+
- **Control UI (`/gateway`)**: Secure interface for managing agents and channels.
|
| 297 |
+
- **Health Check (`/health`)**: Endpoint for uptime monitoring and readiness probes.
|
| 298 |
+
- **Sync Engine**: Python background process managing HF Dataset persistence.
|
| 299 |
+
- **Transparent Proxy**: Interceptor for requests to blocked domains (Telegram, etc.).
|
| 300 |
|
| 301 |
**Startup sequence:**
|
| 302 |
+
|
| 303 |
+
1. Validate required secrets and check HF token.
|
| 304 |
+
2. Resolve backup namespace and restore workspace from HF Dataset.
|
| 305 |
+
3. Generate `openclaw.json` configuration.
|
| 306 |
+
4. Launch background tasks (auto-sync, channel helpers).
|
| 307 |
+
5. Start OpenClaw gateway and listen for connections.
|
| 308 |
+
|
| 309 |
+
</details>
|
|
|
|
|
|
|
| 310 |
|
| 311 |
## π Troubleshooting
|
| 312 |
|
|
|
|
| 340 |
If HuggingClaw saves you time, consider buying me a coffee to keep the projects alive!
|
| 341 |
|
| 342 |
**USDT (TRC-20 / TRON network only)**
|
| 343 |
+
|
| 344 |
```
|
| 345 |
TELx8TJz1W1h7n6SgpgGNNGZXpJCEUZrdB
|
| 346 |
```
|
| 347 |
+
|
| 348 |
> [!WARNING]
|
| 349 |
> Send **USDT on TRC-20 network only**. Sending other tokens or using a different network will result in permanent loss.
|
| 350 |
|