name: 4d-compression-core version: 1.0.2 description: "把长内容压缩成结构化向量——节省 60-80% Token,保留核心信息" metadata: { "openclaw": { "emoji": "🌀", "requires": { "bins": ["jq", "awk"] }, "triggers": ["压缩", "4d",...
中文简介正在准备中。当前显示原文说明。
Routes LLM requests to a local model first (Ollama, LM Studio, llamafile), validates the response quality, and escalates to cloud only when the local result fails. Tracks local vs escalated vs cloud outcomes in a persistent dashboard. Use when: (1) user asks to run a task with a local model first, (2) user wants to reduce cloud API costs or keep requests private, (3) user wants post-outcome quality validation before committing to a local result, (4) user asks to see token savings or the routing dashboard, (5) any request where local-vs-cloud routing should be decided automatically with a quality gate. Supports Ollama, LM Studio, and llamafile as local providers.
中文简介正在准备中。当前显示原文说明。
安装前可以查看交给 AI 代理的指令内容。
Route requests to a local LLM first. Validate the response quality. Escalate to cloud only when the local result fails the quality check. Track every outcome in a persistent dashboard.
python3 skills/adaptive-routing/scripts/check_local.py
Returns JSON: { "any_available": true, "best": { "provider": "ollama", "models": [...] } }
python3 skills/adaptive-routing/scripts/route_request.py \
--prompt "Summarize this meeting transcript" \
--tokens 800 \
--local-available \
--local-provider ollama
Returns: { "decision": "local", "reason": "...", "complexity_score": -1, "complexity_threshold": 3 }
Send the request to your local provider (Ollama, LM Studio, or llamafile).
See references/local-providers.md for curl examples.
python3 skills/adaptive-routing/scripts/validate_result.py \
--response "The meeting covered three topics..." \
--exit-code 0
Returns: { "passed": true, "score": 1.0, "reason": "ok", "should_escalate": false }
If should_escalate: true, re-run step 3 with your cloud provider instead.
# Local success (no escalation needed)
python3 skills/adaptive-routing/scripts/track_savings.py log \
--kind local_success --tokens 800 --model gpt-4o
# Escalated (local failed validation, used cloud)
python3 skills/adaptive-routing/scripts/track_savings.py log \
--kind escalated --tokens 800 --model gpt-4o
python3 skills/adaptive-routing/scripts/dashboard.py
┌──────────────────────────────────────────────────────────┐
│ 1. check_local.py → is a local provider running? │
│ │
│ 2. route_request.py → local or cloud? │
│ · sensitivity check (private data → local) │
│ · complexity score (high score → cloud) │
│ · availability gate (no local → cloud) │
│ │
│ 3. Execute with local provider │
│ │
│ 4. validate_result.py → did the response pass? │
│ · passed=true → use result (kind=local_success) │
│ · passed=false → re-run cloud (kind=escalated) │
│ │
│ 5. track_savings.py log → record the outcome │
│ │
│ 6. dashboard.py → show cumulative savings │
└──────────────────────────────────────────────────────────┘
| Condition | Route |
|---|---|
| No local provider available | ☁️ Cloud |
Prompt contains sensitive data (password, secret, api key, ssn, etc.) | 🏠 Local |
| Complexity score ≥ threshold (default 3) | ☁️ Cloud |
| Complexity score < threshold | 🏠 Local |
After routing locally, validate_result.py applies a second gate:
| Signal | Escalate? |
|---|---|
| Empty response | Yes |
| Process exit code != 0 | Yes |
| Timed out | Yes |
| Tool error | Yes |
| Clean response, score ≥ 0.75 | No |
For full scoring details, see references/routing-logic.md.
Create ~/.openclaw/adaptive-routing/config.json to tune thresholds:
{
"complexity_threshold": 3,
"token_high_watermark": 4000,
"token_low_watermark": 500,
"redact_output": true
}
Pass --config /path/to/config.json to route_request.py to use a custom path.
Once route_request.py returns "decision": "local", send the request:
curl http://localhost:11434/api/generate \
-d '{"model": "llama3.2", "prompt": "YOUR_PROMPT", "stream": false}'
curl http://localhost:1234/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "local-model", "messages": [{"role": "user", "content": "YOUR_PROMPT"}]}'
The dashboard reads from ~/.openclaw/adaptive-routing/savings.json (auto-created).
┌───────────────────────────────────────────────┐
│ 🔀 Adaptive Routing · Dashboard │
├───────────────────────────────────────────────┤
│ Local LLM: ✅ ollama (llama3.2...) │
├───────────────────────────────────────────────┤
│ Total requests: 42 │
│ Local (passed): 31 (73.8%) │
│ Escalated to cloud: 4 │
│ Cloud (direct): 7 │
│ Escalation rate: 11.4% │
├───────────────────────────────────────────────┤
│ Tokens (local): 84,200 │
│ Tokens (cloud): 9,600 │
│ Cost saved (USD): $0.4210 │
└───────────────────────────────────────────────┘
Reset savings data:
python3 skills/adaptive-routing/scripts/track_savings.py reset
还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
name: 4d-compression-core version: 1.0.2 description: "把长内容压缩成结构化向量——节省 60-80% Token,保留核心信息" metadata: { "openclaw": { "emoji": "🌀", "requires": { "bins": ["jq", "awk"] }, "triggers": ["压缩", "4d",...
中文简介正在准备中。当前显示原文说明。
Use cheap, TEE-verified AI models from the 0G Compute Network as OpenClaw providers. Discover available models and compare pricing vs OpenRouter, verify provider integrity via hardware attestation (Intel TDX), manage your 0G wallet and sub-accounts, and configure models in OpenClaw with one workflow. Supports DeepSeek, GLM-5, Qwen, and other models available on the 0G marketplace.
中文简介正在准备中。当前显示原文说明。
Send and receive P2P messages using disposable numbers and PINs. No servers, no accounts. Use for human notifications, approval flows, and agent-to-agent communication.
中文简介正在准备中。当前显示原文说明。
Query historical crypto market data from 0xArchive across Hyperliquid, Lighter.xyz, and HIP-3. Covers orderbooks, trades, candles, funding rates, open interest, liquidations, and data quality. Use when the user asks about crypto market data, orderbooks, trades, funding rates, or historical prices on Hyperliquid, Lighter.xyz, or HIP-3.
中文简介正在准备中。当前显示原文说明。
Find and complete paid tasks on the 0xWork decentralized marketplace (Base chain, USDC escrow). Use when: the agent wants to earn money/USDC by doing work, discover available tasks, claim a bounty, submit deliverables, check earnings or wallet balance, or set up as a 0xWork worker. Task categories: Writing, Research, Social, Creative, Code, Data. NOT for: posting tasks (use the website), managing the 0xWork platform, or frontend development.
中文简介正在准备中。当前显示原文说明。
Patterns and practices that dramatically accelerate development velocity. Covers parallel execution, automation, feedback loops, workflow optimization, and anti-pattern avoidance. Use when starting projects, planning sprints, optimizing workflows, or onboarding developers.
中文简介正在准备中。当前显示原文说明。