♾️ Everclaw — AI Inference You Own, Forever Powering Your OpenClaw Agents
Powered by Morpheus AI
Access Kimi K2.5, Qwen3, GLM-4, Llama 3.3, and 10+ models with inference you own. Everclaw connects your OpenClaw agent to the Morpheus P2P network — stake MOR tokens, open sessions, and recycle your stake for persistent, self-sovereign access to AI.
📦 ClawHub:
clawhub install everclaw-inference— clawhub.ai/DavidAJohnston/everclaw-inference⚠️ Name Collision Warning: A different product ("Everclaw Vault") uses the bare
everclawslug on ClawHub. Always useeverclaw-inference— neverclawhub install everclaworclawhub update everclaw. SeeCLAWHUB_WARNING.mdfor details.
How It Works
- Get MOR tokens on Base — swap from ETH/USDC via Uniswap or Aerodrome (see below)
- You run a proxy-router (Morpheus Lumerin Node) locally as a consumer
- The router connects to Base mainnet and discovers model providers
- You stake MOR tokens to open a session with a provider (MOR is locked, not spent)
- You send inference requests to
http://localhost:8082/v1/chat/completions - When the session ends, your MOR is returned (minus tiny usage fees)
- Re-stake the returned MOR into new sessions → persistent inference you own
Getting MOR Tokens
You need MOR on Base to stake for inference. If you already have ETH, USDC, or USDT on Base:
# Swap ETH for MOR
bash skills/everclaw/scripts/swap.sh eth 0.01
# Swap USDC for MOR
bash skills/everclaw/scripts/swap.sh usdc 50
Or swap manually on a DEX:
- Uniswap: MOR/ETH on Base
- Aerodrome: MOR swap on Base
Don't have anything on Base yet? Buy ETH on Coinbase, withdraw to Base, then swap to MOR. See references/acquiring-mor.md for the full guide.
How much do you need? MOR is staked, not spent — you get it back. 50-100 MOR is enough for daily use. 0.005 ETH covers months of Base gas fees.
Architecture
Agent → proxy-router (localhost:8082) → Morpheus P2P Network → Provider → Model
↓
Base Mainnet (MOR staking, session management)
1. Installation
Option A: ClawHub (Easiest)
clawhub install everclaw-inference
To update: clawhub update everclaw-inference
⚠️ Use everclaw-inference — not everclaw. The bare everclaw slug belongs to a different, unrelated product on ClawHub.
Option B: One-Command Installer
The safe installer handles fresh installs, updates, and ClawHub collision detection:
# Fresh install
curl -fsSL https://raw.githubusercontent.com/profbernardoj/everclaw/main/scripts/install-everclaw.sh | bash
# Or if you already have the skill:
bash skills/everclaw/scripts/install-everclaw.sh
# Check for updates
bash skills/everclaw/scripts/install-everclaw.sh --check
Option C: Manual Git Clone
git clone https://github.com/profbernardoj/everclaw.git ~/.openclaw/workspace/skills/everclaw
To update: cd ~/.openclaw/workspace/skills/everclaw && git pull
Install the Morpheus Router
After cloning, install the proxy-router:
bash skills/everclaw/scripts/install.sh
This downloads the latest proxy-router release for your OS/arch, extracts it to ~/morpheus/, and creates initial config files.
Manual Installation
- Go to Morpheus-Lumerin-Node releases
- Download the release for your platform (e.g.,
mor-launch-darwin-arm64.zip) - Extract to
~/morpheus/ - On macOS:
xattr -cr ~/morpheus/
Required Files
After installation, ~/morpheus/ should contain:
| File | Purpose |
|---|---|
proxy-router |
The main binary |
.env |
Configuration (RPC, contracts, ports) |
models-config.json |
Maps blockchain model IDs to API types |
.cookie |
Auto-generated auth credentials |
2. Configuration
.env File
The .env file configures the proxy-router for consumer mode on Base mainnet. Critical variables:
# RPC endpoint — MUST be set or router silently fails
ETH_NODE_ADDRESS=https://base-mainnet.public.blastapi.io
ETH_NODE_CHAIN_ID=8453
# Contract addresses (Base mainnet)
DIAMOND_CONTRACT_ADDRESS=0x6aBE1d282f72B474E54527D93b979A4f64d3030a
MOR_TOKEN_ADDRESS=0x7431aDa8a591C955a994a21710752EF9b882b8e3
# Wallet key — leave blank, inject at runtime via 1Password
WALLET_PRIVATE_KEY=
# Proxy settings
PROXY_ADDRESS=0.0.0.0:3333
PROXY_STORAGE_PATH=./data/badger/
PROXY_STORE_CHAT_CONTEXT=true
PROXY_FORWARD_CHAT_CONTEXT=true
MODELS_CONFIG_PATH=./models-config.json
# Web API
WEB_ADDRESS=0.0.0.0:8082
WEB_PUBLIC_URL=http://localhost:8082
# Auth
AUTH_CONFIG_FILE_PATH=./proxy.conf
COOKIE_FILE_PATH=./.cookie
# Logging
LOG_COLOR=true
LOG_LEVEL_APP=info
LOG_FOLDER_PATH=./data/logs
ENVIRONMENT=production
⚠️ ETH_NODE_ADDRESS MUST be set. The router silently connects to an empty string without it and all blockchain operations fail. Also MODELS_CONFIG_PATH must point to your models-config.json.
models-config.json
⚠️ This file is required. Without it, chat completions fail with "api adapter not found".
{
"$schema": "./internal/config/models-config-schema.json",
"models": [
{
"modelId": "0xb487ee62516981f533d9164a0a3dcca836b06144506ad47a5c024a7a2a33fc58",
"modelName": "kimi-k2.5:web",
"apiType": "openai",
"apiUrl": ""
},
{
"modelId": "0xbb9e920d94ad3fa2861e1e209d0a969dbe9e1af1cf1ad95c49f76d7b63d32d93",
"modelName": "kimi-k2.5",
"apiType": "openai",
"apiUrl": ""
}
]
}
⚠️ Note the format: The JSON uses a "models" array with "modelId" / "modelName" / "apiType" / "apiUrl" fields. The apiUrl is left empty — the router resolves provider endpoints from the blockchain. Add entries for every model you want to use. See references/models.md for the full list.
3. Starting the Router
Secure Launch (1Password)
The proxy-router needs your wallet private key. Never store it on disk. Inject it at runtime from 1Password:
bash skills/everclaw/scripts/start.sh
Or manually:
cd ~/morpheus
source .env
# Retrieve private key from 1Password (never touches disk)
export WALLET_PRIVATE_KEY=$(
OP_SERVICE_ACCOUNT_TOKEN=$(security find-generic-password -a "YOUR_KEYCHAIN_ACCOUNT" -s "op-service-account-token" -w) \
op item get "YOUR_ITEM_NAME" --vault "YOUR_VAULT_NAME" --fields "Private Key" --reveal
)
export ETH_NODE_ADDRESS
nohup ./proxy-router > ./data/logs/router-stdout.log 2>&1 &
Health Check
Wait a few seconds, then verify:
COOKIE_PASS=$(cat ~/morpheus/.cookie | cut -d: -f2)
curl -s -u "admin:$COOKIE_PASS" http://localhost:8082/healthcheck
Expected: HTTP 200.
Stopping
bash skills/everclaw/scripts/stop.sh
Or: pkill -f proxy-router
4. MOR Allowance
Before opening sessions, approve the Diamond contract to transfer MOR on your behalf:
COOKIE_PASS=$(cat ~/morpheus/.cookie | cut -d: -f2)
curl -s -u "admin:$COOKIE_PASS" -X POST \
"http://localhost:8082/blockchain/approve?spender=0x6aBE1d282f72B474E54527D93b979A4f64d3030a&amount=1000000000000000000000"
⚠️ The /blockchain/approve endpoint uses query parameters, not a JSON body. The amount is in wei (1000000000000000000 = 1 MOR). Approve a large amount so you don't need to re-approve frequently.
5. Opening Sessions
Open a session by model ID (not bid ID):
MODEL_ID="0xb487ee62516981f533d9164a0a3dcca836b06144506ad47a5c024a7a2a33fc58"
curl -s -u "admin:$COOKIE_PASS" -X POST \
"http://localhost:8082/blockchain/models/${MODEL_ID}/session" \
-H "Content-Type: application/json" \
-d '{"sessionDuration": 3600}'
⚠️ Always use the model ID endpoint, not the bid ID. Using a bid ID results in "dial tcp: missing address".
Session Duration
- Duration is in seconds: 3600 = 1 hour, 86400 = 1 day
- Two blockchain transactions occur: approve transfer + open session
- MOR is staked (locked) for the session duration
- When the session closes, MOR is returned to your wallet
Response
The response includes a sessionId (hex string). Save this — you need it for inference.
Using the Script
# Open a 1-hour session for kimi-k2.5:web
bash skills/everclaw/scripts/session.sh open kimi-k2.5:web 3600
# List active sessions
bash skills/everclaw/scripts/session.sh list
# Close a session
bash skills/everclaw/scripts/session.sh close 0xSESSION_ID_HERE
6. Sending Inference
⚠️ THE #1 GOTCHA: Headers, Not Body
session_id and model_id are HTTP headers, not JSON body fields. This is the single most common mistake.
CORRECT:
curl -s -u "admin:$COOKIE_PASS" "http://localhost:8082/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "session_id: 0xYOUR_SESSION_ID" \
-H "model_id: 0xYOUR_MODEL_ID" \
-d '{
"model": "kimi-k2.5:web",
"messages": [{"role": "user", "content": "Hello, world!"}],
"stream": false
}'
WRONG (will fail with "session not found"):
# DON'T DO THIS
curl -s ... -d '{
"model": "kimi-k2.5:web",
"session_id": "0x...", # WRONG — not a body field
"model_id": "0x...", # WRONG — not a body field
"messages": [...]
}'
Using the Chat Script
bash skills/everclaw/scripts/chat.sh kimi-k2.5:web "What is the meaning of life?"
Streaming
Set "stream": true in the request body. The response will be Server-Sent Events (SSE).
7. Closing Sessions
Close a session to reclaim your staked MOR:
curl -s -u "admin:$COOKIE_PASS" -X POST \
"http://localhost:8082/blockchain/sessions/0xSESSION_ID/close"
Or use the script:
bash skills/everclaw/scripts/session.sh close 0xSESSION_ID
⚠️ MOR staked in a session is returned when the session closes. Close sessions you're not using to free up MOR for new sessions.
8. Session Management
Sessions Are Ephemeral
⚠️ Sessions are NOT persisted across router restarts. If you restart the proxy-router, you must re-open sessions. The blockchain still has the session, but the router's in-memory state is lost.
Monitoring
# Check balance (MOR + ETH)
bash skills/everclaw/scripts/balance.sh
# List sessions
bash skills/everclaw/scripts/session.sh list
Session Lifecycle
- Open → MOR is staked, session is active
- Active → Send inference requests using session_id header
- Expired → Session duration elapsed; MOR returned automatically
- Closed → Manually closed; MOR returned immediately
Re-opening After Restart
After restarting the router:
# Wait for health check
sleep 5
# Re-open sessions for models you need
bash skills/everclaw/scripts/session.sh open kimi-k2.5:web 3600
9. Checking Balances
COOKIE_PASS=$(cat ~/morpheus/.cookie | cut -d: -f2)
# MOR and ETH balance
curl -s -u "admin:$COOKIE_PASS" http://localhost:8082/blockchain/balance | jq .
# Active sessions
curl -s -u "admin:$COOKIE_PASS" http://localhost:8082/blockchain/sessions | jq .
# Available models
curl -s -u "admin:$COOKIE_PASS" http://localhost:8082/blockchain/models | jq .
10. Troubleshooting
See references/troubleshooting.md for a complete guide. Quick hits:
| Error | Fix |
|---|---|
session not found |
Use session_id/model_id as HTTP headers, not body fields |
dial tcp: missing address |
Open session by model ID, not bid ID |
api adapter not found |
Add the model to models-config.json |
ERC20: transfer amount exceeds balance |
Close old sessions to free staked MOR |
| Sessions gone after restart | Normal — re-open sessions after restart |
| MorpheusUI conflicts | Don't run MorpheusUI and headless router simultaneously |
Key Contract Addresses (Base Mainnet)
| Contract | Address |
|---|---|
| Diamond | 0x6aBE1d282f72B474E54527D93b979A4f64d3030a |
| MOR Token | 0x7431aDa8a591C955a994a21710752EF9b882b8e3 |
Quick Reference
| Action | Command |
|---|---|
| Install | bash skills/everclaw/scripts/install.sh |
| Start | bash skills/everclaw/scripts/start.sh |
| Stop | bash skills/everclaw/scripts/stop.sh |
| Swap ETH→MOR | bash skills/everclaw/scripts/swap.sh eth 0.01 |
| Swap USDC→MOR | bash skills/everclaw/scripts/swap.sh usdc 50 |
| Open session | bash skills/everclaw/scripts/session.sh open <model> [duration] |
| Close session | bash skills/everclaw/scripts/session.sh close <session_id> |
| List sessions | bash skills/everclaw/scripts/session.sh list |
| Send prompt | bash skills/everclaw/scripts/chat.sh <model> "prompt" |
| Check balance | bash skills/everclaw/scripts/balance.sh |
| Diagnose | bash skills/everclaw/scripts/diagnose.sh |
| Diagnose (config only) | bash skills/everclaw/scripts/diagnose.sh --config |
| Diagnose (quick) | bash skills/everclaw/scripts/diagnose.sh --quick |
11. Wallet Management (v0.4)
Everclaw v0.4 includes a self-contained wallet manager that eliminates all external account dependencies. No 1Password, no Foundry, no Safe Wallet — just macOS Keychain and Node.js (already bundled with OpenClaw).
Setup (One Command)
node skills/everclaw/scripts/everclaw-wallet.mjs setup
This generates a new Ethereum wallet and stores the private key in your macOS Keychain (encrypted at rest, protected by your login password / Touch ID).
Import Existing Key
node skills/everclaw/scripts/everclaw-wallet.mjs import-key 0xYOUR_PRIVATE_KEY
Check Balances
node skills/everclaw/scripts/everclaw-wallet.mjs balance
Shows ETH, MOR, USDC balances and MOR allowance for the Diamond contract.
Swap ETH/USDC for MOR
# Swap 0.05 ETH for MOR
node skills/everclaw/scripts/everclaw-wallet.mjs swap eth 0.05
# Swap 50 USDC for MOR
node skills/everclaw/scripts/everclaw-wallet.mjs swap usdc 50
Executes onchain swaps via Uniswap V3 on Base. No external tools required — uses viem (bundled with OpenClaw).
Approve MOR for Staking
node skills/everclaw/scripts/everclaw-wallet.mjs approve
Approves the Morpheus Diamond contract to use your MOR for session staking.
Security Model
- Private key stored in macOS Keychain (encrypted at rest)
- Protected by your login password / Touch ID
- Key is injected at runtime and immediately unset from environment
- Key is never written to disk as a plaintext file
- For advanced users: 1Password is supported as a fallback (backward compatible)
Full Command Reference
| Command | Description |
|---|---|
setup |
Generate wallet, store in Keychain |
address |
Show wallet address |
balance |
Show ETH, MOR, USDC balances |
swap eth <amount> |
Swap ETH → MOR via Uniswap V3 |
swap usdc <amount> |
Swap USDC → MOR via Uniswap V3 |
approve [amount] |
Approve MOR for Morpheus staking |
export-key |
Print private key (use with caution) |
import-key <0xkey> |
Import existing private key |
12. OpenAI-Compatible Proxy (v0.2)
The Morpheus proxy-router requires custom auth (Basic auth via .cookie) and custom HTTP headers (session_id, model_id) that standard OpenAI clients don't support. Everclaw includes a lightweight proxy that bridges this gap.
What It Does
OpenClaw/any client → morpheus-proxy (port 8083) → proxy-router (port 8082) → Morpheus P2P → Provider
- Accepts standard OpenAI
/v1/chat/completionsrequests - Auto-opens blockchain sessions on demand (no manual session management)
- Auto-renews sessions before expiry (default: 1 hour before)
- Injects Basic auth +
session_id/model_idheaders automatically - Exposes
/health,/v1/models,/v1/chat/completions
Installation
bash skills/everclaw/scripts/install-proxy.sh
This installs:
morpheus-proxy.mjs→~/morpheus/proxy/gateway-guardian.sh→~/.openclaw/workspace/scripts/- launchd plists for both (macOS, auto-start on boot)
Configuration
Environment variables (all optional, sane defaults):
| Variable | Default | Description |
|---|---|---|
MORPHEUS_PROXY_PORT |
8083 |
Port the proxy listens on |
MORPHEUS_ROUTER_URL |
http://localhost:8082 |
Proxy-router URL |
MORPHEUS_COOKIE_PATH |
~/morpheus/.cookie |
Path to auth cookie |
MORPHEUS_SESSION_DURATION |
604800 (7 days) |
Session duration in seconds |
MORPHEUS_RENEW_BEFORE |
3600 (1 hour) |
Renew session this many seconds before expiry |
MORPHEUS_PROXY_API_KEY |
morpheus-local |
Bearer token for proxy auth |
Session Duration
Sessions stake MOR tokens for their duration. Longer sessions = more MOR locked but fewer blockchain transactions:
| Duration | MOR Staked (approx) | Transactions |
|---|---|---|
| 1 hour | ~11 MOR | Every hour |
| 1 day | ~274 MOR | Daily |
| 7 days | ~1,915 MOR | Weekly |
MOR is returned when the session closes or expires. The proxy auto-renews before expiry, so you get continuous inference with minimal staking overhead.
Health Check
curl http://127.0.0.1:8083/health
Available Models
curl http://127.0.0.1:8083/v1/models
Direct Usage (without OpenClaw)
curl http://127.0.0.1:8083/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer morpheus-local" \
-d '{
"model": "kimi-k2.5",
"messages": [{"role": "user", "content": "Hello!"}],
"stream": false
}'
Reliability Notes
kimi-k2.5(non-web) is the most reliable model — recommended as primary fallbackkimi-k2.5:web(web search variant) tends to timeout on P2P routing — avoid for fallback use- Provider connection resets are transient — retries usually succeed
- The proxy itself runs as a KeepAlive launchd service — auto-restarts if it crashes
Proxy Resilience (v0.5)
v0.5 adds three critical improvements to the proxy that prevent prolonged outages caused by cooldown cascades — where both primary and fallback providers become unavailable simultaneously.
Problem: Cooldown Cascades
When a primary provider (e.g., Venice) returns a billing error, OpenClaw's failover engine marks that provider as "in cooldown." If the Morpheus proxy also returns errors that OpenClaw misclassifies as billing errors, both providers enter cooldown and the agent goes completely offline — sometimes for 6+ hours.
Fix 1: OpenAI-Compatible Error Classification
The proxy now returns errors in the exact format OpenAI uses, with proper type and code fields:
{
"error": {
"message": "Morpheus session unavailable: ...",
"type": "server_error",
"code": "morpheus_session_error",
"param": null
}
}
Key distinction: All Morpheus infrastructure errors are typed as "server_error" — never "billing" or "rate_limit_error". This ensures OpenClaw treats them as transient failures and retries appropriately, instead of putting the provider into extended cooldown.
Error codes returned by the proxy:
| Code | Meaning |
|---|---|
morpheus_session_error |
Failed to open or refresh a blockchain session |
morpheus_inference_error |
Provider returned an error during inference |
morpheus_upstream_error |
Connection error to the proxy-router |
timeout |
Inference request exceeded the time limit |
model_not_found |
Requested model not in MODEL_MAP |
Fix 2: Automatic Session Retry
When the proxy-router returns a session-related error (expired, invalid, not found, closed), the proxy now:
- Invalidates the cached session
- Opens a fresh blockchain session
- Retries the inference request once
This handles the common case where the proxy-router restarts and loses its in-memory session state, or when a long-running session expires mid-request.
Fix 3: Multi-Tier Fallback Chain
Configure OpenClaw with multiple fallback models across providers:
{
"agents": {
"defaults": {
"model": {
"primary": "venice/claude-opus-4-6",
"fallbacks": [
"venice/claude-opus-45", // Try different Venice model first
"venice/kimi-k2-5", // Try yet another Venice model
"morpheus/kimi-k2.5" // Last resort: decentralized inference
]
}
}
}
}
This way, if the primary model has billing issues, OpenClaw tries other models on the same provider (which may have separate rate limits) before falling back to Morpheus. The cascade is:
- venice/claude-opus-4-6 (primary) → billing error
- venice/claude-opus-45 (fallback 1) → tries a different model on Venice
- venice/kimi-k2-5 (fallback 2) → tries open-source model on Venice
- morpheus/kimi-k2.5 (fallback 3) → decentralized inference, always available if MOR is staked
13. OpenClaw Integration (v0.2)
Configure OpenClaw to use Morpheus as a fallback provider so your agent keeps running when primary API credits run out.
Step 1: Add Morpheus Provider
Add to your openclaw.json via config patch or manual edit:
{
"models": {
"providers": {
"morpheus": {
"baseUrl": "http://127.0.0.1:8083/v1",
"apiKey": "morpheus-local",
"api": "openai-completions",
"models": [
{
"id": "kimi-k2.5",
"name": "Kimi K2.5 (via Morpheus)",
"reasoning": true,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 131072,
"maxTokens": 8192
},
{
"id": "kimi-k2-thinking",
"name": "Kimi K2 Thinking (via Morpheus)",
"reasoning": true,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 131072,
"maxTokens": 8192
},
{
"id": "glm-4.7-flash",
"name": "GLM 4.7 Flash (via Morpheus)",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 131072,
"maxTokens": 8192
}
]
}
}
}
}
Step 2: Set as Fallback
Configure a multi-tier fallback chain (recommended since v0.5):
{
"agents": {
"defaults": {
"model": {
"primary": "venice/claude-opus-4-6",
"fallbacks": [
"venice/claude-opus-45", // Different model, same provider
"venice/kimi-k2-5", // Open-source model, same provider
"morpheus/kimi-k2.5" // Decentralized fallback
]
},
"models": {
"venice/claude-opus-45": { "alias": "Claude Opus 4.5" },
"venice/kimi-k2-5": { "alias": "Kimi K2.5" },
"morpheus/kimi-k2.5": { "alias": "Kimi K2.5 (Morpheus)" },
"morpheus/kimi-k2-thinking": { "alias": "Kimi K2 Thinking (Morpheus)" },
"morpheus/glm-4.7-flash": { "alias": "GLM 4.7 Flash (Morpheus)" }
}
}
}
}
⚠️ Why multi-tier? A single fallback creates a single point of failure. If both the primary provider and the single fallback enter cooldown simultaneously (e.g., billing error triggers cooldown on both), your agent goes offline. Multiple fallback tiers across different models and providers ensure at least one path remains available.
Step 3: Add Auth Profiles
OpenClaw supports multiple API keys per provider with automatic rotation. When one key's credits run out (billing error), OpenClaw disables that key only and rotates to the next one — same model, fresh credits. This is the single most effective way to prevent downtime.
Single Key (Minimum Setup)
Add to ~/.openclaw/agents/main/agent/auth-profiles.json:
{
"venice:default": {
"type": "api_key",
"provider": "venice",
"key": "VENICE-INFERENCE-KEY-YOUR_KEY_HERE"
},
"morpheus:default": {
"type": "api_key",
"provider": "morpheus",
"key": "morpheus-local"
}
}
Multiple Keys (Recommended — v0.9.1)
If you have multiple Venice API keys (e.g., from different accounts or plans), add them all as separate profiles. Order them from most credits to least:
auth-profiles.json:
{
"version": 1,
"profiles": {
"venice:key1": {
"type": "api_key",
"provider": "venice",
"key": "VENICE-INFERENCE-KEY-YOUR_PRIMARY_KEY"
},
"venice:key2": {
"type": "api_key",
"provider": "venice",
"key": "VENICE-INFERENCE-KEY-YOUR_SECOND_KEY"
},
"venice:key3": {
"type": "api_key",
"provider": "venice",
"key": "VENICE-INFERENCE-KEY-YOUR_THIRD_KEY"
},
"morpheus:default": {
"type": "api_key",
"provider": "morpheus",
"key": "morpheus-local"
}
}
}
openclaw.json — register the profiles and set explicit rotation order:
{
"auth": {
"profiles": {
"venice:key1": { "provider": "venice", "mode": "api_key" },
"venice:key2": { "provider": "venice", "mode": "api_key" },
"venice:key3": { "provider": "venice", "mode": "api_key" },
"morpheus:default": { "provider": "morpheus", "mode": "api_key" }
},
"order": {
"venice": ["venice:key1", "venice:key2", "venice:key3"]
}
}
}
⚠️ auth.order is critical. Without it, OpenClaw uses round-robin (oldest-used first), which may not match your credit balances. With an explicit order, keys are tried in the exact sequence you specify — highest credits first.
How Multi-Key Rotation Works
OpenClaw's auth engine handles rotation automatically:
- Session stickiness: A key is pinned per session to keep provider caches warm. It won't flip-flop mid-conversation.
- Billing disable: When a key returns a billing/credit error, that profile is disabled with exponential backoff (starts at 5 hours). Other profiles for the same provider remain active.
- Rotation on failure: After disabling a profile, OpenClaw immediately tries the next key in
auth.order. Same model, same provider — just fresh credits. - Model fallback: Only after ALL profiles for Venice are disabled does OpenClaw move to the next model in the fallback chain (e.g., Morpheus).
- Auto-recovery: Disabled profiles auto-recover after backoff expires. If credits refill (e.g., daily reset), the profile becomes available again.
Venice DIEM Credits
Venice uses "DIEM" as its internal credit unit (1 DIEM ≈ $1 USD). Each API key has its own DIEM balance. Credits appear to reset daily. Expensive models drain credits faster:
| Model | Input Cost | Output Cost | ~Messages per 10 DIEM |
|---|---|---|---|
| Claude Opus 4.6 | 6 DIEM/M tokens | 30 DIEM/M tokens | ~5-10 |
| Claude Opus 4.5 | 6 DIEM/M tokens | 30 DIEM/M tokens | ~5-10 |
| Kimi K2.5 | 0.75 DIEM/M tokens | 3.75 DIEM/M tokens | ~50-100 |
| GLM 4.7 Flash | 0.125 DIEM/M tokens | 0.5 DIEM/M tokens | ~500+ |
Tip: With multiple keys, the agent can stay on Claude Opus across key rotations. Without multi-key, it would fall to cheaper models or Morpheus after one key's credits run out.
Failover Behavior (v0.9.1)
The complete failover chain with multi-key rotation:
- Key rotation within Venice — Key 1 credits exhausted → billing disable on that profile only → immediately rotates to Key 2 → Key 3 → etc. Same model, fresh credits.
- Model fallback — Only after ALL Venice keys are disabled → tries
venice/claude-opus-45(all keys again) →venice/kimi-k2-5(all keys) →morpheus/kimi-k2.5 - Morpheus fallback — The proxy auto-opens a 7-day Morpheus session (if none exists). Inference routes through the Morpheus P2P network.
- Gateway Guardian v4 — If all providers enter cooldown despite multi-key rotation → classifies error (billing vs transient) → billing: backs off + notifies owner (restart is useless for empty credits) → transient: restarts gateway (clears cooldowns) → nuclear reinstall if needed. Proactively monitors Venice DIEM balance.
- Auto-recovery — When credits refill (daily reset) or backoff expires, OpenClaw switches back to Venice automatically.
Example with 6 keys (246 DIEM total):
venice:key1 (98 DIEM) → venice:key2 (50 DIEM) → venice:key3 (40 DIEM) →
venice:key4 (26 DIEM) → venice:key5 (20 DIEM) → venice:key6 (12 DIEM) →
morpheus/kimi-k2.5 (owned, staked MOR) → mor-gateway/kimi-k2.5 (community gateway)
v0.5 improvement: The Morpheus proxy returns "server_error" type errors (not billing errors), so OpenClaw won't put the Morpheus provider into extended cooldown due to transient infrastructure issues. If a Morpheus session expires mid-request, the proxy automatically opens a fresh session and retries once.
14. Gateway Guardian v4 (v0.9.3)
A self-healing, billing-aware watchdog that monitors the OpenClaw gateway and its ability to run inference. Runs every 2 minutes via launchd.
Evolution
| Version | What it checked | Fatal flaw |
|---|---|---|
| v1 | HTTP dashboard alive | Providers in cooldown = brain-dead but HTTP 200 |
| v2 | Raw provider URLs | Provider APIs always return 200 regardless of internal state |
| v3 | Through-OpenClaw inference probe | Billing exhaustion → restart → instant re-disable = dead loop. Also: set -e + pkill self-kill = silent no-op restarts |
| v4 | Through-OpenClaw + billing classification + credit monitoring | Current version |
What v4 Fixes Over v3
- Billing-aware escalation — Classifies inference errors as
billingvstransientvstimeout. Billing errors trigger backoff + notification instead of useless restarts. - Silent restart bug — Replaced
set -euo pipefailwithset -uo pipefail+ explicit ERR trap. Restart failures are now logged instead of silently exiting. - pkill self-kill — Hard restart now iterates PIDs and excludes the Guardian's own PID. No more accidentally killing the watchdog.
- Proactive credit monitoring — Checks Venice DIEM balance via
x-venice-balance-diemresponse header every 10 min. Warns when balance drops below threshold. - DIEM reset awareness — Calculates hours to midnight UTC (when Venice DIEM resets daily). When billing-dead, enters 30-min backoff instead of hammering every 2 min. Auto-clears when UTC day rolls over.
- Signal notifications — Notifies owner on: billing exhaustion (with ETA to reset), billing recovery, nuclear restart, and total failure.
How It Works
- Billing backoff gate — If in billing-dead state, check if midnight UTC has passed. If yes, re-probe. If no, skip this run (30-min intervals).
- Credit monitoring — Every 10 min, makes a cheap Kimi K2.5 call to Venice and reads the
x-venice-balance-diemresponse header. Warns below 15 DIEM. - Circuit breaker — Kills sub-agents stuck >30 min with repeated timeouts.
- HTTP probe — Is the gateway process running?
- Inference probe — Can the agent run inference through the full stack?
- Error classification — Parses probe output:
billing→ 402, Insufficient DIEM/USD/balance → don't restart, enter billing backoff, notify ownertransient→ auth cooldown without billing keywords → restart (clears cooldown)timeout→ probe timed out → restartunknown→ restart (safe default)
- Four-stage restart escalation (for non-billing errors only):
openclaw gateway restart(graceful — resets cooldown state)- Hard kill (excludes own PID) → launchd KeepAlive
launchctl kickstart -k- 🔴 NUCLEAR:
curl -fsSL https://clawd.bot/install.sh | bash
Recommended Config
Pair with reduced billing backoff in openclaw.json to minimize downtime:
{
"auth": {
"cooldowns": {
"billingBackoffHoursByProvider": { "venice": 1 },
"billingMaxHours": 6,
"failureWindowHours": 12
}
}
}
Installation
Included in install-proxy.sh, or manually:
cp skills/everclaw/scripts/gateway-guardian.sh ~/.openclaw/workspace/scripts/
chmod +x ~/.openclaw/workspace/scripts/gateway-guardian.sh
# Install launchd plist (macOS)
# See templates/ai.openclaw.guardian.plist
⚠️ Important: The launchd plist should include OPENCLAW_GATEWAY_TOKEN in its environment variables.
Manual Test
bash ~/.openclaw/workspace/scripts/gateway-guardian.sh --verbose
Logs
tail -f ~/.openclaw/logs/guardian.log
Configuration
| Variable | Default | Description |
|---|---|---|
GATEWAY_PORT |
18789 |
Gateway port to probe |
PROBE_TIMEOUT |
8 |
HTTP timeout in seconds |
INFERENCE_TIMEOUT |
45 |
Agent probe timeout |
FAIL_THRESHOLD |
2 |
HTTP failures before restart |
INFERENCE_FAIL_THRESHOLD |
3 |
Inference failures before escalation (~6 min) |
BILLING_BACKOFF_INTERVAL |
1800 |
Seconds between probes when billing-dead (30 min) |
CREDIT_CHECK_INTERVAL |
600 |
Seconds between Venice DIEM balance checks (10 min) |
CREDIT_WARN_THRESHOLD |
15 |
DIEM balance warning threshold |
MAX_STUCK_DURATION_SEC |
1800 |
Circuit breaker: kill sub-agents stuck >30 min |
STUCK_CHECK_INTERVAL |
300 |
Circuit breaker check interval (5 min) |
OWNER_SIGNAL |
+14432859111 |
Signal number for notifications |
SIGNAL_ACCOUNT |
+15129488566 |
Signal sender account |
State Files
| File | Purpose |
|---|---|
~/.openclaw/logs/guardian.state |
HTTP failure counter |
~/.openclaw/logs/guardian-inference.state |
Inference failure counter |
~/.openclaw/logs/guardian-circuit-breaker.state |
Circuit breaker timestamp |
~/.openclaw/logs/guardian-billing.state |
Billing exhaustion start timestamp (0 = healthy) |
~/.openclaw/logs/guardian-billing-notified.state |
Whether owner was notified (0/1) |
~/.openclaw/logs/guardian-credit-check.state |
Last credit check timestamp |
~/.openclaw/logs/guardian.log |
Guardian activity log |
15. Smart Session Archiver (v0.9.4)
OpenClaw stores every conversation as a .jsonl file in ~/.openclaw/agents/main/sessions/. Over time, these accumulate — and when the dashboard loads, it parses all session history into the DOM. At ~17MB (134+ sessions), browsers hit "Page Unresponsive" because the renderer chokes on thousands of chat message elements.
The Problem
The bottleneck isn't raw memory — Chrome gives each tab 1.4-4GB of V8 heap. The real limit is DOM rendering performance. Chrome Lighthouse warns at 800 DOM nodes and errors at 1,400. A hundred sessions with tool calls, code blocks, and long conversations easily generate 5,000+ DOM elements. The browser's layout engine can't keep up.
| Sessions Dir Size | Dashboard Behavior |
|---|---|
| < 5 MB | ✅ Loads instantly |
| 5-10 MB | ⚡ Slight delay, usable |
| 10-15 MB | ⚠️ Sluggish, noticeable lag |
| 15-20 MB | 🔴 "Page Unresponsive" likely |
| 20+ MB | 💀 Dashboard won't load |
Solution: Size-Triggered Archiving
Instead of archiving on a fixed schedule (which may fire too early or too late depending on usage), the session archiver monitors the actual size of the sessions directory and only moves files when they exceed a threshold.
Default threshold: 10MB — provides good headroom before hitting the ~15MB danger zone, without firing unnecessarily on light usage days.
Usage
# Archive if over threshold (default 10MB)
bash skills/everclaw/scripts/session-archive.sh
# Check size without archiving
bash skills/everclaw/scripts/session-archive.sh --check
# Force archive regardless of size
bash skills/everclaw/scripts/session-archive.sh --force
# Detailed output
bash skills/everclaw/scripts/session-archive.sh --verbose
What It Protects
The archiver never moves:
- Active sessions — referenced in
sessions.json(the index file) - Guardian health probe —
guardian-health-probe.jsonl - Recent sessions — keeps the 5 most recent by modification time (configurable via
KEEP_RECENT)
Everything else gets moved to sessions/archive/ — not deleted. You can always move files back if needed.
Configuration
| Variable | Default | Description |
|---|---|---|
ARCHIVE_THRESHOLD_MB |
10 |
Trigger threshold in MB |
SESSIONS_DIR |
~/.openclaw/agents/main/sessions |
Sessions directory path |
KEEP_RECENT |
5 |
Number of recent sessions to always keep |
Cron Integration
Set up a cron job that runs the archiver periodically. The script is a no-op when under threshold, so it's safe to run frequently:
{
"name": "Smart session archiver",
"schedule": { "kind": "cron", "expr": "0 */6 * * *", "tz": "America/Chicago" },
"sessionTarget": "isolated",
"payload": {
"kind": "agentTurn",
"model": "morpheus/kimi-k2.5",
"message": "Run the smart session archiver: bash skills/everclaw/scripts/session-archive.sh --verbose. Report the results. If sessions were archived, mention the before/after size.",
"timeoutSeconds": 60
}
}
Recommended: every 6 hours. Frequent enough to catch growth spurts, cheap enough to run on the LIGHT tier since it's a no-op most of the time.
Output
The script outputs a JSON summary for programmatic consumption:
{"archived":42,"freedMB":8.2,"beforeMB":12.4,"afterMB":4.2,"threshold":10}
Why 10MB?
Based on real-world testing: 134 sessions totaling 17MB caused "Page Unresponsive" in Chrome, Safari, and Brave on macOS. The dashboard uses a standard web renderer that parses all session JSONL into DOM elements — there's no virtualization or lazy loading. 10MB gives ~50% headroom before the ~15-20MB danger zone where most browsers start struggling.
17. x402 Payment Client (v0.7)
Everclaw v0.7 includes an x402 payment client that lets your agent make USDC payments to any x402-enabled endpoint. The x402 protocol is an HTTP-native payment standard: when a server returns HTTP 402, your agent automatically signs a USDC payment and retries.
How x402 Works
Agent → request → Server returns 402 + PAYMENT-REQUIRED header
Agent → parse requirements → sign EIP-712 payment → retry with PAYMENT-SIGNATURE header
Server → verify signature via
…(truncated)