Adaptive Routing for Openclaw

A local-first routing engine that prioritizes privacy and cost-efficiency by intelligently escalating LLM requests to the cloud only when necessary.

joelnishanth
v1.0.0
Mar 3, 2026
0
1.1k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install adaptive-routing

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install adaptive-routing using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Adaptive Routing?

Adaptive Routing is a sophisticated orchestration layer designed to optimize how AI agents interact with language models. By leveraging the Openclaw Skills framework, this tool implements a local-first strategy that attempts to fulfill requests using local providers like Ollama, LM Studio, or llamafile before considering expensive cloud APIs. It acts as an intelligent gateway, evaluating every prompt for data sensitivity and task complexity to ensure that private data stays on-premise and simple tasks don't incur unnecessary costs.

Beyond simple routing, this skill incorporates a rigorous quality gate. Every local response is validated against performance benchmarks; if a local model produces an empty response or fails a tool call, the system automatically escalates the request to a cloud provider. This ensures a seamless developer experience where reliability is never sacrificed for efficiency. All activities are recorded, providing users with a comprehensive dashboard to visualize their token savings and operational metrics within the Openclaw Skills ecosystem.

Adaptive Routing Use Cases

  • Processing sensitive data like API keys or PII locally to maintain strict data privacy.
  • Reducing operational overhead by offloading high-volume, low-complexity tasks to local hardware.
  • Implementing automated failover systems that escalate to cloud LLMs only when local models fail validation.
  • Monitoring and reporting on AI cost savings and token usage through a persistent tracking dashboard.
  • Benchmarking local model performance against cloud counterparts using standardized scoring logic.

How Adaptive Routing Works

  1. The system scans for available local LLM providers such as Ollama or LM Studio to determine the best available local engine.
  2. A routing script analyzes the incoming prompt to assign a complexity score and check for sensitive information.
  3. Based on the complexity threshold and privacy requirements, the request is routed to either a local or cloud provider.
  4. If routed locally, the system executes the request and passes the output through a validation script to check for errors or low-quality scores.
  5. If the local output fails validation, the request is automatically escalated to a cloud provider to ensure task completion.
  6. The final outcome is logged to a persistent data store, updating the cumulative savings and performance dashboard.

Adaptive Routing Setup

To begin using this skill within the Openclaw Skills environment, ensure Python 3 is installed. First, verify your local LLM status:

python3 skills/adaptive-routing/scripts/check_local.py

Next, configure your routing preferences by editing the configuration file located at ~/.openclaw/adaptive-routing/config.json:

{
  "complexity_threshold": 3,
  "token_high_watermark": 4000,
  "redact_output": true
}

You can then run your first routed request using the following command:

python3 skills/adaptive-routing/scripts/route_request.py --prompt "Summarize this text" --tokens 500 --local-available

Adaptive Routing Data Schema & Taxonomy

Adaptive Routing organizes its operational data into two primary JSON files to maintain state and configuration within Openclaw Skills.

File Name Description Key Attributes
config.json Defines the logic for routing decisions and privacy. complexity_threshold, redact_output, token_watermarks
savings.json Stores historical data for the dashboard. local_success_count, escalated_count, total_tokens_saved, cost_usd

Adaptive Routing Advanced Features

  • Automated sensitivity detection that forces local routing if keywords like password or secret are detected.
  • Dynamic complexity scoring to ensure high-reasoning tasks are automatically sent to superior cloud models.
  • Multi-provider support compatible with any OpenAI-compatible local server or Ollama instance.
  • Comprehensive validation gates that check for process exit codes, timeouts, and empty responses.
  • Real-time cost tracking to calculate exactly how much money is saved by using Openclaw Skills for local routing.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Requires
Bins python3
Github Stars: 0
forks: 0

Featured*