Spaces:
Sleeping
Sleeping
docs: add detailed env var table with examples, change sync interval to 60s
Browse files- Add Example column to secrets table with sample values
- Add Environment Variables section with AUTO_CREATE_DATASET, SYNC_INTERVAL,
NODE_MEMORY_LIMIT, TZ — detailed descriptions and defaults
- Expand Configuration section with categorized OpenClaw env var list
- Change SYNC_INTERVAL default from 120 to 60 seconds
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- .env.example +3 -3
- README.md +32 -14
- scripts/sync_hf.py +1 -1
.env.example
CHANGED
|
@@ -59,9 +59,9 @@ OPENCLAW_DATASET_REPO=your-username/HuggingClaw-data
|
|
| 59 |
# How often (in seconds) to back up data to the Dataset repo.
|
| 60 |
# Lower values = safer but more API calls to HuggingFace.
|
| 61 |
#
|
| 62 |
-
# [OPTIONAL] Default:
|
| 63 |
#
|
| 64 |
-
# SYNC_INTERVAL=
|
| 65 |
|
| 66 |
|
| 67 |
# ─── LLM / OPENAI-COMPATIBLE API ───────────────────────────────────────────
|
|
@@ -173,7 +173,7 @@ OPENROUTER_API_KEY=sk-or-v1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
| 173 |
# HF_TOKEN [必填] HF 访问令牌,需具备写入权限
|
| 174 |
# OPENCLAW_DATASET_REPO [必填] 备份用 Dataset 仓库,如 your-name/HuggingClaw-data
|
| 175 |
# AUTO_CREATE_DATASET [可选] 是否自动创建仓库,默认 true
|
| 176 |
-
# SYNC_INTERVAL [可选] 备份间隔(秒),默认
|
| 177 |
# HF_HUB_DOWNLOAD_TIMEOUT [可选] 下载超时(秒),默认 300
|
| 178 |
# HF_HUB_UPLOAD_TIMEOUT [可选] 上传超时(秒),默认 600
|
| 179 |
#
|
|
|
|
| 59 |
# How often (in seconds) to back up data to the Dataset repo.
|
| 60 |
# Lower values = safer but more API calls to HuggingFace.
|
| 61 |
#
|
| 62 |
+
# [OPTIONAL] Default: 60
|
| 63 |
#
|
| 64 |
+
# SYNC_INTERVAL=60
|
| 65 |
|
| 66 |
|
| 67 |
# ─── LLM / OPENAI-COMPATIBLE API ───────────────────────────────────────────
|
|
|
|
| 173 |
# HF_TOKEN [必填] HF 访问令牌,需具备写入权限
|
| 174 |
# OPENCLAW_DATASET_REPO [必填] 备份用 Dataset 仓库,如 your-name/HuggingClaw-data
|
| 175 |
# AUTO_CREATE_DATASET [可选] 是否自动创建仓库,默认 true
|
| 176 |
+
# SYNC_INTERVAL [可选] 备份间隔(秒),默认 60
|
| 177 |
# HF_HUB_DOWNLOAD_TIMEOUT [可选] 下载超时(秒),默认 300
|
| 178 |
# HF_HUB_UPLOAD_TIMEOUT [可选] 上传超时(秒),默认 600
|
| 179 |
#
|
README.md
CHANGED
|
@@ -76,18 +76,29 @@ Click **Duplicate this Space** on the [HuggingClaw Space page](https://huggingfa
|
|
| 76 |
|
| 77 |
Go to **Settings → Repository secrets** and configure:
|
| 78 |
|
| 79 |
-
| Secret | Status | Description |
|
| 80 |
-
|--------|:------:|-------------|
|
| 81 |
-
| `OPENCLAW_PASSWORD` | Recommended | Password for the Control UI (default: `huggingclaw`) |
|
| 82 |
-
| `HF_TOKEN` | **Required** | HF Access Token with write permission ([create one](https://huggingface.co/settings/tokens)) |
|
| 83 |
-
| `OPENCLAW_DATASET_REPO` | **Required** | Dataset repo for backup
|
| 84 |
-
| `OPENAI_API_KEY` | Recommended | OpenAI (or any [OpenAI-compatible](https://openclawdoc.com/docs/reference/environment-variables)) API key
|
| 85 |
-
| `OPENROUTER_API_KEY` | Optional | [OpenRouter](https://openrouter.ai) API key (200+ models, free tier) |
|
| 86 |
-
| `ANTHROPIC_API_KEY` | Optional | Anthropic Claude API key |
|
| 87 |
-
| `GOOGLE_API_KEY` | Optional | Google / Gemini API key |
|
| 88 |
-
| `OPENCLAW_DEFAULT_MODEL` | Optional | Default model
|
| 89 |
-
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
### 3. Open the Control UI
|
| 93 |
|
|
@@ -97,9 +108,16 @@ Messaging integrations (Telegram, WhatsApp) can be configured directly inside th
|
|
| 97 |
|
| 98 |
## Configuration
|
| 99 |
|
| 100 |
-
HuggingClaw supports **all OpenClaw environment variables** — it passes the entire environment to the OpenClaw process (`env=os.environ.copy()`), so any variable from the [OpenClaw docs](https://openclawdoc.com/docs/reference/environment-variables)
|
| 101 |
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
## Security
|
| 105 |
|
|
|
|
| 76 |
|
| 77 |
Go to **Settings → Repository secrets** and configure:
|
| 78 |
|
| 79 |
+
| Secret | Status | Description | Example |
|
| 80 |
+
|--------|:------:|-------------|---------|
|
| 81 |
+
| `OPENCLAW_PASSWORD` | Recommended | Password for the Control UI (default: `huggingclaw`) | `my-secret-password` |
|
| 82 |
+
| `HF_TOKEN` | **Required** | HF Access Token with write permission ([create one](https://huggingface.co/settings/tokens)) | `hf_AbCdEfGhIjKlMnOpQrStUvWxYz` |
|
| 83 |
+
| `OPENCLAW_DATASET_REPO` | **Required** | Dataset repo for backup — format: `username/repo-name` | `tao-shen/HuggingClaw-data` |
|
| 84 |
+
| `OPENAI_API_KEY` | Recommended | OpenAI (or any [OpenAI-compatible](https://openclawdoc.com/docs/reference/environment-variables)) API key | `sk-proj-xxxxxxxxxxxx` |
|
| 85 |
+
| `OPENROUTER_API_KEY` | Optional | [OpenRouter](https://openrouter.ai) API key (200+ models, free tier available) | `sk-or-v1-xxxxxxxxxxxx` |
|
| 86 |
+
| `ANTHROPIC_API_KEY` | Optional | Anthropic Claude API key | `sk-ant-xxxxxxxxxxxx` |
|
| 87 |
+
| `GOOGLE_API_KEY` | Optional | Google / Gemini API key | `AIzaSyXxXxXxXxXx` |
|
| 88 |
+
| `OPENCLAW_DEFAULT_MODEL` | Optional | Default model for new conversations | `openrouter/openai/gpt-oss-20b:free` |
|
| 89 |
+
|
| 90 |
+
### Environment Variables
|
| 91 |
+
|
| 92 |
+
In addition to the secrets above, HuggingClaw provides environment variables to fine-tune persistence and performance. Set these the same way — as **Repository Secrets** in HF Spaces, or in your `.env` file for local Docker.
|
| 93 |
+
|
| 94 |
+
| Variable | Default | Description |
|
| 95 |
+
|----------|---------|-------------|
|
| 96 |
+
| `AUTO_CREATE_DATASET` | `true` | **Auto-create the Dataset repo** if it doesn't exist. When set to `true`, HuggingClaw automatically creates a **private** HuggingFace Dataset repo (using the name from `OPENCLAW_DATASET_REPO`) on first startup. Set to `false` if you prefer to [create the repo manually](https://huggingface.co/new-dataset) before deploying. Accepted values: `true`, `1`, `yes` (enabled) / `false`, `0`, `no` (disabled). |
|
| 97 |
+
| `SYNC_INTERVAL` | `60` | **Backup interval in seconds.** How often HuggingClaw syncs the `~/.openclaw` directory (conversations, settings, credentials) to the HuggingFace Dataset repo. Lower values mean less data loss on restart but more API calls. Recommended: `60`–`300`. |
|
| 98 |
+
| `NODE_MEMORY_LIMIT` | `512` | **Node.js heap memory limit in MB.** HF free tier provides 16 GB RAM; the default 512 MB is enough for most cases. Increase if you run complex agent workflows or handle very large conversations. |
|
| 99 |
+
| `TZ` | `UTC` | **Timezone** for log timestamps and scheduled tasks. Example: `Asia/Shanghai`, `America/New_York`. |
|
| 100 |
+
|
| 101 |
+
> For the full list of environment variables (including `OPENAI_BASE_URL`, `OLLAMA_HOST`, proxy settings, and more), see [`.env.example`](.env.example).
|
| 102 |
|
| 103 |
### 3. Open the Control UI
|
| 104 |
|
|
|
|
| 108 |
|
| 109 |
## Configuration
|
| 110 |
|
| 111 |
+
HuggingClaw supports **all OpenClaw environment variables** — it passes the entire environment to the OpenClaw process (`env=os.environ.copy()`), so any variable from the [OpenClaw docs](https://openclawdoc.com/docs/reference/environment-variables) works out of the box in HF Spaces. This includes:
|
| 112 |
|
| 113 |
+
- **API Keys** — `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GOOGLE_API_KEY`, `MISTRAL_API_KEY`, `COHERE_API_KEY`, `OPENROUTER_API_KEY`
|
| 114 |
+
- **Server** — `OPENCLAW_API_PORT`, `OPENCLAW_WS_PORT`, `OPENCLAW_HOST`
|
| 115 |
+
- **Memory** — `OPENCLAW_MEMORY_BACKEND`, `OPENCLAW_REDIS_URL`, `OPENCLAW_SQLITE_PATH`
|
| 116 |
+
- **Network** — `OPENCLAW_HTTP_PROXY`, `OPENCLAW_HTTPS_PROXY`, `OPENCLAW_NO_PROXY`
|
| 117 |
+
- **Ollama** — `OLLAMA_HOST`, `OLLAMA_NUM_PARALLEL`, `OLLAMA_KEEP_ALIVE`
|
| 118 |
+
- **Secrets** — `OPENCLAW_SECRETS_BACKEND`, `VAULT_ADDR`, `VAULT_TOKEN`
|
| 119 |
+
|
| 120 |
+
HuggingClaw adds its own variables for persistence and deployment: `HF_TOKEN`, `OPENCLAW_DATASET_REPO`, `AUTO_CREATE_DATASET`, `SYNC_INTERVAL`, `OPENCLAW_PASSWORD`, `OPENCLAW_DEFAULT_MODEL`, etc. See [`.env.example`](.env.example) for the complete reference.
|
| 121 |
|
| 122 |
## Security
|
| 123 |
|
scripts/sync_hf.py
CHANGED
|
@@ -76,7 +76,7 @@ OPENCLAW_DEFAULT_MODEL = os.environ.get("OPENCLAW_DEFAULT_MODEL") or (
|
|
| 76 |
SPACE_HOST = os.environ.get("SPACE_HOST", "") # e.g. "tao-shen-huggingclaw.hf.space"
|
| 77 |
SPACE_ID = os.environ.get("SPACE_ID", "") # e.g. "tao-shen/HuggingClaw"
|
| 78 |
|
| 79 |
-
SYNC_INTERVAL = int(os.environ.get("SYNC_INTERVAL", "
|
| 80 |
AUTO_CREATE_DATASET = os.environ.get("AUTO_CREATE_DATASET", "true").lower() in ("true", "1", "yes")
|
| 81 |
|
| 82 |
# Setup logging
|
|
|
|
| 76 |
SPACE_HOST = os.environ.get("SPACE_HOST", "") # e.g. "tao-shen-huggingclaw.hf.space"
|
| 77 |
SPACE_ID = os.environ.get("SPACE_ID", "") # e.g. "tao-shen/HuggingClaw"
|
| 78 |
|
| 79 |
+
SYNC_INTERVAL = int(os.environ.get("SYNC_INTERVAL", "60"))
|
| 80 |
AUTO_CREATE_DATASET = os.environ.get("AUTO_CREATE_DATASET", "true").lower() in ("true", "1", "yes")
|
| 81 |
|
| 82 |
# Setup logging
|