LLM Router for Openclaw

An intelligent proxy that classifies incoming requests by complexity and routes them to the most cost-effective LLM provider.

alexrudloff
v0.1.1
Feb 3, 2026
6
3.3k
0

Install & Download

1. ClawHub CLI

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

npx clawhub@latest install llmrouter

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 llmrouter 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 LLM Router?

LLM Router is a sophisticated proxy layer designed to optimize token usage and significantly reduce API expenses by dynamically directing incoming requests to appropriate language models. By analyzing the inherent complexity of a prompt, the system ensures that simple tasks like greetings or basic acknowledgments are handled by lightweight, inexpensive models, while reserving high-performance models for intense coding, system architecture, or complex reasoning.

Built to enhance the efficiency of Openclaw Skills, this tool provides a unified OpenAI-compatible API that bridges multiple providers including Anthropic, OpenAI, Google Gemini, and local Ollama instances. It empowers developers to maintain high performance without the high costs typically associated with premium LLM usage by automating the model selection process based on real-time task analysis.

LLM Router Use Cases

  • Reducing operational costs for Openclaw Skills by offloading simple queries to cheaper models like Claude Haiku or GPT-4o-mini.
  • Automating model selection across multi-provider environments including Anthropic, OpenAI, and Gemini.
  • Leveraging local LLMs via Ollama for privacy-focused and cost-free request classification.
  • Streamlining development workflows by using a single API endpoint that intelligently selects the best tool for the job.

How LLM Router Works

  1. The router receives a request via its OpenAI-compatible chat completions endpoint.
  2. The classification engine analyzes the prompt against criteria defined in the documentation to determine its complexity level.
  3. The request is categorized into one of five levels: super_easy, easy, medium, hard, or super_hard.
  4. Based on the mappings in the configuration file, the router selects the corresponding model for that complexity level.
  5. The request is forwarded to the chosen provider (Anthropic, OpenAI, Google, etc.) with appropriate authentication.
  6. The response is returned to the user, with optional remapping to ensure compatibility with Openclaw Skills.

LLM Router Setup

To get started with this skill, ensure you have Python 3.10+ installed. Follow these steps to deploy the router:

# Clone the repository and enter the directory
git clone https://github.com/alexrudloff/llmrouter.git
cd llmrouter

# Create and activate a virtual environment
python3 -m venv venv
source venv/bin/activate

# Install required dependencies
pip install -r requirements.txt

# Prepare your configuration
cp config.yaml.example config.yaml
# Edit config.yaml with your specific API keys and model preferences

# Launch the server with compatibility for Openclaw Skills
python server.py --openclaw

LLM Router Data Schema & Taxonomy

The skill manages its logic and routing through a structured set of files and API mappings:

Component Function
config.yaml The primary configuration file defining model assignments for each complexity tier and classifier settings.
ROUTES.md A customizable markdown file used by the classifier to tune how different types of messages are categorized.
API Endpoint A standard /v1/chat/completions interface that mimics the OpenAI API for easy integration.
Openclaw Config Integration settings stored in ~/.openclaw/openclaw.json to register the router as a provider.

LLM Router Advanced Features

  • Native support for Openclaw Skills compatibility mode, which handles tool name and ID remapping for complex agentic workflows.
  • Flexible classification options including local Ollama models (like qwen2.5) or remote providers (Haiku, GPT-4o-mini).
  • Automatic detection and parameter handling for specialized reasoning models like OpenAI o1 or o3.
  • Robust identity header management for Anthropic Claude Code OAuth tokens.
  • Background service capabilities on macOS via LaunchAgent for persistent, always-on routing.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Requires
Bins python3
Github Stars: 0
forks: 0

Featured*