CoolFace
Apppublic

zhshuvo/HuggingClaw

sourceHugging Facemitupdated 4mo agoView on Hugging Face
0likes
.env.example344 linesDownload Raw Back to root
1# ════════════════════════════════════════════════════════════════2# 🦞 HuggingClaw — OpenClaw Gateway for HuggingFace Spaces3# ════════════════════════════════════════════════════════════════4# Copy this file to .env and fill in your values.5# For local development: cp .env.example .env && nano .env6 7# ── REQUIRED: Core Configuration ──8# [REQUIRED] Primary LLM provider API key (for the provider in LLM_MODEL)9# - Anthropic: sk-ant-v0-...10# - OpenAI: sk-...11# - Google: AIzaSy...12# - OpenRouter: sk-or-v1-... (300+ models via single key)13LLM_API_KEY=your_api_key_here14 15# [REQUIRED] LLM model to use (format: provider/model-name)16# Auto-detects provider from prefix — any provider is supported!17# Provider IDs from OpenClaw docs: docs.openclaw.ai/concepts/model-providers18#19# ── Core Providers ──20#21# Anthropic (ANTHROPIC_API_KEY):22#   - anthropic/claude-opus-4-623#   - anthropic/claude-sonnet-4-624#   - anthropic/claude-sonnet-4-525#   - anthropic/claude-haiku-4-526#27# OpenAI (OPENAI_API_KEY):28#   - openai/gpt-5.4-pro29#   - openai/gpt-5.430#   - openai/gpt-5.4-mini31#   - openai/gpt-5.4-nano32#   - openai/gpt-4.133#   - openai/gpt-4.1-mini34#35# Google Gemini (GEMINI_API_KEY):36#   - google/gemini-3.1-pro-preview37#   - google/gemini-3-flash-preview38#   - google/gemini-2.5-pro39#   - google/gemini-2.5-flash40#41# DeepSeek (DEEPSEEK_API_KEY):42#   - deepseek/deepseek-v3.243#   - deepseek/deepseek-r1-052844#   - deepseek/deepseek-r145#46# ── OpenCode Providers ──47#48# OpenCode Zen — tested & verified models (OPENCODE_API_KEY):49#   - opencode/claude-opus-4-650#   - opencode/gpt-5.451#   Get key from: https://opencode.ai/auth52#53# OpenCode Go — low-cost open models (OPENCODE_API_KEY):54#   - opencode-go/kimi-k2.555#56# ── Gateway/Router Providers ──57#58# OpenRouter — 300+ models via single API key (OPENROUTER_API_KEY):59#   - openrouter/anthropic/claude-sonnet-4-660#   - openrouter/openai/gpt-5.461#   - openrouter/deepseek/deepseek-v3.262#   - openrouter/meta-llama/llama-3.3-70b-instruct:free63#   Get key from: https://openrouter.ai64#65# Kilo Gateway (KILOCODE_API_KEY):66#   - kilocode/anthropic/claude-opus-4.667#68# ── Chinese/Asian Providers ──69#70# Z.ai / GLM (ZAI_API_KEY) — OpenClaw normalizes z-ai/z.ai → zai:71#   - zai/glm-572#   - zai/glm-5-turbo73#   - zai/glm-4.774#   - zai/glm-4.7-flash75#76# Moonshot / Kimi (MOONSHOT_API_KEY):77#   - moonshot/kimi-k2.578#   - moonshot/kimi-k2-thinking79#80# MiniMax (MINIMAX_API_KEY):81#   - minimax/minimax-m2.782#   - minimax/minimax-m2.583#84# Xiaomi / MiMo (XIAOMI_API_KEY):85#   - xiaomi/mimo-v2-pro86#   - xiaomi/mimo-v2-omni87#88# Volcengine / Doubao (VOLCANO_ENGINE_API_KEY):89#   - volcengine/doubao-seed-1-8-25122890#   - volcengine/kimi-k2-5-26012791#92# BytePlus — international (BYTEPLUS_API_KEY):93#   - byteplus/seed-1-8-25122894#95# ── Western Providers ──96#97# Mistral (MISTRAL_API_KEY):98#   - mistral/mistral-large-latest99#   - mistral/mistral-small-2603100#   - mistral/devstral-medium101#102# xAI / Grok (XAI_API_KEY):103#   - xai/grok-4.20-beta104#   - xai/grok-4105#106# NVIDIA (NVIDIA_API_KEY):107#   - nvidia/nemotron-3-super-120b-a12b108#109# Groq (GROQ_API_KEY):110#   - groq/mixtral-8x7b-32768111#112# Cohere (COHERE_API_KEY):113#   - cohere/command-a114#115# Together (TOGETHER_API_KEY):116#   - together/meta-llama/llama-3.3-70b-instruct117#118# Cerebras (CEREBRAS_API_KEY):119#   - cerebras/zai-glm-4.7120#121# HuggingFace Inference (HUGGINGFACE_HUB_TOKEN):122#   - huggingface/deepseek-ai/DeepSeek-R1123#124# Or any other OpenClaw-supported provider (format: provider/model-name)125LLM_MODEL=anthropic/claude-sonnet-4-5126 127# ════════════════════════════════════════════════════════════════128# 🔑 API KEY ROTATION (per-provider key pools)129# ════════════════════════════════════════════════════════════════130# Every provider supports a comma-separated key pool.131# Keys are rotated round-robin on every request — useful when you132# have multiple accounts or want to spread rate-limit quota.133#134# Smart backoff: when a key gets a 429/402 response, it is temporarily135# suspended so other keys handle traffic.136#   Strike 1 → suspended for KEY_BLACKLIST_COOLDOWN_MS   (default 60 s)137#   Strike 2 → suspended for KEY_BLACKLIST_COOLDOWN_MS × 4 (default 4 min)138#   Strike 3 → suspended for 24 h  (quota likely exhausted — skipped all day)139# A successful response resets the strike counter for that key.140#141# Pattern: <PROVIDER>_API_KEYS=key1,key2,key3142# Fallback order: plural pool → singular key → LLM_API_KEY (optional)143# Set false only if you want to disable global LLM_API_KEY fallback144# across providers.145LLM_API_KEY_FALLBACK_ENABLED=true146#147# Base backoff duration (ms) after the first 429 on a key (default: 60 s).148# Increases exponentially on repeated failures.149# KEY_BLACKLIST_COOLDOWN_MS=60000150#151# Number of consecutive 429/quota errors before a key is suspended for 24 h.152# KEY_MAX_STRIKES=3153#154# Note: KIMI_API_KEYS and MOONSHOT_API_KEYS share the same API endpoint155# (api.moonshot.cn) and are combined into one rotation pool automatically.156#157# Uncomment and fill in only the providers you use:158#159# ANTHROPIC_API_KEYS=sk-ant-key1,sk-ant-key2,sk-ant-key3160# OPENAI_API_KEYS=sk-key1,sk-key2,sk-key3161# GEMINI_API_KEYS=AIzaSy-key1,AIzaSy-key2162# DEEPSEEK_API_KEYS=key1,key2163# OPENROUTER_API_KEYS=sk-or-key1,sk-or-key2164# KILOCODE_API_KEYS=key1,key2165# OPENCODE_API_KEYS=key1,key2166# ZAI_API_KEYS=key1,key2167# MOONSHOT_API_KEYS=key1,key2   # combines with KIMI_API_KEYS168# KIMI_API_KEYS=key1,key2       # combines with MOONSHOT_API_KEYS169# MINIMAX_API_KEYS=key1,key2170# XIAOMI_API_KEYS=key1,key2171# VOLCANO_ENGINE_API_KEYS=key1,key2172# BYTEPLUS_API_KEYS=key1,key2173# MISTRAL_API_KEYS=key1,key2174# XAI_API_KEYS=key1,key2175# NVIDIA_API_KEYS=key1,key2,key3176# GROQ_API_KEYS=gsk-key1,gsk-key2,gsk-key3177# COHERE_API_KEYS=key1,key2178# TOGETHER_API_KEYS=key1,key2179# CEREBRAS_API_KEYS=key1,key2180# HUGGINGFACE_HUB_TOKENS=hf_key1,hf_key2181 182# ════════════════════════════════════════════════════════════════183# 🌐 MULTI-PROVIDER SETUP (use multiple models simultaneously)184# ════════════════════════════════════════════════════════════════185# LLM_MODEL sets your DEFAULT model. But you can activate multiple186# providers at once — OpenClaw auto-discovers any provider whose187# API key is present in the environment.188#189# HOW IT WORKS:190#   1. LLM_MODEL + LLM_API_KEY  → sets your default model & exports191#      the matching provider key automatically (e.g. ANTHROPIC_API_KEY)192#   2. Any additional provider key you set directly (e.g. OPENAI_API_KEY)193#      is also picked up by OpenClaw → that provider's models become194#      available in the Control UI for manual selection.195#   3. Rotation pools (*_API_KEYS) work for every active provider196#197# Optional: explicitly pin model lists per provider for Control UI visibility198# when provider keys are configured.199# Format: comma-separated model IDs200# NVIDIA_MODELS=meta/llama-3.1-70b-instruct,nvidia/llama-3.1-nemotron-70b-instruct201# OPENAI_MODELS=gpt-4o-mini,gpt-4.1202# GROQ_MODELS=llama-3.3-70b-versatile,deepseek-r1-distill-llama-70b203#      independently and in parallel.204#205# EXAMPLE — default Anthropic, also use OpenAI and Groq:206#207#   LLM_MODEL=anthropic/claude-sonnet-4-6   # default208#   LLM_API_KEY=sk-ant-xxx                  # → auto-sets ANTHROPIC_API_KEY209#210#   OPENAI_API_KEY=sk-oai-xxx               # activates OpenAI models211#   OPENAI_API_KEYS=sk-oai-k1,sk-oai-k2    # optional: rotation pool212#213#   GROQ_API_KEY=gsk-xxx                    # activates Groq models214#   GROQ_API_KEYS=gsk-k1,gsk-k2,gsk-k3     # optional: rotation pool215#216# EXAMPLE — OpenRouter only (easiest: one key, 300+ models):217#218#   LLM_MODEL=openrouter/anthropic/claude-sonnet-4-6219#   LLM_API_KEY=sk-or-v1-xxx220#   # Switch between any of 300+ models in Control UI — no extra keys needed221#222# Set any of these directly as HF Space Secrets (not via LLM_API_KEY):223# ANTHROPIC_API_KEY=sk-ant-xxx224# OPENAI_API_KEY=sk-oai-xxx225# GEMINI_API_KEY=AIzaSy-xxx226# DEEPSEEK_API_KEY=xxx227# GROQ_API_KEY=gsk-xxx228# MISTRAL_API_KEY=xxx229# XAI_API_KEY=xxx230# NVIDIA_API_KEY=nvapi-xxx231# COHERE_API_KEY=xxx232# TOGETHER_API_KEY=xxx233# CEREBRAS_API_KEY=xxx234# MOONSHOT_API_KEY=xxx235# OPENROUTER_API_KEY=sk-or-v1-xxx236# HUGGINGFACE_HUB_TOKEN=hf_xxx237 238# ════════════════════════════════════════════════════════════════239 240# Optional: custom OpenAI-compatible provider241# Only use this if you want to register your own endpoint at startup.242# Leave all of these empty unless you need a custom provider.243#244# Example:245#   CUSTOM_PROVIDER_NAME=modal246#   CUSTOM_BASE_URL=https://api.us-west-2.modal.direct/v1247#   CUSTOM_MODEL_ID=zai-org/GLM-5.1-FP8248#   LLM_MODEL=modal/zai-org/GLM-5.1-FP8249#250# Notes:251# - CUSTOM_BASE_URL should be the API base URL, not /chat/completions252# - CUSTOM_PROVIDER_NAME must not reuse a built-in provider name253# - Uses LLM_API_KEY by default; set CUSTOM_API_KEY only if different254#255# CUSTOM_PROVIDER_NAME=modal256# CUSTOM_BASE_URL=https://your-openai-compatible-endpoint/v1257# CUSTOM_MODEL_ID=your-model-id258# CUSTOM_MODEL_NAME=Friendly Model Name259# CUSTOM_API_KEY=your_custom_api_key_here260# CUSTOM_API_TYPE=openai-completions261# CUSTOM_CONTEXT_WINDOW=128000262# CUSTOM_MAX_TOKENS=500263 264# [REQUIRED] Gateway authentication token265# Generate: openssl rand -hex 32266GATEWAY_TOKEN=your_gateway_token_here267 268# [OPTIONAL] JupyterLab terminal token for /terminal/269# Set a strong token for private deployments. Must NOT be "huggingface".270JUPYTER_TOKEN=run: openssl rand -hex 32271 272# (Optional) Password auth — simpler alternative to token for casual users273# If set, users can log in with this password instead of the token274# OPENCLAW_PASSWORD=your_password_here275 276# ── OPTIONAL: Chat Integrations ──277# Enable WhatsApp pairing flow278# Set to true only if you want WhatsApp enabled279WHATSAPP_ENABLED=false280 281# Get bot token from: https://t.me/BotFather282TELEGRAM_BOT_TOKEN=your_bot_token_here283 284# Allowed Telegram User IDs (comma-separated numeric IDs)285# TELEGRAM_ALLOWED_USERS=123456789,987654321286 287# ── OPTIONAL: Cloudflare Outbound Proxy ──288# Automatically bypass platform network blocks for Telegram/WhatsApp/Google/etc.289# Get a Cloudflare API Token with Account: Workers Scripts: Edit permissions.290# CLOUDFLARE_WORKERS_TOKEN=your_cloudflare_api_token_here291 292# Alternatively, if you already have a worker deployed:293# CLOUDFLARE_PROXY_URL=https://your-proxy.workers.dev294# CLOUDFLARE_PROXY_SECRET=your_proxy_secret_here295 296# Extra domains to proxy, merged with built-in defaults (Telegram, Discord, WhatsApp,297# Facebook, Google). Comma-separated. Set to "*" to proxy ALL external traffic.298# Leave unset to proxy only the built-in default domains.299# CLOUDFLARE_PROXY_DOMAINS=api.sendgrid.com,slack.com300 301# ── OPTIONAL: Workspace Backup to HF Dataset ──302HF_USERNAME=your_hf_username303HF_TOKEN=hf_your_token_here304 305# Backup dataset name (auto-created if missing)306# Default: huggingclaw-backup307BACKUP_DATASET_NAME=huggingclaw-backup308 309# ── OPTIONAL: Background Services ──310# Workspace auto-sync interval (seconds). Default: 180.311SYNC_INTERVAL=180312 313# Check openclaw.json for settings changes this often (seconds). Default: 1.314OPENCLAW_CONFIG_WATCH_INTERVAL=1315 316# Wait for openclaw.json to stay valid and unchanged before syncing. Default: 3.317OPENCLAW_CONFIG_SETTLE_SECONDS=3318 319# Minimum gap between sessions-triggered immediate syncs (seconds). Default: 30.320SESSIONS_MIN_SYNC_GAP=30321 322# Webhooks: Standard POST notifications for lifecycle events323# WEBHOOK_URL=https://your-webhook-endpoint.com/log324 325# Cloudflare proxy & keep-alive: add your Cloudflare API token.326# A Worker is created automatically at boot for both outbound proxying and keep-alive.327# CLOUDFLARE_WORKERS_TOKEN=your_cloudflare_token_here328 329# Trusted proxies (comma-separated IPs)330# Fixes "Proxy headers detected from untrusted address" behind reverse proxies331# Only set if you see pairing/auth errors. Find IPs in Space logs (remote=x.x.x.x)332# TRUSTED_PROXIES=10.20.31.87,10.20.26.157333 334# Allowed origins for Control UI (comma-separated URLs)335# Locks down the web UI to only these origins336# ALLOWED_ORIGINS=https://your-space.hf.space337 338# ════════════════════════════════════════════════════════════════339# QUICK START: Only 3 secrets required!340#   1. LLM_API_KEY    → From your LLM provider341#   2. LLM_MODEL      → Pick a model above342#   3. GATEWAY_TOKEN   → Run: openssl rand -hex 32343# ════════════════════════════════════════════════════════════════344